elharo opened a new issue, #100:
URL: https://github.com/apache/maven-jarsigner/issues/100

   The `readManifest()` helper in `JarSignerUtilTest` opens a `JarFile` without 
try-with-resources. If `getManifest()` throws, the file handle leaks.
   
   **File:** `JarSignerUtilTest.java:73-80`
   
   ```java
   private Manifest readManifest(File file) throws IOException {
       JarFile jarFile = new JarFile(file);
       Manifest manifest = jarFile.getManifest();
       jarFile.close();
       return manifest;
   }
   ```
   
   **Suggested fix:** Use try-with-resources:
   
   ```java
   private Manifest readManifest(File file) throws IOException {
       try (JarFile jarFile = new JarFile(file)) {
           return jarFile.getManifest();
       }
   }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to