Author: rickhall
Date: Thu Feb 28 18:39:55 2013
New Revision: 1451284
URL: http://svn.apache.org/r1451284
Log:
Catch and ignore IAEs due to harmless check-then-act situation. (FELIX-3939)
Modified:
felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java
Modified:
felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java
URL:
http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java?rev=1451284&r1=1451283&r2=1451284&view=diff
==============================================================================
---
felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java
(original)
+++
felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java
Thu Feb 28 18:39:55 2013
@@ -2185,7 +2185,12 @@ public class BundleWiringImpl implements
if (getPackage(pkgName) == null)
{
Object[] params = definePackage(pkgName);
- if (params != null)
+
+ // This is a harmless check-then-act
situation,
+ // where threads might be racing to create
different
+ // classes in the same package, so catch
and ignore
+ // any IAEs that may occur.
+ try
{
definePackage(
pkgName,
@@ -2197,10 +2202,9 @@ public class BundleWiringImpl implements
(String) params[5],
null);
}
- else
+ catch (IllegalArgumentException ex)
{
- definePackage(pkgName, null, null,
- null, null, null, null, null);
+ // Ignore.
}
}
}
@@ -2315,7 +2319,7 @@ public class BundleWiringImpl implements
spectitle, specversion, specvendor, impltitle,
implversion, implvendor
};
}
- return null;
+ return new Object[] {null, null, null, null, null, null};
}
private Class getDexFileClass(JarContent content, String name,
ClassLoader loader)