Author: struberg
Date: Sat Nov  5 11:50:59 2016
New Revision: 1768201

URL: http://svn.apache.org/viewvc?rev=1768201&view=rev
Log:
OPENJPA-2674 properly closing JarFile

txs to Kaloyan Spiridonov for the catch!

Modified:
    
openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/InstrumentationFactory.java

Modified: 
openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/InstrumentationFactory.java
URL: 
http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/InstrumentationFactory.java?rev=1768201&r1=1768200&r2=1768201&view=diff
==============================================================================
--- 
openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/InstrumentationFactory.java
 (original)
+++ 
openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/InstrumentationFactory.java
 Sat Nov  5 11:50:59 2016
@@ -369,10 +369,8 @@ public class InstrumentationFactory {
      * @return True if the provided agentClassName is defined as the 
Agent-Class
      *         in the manifest from the provided agentJarFile. False otherwise.
      */
-    private static boolean validateAgentJarManifest(File agentJarFile, Log log,
-        String agentClassName) {
-        try {
-            JarFile jar = new JarFile(agentJarFile);
+    private static boolean validateAgentJarManifest(File agentJarFile, Log 
log, String agentClassName) {
+        try (JarFile jar = new JarFile(agentJarFile)) {
             Manifest manifest = jar.getManifest();
             if (manifest == null) {
                 return false;


Reply via email to