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

JDK-8261237: remove isClassPathAttributePresent method #2429

Closed
wants to merge 2 commits into from

Conversation

@MBaesken
Copy link
Member

@MBaesken MBaesken commented Feb 5, 2021

Hello,
Currently in jdk/internal/vm/VMSupport.java , we create a JarFile without a related finally clause or try with resources. That should better be changed.
See also the Sonar check result :

https://sonarcloud.io/project/issues?id=shipilev_jdk&languages=java&open=AXcqM8zf8sPJZZzON5qG&resolved=false&severities=BLOCKER&types=BUG

public static boolean isClassPathAttributePresent(String path) {
    try {
        Manifest man = (new JarFile(path)).getManifest();

Use try-with-resources or close this "JarFile" in a "finally" clause.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8261237: remove isClassPathAttributePresent method

Reviewers

Download

$ git fetch https://git.openjdk.java.net/jdk pull/2429/head:pull/2429
$ git checkout pull/2429

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Feb 5, 2021

👋 Welcome back mbaesken! 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 rfr label Feb 5, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Feb 5, 2021

@MBaesken 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 label Feb 5, 2021
@mlbridge
Copy link

@mlbridge mlbridge bot commented Feb 5, 2021

Webrevs

Copy link
Contributor

@shipilev shipilev left a comment

This looks good to me.

@openjdk
Copy link

@openjdk openjdk bot commented Feb 8, 2021

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

8261237: remove isClassPathAttributePresent method

Reviewed-by: shade, clanger, redestad, 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 38 new commits pushed to the master branch:

  • 5183d8a: 8260355: AArch64: deoptimization stub should save vector registers
  • 5d8204b: 8261368: The new TestNullSetColor test is placed in the wrong group
  • f03e839: 8261127: Cleanup THREAD/TRAPS/CHECK usage in CDS code
  • 7451962: 8129776: The optimized Stream returned from Files.lines should unmap the mapped byte buffer (if created) when closed
  • ad525bc: 8261281: Linking jdk.jpackage fails for linux aarch32 builds after 8254702
  • 2fd8ed0: 8240632: Note differences between IEEE 754-2019 math lib special cases and java.lang.Math
  • ace8f94: 8195744: Avoid calling ClassLoader.checkPackageAccess if security manager is not installed
  • ab65d53: 8261261: The version extra fields needs to be overridable in jib-profiles.js
  • 20d7713: 8261334: NMT: tuning statistic shows incorrect hash distribution
  • 92c6e6d: 8261254: Initialize charset mapping data lazily
  • ... and 28 more: https://git.openjdk.java.net/jdk/compare/43ae0cf878548ba56b88459290145a776839bcf5...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 label Feb 8, 2021
Copy link
Contributor

@RealCLanger RealCLanger left a comment

Looks correct and straightforward.

cl4es
cl4es approved these changes Feb 8, 2021
@@ -85,8 +85,8 @@ public static synchronized Properties getAgentProperties() {
* path is not a JAR file or some other error occurs.
*/
public static boolean isClassPathAttributePresent(String path) {
Copy link
Contributor

@AlanBateman AlanBateman Feb 8, 2021

Is isClassPathAttributePresent used anywhere? I remember we added VMSupport for use by JVMTI and the attach mechanism but I don't see any usages of this method now.

Copy link
Contributor

@RealCLanger RealCLanger Feb 8, 2021

Seems you're right. My search for "isClassPathAttributePresent" also didn't yield anything. So why not remove it altogether...?

Copy link
Member

@cl4es cl4es Feb 8, 2021

Removing it sounds good.

Copy link
Member Author

@MBaesken MBaesken Feb 9, 2021

hi, I removed isClassPathAttributePresent .

cl4es
cl4es approved these changes Feb 9, 2021
Copy link
Contributor

@AlanBateman AlanBateman left a comment

Removing it looks fine.
Can you change the description of JDK-8261237 to reflect the change.

@openjdk openjdk bot removed the ready label Feb 9, 2021
@MBaesken MBaesken changed the title JDK-8261237: isClassPathAttributePresent use try with resources with JarFile JDK-8261237: remove isClassPathAttributePresent method Feb 9, 2021
@openjdk openjdk bot added the ready label Feb 9, 2021
@MBaesken
Copy link
Member Author

@MBaesken MBaesken commented Feb 9, 2021

/integrate

@openjdk openjdk bot closed this Feb 9, 2021
@openjdk openjdk bot added integrated and removed ready rfr labels Feb 9, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Feb 9, 2021

@MBaesken Since your change was applied there have been 38 commits pushed to the master branch:

  • 5183d8a: 8260355: AArch64: deoptimization stub should save vector registers
  • 5d8204b: 8261368: The new TestNullSetColor test is placed in the wrong group
  • f03e839: 8261127: Cleanup THREAD/TRAPS/CHECK usage in CDS code
  • 7451962: 8129776: The optimized Stream returned from Files.lines should unmap the mapped byte buffer (if created) when closed
  • ad525bc: 8261281: Linking jdk.jpackage fails for linux aarch32 builds after 8254702
  • 2fd8ed0: 8240632: Note differences between IEEE 754-2019 math lib special cases and java.lang.Math
  • ace8f94: 8195744: Avoid calling ClassLoader.checkPackageAccess if security manager is not installed
  • ab65d53: 8261261: The version extra fields needs to be overridable in jib-profiles.js
  • 20d7713: 8261334: NMT: tuning statistic shows incorrect hash distribution
  • 92c6e6d: 8261254: Initialize charset mapping data lazily
  • ... and 28 more: https://git.openjdk.java.net/jdk/compare/43ae0cf878548ba56b88459290145a776839bcf5...master

Your commit was automatically rebased without conflicts.

Pushed as commit 8ebed28.

💡 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
5 participants