Class MessageErrorIndicator
java.lang.Object
org.jpos.iso.MessageErrorIndicator
Encodes and decodes the ISO 8583 Message Error Indicator (DE-018).
DE-018 carries up to ten error sets, each exactly 14 positions long. Each set identifies the type of error and the precise location within the message (data element, sub-element for constructed fields, or dataset identifier plus bit/tag for composite fields).
Error sets are concatenated without separators. The overall field is
transmitted as an LLLVAR character field.
Error set wire layout
Pos Len Type Subfield 1–2 2 N2 (ASCII) Error severity 3–6 4 N4 (ASCII) Message error code 7–9 3 N3 (ASCII) Data element in error (001–128) 10–11 2 N2 (ASCII) Data sub-element in error (constructed DEs), else "00" 12 1 B1 (binary) Dataset identifier (composite DEs), else 0x00 13–14 2 B2 (binary) Dataset bit or TLV tag (composite DEs), else 0x0000
Usage:
MessageErrorIndicator mei = new MessageErrorIndicator()
.add(FieldError.primitiveError(ErrorCode.REQUIRED_MISSING, 37))
.add(FieldError.compositeError(ErrorCode.INVALID_VALUE, 55, 0x37, 0x9F26));
msg.set(18, new String(mei.pack(), ISOUtil.CHARSET));
// or
MessageErrorIndicator parsed = MessageErrorIndicator.unpack(msg.getBytes(18));
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumStandard message error codes defined by ISO 8583:2023, Table D.15.static classOne error set within aMessageErrorIndicatorfield.static enumError severity carried in positions 1–2 of each error set. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intLength in bytes of one error set on the wire.static final intMaximum number of error sets per DE-018 field. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAppends an error set.errors()Returns an unmodifiable view of the current error sets.booleanisEmpty()Indicates whether this indicator contains no error sets.byte[]pack()Serializes all error sets to the DE-018 wire format.intsize()Returns the number of error sets.static MessageErrorIndicatorunpack(byte[] data) Deserializes DE-018 wire bytes into aMessageErrorIndicator.
-
Field Details
-
MAX_ERROR_SETS
-
ERROR_SET_LENGTH
-
-
Constructor Details
-
MessageErrorIndicator
public MessageErrorIndicator()Creates an empty indicator.
-
-
Method Details
-
add
Appends an error set.- Parameters:
error- error set to add- Returns:
- this indicator for fluent chaining
- Throws:
IllegalStateException- when the maximum of 10 error sets has been reached
-
errors
Returns an unmodifiable view of the current error sets.- Returns:
- error set list
-
isEmpty
Indicates whether this indicator contains no error sets.- Returns:
truewhen empty
-
size
-
pack
Serializes all error sets to the DE-018 wire format.- Returns:
- packed bytes suitable for setting on DE-018 of an ISOMsg
-
unpack
Deserializes DE-018 wire bytes into aMessageErrorIndicator.- Parameters:
data- DE-018 field bytes (must be a multiple of 14)- Returns:
- parsed indicator
- Throws:
ISOException- when the byte array is malformed
-