RFR: 8256515: javax.xml.XMLEventReader produces incorrect START_DOCUMENT event [v3]
Joe Wang
joehw at openjdk.java.net
Mon Dec 7 17:40:18 UTC 2020
On Fri, 4 Dec 2020 00:32:26 GMT, Joe Wang <joehw at openjdk.org> wrote:
>> Marius Volkhart has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains three commits:
>>
>> - Adjust test so it works with jtreg
>> - Fix: javax.xml.stream.XMLEventReader produces incorrect START_DOCUMENT event
>>
>> The default implementation of javax.xml.stream.XMLEventReader produced a StartDocument event that always indicated that the "standalone" attribute was set.
>>
>> The root cause of this was that the com.sun.xml.internal.stream.events.XMLEventAllocatorImpl always set the "standalone" attribute, rather than asking streamReader.standaloneSet() before setting the property of the StartDocumentEvent being created.
>> - Add test for XmlInputFactory
>
> test/jdk/javax/xml/jaxp/8256515/XmlInputFactoryTest.java line 25:
>
>> 23: var factory = XMLInputFactory.newInstance();
>> 24: var xml = """
>> 25: <?xml version="1.0"?>""";
>
> There are three test cases here. Let's use DataProvider, sth. like {"<?xml version='1.0'?>", false, false}. The test then will take three parameters, e.g. xml, standalone, standaloneSet, and make two assertEquals
And while we are here, I'm not against using new features, we actually have done a lot over time. But unless there's a clear advantage, I'd keep the code (esp. tests) compatible with 8 since it's very likely changes will be backported. With that, I would recommend not using var and text blocks.
-------------
PR: https://git.openjdk.java.net/jdk/pull/1056
More information about the core-libs-dev
mailing list