Claus Ibsen created CAMEL-25990:
-----------------------------------

             Summary: camel-schematron - no body fails with a 
NullPointerException
                 Key: CAMEL-25990
                 URL: https://issues.apache.org/jira/browse/CAMEL-25990
             Project: Camel
          Issue Type: Bug
          Components: camel-schematron
    Affects Versions: 4.18.0, 4.22.0, 4.23.0
            Reporter: Claus Ibsen
             Fix For: 4.24.0


The schematron producer fails with a NullPointerException when there is no 
body: {{SchematronProcessor.validate}} passes the text to 
{{IOUtils.toInputStream(xml, Charset.defaultCharset())}} (main e6885df7894d, 
line 65), and the text is null.

Checked on 4.24.0-SNAPSHOT with {{camel run}}: {{NullPointerException: Cannot 
invoke "String.getBytes(java.nio.charset.Charset)" because "input" is null}}.

The same line encodes the text with the platform charset, while the parser 
follows the encoding of the XML declaration, so XML whose declared encoding is 
not the platform default can be read wrong (from the code, not run).

*Proposed change*: fail with a clear error when there is no body, and give the 
parser the bytes or the text without encoding it again.

_Claude Code on behalf of davsclaus_



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

Reply via email to