Claus Ibsen created CAMEL-26002:
-----------------------------------

             Summary: camel-iso8583 - a missing ISO-Type fails with a 
NumberFormatException, and a configFile outside the classpath is silently not 
loaded
                 Key: CAMEL-26002
                 URL: https://issues.apache.org/jira/browse/CAMEL-26002
             Project: Camel
          Issue Type: Bug
    Affects Versions: 4.18.0, 4.22.0, 4.23.0
            Reporter: Claus Ibsen
             Fix For: 4.24.0


Two problems with the iso8583 data format make the cause of a failure hard to 
find:
* *The ISO-Type*: without the {{CamelIso8583IsoType}} header and the 
{{isoType}} option, unmarshal calls {{Integer.parseUnsignedInt(null, 16)}} 
({{Iso8583DataFormat}}, main 50d17f9c2614, line 76). It fails with 
{{NumberFormatException: Cannot parse null string}} instead of saying that the 
ISO-Type is missing.
* *The configFile*: the file is passed to {{MessageFactory.setConfigPath}} 
(line 133), which j8583 loads from the classpath only. A {{file:}} path, or any 
path that is not on the classpath, is silently not loaded. Every unmarshal then 
fails with {{ParseException: ISO8583 MessageFactory has no parsing guide for 
message type ...}}.

Checked on 4.24.0-SNAPSHOT with {{camel run}}, with the {{j8583-config.xml}} 
and {{parse1.txt}} of the tests:
* {{configFile=file:/path/j8583-config.xml}} and {{isoType=0210}}: "no parsing 
guide for message type 1b3f0";
* the same file on the classpath (the default {{configFile}}): an 
{{IsoMessage}};
* no {{isoType}} and no header: the NumberFormatException.

*Proposed change*: fail with a clear message when there is no ISO-Type. Load 
the {{configFile}} with the Camel resource loader ({{classpath:}}, {{file:}} 
and so on), or fail at startup when it is not found.

_Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to