felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r800940 - /felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/JarContent.java
Date Tue, 04 Aug 2009 19:53:45 GMT
Author: rickhall
Date: Tue Aug  4 19:53:45 2009
New Revision: 800940

URL: http://svn.apache.org/viewvc?rev=800940&view=rev
Log:
Let exception pass up when trying to open JAR files. (FELIX-883)

Modified:
    felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/JarContent.java

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/JarContent.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/JarContent.java?rev=800940&r1=800939&r2=800940&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/JarContent.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/JarContent.java Tue
Aug  4 19:53:45 2009
@@ -59,17 +59,7 @@
 
     protected void finalize()
     {
-        if (m_jarFile != null)
-        {
-            try
-            {
-                m_jarFile.close();
-            }
-            catch (IOException ex)
-            {
-                // Not much we can do, so ignore it.
-            }
-        }
+        close();
     }
 
     public synchronized void close()
@@ -96,17 +86,7 @@
         // Open JAR file if not already opened.
         if (m_jarFile == null)
         {
-            try
-            {
-                openJarFile();
-            }
-            catch (IOException ex)
-            {
-                m_logger.log(
-                    Logger.LOG_ERROR,
-                    "JarContent: Unable to open JAR file.", ex);
-                return false;
-            }
+            openJarFile();
         }
 
         try
@@ -128,17 +108,7 @@
         // Open JAR file if not already opened.
         if (m_jarFile == null)
         {
-            try
-            {
-                openJarFile();
-            }
-            catch (IOException ex)
-            {
-                m_logger.log(
-                    Logger.LOG_ERROR,
-                    "JarContent: Unable to open JAR file.", ex);
-                return null;
-            }
+            openJarFile();
         }
 
         // Wrap entries enumeration to filter non-matching entries.
@@ -153,17 +123,7 @@
         // Open JAR file if not already opened.
         if (m_jarFile == null)
         {
-            try
-            {
-                openJarFile();
-            }
-            catch (IOException ex)
-            {
-                m_logger.log(
-                    Logger.LOG_ERROR,
-                    "JarContent: Unable to open JAR file.", ex);
-                return null;
-            }
+            openJarFile();
         }
 
         // Get the embedded resource.
@@ -224,17 +184,7 @@
         // Open JAR file if not already opened.
         if (m_jarFile == null)
         {
-            try
-            {
-                openJarFile();
-            }
-            catch (IOException ex)
-            {
-                m_logger.log(
-                    Logger.LOG_ERROR,
-                    "JarContent: Unable to open JAR file.", ex);
-                return null;
-            }
+            openJarFile();
         }
 
         // Get the embedded resource.
@@ -266,17 +216,7 @@
         // Open JAR file if not already opened.
         if (m_jarFile == null)
         {
-            try
-            {
-                openJarFile();
-            }
-            catch (IOException ex)
-            {
-                m_logger.log(
-                    Logger.LOG_ERROR,
-                    "JarContent: Unable to open JAR file.", ex);
-                return null;
-            }
+            openJarFile();
 
         }
 
@@ -366,18 +306,7 @@
         // Open JAR file if not already opened.
         if (m_jarFile == null)
         {
-            try
-            {
-                openJarFile();
-            }
-            catch (IOException ex)
-            {
-                m_logger.log(
-                    Logger.LOG_ERROR,
-                    "Unable to open JAR file.", ex);
-                return null;
-            }
-
+            openJarFile();
         }
 
         // Remove any leading slash.
@@ -491,11 +420,18 @@
         return m_file;
     }
 
-    private void openJarFile() throws IOException
+    private void openJarFile() throws RuntimeException
     {
         if (m_jarFile == null)
         {
-            m_jarFile = BundleCache.getSecureAction().openJAR(m_file, false);
+            try
+            {
+                m_jarFile = BundleCache.getSecureAction().openJAR(m_file, false);
+            }
+            catch (IOException ex)
+            {
+                throw new RuntimeException("Unable to open JAR file, probably deleted.",
ex);
+            }
         }
     }
 



Mime
View raw message