Let exception pass up when trying to open JAR files. (FELIX-883)
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@800940 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/cache/JarContent.java b/framework/src/main/java/org/apache/felix/framework/cache/JarContent.java
index ebb7fa0..1be5d99 100644
--- a/framework/src/main/java/org/apache/felix/framework/cache/JarContent.java
+++ b/framework/src/main/java/org/apache/felix/framework/cache/JarContent.java
@@ -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);
+ }
}
}