-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
8266019: StreamResult(File) writes to incorrect file path if # is part of the file path #4318
Conversation
…t of the file path
👋 Welcome back joehw! A progress list of the required criteria for merging this PR into |
@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. |
I believe this is the wrong fix - or at least an incomplete fix that will hide the bug under the carpet. Looking at TransformImpl I would change line TransformImpl.java:521 to:
|
I tried, but getRawPath returned output/%23/dom.xml, that in turn resulted in java.io.FileNotFoundException later. For StreamResult, when a String-form systemId is in File protocol, a FileOutputStream will eventually get created. Since StreamResult accepts OutputStream, there's no need for the File -> URI -> systemId -> URL -> File conversion (as did in TransformerImpl). I think it's better to create a FileOutputStream right from the File input. |
Argh! You're right. It's this line which is horribly wrong:
OK - hopefully with your fix this becomes dead code? |
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 now agree that what you propose is the safer route to fix this particular issue.
@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 6 new commits pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the ➡️ To integrate this PR with the above commit message to the |
Thanks Daniel! For the question, it will not be dead code as it accepts systemId in String form as well. But as least when File is the input, we don't end up going through a convoluted (if not unnecessary) File -URI -URL - File conversion. I think the later has sth. to do with the fact that Apache still supports older JDKs. While we agree not to touch that code for this fix (and also for not changing the mechanisms, e.g. how errors are handled), we'll keep an eye out on it. |
/integrate |
@JoeWang-Java Since your change was applied there have been 32 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit 460ce55. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Special characters are different in File and URI. Treat File input as File using FileInputStream instead of converting to an URI, but fall back to URI in case of error for compatibility (in error handling).
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/4318/head:pull/4318
$ git checkout pull/4318
Update a local copy of the PR:
$ git checkout pull/4318
$ git pull https://git.openjdk.java.net/jdk pull/4318/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 4318
View PR using the GUI difftool:
$ git pr show -t 4318
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/4318.diff