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.

Bug 101327 - NPE in MobilityBridge on opening project
Summary: NPE in MobilityBridge on opening project
Status: VERIFIED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 5.x
Hardware: All All
: P1 blocker (vote)
Assignee: Vladimir Voskresensky
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-04-17 12:48 UTC by Vladimir Kvashin
Modified: 2007-12-06 12:10 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Kvashin 2007-04-17 12:48:08 UTC
The conditions under which the NPE occurs, are the same as in #101314:

For large project, try the following. Open "Open project" dialog. Select the
project and then click "Open" button (or press Enter key).

If "Open" is clicked while "Required projects" list is filling (i.e. while
"Please wait..." is displaying in the list), NPE occurs.

java.lang.NullPointerException
	at
org.netbeans.modules.cnd.makeproject.MobilityBridge.getConfigurationsImpl(MobilityBridge.java:84)
	at
org.netbeans.modules.cnd.makeproject.MobilityBridge.addPropertyChangeListener(MobilityBridge.java:164)
	at
org.netbeans.modules.cnd.makeproject.MobilityBridge.invoke(MobilityBridge.java:114)
	at $Proxy7.addPropertyChangeListener(Unknown Source)
	at
org.netbeans.modules.project.support.ActiveConfigAction.activeProjectChanged(ActiveConfigAction.java:197)
	at
org.netbeans.modules.project.support.ActiveConfigAction.access$200(ActiveConfigAction.java:55)
	at
org.netbeans.modules.project.support.ActiveConfigAction$1.enable(ActiveConfigAction.java:89)
	at
org.netbeans.modules.project.ui.actions.MainProjectAction.refreshView(MainProjectAction.java:129)
	at
org.netbeans.modules.project.ui.actions.MainProjectAction.propertyChange(MainProjectAction.java:118)
	at
org.openide.util.WeakListenerImpl$PropertyChange.propertyChange(WeakListenerImpl.java:151)
	at
java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:339)
	at
java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:276)
	at
org.netbeans.modules.project.ui.OpenProjectList.setMainProject(OpenProjectList.java:427)
[catch] at
org.netbeans.modules.project.ui.actions.NewProject$2.run(NewProject.java:175)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
	at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
	at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
Comment 1 Jan Lahoda 2007-04-17 14:00:31 UTC
Seems that ConfigurationDescriptorProvider.getConfigurationDescriptor() returns
null (which is probably also the cause of issue #101314). I would propose to:
-investigate why CDP.getCD() returns null, and if it can be modified not to
return null
-it there is a compelling reason why CDP.getCD() returns null, prevent the NPE
in the MobilityBridge and throw correct events when CDP.getCD() turns non-null
(will probably need careful testing).
Comment 2 Vladimir Kvashin 2007-04-17 14:18:28 UTC
The issue is that Netbeans notification comes before native project is
completely initialized. The configuration descriptors are initialized in
ProjectOpenedHook (MakeProject.ProjectOpenedHookImpl.projectOpened).

This issue is related (though does not duplicate) #101314.
Please see my comments to #101314
Comment 3 Jan Lahoda 2007-04-17 15:23:51 UTC
Hm, I think that the projects should not rely on ProjectOpenedHook for such
things. I think that the project configurations should be available regardless
the project was already opened or not. But, I do not see that the POH for CND
project would actually compute the configurations - it seems to be computed
somehow asynchronously (see MakeProject:491). Maybe I miss something? I would
consider such asynchronous initialization quite dangerous.
Comment 4 Alexander Pepin 2007-04-18 15:29:32 UTC
I've raised priority to P1 because the exception occurs every time when user
opens a big project (e.g. boost) with a fresh userdir. Please fix it ASAP as
it's a real showstopper.
Comment 5 Vladimir Voskresensky 2007-04-18 16:37:53 UTC
I have changed the logic of
ConfigurationDescriptorProvider.getConfigurationDescriptor.
the problem was in syncronization. 
- Someone called this method first time
- hasTried set to true
- reading of XML file started - it takes long time
- another thread call method hasTried already true, but projectDescriptor is
still null
=> null is returned

The change was made to wait for the finish of reading, but at the same time read
only once.

Please, review the changes.

cvs log:
Comment 6 Vladimir Voskresensky 2007-04-18 16:51:23 UTC
cvs log:
Checking in ConfigurationDescriptorProvider.java;
/shared/data/ccvs/repository/cnd/makeproject/src/org/netbeans/modules/cnd/makeproject/api/configurations/ConfigurationDescriptorProvider.java,v
 <--  ConfigurationDescriptorProvider.java
new revision: 1.2.2.2.8.3; previous revision: 1.2.2.2.8.2
done
Comment 7 soldatov 2007-12-06 12:10:28 UTC
verified in 200712050000 build