Author: fbricon
Date: 2012-10-04 10:34:33 -0400 (Thu, 04 Oct 2012)
New Revision: 44297
Modified:
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/identification/MavenPropertiesIdentifier.java
Log:
JBIDE-12529 close opened jar file.
Modified:
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/identification/MavenPropertiesIdentifier.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/identification/MavenPropertiesIdentifier.java 2012-10-04
14:33:47 UTC (rev 44296)
+++
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/identification/MavenPropertiesIdentifier.java 2012-10-04
14:34:33 UTC (rev 44297)
@@ -28,7 +28,7 @@
}
public ArtifactKey identify(File file) throws CoreException {
- ZipFile jar;
+ ZipFile jar = null;
try {
jar = new ZipFile(file);
return getArtifactFromMetaInf(jar);
@@ -36,11 +36,18 @@
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
+ } finally {
+ if (jar != null) {
+ try {
+ jar.close();
+ } catch (IOException e) {
+ }
+ }
}
- //System.err.println(getName() + " could not identify "+file);
return null;
}
+ @SuppressWarnings("nls")
protected static ArtifactKey getArtifactFromMetaInf(ZipFile jar) throws IOException {
ZipEntry mavenEntry = jar.getEntry("META-INF/maven");//$NON-NLS-1$
if (mavenEntry == null) {
Show replies by date