This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Attached NPEs were thrown when started ide. See issue #18760 for details. Why does Lokup.getDefault().lookup(JavaSettings.class) return null? CCing Honza.
Created attachment 3964 [details] stacktraces
this is not a bug in java module, rather a bug in Lookup I think
Zohar, are you able to reproduce this bug?
The issue #18760 indicated that there were problems recognizing the content of setttings files. In such case it is ok that JavaSettings were not found. But I cannot reproduce it. I have: 1. Installed version XXX of NetBeans 2. Unziped Zohar's userdir into directory zohar 3. started netbeans with XXX/bin/runide.sh -userdir zohar 4. no NullPointerException I repeated those steps for latest builds of Nb3.3.0, Nb3.3.1 and Main trunk. Nothing. Please reopen with some steps how to simulate the behaviour.
Reproduced. Create issue 19025 to improve the general behaviour, but reassigned to java module because lookup is allowed to return null. Fix the NPE please.
*** Issue 19015 has been marked as a duplicate of this issue. ***
So, what's your recommendation ? Should all queries for the setting object use SharedClassObject.findObject(whatever.class, true) to be safe ? Will it work when Lookup.getDefault().lookup() and SharedClassObject.find() are mixed ? We can't really create a default setting object (since it is a subclass of SharedClassObject) and use it when Lookup finds nothing. The alternative is to guard all lookup()s with a condition.
Depends on what you need. SharedClassObject.findObject (...) guarantees that an instance will be returned (in this case uninitialized) - Lookup can return null and then you can ignore the action but that depends on your decision.
I've created a work around - but still I think that behaviour of the Lookup holding system options should be better. Fixed in trunk, /cvs/java/src/org/netbeans/modules/java/JavaExecSupport.java,v <-- JavaExecSupport.java new revision: 1.8; previous revision: 1.7
VERIFIED
Resolved for 3.4.x or earlier, no new info since then -> closing.