FELIX-661: must remember to close all BND builders and analyzers
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@683313 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/AntPlugin.java b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/AntPlugin.java
index 5aa871e..99793f1 100644
--- a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/AntPlugin.java
+++ b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/AntPlugin.java
@@ -82,6 +82,9 @@
buildXml = StringUtils.replace( buildXml, "ARTIFACT_ID", artifactId );
FileUtils.fileWrite( baseDir + BUILD_XML, buildXml );
+
+ // cleanup...
+ builder.close();
}
catch ( Exception e )
{
diff --git a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundleAllPlugin.java b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundleAllPlugin.java
index 7b7bcba..1f9b58d 100644
--- a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundleAllPlugin.java
+++ b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundleAllPlugin.java
@@ -383,6 +383,10 @@
BundleInfo bundleInfo = addExportedPackages( project, exportedPackages );
+ // cleanup...
+ analyzer.close();
+ osgiJar.close();
+
return bundleInfo;
}
/* too bad Jar.write throws Exception */
diff --git a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
index b5bf8b2..e7a9fbf 100644
--- a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
+++ b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
@@ -334,6 +334,9 @@
getLog().error( "Error trying to write Manifest to file " + outputFile, e );
}
}
+
+ // cleanup...
+ builder.close();
}
catch ( MojoFailureException e )
{
diff --git a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java
index 94bbdcb..3aabdf5 100644
--- a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java
+++ b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java
@@ -36,6 +36,7 @@
import org.apache.maven.project.MavenProject;
import aQute.lib.osgi.Analyzer;
+import aQute.lib.osgi.Builder;
import aQute.lib.osgi.Jar;
@@ -56,7 +57,9 @@
{
if ( "bundle".equals( project.getPackaging() ) )
{
- manifest = buildOSGiBundle( project, instructions, properties, classpath ).getJar().getManifest();
+ Builder builder = buildOSGiBundle( project, instructions, properties, classpath );
+ manifest = builder.getJar().getManifest();
+ builder.close();
}
else
{
@@ -131,7 +134,12 @@
}
}
- return analyzer.getJar().getManifest();
+ Manifest manifest = analyzer.getJar().getManifest();
+
+ // cleanup...
+ analyzer.close();
+
+ return manifest;
}
diff --git a/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java b/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java
index c88090f..96bc47b 100644
--- a/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java
+++ b/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java
@@ -122,6 +122,8 @@
analyzer.calcManifest();
assertEquals( 3, analyzer.getExports().size() );
+
+ analyzer.close();
}