[
https://issues.apache.org/jira/browse/CAMEL-19415?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17729654#comment-17729654
]
vincenttang commented on CAMEL-19415:
-------------------------------------
Thanks Nicolas,
Our project is still using Java 8, which cannot upgrade to most recent versions
(3.20.5 or 4.0.0-M3).
Checked that most latest version for JAVA 8 (3.14) is EOL also....
Our project is ancient (more than 20 years). Every upgrade is an ordeal.
I understand 2.25.4 is EOL, is there any temporary solution on it, e.g. fix the
woodstox property from camel core, to avoid this potential NPE?
I've also asked in SO [https://stackoverflow.com/q/76380521/21201981], but
sadly there is no res. :(
> camel-core: using xtokenize might be NPE on xml default namespace
> -----------------------------------------------------------------
>
> Key: CAMEL-19415
> URL: https://issues.apache.org/jira/browse/CAMEL-19415
> Project: Camel
> Issue Type: Bug
> Components: camel-core
> Affects Versions: 2.25.4
> Environment: java 8
> camel-core 2.25.4
> woodstox-core-asl 4
> woodstox-core 5/6
> Reporter: vincenttang
> Priority: Major
> Attachments: error_3_hide.PNG
>
>
> Background:
> camel-core use Woodstox to xtokenize the xml.
> Woodstox has a property on
> WstxInputProperties.P_RETURN_NULL_FOR_DEFAULT_NAMESPACE
> which has different value in different woodstox-core version.
> ---
> Issue:
> When using camel core to xtokenize xml, it will get the XML namespace prefix
> through javax.xml.stream.XMLStreamReader#getNamespacePrefix, which will use
> woodstox-core lib.
> In
> org.apache.camel.support.XMLTokenExpressionIterator.XMLTokenIterator#createContextualToken
> with i mode,
> It will then construct a namespace map and loop it .
> In org.apache.camel.support.XMLTokenExpressionIterator line 404
> sb.append(e.getKey().length() == 0 ? " xmlns" : " xmlns:")
> As the e.getKey() has no null check, it might be null and resulting in NPE
> because of null.length()
> ---
> Suggested Solution:
> Add a null check at org.apache.camel.support.XMLTokenExpressionIterator line
> 404 e.getKey() to avoid NPE
> i.e. sb.append((e.getKey() == null || e.getKey().length() == 0) ? " xmlns" :
> " xmlns:")
--
This message was sent by Atlassian Jira
(v8.20.10#820010)