Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FrameworkExtensionInstaller.addExtensionContent0 throws NullPointerException when attempting to throw a BundleException [PAXEXAM-927] #1008

Open
ops4j-issues opened this issue Jun 2, 2019 · 1 comment
Labels

Comments

@ops4j-issues
Copy link

Steinar Bang created PAXEXAM-927

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:

	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:

[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

Votes: 0, Watches: 2

@ops4j-issues
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant