On Mon, 8 Feb 2021 13:41:17 GMT, Alan Bateman <al...@openjdk.org> wrote:

>> 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.
>
> src/java.base/share/classes/jdk/internal/vm/VMSupport.java line 87:
> 
>> 85:      * path is not a JAR file or some other error occurs.
>> 86:      */
>> 87:     public static boolean isClassPathAttributePresent(String path) {
> 
> 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.

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

-------------

PR: https://git.openjdk.java.net/jdk/pull/2429

Reply via email to