FELIX-661: BND builder should remember to close inlined jars

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@683308 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/Builder.java b/bundleplugin/src/main/java/aQute/lib/osgi/Builder.java
index 1b0f0ad..ed0f81d 100644
--- a/bundleplugin/src/main/java/aQute/lib/osgi/Builder.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/Builder.java
@@ -26,6 +26,7 @@
     private static final int SPLIT_FIRST       = 4;
     private static final int SPLIT_DEFAULT     = 0;
 
+    List                     inlinedJars       = new ArrayList();
     boolean                  sources           = false;
     File[]                   sourcePath;
     Pattern                  NAME_URL          = Pattern
@@ -487,8 +488,10 @@
         Jar sub = getJarFromName(name, "extract from jar");
         if (sub == null)
             error("Can not find JAR file " + name);
-        else
+        else {
             jar.addAll(sub, filter);
+            inlinedJars.add(sub);
+        }
     }
 
     private Pattern wildcard(String spec) {
@@ -764,6 +767,10 @@
     }
 
     public void close() {
+        for (Iterator j = inlinedJars.iterator(); j.hasNext();) {
+            Jar jar = (Jar) j.next();
+            jar.close();
+        }
         super.close();
     }
 }