RFR: 8256515: javax.xml.XMLEventReader produces incorrect START_DOCUMENT event [v4]

Marius Volkhart github.com+1709517+mariusvolkhart at openjdk.java.net
Tue Dec 8 16:26:05 UTC 2020


On Thu, 3 Dec 2020 23:40:40 GMT, Joe Wang <joehw at openjdk.org> wrote:

>> Marius Volkhart has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - fixup! Fix: javax.xml.stream.XMLEventReader produces incorrect START_DOCUMENT event
>>  - fixup! Fix: javax.xml.stream.XMLEventReader produces incorrect START_DOCUMENT event
>
> src/java.xml/share/classes/com/sun/xml/internal/stream/events/XMLEventAllocatorImpl.java line 136:
> 
>> 134:                 if (streamReader.standaloneSet()) {
>> 135:                     sdEvent.setStandalone(streamReader.isStandalone());
>> 136:                 }
> 
> The change looked fine at the first glance. However, when I looked at your test, I noticed that in your first test case, isStandalone will return true. This is because standalone was initiated as true and with the added condition, setStandalone is skipped.
> 
> To fix the issue, consider, instead of making it conditional, adding standaloneSet to the setStandalone method. 
> 
> Pls update the copyright year at line 2, e.g. 2016 -> 2020.

Updates made. I understood your comment about modifying the `setStandalone` method to mean `StartDocumentEvent#setStandalone`. If it was something else, please let me know!

-------------

PR: https://git.openjdk.java.net/jdk/pull/1056


More information about the core-libs-dev mailing list