Community
Participate
Working Groups
If the Map of properties passed to the framework instance created from a FrameworkFactory contains an entry with a null value, the framework will crash with an NPE. Steps to reproduce: java.util.ServiceLoader<FrameworkFactory> loader = java.util.ServiceLoader.load(FrameworkFactory.class); Map<String, String> properties = new HashMap<String, String>(); properties.put("blah", null); Framework newFramework = loader.iterator().next().newFramework(properties);
Need to fix this for Luna SR1 since it is a regression. There are two fixes needed here: 1) prevent the NPE 2) make sure that when a key is supplied with a null value then BundleContext.getProperty (and EnvironmentInfo.getProperty) return null for the supplied key.
In master I fixed this with the following. Testcase added: http://git.eclipse.org/c/equinox/rt.equinox.framework.git/commit/?id=2c2478f593605b9c4e1c34a7e1ec71f2740a7162 Fixed with: http://git.eclipse.org/c/equinox/rt.equinox.framework.git/commit/?id=6518be6daad51538b7124f49a889a4a762b63a07 In Luna SR1 I cherry-picked the fixes with the following: Testcase added: http://git.eclipse.org/c/equinox/rt.equinox.framework.git/commit/?h=R4_4_maintenance&id=1db10dd770964dc197f682445bae76f2a1f20556 Fixed with: http://git.eclipse.org/c/equinox/rt.equinox.framework.git/commit/?h=R4_4_maintenance&id=d44e2c55de7601046b30006294c06d0591ae833a
This fix seems to be responsible for a breakage of the Object Teams build. Since upgrading to RC2 I get: [java] java.lang.NullPointerException [java] at org.eclipse.osgi.internal.framework.EquinoxConfiguration<init>(EquinoxConfiguration.java:207) [java] at org.eclipse.osgi.internal.framework.EquinoxContainer.<init>(EquinoxContainer.java:69) [java] at org.eclipse.osgi.launch.Equinox.<init>(Equinox.java:31) [java] at org.eclipse.core.runtime.adaptor.EclipseStarter.startup(EclipseStarter.java:299) [java] at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235) [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [java] at java.lang.reflect.Method.invoke(Method.java:483) [java] at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648) [java] at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603) [java] at org.eclipse.equinox.launcher.Main.run(Main.java:1465) [java] at org.eclipse.equinox.launcher.Main.main(Main.java:1438) [java] An error has occurred. See the log file [java] null. [java] Java Result: 13
See that the first line in the constructor checks: initialConfiguration == null ? just a few lines down you assume non-null without checking: for (Map.Entry<String, ?> initialEntry : initialConfiguration.entrySet()) { JDT would have told you, if you let it ...
Working a fix now.
This bug introduced the code that caused the NPE, but it is also the fix to bug 441681 that allowed EclipseStarter to pass null into the constructor of Equinox.
For Luna SR1: NPE fixed with: http://git.eclipse.org/c/equinox/rt.equinox.framework.git/commit/?h=R4_4_maintenance&id=05121265bfd6d40543f88d4c9b0259b8eb94bf3e Tested with: http://git.eclipse.org/c/equinox/rt.equinox.framework.git/commit/?h=R4_4_maintenance&id=a1e29deb8ee99337f10b888db19febceb907d745 Ensure EclipseStarter initializes a configuraion map with: http://git.eclipse.org/c/equinox/rt.equinox.framework.git/commit/?h=R4_4_maintenance&id=6788b3735c94945b7d67cf54fa1113dc945e16e7 Same fixes also in master.
The Object Teams build has finished successfully using M20140902-1430. Thanks!
I also confirmed this fix. Thanks for reporting Stephan and sorry for the trouble.
I have also verified that the issue in Comment #3 has been addressed. I used RC2a build. Many thanks for making the fix available before the next milestone.