felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sseif...@apache.org
Subject svn commit: r1785859 - in /felix/trunk/tools/maven-bundle-plugin/src: main/java/org/apache/felix/bundleplugin/ main/java/org/apache/maven/shared/osgi/ test/java/org/apache/felix/bundleplugin/
Date Tue, 07 Mar 2017 16:51:42 GMT
Author: sseifert
Date: Tue Mar  7 16:51:41 2017
New Revision: 1785859

URL: http://svn.apache.org/viewvc?rev=1785859&view=rev
Log:
FELIX-5582 maven-bundle-plugin: Make sure Closeable resources are closed

Modified:
    felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
    felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/maven/shared/osgi/DefaultMaven2OsgiConverter.java
    felix/trunk/tools/maven-bundle-plugin/src/test/java/org/apache/felix/bundleplugin/BlueprintComponentTest.java

Modified: felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
URL: http://svn.apache.org/viewvc/felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java?rev=1785859&r1=1785858&r2=1785859&view=diff
==============================================================================
--- felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
(original)
+++ felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
Tue Mar  7 16:51:41 2017
@@ -1188,7 +1188,10 @@ public class BundlePlugin extends Abstra
             {
                 Set optionalPackages = getOptionalPackages( currentProject, dependencyGraph
);
 
-                Map<String, ? extends Map<String, String>> values = new Analyzer().parseHeader(
importPackages );
+                Map<String, ? extends Map<String, String>> values;
+                try (Analyzer analyzer = new Analyzer()) {
+                    values = analyzer.parseHeader( importPackages );
+                }
                 for ( Map.Entry<String, ? extends Map<String, String>> entry
: values.entrySet() )
                 {
                     String pkg = entry.getKey();

Modified: felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/maven/shared/osgi/DefaultMaven2OsgiConverter.java
URL: http://svn.apache.org/viewvc/felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/maven/shared/osgi/DefaultMaven2OsgiConverter.java?rev=1785859&r1=1785858&r2=1785859&view=diff
==============================================================================
--- felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/maven/shared/osgi/DefaultMaven2OsgiConverter.java
(original)
+++ felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/maven/shared/osgi/DefaultMaven2OsgiConverter.java
Tue Mar  7 16:51:41 2017
@@ -76,10 +76,9 @@ public class DefaultMaven2OsgiConverter
     {
         if ( ( artifact.getFile() != null ) && artifact.getFile().isFile() )
         {
-            Analyzer analyzer = new Analyzer();
 
             JarFile jar = null;
-            try
+            try (Analyzer analyzer = new Analyzer())
             {
                 jar = new JarFile( artifact.getFile(), false );
 

Modified: felix/trunk/tools/maven-bundle-plugin/src/test/java/org/apache/felix/bundleplugin/BlueprintComponentTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/tools/maven-bundle-plugin/src/test/java/org/apache/felix/bundleplugin/BlueprintComponentTest.java?rev=1785859&r1=1785858&r2=1785859&view=diff
==============================================================================
--- felix/trunk/tools/maven-bundle-plugin/src/test/java/org/apache/felix/bundleplugin/BlueprintComponentTest.java
(original)
+++ felix/trunk/tools/maven-bundle-plugin/src/test/java/org/apache/felix/bundleplugin/BlueprintComponentTest.java
Tue Mar  7 16:51:41 2017
@@ -153,7 +153,9 @@ public class BlueprintComponentTest exte
             assertTrue( pkgs.contains( "p" + i ) );
         }
 
-        new Verifier(builder).verify();
+        try (Verifier verifier = new Verifier(builder)) {
+            verifier.verify();
+        }
     }
 
     public void testAnalyzer() throws Exception
@@ -165,7 +167,10 @@ public class BlueprintComponentTest exte
         jar.setManifest(manifest);
         analyzer.setJar(jar);
         analyzer.analyze();
-        new Verifier(analyzer).verify();
+
+        try (Verifier verifier = new Verifier(analyzer)) {
+            verifier.verify();
+        }
     }
 
 }



Mime
View raw message