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 230539 - NPE while creation a full remote project
Summary: NPE while creation a full remote project
Status: RESOLVED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Remote (show other bugs)
Version: 7.4
Hardware: PC All
: P2 normal (vote)
Assignee: Vladimir Kvashin
URL:
Keywords: TEST
Depends on:
Blocks:
 
Reported: 2013-05-30 14:29 UTC by Alexander Pepin
Modified: 2013-06-25 02:43 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Another NPE (2.16 KB, text/plain)
2013-06-18 21:30 UTC, Vladimir Kvashin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Pepin 2013-05-30 14:29:59 UTC
Lots of full remote tests now fails on full remote project creation due to NPE occurring in New Project Wizard:

WARNING [org.netbeans.modules.localhistory]: source grouphudson@nyx-intel2.russia.sun.com:/export/hudson/home/testing/full_remote/nyx-intel4/cnd/gdb/Breakpoints/Breakpoints_application returned null root folder
WARNING [org.netbeans.modules.localhistory]: project hudson@nyx-intel2.russia.sun.com:/export/hudson/home/testing/full_remote/nyx-intel4/cnd/gdb/Breakpoints/Breakpoints_application [valid] returned null root folder
SEVERE [org.openide.util.Exceptions]
java.lang.NullPointerException
	at org.netbeans.modules.cnd.remote.projectui.wizard.cnd.ImportRemoteProject.makeProject(ImportRemoteProject.java:665)
[catch] at org.netbeans.modules.cnd.remote.projectui.wizard.cnd.ImportRemoteProject.doWork(ImportRemoteProject.java:455)
	at org.netbeans.modules.cnd.remote.projectui.wizard.cnd.ImportRemoteProject.access$100(ImportRemoteProject.java:145)
	at org.netbeans.modules.cnd.remote.projectui.wizard.cnd.ImportRemoteProject$3.run(ImportRemoteProject.java:401)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1432)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2042)
Comment 1 Alexander Pepin 2013-06-13 12:45:03 UTC
Please fix this bug ASAP as it causes massive full remote test failures.
Comment 2 Vladimir Kvashin 2013-06-14 12:22:47 UTC
As I understand nobody knows how to reproduce it manually, this happens only in tests. If I'm wrong then please describe how to reproduce this.
Comment 3 Vladimir Kvashin 2013-06-18 21:27:50 UTC
This happens when creating a full remopte project *from existing sources*.

The NPE concerns FileObject that corresponds to the path to sources that was 
entered by user. It is unexpectedly null, so we have an NPE.

I was finally able to reproduce it; although I have absolutely no idea why does it happen in tests.

The reason for the NPE I found was that there is a (usually short) time slice between two moments:
1) we set FileObject (it can be null if remote file system could not find file object). 
2) validate() is called enable or disable "Finish" button

SelectModeDescriptorPanel.java:259 sets source file object, SelectModeDescriptorPanel.java:260 calls validate(), which in turn enables/disables "Finish" 

Here is the stack. 

org.netbeans.modules.cnd.makeproject.ui.wizards.SelectModeDescriptorPanel$MyWizardStorage.setSourcesFileObject(SelectModeDescriptorPanel.java:259)
org.netbeans.modules.cnd.makeproject.ui.wizards.SelectModePanel.refreshSourceFolder(SelectModePanel.java:119)
org.netbeans.modules.cnd.makeproject.ui.wizards.SelectModePanel.access$700(SelectModePanel.java:86)
org.netbeans.modules.cnd.makeproject.ui.wizards.SelectModePanel$RefreshRunnable.run(SelectModePanel.java:576)
org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1432)
org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2042)


I was also able to get a little bit different NPE, see attachment

What I still don't understand is why this NPE happens in tests.
In my case I did the following: 
- entered correct directory
- waited until "finish" was enabled
- replaced dierctory with an inexistent one
- stopped on breakpoint in SelectModeDescriptorPanel.java:260 (just before call to validate)
- pressede "finish"
Comment 4 Vladimir Kvashin 2013-06-18 21:30:25 UTC
Created attachment 135999 [details]
Another NPE
Comment 5 Vladimir Kvashin 2013-06-18 21:55:47 UTC
To put it more precise: here is the race I see right now in my debugger.
Two threads are stopped at breakpoints.

1) This thread will set file object to null, then will call validate - but it's already late. I was in time to press "Finish"

"SelectRoot"
org.netbeans.modules.cnd.makeproject.ui.wizards.SelectModeDescriptorPanel$MyWizardStorage.setSourcesFileObject(SelectModeDescriptorPanel.java:259)
org.netbeans.modules.cnd.makeproject.ui.wizards.SelectModePanel.refreshSourceFolder(SelectModePanel.java:119)
org.netbeans.modules.cnd.makeproject.ui.wizards.SelectModePanel.access$700(SelectModePanel.java:86)
org.netbeans.modules.cnd.makeproject.ui.wizards.SelectModePanel$RefreshRunnable.run(SelectModePanel.java:577)
org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1432)
org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2042)

2) Another thread already tried to instantiate project.

"wizard-descriptor-asynchronous-jobs"
org.netbeans.modules.cnd.makeproject.ui.wizards.SelectModePanel.store(SelectModePanel.java:421)
org.netbeans.modules.cnd.makeproject.ui.wizards.SelectModeDescriptorPanel.storeSettings(SelectModeDescriptorPanel.java:189)
org.netbeans.modules.cnd.makeproject.ui.wizards.SelectModeDescriptorPanel.storeSettings(SelectModeDescriptorPanel.java:72)
org.openide.WizardDescriptor.callInstantiateOpen(WizardDescriptor.java:1615)
org.openide.WizardDescriptor.callInstantiate(WizardDescriptor.java:1570)
org.openide.WizardDescriptor.access$2300(WizardDescriptor.java:92)
org.openide.WizardDescriptor$Listener$2$1.run(WizardDescriptor.java:2257)
org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1432)
org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2042)

If I launch thread (1) we'll get NPE
Comment 6 Vladimir Kvashin 2013-06-18 22:18:46 UTC
I fixed the problem I described in cnd-main
http://hg.netbeans.org/cnd-main/rev/caebaccdcf45
Comment 7 Quality Engineering 2013-06-25 02:43:33 UTC
Integrated into 'main-golden', will be available in build *201306242301* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/fa5507dc1ea1
User: Vladimir Kvashin <vkvashin@netbeans.org>
Log: Addfix for #230539 NPE while creation a full remote project