You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ss...@apache.org on 2015/11/06 14:05:57 UTC
svn commit: r1712958 -
/sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleDeployMojo.java
Author: sseifert
Date: Fri Nov 6 13:05:56 2015
New Revision: 1712958
URL: http://svn.apache.org/viewvc?rev=1712958&view=rev
Log:
SLING-5272 maven-sling-plugin: Potential resource leak in JAR file handling
Modified:
sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleDeployMojo.java
Modified: sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleDeployMojo.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleDeployMojo.java?rev=1712958&r1=1712957&r2=1712958&view=diff
==============================================================================
--- sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleDeployMojo.java (original)
+++ sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleDeployMojo.java Fri Nov 6 13:05:56 2015
@@ -147,9 +147,10 @@ abstract class AbstractBundleDeployMojo
JarInputStream jis = null;
JarOutputStream jos;
OutputStream out = null;
+ JarFile sourceJar = null;
try {
// now create a temporary file and update the version
- final JarFile sourceJar = new JarFile(file);
+ sourceJar = new JarFile(file);
final Manifest manifest = sourceJar.getManifest();
manifest.getMainAttributes().putValue("Bundle-Version", newVersion);
@@ -182,6 +183,14 @@ abstract class AbstractBundleDeployMojo
throw new MojoExecutionException(
"Unable to update version in jar file.", ioe);
} finally {
+ if (sourceJar != null) {
+ try {
+ sourceJar.close();
+ }
+ catch (IOException ex) {
+ // close
+ }
+ }
IOUtils.closeQuietly(jis);
IOUtils.closeQuietly(out);
}