FrameworkExtensionInstaller.addExtensionContent0 throws NullPointerException when attempting to throw a BundleException

Description

If BundleExtensionInstaller.addExtensionContent0 fails and has an empty revision list then it will get a NullPointerException when throwing the BundleException, because revision.getBundle() will fail:

1 2 3 4 5 6 7 void addExtensionContent0(Collection<ModuleRevision> revisions, Module systemModule) throws BundleException { if (CL == null || ADD_FWK_URL_METHOD == null) { // use the first revision as the blame ModuleRevision revision = revisions.isEmpty() ? null : revisions.iterator().next(); throw new BundleException("Cannot support framework extension bundles without a public addURL(URL) method on the framework class loader: " + revision.getBundle()); //$NON-NLS-1$ } ....

The stack trace, is:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 [org.ops4j.pax.exam.karaf.container.internal.KarafTestContainer] : Shutting down the test container (Pax Runner) java.lang.RuntimeException: Container never came up at org.ops4j.pax.exam.karaf.container.internal.KarafTestContainer.stop(KarafTestContainer.java:629) at org.ops4j.pax.exam.spi.reactors.EagerSingleStagedReactor.tearDown(EagerSingleStagedReactor.java:118) at org.ops4j.pax.exam.spi.reactors.EagerSingleStagedReactor.afterClass(EagerSingleStagedReactor.java:132) at org.ops4j.pax.exam.spi.reactors.ReactorManager.afterClass(ReactorManager.java:441) at org.ops4j.pax.exam.junit.impl.ProbeRunner.run(ProbeRunner.java:107) at org.ops4j.pax.exam.junit.PaxExam.run(PaxExam.java:93) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:89) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:541) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:763) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:463) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:209) Exception in thread "KarafEmbeddedRunner" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException at org.ops4j.pax.exam.karaf.container.internal.runner.KarafEmbeddedRunner$1.run(KarafEmbeddedRunner.java:96) Caused by: java.lang.reflect.InvocationTargetException at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.ops4j.pax.exam.karaf.container.internal.runner.KarafEmbeddedRunner$1.run(KarafEmbeddedRunner.java:86) Caused by: java.lang.NullPointerException at org.eclipse.osgi.storage.FrameworkExtensionInstaller.addExtensionContent0(FrameworkExtensionInstaller.java:99) at org.eclipse.osgi.storage.FrameworkExtensionInstaller.addExtensionContent(FrameworkExtensionInstaller.java:79) at org.eclipse.osgi.storage.Storage.installExtensions(Storage.java:194) at org.eclipse.osgi.storage.Storage.createStorage(Storage.java:92) at org.eclipse.osgi.internal.framework.EquinoxContainer.<init>(EquinoxContainer.java:66) at org.eclipse.osgi.launch.Equinox.<init>(Equinox.java:31) at org.eclipse.osgi.launch.EquinoxFactory.newFramework(EquinoxFactory.java:24) at org.apache.karaf.main.Main.launch(Main.java:256) ... 5 more

Environment

JDK11 specific

Status

Assignee

Freeman Fang

Reporter

Steinar Bang

Labels

None

Priority

Major
Configure