Details
-
Bug
-
Status: Closed
-
Critical
-
Resolution: Fixed
-
framework-2.0.0
-
None
-
generic, JDK6, tested on Windows & Linux
Description
I tried to update to felix-2.0.0 but my bundles with native code would not install anymore, even though they work fine under felix-1.8.1 and equinox. The following error showed up for no good reason:
org.osgi.framework.BundleException: Activator start error in bundle org.example.pkg [23].
at org.apache.felix.framework.Felix.activateBundle(Felix.java:1750)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1621)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:890)
at org.apache.felix.shell.impl.StartCommandImpl.execute(StartCommandImpl.java:114)
at org.apache.felix.shell.impl.Activator$ShellServiceImpl.executeCommand(Activator.java:281)
at org.apache.felix.shell.tui.Activator$ShellTuiRunnable.run(Activator.java:184)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
at org.apache.felix.framework.util.manifestparser.R4Library.match(R4Library.java:113)
at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.findLibrary(ModuleImpl.java:1929)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1680)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1028)
at org.example.pkg.internal.ExampleActivator.start(ExampleActivator.java:12)
at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:667)
at org.apache.felix.framework.Felix.activateBundle(Felix.java:1699)
... 6 more
java.lang.ArrayIndexOutOfBoundsException: 0
Through trial-and-error I have found the rather confusing conditions under which this error shows up:
- a library is not found in the bundle (code passes a nonexisting name to System.loadLibrary())
- multiple libraries are correctly specified in the Bundle-NativeCode header!
There might be other confusing combinations.
I traced this back to the changes to R4Library in r790963 (Add support for configurable native library extensions. (FELIX-1298)) where the match() method was modified. It seems that the "exts" array is empty and therefore leads to the AIOOB later.