jPOS icon indicating copy to clipboard operation
jPOS copied to clipboard

ISOStringFieldPackager throws an IndexOutOfBoundsException

Open MouslihAbdelhakim opened this issue 7 years ago • 1 comments
trafficstars

Hello,

While Unpacking a DE with IFE_LLLCHAR today this exception was thrown

Exception in thread "main" org.jpos.iso.ISOException: org.jpos.iso.IFE_LLLCHAR: Problem unpacking field 61 (java.lang.IndexOutOfBoundsException) unpacking field=61, consumed=241

After some investigating, it turned out that the DE value was signaling that it has a length of a 100 but in reality it was only 26 bytes in length.

Since java.lang.IndexOutOfBoundsException does not tell us much, i think that it would be useful if ISOStringFieldPackager compared how many bytes are still array to how much it is expecting to extract and threw a more comprehensive error message like :

Trying to extract X bytes but the message contains only Y bytes

I will gladly work on this issue if the JPos project accepts PRs.

kind regards.

MouslihAbdelhakim avatar Feb 07 '18 14:02 MouslihAbdelhakim

Anything that saves us debugging time with this kind of very common issues while configuring new endpoints is welcome, so please go ahead with the PR at your convenience.

ar avatar Feb 07 '18 14:02 ar