Skip to content
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

8306632: Add a JDK Property for specifying DTD support #15075

Closed
wants to merge 3 commits into from

Conversation

JoeWang-Java
Copy link
Member

@JoeWang-Java JoeWang-Java commented Jul 28, 2023

Add a JDK Impl specific property 'jdk.xml.dtd.support' for applications to specify how DTDs are handled. This property is uniformly supported across the JDK XML libraries. It complements, rather than replaces, the existing properties that are supportDTD for StAX and disallow-doctype-decl for DOM and SAX processors, which means the later will continue to work as they were and that if they are set, the new property will have no effect. Applications that use the existing properties continue to work as expected.

This patch continues the path made previously with Xalan and XPath in which functions were moved into the jdk/xml classes. Similar changes are now made with the Xerces and XML classes, consolidating functions into the jdk/xml classes, reducing duplicate code for easier future maintenance.

Tests: new tests are added to cover the various processors.
Existing tests pass. Only one was updated due to the change to the property impl.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change requires CSR request JDK-8306633 to be approved

Issues

  • JDK-8306632: Add a JDK Property for specifying DTD support (Enhancement - P4)
  • JDK-8306633: Add a JDK Property for specifying DTD support (CSR)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/15075/head:pull/15075
$ git checkout pull/15075

Update a local copy of the PR:
$ git checkout pull/15075
$ git pull https://git.openjdk.org/jdk.git pull/15075/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 15075

View PR using the GUI difftool:
$ git pr show -t 15075

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/15075.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jul 28, 2023

👋 Welcome back joehw! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the csr Pull request needs approved CSR before integration label Jul 28, 2023
@openjdk
Copy link

openjdk bot commented Jul 28, 2023

@JoeWang-Java The following label will be automatically applied to this pull request:

  • core-libs

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.

@openjdk openjdk bot added the core-libs core-libs-dev@openjdk.org label Jul 28, 2023
@openjdk openjdk bot added the rfr Pull request is ready for review label Jul 28, 2023
@mlbridge
Copy link

mlbridge bot commented Jul 28, 2023

Webrevs

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 26, 2023

@JoeWang-Java This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@openjdk openjdk bot removed the csr Pull request needs approved CSR before integration label Aug 30, 2023
@AlanBateman
Copy link
Contributor

I think you've got this to a good place and brings uniformity to configuring how all the processors deal with DTDs. The proposal in the CSR is approved now so hopefully you'll get Reviewer cycles to help move forward on this.

@JoeWang-Java
Copy link
Member Author

I think you've got this to a good place and brings uniformity to configuring how all the processors deal with DTDs. The proposal in the CSR is approved now so hopefully you'll get Reviewer cycles to help move forward on this.

Thanks Alan! And with that, you voided Git bot's warning (inactive for more than 4 weeks, blah) :-)

Copy link
Contributor

@LanceAndersen LanceAndersen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Joe,

I have made a few passes through the code and overall I think it is OK.

Nothing jumped out and was glaringly wrong given you have touched a large number of classes and added a fair amount of additional tests

@openjdk
Copy link

openjdk bot commented Sep 5, 2023

@JoeWang-Java 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:

8306632: Add a JDK Property for specifying DTD support

Reviewed-by: lancea, smarks

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 1 new commit pushed to the master branch:

  • a62c48b: 8315891: java/foreign/TestLinker.java failed with "error occurred while instantiating class TestLinker: null"

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
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.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Sep 5, 2023
Copy link
Member

@stuart-marks stuart-marks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK I looked through a bunch of the code and I didn't see anything that needs to be changed right now. However I did spot a number of issues for future work. :-)

Good to see the duplicate XMLSecurityManager has been removed. However (not part of this diff) I note that there are two XMLSecurityPropertyManager classes in xerces and xalan. The code between them seems quite similar, so this might be an opportunity for future deduplication.

Most of the logic around handling of properties and config settings looks like it's in jdk/xml/internal. There are bunches of enums here and String arrays indexed by enum ordinals, plus things that search the enum values() arrays. It seems like some things could be done to improve the internal representation of this information, both to reduce the amount of code, and to make things easier for clients of this information.

It looks like ValueMapper1 is unused.

In XMLDTDScannerImpl.java line 391 this line is inserted:

   fEntityScanner = fEntityManager.getEntityScanner();

The addition of this line kind of sticks out. The initial value of this field is null. This assignment is done repeatedly in a bunch of places; but other places just assume the field has been initialized. Was this an NPE, and are there possibilities of NPE in other code paths?

I think the thing to do is to integrate this code as is, since it's already been tested, and then identify a few candidates for cleanup work. Then chip away at some cleanups in parallel with pursuing other design activities (e.g., Catalog).

Sync up to re-run tests.
@JoeWang-Java
Copy link
Member Author

Thanks Stuart! Will integrate after re-run tests. Will look into the cleanups, along with the ones you suggested during the last review.

@JoeWang-Java
Copy link
Member Author

Tier1 and Tier3 passed! Tier2 with one known failure (intermittent).

@JoeWang-Java
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Sep 8, 2023

Going to push as commit dccf670.
Since your change was applied there has been 1 commit pushed to the master branch:

  • a62c48b: 8315891: java/foreign/TestLinker.java failed with "error occurred while instantiating class TestLinker: null"

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Sep 8, 2023
@openjdk openjdk bot closed this Sep 8, 2023
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Sep 8, 2023
@openjdk
Copy link

openjdk bot commented Sep 8, 2023

@JoeWang-Java Pushed as commit dccf670.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@JoeWang-Java JoeWang-Java deleted the JDK-8306632 branch September 19, 2023 03:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs core-libs-dev@openjdk.org integrated Pull request has been integrated
4 participants