]> source.dussan.org Git - archiva.git/commitdiff
correctly close jarFile in a finally block
authorOlivier Lamy <olamy@apache.org>
Sun, 8 Jul 2012 16:16:01 +0000 (16:16 +0000)
committerOlivier Lamy <olamy@apache.org>
Sun, 8 Jul 2012 16:16:01 +0000 (16:16 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1358773 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultBrowseService.java

index 5228ae6216f971162747eb02122142759ab491cc..7896ec50c75628139a5d2a64753951068735452e 100644 (file)
@@ -752,6 +752,7 @@ public class DefaultBrowseService
                     }
                     finally
                     {
+                        closeQuietly( jarFile );
                         IOUtils.closeQuietly( inputStream );
                     }
                 }
@@ -782,6 +783,21 @@ public class DefaultBrowseService
         return new ArtifactContent();
     }
 
+    private void closeQuietly( JarFile jarFile )
+    {
+        if ( jarFile != null )
+        {
+            try
+            {
+                jarFile.close();
+            }
+            catch ( IOException e )
+            {
+                log.warn( "ignore error closing jarFile {}", jarFile.getName() );
+            }
+        }
+    }
+
     //---------------------------
     // internals
     //---------------------------