-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
8276141: XPathFactory set/getProperty method #6215
Conversation
/csr |
👋 Welcome back joehw! A progress list of the required criteria for merging this PR into |
@JoeWang-Java this pull request will not be integrated until the CSR request JDK-8276143 for issue JDK-8276141 has been approved. |
@JoeWang-Java 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. |
Webrevs
|
Are you planning to add tests? Also don't forget @SInCE. |
Thanks Alan. Added "since"; Added default impl; Added tests. Note that I removed the run with security manager from this test. As the Security Manager is deprecated, the run with security manager in tests unrelated to secure processing will need to be removed. |
* | ||
* @implSpec | ||
* The default implementation in the XPath API throws | ||
* {@link java.lang.UnsupportedOperationException}. |
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.
I think you can drop "in the XPath API" from the sentence.
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.
Dropped.
* @return the value of the property. | ||
* | ||
* @throws XPathFactoryConfigurationException if the property name is not | ||
* recognized |
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.
Are you sure XPathFactoryConfigurationException is the right exception here? This exception suggests "a configuration error in a XPathFactory environment". I would expect something like IllegalArgumentException here.
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.
Agree, IAE would have been more appropriate. The only reason I went with XCE was consistency among the XPath API. It's unfortunate it has not been consistent among the XML libs. The DOM/StAX/XSLT went with IAE, SAX/Validation SAXNotRecognizedException and SAXNotSupportedException, and then XPath XCE which was designed for config error. But if we don't plan to fix XPathFactory::set/getFeature, should we go with sth different for the property methods?
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.
Roger also suggested changing to IAE. I've just pushed a change to IAE. Thanks.
throw new NullPointerException("the name parameter is null"); | ||
} | ||
throw new UnsupportedOperationException("not implemented"); | ||
} |
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.
Changing it to throw IAE looks much better. You can drop "throws IllegalArgumentException" from the method signature as it's a runtime exception.
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.
IAE dropped from the method signature.
|
||
/** | ||
* Sets a property for this {@code XPathFactory} and {@code XPath} | ||
* created by this factory. |
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.
Are properties inherited by the XPath object at create time? The javadoc for newXPath suggests so and I'm wondering if the javadoc for setProperty needs to consistent with that. Maybe the intention is really that this method sets a XPathFactory property and it is used when configuring the XPath object returned by the newXPath method.
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.
Yes. Made a clarification to the javadoc, and while we are here, to setFeature method as well.
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.
One other suggestion for wording is to change:
"A property set on the factory is effective to the XPath object created thereafter"
to something like:
"The property applies to XPath objects that the XPathFactory creates. It has no impact on XPath objects that are already created."
I don't have any other comments on the API.
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 wording is adjusted accordingly. Thanks.
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 wording is adjusted accordingly. Thanks.
Thanks for the update. The API additions (and clarification) look good to me. Do you have other reviewers for the impl change and tests?
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.
Thanks again, Alan. I'll ask around for help.
/** | ||
* Sets a property for this {@code XPathFactory}. A property set on the | ||
* factory is effective to the {@code XPath} object created thereafter, but | ||
* not ones that may have been created beforehand. |
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.
It might be clear to say something like "The property has no impact on XPath object that are already created".
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.
Thanks Alan. Updated accordingly.
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.
Looks good.
* or the value can not be assigned | ||
* @throws UnsupportedOperationException if the implementation does not | ||
* support the method | ||
* @throws NullPointerException if the {@code name} is {@code null}. |
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.
Drop the "." at the end of the sentence (to be consistent with the other throws).
* @throws IllegalArgumentException if the property name is not recognized | ||
* @throws UnsupportedOperationException if the implementation does not | ||
* support the method | ||
* @throws NullPointerException if the {@code name} is {@code null}. |
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.
Ditto.
|
||
// property name not recognized | ||
String fmsg = XSLMessages.createXPATHMessage( | ||
XPATHErrorResources.ER_GETTING_UNKNOWN_PROPERTY, |
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.
Should this be ER_PROPERTY_UNKNOWN
?
Thanks Roger, Naoto. Fixed as suggested. |
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.
Associated CSR also Reviewed.
@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:
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 362 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. ➡️ To integrate this PR with the above commit message to the |
Hi all, refer to Joe's comment on the CSR, adding a statement to clarify where properties may be defined, that is, the method may be used for setting properties that may have been defined by the spec or the underlying impl. |
/integrate |
Going to push as commit b226ab9.
Your commit was automatically rebased without conflicts. |
@JoeWang-Java Pushed as commit b226ab9. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Add setProperty/getProperty methods to the XPath API so that properties can be supported in the future.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/6215/head:pull/6215
$ git checkout pull/6215
Update a local copy of the PR:
$ git checkout pull/6215
$ git pull https://git.openjdk.java.net/jdk pull/6215/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 6215
View PR using the GUI difftool:
$ git pr show -t 6215
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/6215.diff