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

8278165: Clarify that ZipInputStream does not access the CEN fields for a ZipEntry #10102

Closed
wants to merge 14 commits into from

Conversation

LanceAndersen
Copy link
Contributor

@LanceAndersen LanceAndersen commented Aug 31, 2022

Hi,

Please review this update to the ZipInputStream class description to clarify that ZipInputStream walks sequentially through each Zip Entry contained within the Zip File. As a result, the CEN header for the Zip file entries are not read resulting in ZipInputStream not having access to information that is stored within the CEN Header fields such the as the external file attributes which can be used to store optional data such as Posix Permissions.


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 a CSR request to be approved

Issues

  • JDK-8278165: Clarify that ZipInputStream does not access the CEN fields for a ZipEntry
  • JDK-8293756: Clarify that ZipInputStream does not access the CEN fields for a ZipEntry (CSR)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 10102

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 31, 2022

👋 Welcome back lancea! 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
Copy link

openjdk bot commented Aug 31, 2022

@LanceAndersen 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 Aug 31, 2022
@openjdk
Copy link

openjdk bot commented Sep 12, 2022

⚠️ @LanceAndersen This pull request contains merges that bring in commits not present in the target repository. Since this is not a "merge style" pull request, these changes will be squashed when this pull request in integrated. If this is your intention, then please ignore this message. If you want to preserve the commit structure, you must change the title of this pull request to Merge <project>:<branch> where <project> is the name of another project in the OpenJDK organization (for example Merge jdk:master).

@LanceAndersen LanceAndersen marked this pull request as ready for review September 13, 2022 17:23
@openjdk openjdk bot added the rfr Pull request is ready for review label Sep 13, 2022
@mlbridge
Copy link

mlbridge bot commented Sep 13, 2022

Webrevs

*
* The {@link #getNextEntry()} method is used to read the next ZIP file entry
* (Local file (LOC) header record in the ZIP format) and position the stream at
* the entry's file data. The file data may read using one of
Copy link
Member

Choose a reason for hiding this comment

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

of -> of the?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

* <pre>
* {@code
* try (FileInputStream fis = new FileInputStream(jar.toFile());
* ZipInputStream zis = new ZipInputStream(fis)) {
Copy link
Member

Choose a reason for hiding this comment

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

The indentation seems weird in this code sample.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reformatted

Copy link
Member

@bplb bplb left a comment

Choose a reason for hiding this comment

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

Looks fine.

@openjdk
Copy link

openjdk bot commented Sep 13, 2022

@LanceAndersen 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:

8278165: Clarify that ZipInputStream does not access the CEN fields for a ZipEntry

Reviewed-by: bpb, alanb

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 master branch:

  • 5feca68: 8293840: RISC-V: Remove cbuf parameter from far_call/far_jump/trampoline_call
  • 39cd163: 8293578: Duplicate ldc generated by javac
  • 7765942: 8290367: Update default value and extend the scope of com.sun.jndi.ldap.object.trustSerialData system property
  • 11e7d53: 8293819: sun/util/logging/PlatformLoggerTest.java failed with "RuntimeException: Retrieved backing PlatformLogger level null is not the expected CONFIG"
  • 141d5f5: 8293767: AWT test TestSinhalaChar.java has old SCCS markings
  • 3beca2d: 8291600: [vectorapi] vector cast op check is not always needed for vector mask cast
  • 9a40b76: 8293842: IPv6-only systems throws UnsupportedOperationException for several socket/TCP options
  • bb9aa4e: 8293813: ProblemList com/sun/jdi/JdbLastErrorTest.java on windows-x64 in Xcomp mode
  • 4cec141: 8291509: Minor cleanup could be done in sun.security
  • 6beeb84: 8293875: ProblemList sun/management/jmxremote/bootstrap/RmiBootstrapTest.java#id1 on linux-x64
  • ... and 42 more: https://git.openjdk.org/jdk/compare/524af949370990df6f58a84ad2493eb1dcba2231...master

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 13, 2022
* }
* }
* }
* </pre>
Copy link
Contributor

Choose a reason for hiding this comment

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

The updated class description looks okay. For the example then I assume you make this a code snippet.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Converted the example to a snippet. Thanks for the suggestion

@openjdk openjdk bot added csr Pull request needs approved CSR before integration and removed ready Pull request is ready to be integrated labels Sep 13, 2022
* For example:
* {@snippet :
* try (FileInputStream fis = new FileInputStream(jar.toFile());
* ZipInputStream zis = new ZipInputStream(fis)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

One other comment on the snippet is that the type of "jar" may not be obvious to readers. I think you'll need Path jar = ... in which case changing it Files.newInputStream(jar) might be simpler.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

One other comment on the snippet is that the type of "jar" may not be obvious to readers. I think you'll need Path jar = ... in which case changing it Files.newInputStream(jar) might be simpler.

Updated per your suggestion

* does not read the Central directory (CEN) header for the entry and therefore
* will not have access to its metadata such as the external file attributes.
* {@linkplain ZipFile} may be used when the information stored within
* the CEN header is required.
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if this paragraph should be an apiNote. It's not wrong as is but it feels like a note to remind developers that this is an "input stream" for iterating through the ZIP entries. The external files attributes are in the CEN at the end of the ZIP file so this is why they aren't available.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wonder if this paragraph should be an apiNote. It's not wrong as is but it feels like a note to remind developers that this is an "input stream" for iterating through the ZIP entries. The external files attributes are in the CEN at the end of the ZIP file so this is why they aren't available.

converted to an apiNote

@openjdk openjdk bot removed the rfr Pull request is ready for review label Sep 14, 2022
Copy link
Contributor

@AlanBateman AlanBateman left a comment

Choose a reason for hiding this comment

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

I think version e15660e looks okay.

@openjdk openjdk bot added rfr Pull request is ready for review ready Pull request is ready to be integrated and removed csr Pull request needs approved CSR before integration labels Sep 16, 2022
@LanceAndersen
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Sep 16, 2022

Going to push as commit a8f0f57.
Since your change was applied there have been 56 commits pushed to the master branch:

  • 746f5f5: 8293816: CI: ciBytecodeStream::get_klass() is not consistent
  • 4b297c1: 8293892: Add links to JVMS 19 and 20 from ClassFileFormatVersion enum constants
  • dfb9c06: 8293535: jdk/javadoc/doclet/testJavaFX/TestJavaFxMode.java fail with jfx
  • f42caef: 8293550: Optionally add get-task-allow entitlement to macos binaries
  • 5feca68: 8293840: RISC-V: Remove cbuf parameter from far_call/far_jump/trampoline_call
  • 39cd163: 8293578: Duplicate ldc generated by javac
  • 7765942: 8290367: Update default value and extend the scope of com.sun.jndi.ldap.object.trustSerialData system property
  • 11e7d53: 8293819: sun/util/logging/PlatformLoggerTest.java failed with "RuntimeException: Retrieved backing PlatformLogger level null is not the expected CONFIG"
  • 141d5f5: 8293767: AWT test TestSinhalaChar.java has old SCCS markings
  • 3beca2d: 8291600: [vectorapi] vector cast op check is not always needed for vector mask cast
  • ... and 46 more: https://git.openjdk.org/jdk/compare/524af949370990df6f58a84ad2493eb1dcba2231...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Sep 16, 2022

@LanceAndersen Pushed as commit a8f0f57.

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

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
Development

Successfully merging this pull request may close these issues.

3 participants