RFR: 8349516: StAXStream2SAX.handleCharacters() fails on empty CDATA
Naoto Sato
naoto at openjdk.org
Fri Feb 28 23:04:53 UTC 2025
On Fri, 28 Feb 2025 22:56:27 GMT, Joe Wang <joehw at openjdk.org> wrote:
>> src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/StAXStream2SAX.java line 286:
>>
>>> 284: if (textLength > 0) {
>>> 285: staxStreamReader.getTextCharacters(0, chars, 0, textLength);
>>> 286: }
>>
>> Hi Joe,
>> The comment above this piece reads:
>>
>> // workaround for bugid 5046319 - switch over to commented section
>> // below when it is fixed.
>>
>> And the bug 5046319 (closed issue about AIOOBE) is fixed. Should the commented section be considered?
>
> Hi Naoto,
>
> Yes, I did look through that code and bug 5046319. Unfortunately, it happened when JAXP was standalone, the history of the change was lost.
> The variable "buf" seems to be an instance variable that serves to cache the text read. That part had been changed as well. Furthermore, if buf starts with zero length, the call to getTextCharacters would still result in IndexOutOfBoundsException.
>
> Maybe the commented code can be removed, I kept them as is in case they may be useful reference as a history.
OK, then I'd suggest removing the above comment and commented section altogether, as it only provides confusion.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23847#discussion_r1976100268
More information about the core-libs-dev
mailing list