OPENJPA-2674 properly closing JarFile

txs to Kaloyan Spiridonov for the catch!


git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@1768201 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Struberg 2016-11-05 11:50:59 +00:00
parent 701a4e7d27
commit 4068d5ccb2
1 changed files with 2 additions and 4 deletions

View File

@ -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;