-
Notifications
You must be signed in to change notification settings - Fork 5.8k
8256515: javax.xml.XMLEventReader produces incorrect START_DOCUMENT event #1056
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8256515: javax.xml.XMLEventReader produces incorrect START_DOCUMENT event #1056
Conversation
👋 Welcome back MariusVolkhart! A progress list of the required criteria for merging this PR into |
@MariusVolkhart The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
import static org.testng.Assert.assertFalse; | ||
import static org.testng.Assert.assertTrue; | ||
|
||
public class XmlInputFactoryTest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is written correctly for regular TestNG, but I don't know if it's "right" for jtreg. I'm happy to make any changes necessary.
@MariusVolkhart I'll work with you getting the fix in and get the test running using jtreg. Give me a few moments to reproduce. |
Hi Marius, Saw the JBS issue, pls edit the title to sth. like the following: Thanks, |
@MariusVolkhart I think doing a PR is fine before you find a sponsor provided you're fairly certain it's an actual bug. It'll require one to then send an email to the mailing lists asking for a sponsor. That email could potentially reference a PR. That should be fine. The sponsor (committer) will then help you get it integrated. It somewhat depends on the issue. No hard-and-fast rules that I'm aware of in that regard. |
@MariusVolkhart Here is a PR for your branch so the test works with jtreg: Fails before the JDK patch and passes after. Run it with:
Results are in *.jtr files:
Or using the test framework of OpenJDK with:
HTH |
|
@jerboaa Thanks! That PR was immensely helpful, not just in helping get this change moving, but in helping me understand how to write the tests for next time! |
When you update, pls do a merge from the latest upstream jdk master. The changeset is pretty far behind the master. |
e37f5b2
to
cb68339
Compare
…T 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.
cb68339
to
0fa81e4
Compare
sdEvent.setStandalone(streamReader.isStandalone()); | ||
if (streamReader.standaloneSet()) { | ||
sdEvent.setStandalone(streamReader.isStandalone()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updates made. I understood your comment about modifying the setStandalone
method to mean StartDocumentEvent#setStandalone
. If it was something else, please let me know!
@MariusVolkhart This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 52 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@JoeWang-Java) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
/contributor add @MariusVolkhart |
@JoeWang-Java Only the author (@MariusVolkhart) is allowed to issue the |
Hi Marius, As the bot suggested, this PR is ready to be integrated. You may issue the integrate command when you're ready, I'll then sponsor it for you. Thanks for contributing the fix! Regards, |
/integrate |
@MariusVolkhart |
/sponsor |
@JoeWang-Java @MariusVolkhart Since your change was applied there have been 52 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit c47ab5f. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
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.
Progress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jdk pull/1056/head:pull/1056
$ git checkout pull/1056