-
Notifications
You must be signed in to change notification settings - Fork 5.8k
8080272 Refactor I/O stream copying to use InputStream.transferTo/readAllBytes and Files.copy #1853
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
Conversation
👋 Welcome back turbanoff! A progress list of the required criteria for merging this PR into |
@turbanoff The following labels 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 lists. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
jrtfs is compiled twice, the second is to --release 8 so it can be packaged into jrt-fs.jar for use by IDEs/tools running on older JDK releases. So need to be careful with the changes here as it will likely causing build breakage. We try to keep the changes to ASM to a minimum, might be better to leave this change out of the patch. One or two of the sources changes should probably uses Files.copy, e.g. ZipPath, sjavac/CopyFile.java. |
Good idea! Replaced in few places. But not in ZipPath: it's actually implementation of underlying call from Files.copy: |
So these changes are all over the place which means no one person knows how to test all of it. |
I already suggested this, but anyway please always extract the changes to the java.desktop module to the separate PR. |
ec602c1
to
6f8ec71
Compare
I've extracted changes in java.desktop into separate PR #1856 |
6f8ec71
to
fceb20e
Compare
Probably best to drop the changes to src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/** too as it gets refreshed periodically from the upstream Apache Santuario project. |
…ferTo revert changes in Apache Santuario
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'm not a reviewer, but still think we could simplify sun.security.tools.keytool.Main
…ferTo revert changes from MimeLauncher
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 changes to sjavac changes look good
@turbanoff 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 1076 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 (@wangweij, @mcimadamore, @AlanBateman) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
src/java.management/share/classes/javax/management/loading/MLet.java
Outdated
Show resolved
Hide resolved
…ferTo remove unnecessary file.exists() check
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 for perceiving with this one. I think you've addressed all issues in the latest revision.
/integrate |
@turbanoff |
Hi @turbanoff, I'm happy to sponsor but I see two comments by @marschall - have they been addressed? |
@FrauBoes fixed in the last commit. Is there any way to de-integrate PR (to include last commit)? |
To re-integrate, just run the /integrate command again. Before doing that, could someone from security libs acknowledge the changes in their area? |
@@ -225,12 +224,7 @@ public X509CertPath(InputStream is, String encoding) | |||
} | |||
|
|||
try { | |||
if (is.markSupported() == false) { |
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 don't think you should remove lines 228-232. These methods are called by methods of CertificateFactory that take InputStream (which may contain a stream of security data) and they are designed such that they try to read one Certificate, CRL, or CertPath from the InputStream and leave the InputStream ready to parse the next structure instead of consuming all of the bytes. Thus they check if the InputStream supports mark in order to try to preserve that behavior. If mark is not supported, then it's ok to use InputStream.readAllBytes, otherwise, leave the stream as-is.
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.
As I can see only ByteArrayInputStream is actually passed in InputStream
in current JDK code:
PKCS7 pkcs7 = new PKCS7(is.readAllBytes());
private static List<X509Certificate> parsePKCS7(InputStream is)
certs = parsePKCS7(is);
public X509CertPath(InputStream is, String encoding)
return new X509CertPath(new ByteArrayInputStream(data), encoding);
PKCS7 pkcs7 = new PKCS7(is.readAllBytes());
private static List<X509Certificate> parsePKCS7(InputStream is)
certs = parsePKCS7(is);
public X509CertPath(InputStream is, String encoding)
this(is, PKIPATH_ENCODING);
public X509CertPath(InputStream is) throws CertificateException {
return new X509CertPath(new ByteArrayInputStream(encoding));
Perhaps original marking approach was lost during refactoring?
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.
You are right, the code was refactored (way back in 2010) [1] to read one block at a time, so this check on mark can be removed. So, in this case, I think it is probably safe to just pass the InputStream as-is to PKCS7(InputStream), but maybe you can add a comment that says this should always be a ByteArrayInputStream. We can look at refactoring this code and clean it up a bit more later.
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 find implementation of sun.security.pkcs.PKCS7#PKCS7(java.io.InputStream)
a bit confusing (or even buggy). It uses only InputStream.available()
to parse block.
So I would prefer to not use it.
@turbanoff Given that this PR has been lingering for a while, you could drop the change in |
…dAllBytes and Files.copy drop changes in X509CertPath
@turbanoff Tier 1-3 still all clear. If you /integrate, I will sponsor this tomorrow. |
/integrate |
@turbanoff |
/sponsor |
@FrauBoes @turbanoff Since your change was applied there have been 1086 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit 68deb24. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Progress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jdk pull/1853/head:pull/1853
$ git checkout pull/1853