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 177856 - [68cat] NullPointerException at org.netbeans.modules.cnd.makeproject.api.configurations.Item.renameTo
Summary: [68cat] NullPointerException at org.netbeans.modules.cnd.makeproject.api.conf...
Status: VERIFIED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Project (show other bugs)
Version: 6.x
Hardware: All All
: P1 normal (vote)
Assignee: Vladimir Voskresensky
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-30 08:21 UTC by aldobrucale
Modified: 2009-12-03 05:02 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 163126


Attachments
stacktrace (1.20 KB, text/plain)
2009-11-30 08:21 UTC, aldobrucale
Details

Note You need to log in before you can comment on or make changes to this bug.
Description aldobrucale 2009-11-30 08:21:52 UTC
Build: NetBeans IDE Dev (Build 200911291400)
VM: Java HotSpot(TM) Client VM, 14.2-b01, Java(TM) SE Runtime Environment, 1.6.0_16-b01
OS: Linux, 2.6.31-15-generic, i386

User Comments:
aldobrucale: Moving a cpp file



Stacktrace: 
java.lang.NullPointerException
        at org.netbeans.modules.cnd.makeproject.api.configurations.Item.renameTo(Item.java:138)
        at org.netbeans.modules.cnd.makeproject.api.configurations.Item.propertyChange(Item.java:229)
        at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:339)
        at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:276)
        at org.openide.loaders.DataObject.firePropertyChange(DataObject.java:922)
        at org.openide.loaders.DataObject.move(DataObject.java:727)
Comment 1 aldobrucale 2009-11-30 08:21:56 UTC
Created attachment 91860 [details]
stacktrace
Comment 2 Alexander Pepin 2009-11-30 10:13:26 UTC
Can not reproduce it in RC1. Please investigate if the bug exists only in trunk. 

aldobrucale,
 could you please provide a detailed scenario to reproduce this bug.
Comment 3 Thomas Preisler 2009-11-30 10:19:16 UTC
How do you move the file? Drag & Drop, Cut & Paste, or ?. And from Projects window?
Comment 4 aldobrucale 2009-12-01 02:38:57 UTC
I moved the file via drag and drop in the "projects window", and it was a "Project with Existing Sources". The project is versioned under mercurial.

I've just tried to move another file, but nothing happened.
Comment 5 Alexander Pepin 2009-12-01 04:11:10 UTC
The problem confirmed. It's a showstopper for FCS. Please fix it ASAP.
Scenario:
- create local litesql-0.3.5 project
- expand 'src' in the projects view
- move any file (drag&drop) from one folder to another one (e.g. backend.cpp from 'library' to 'generator')
Result: NPE occurs.
Comment 6 Alexander Pepin 2009-12-01 04:13:53 UTC
My stacktrace seems to be slightly different:


java.lang.NullPointerException
	at org.netbeans.modules.cnd.makeproject.api.configurations.ItemConfiguration.getCCCompilerConfiguration(ItemConfiguration.java:242)
	at org.netbeans.modules.cnd.makeproject.api.configurations.ItemConfiguration.assignValues(ItemConfiguration.java:371)
	at org.netbeans.modules.cnd.makeproject.ui.MakeLogicalViewProvider$ViewItemPasteType.copyItemConfigurations(MakeLogicalViewProvider.java:1231)
	at org.netbeans.modules.cnd.makeproject.ui.MakeLogicalViewProvider$ViewItemPasteType.paste(MakeLogicalViewProvider.java:1262)
	at org.openide.explorer.view.DragDropUtilities.performPaste(DragDropUtilities.java:197)
	at org.openide.explorer.view.TreeViewDropSupport.drop(TreeViewDropSupport.java:770)
	at java.awt.dnd.DropTarget.drop(DropTarget.java:434)
	at sun.awt.dnd.SunDropTargetContextPeer.processDropMessage(SunDropTargetContextPeer.java:500)
	at sun.awt.X11.XDropTargetContextPeer.processDropMessage(XDropTargetContextPeer.java:165)
	at sun.awt.dnd.SunDropTargetContextPeer$EventDispatcher.dispatchDropEvent(SunDropTargetContextPeer.java:812)
	at sun.awt.dnd.SunDropTargetContextPeer$EventDispatcher.dispatchEvent(SunDropTargetContextPeer.java:736)
	at sun.awt.dnd.SunDropTargetEvent.dispatch(SunDropTargetEvent.java:30)
	at java.awt.Component.dispatchEventImpl(Component.java:4487)
	at java.awt.Container.dispatchEventImpl(Container.java:2099)
	at java.awt.Component.dispatchEvent(Component.java:4460)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
	at java.awt.LightweightDispatcher.processDropTargetEvent(Container.java:4309)
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4163)
	at java.awt.Container.dispatchEventImpl(Container.java:2085)
	at java.awt.Window.dispatchEventImpl(Window.java:2475)
	at java.awt.Component.dispatchEvent(Component.java:4460)
[catch] at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
	at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:125)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Comment 7 Alexander Pepin 2009-12-01 06:53:07 UTC
See also bug #177890
It also has a similar stacktrace and scenario. Apparently we have a common problem in the background.
Please fix both issues.
Comment 8 Vladimir Voskresensky 2009-12-01 09:54:42 UTC
fixed:
http://hg.netbeans.org/cnd-main/rev/72726856e54e
Comment 9 Alexander Pepin 2009-12-01 09:59:25 UTC
The fix is verified in dev-build. Please review the fix and push it into release68 clone.
Comment 10 Alexander Pepin 2009-12-01 10:17:40 UTC
Reopened until it's integrated into release68 clone.
Comment 11 Thomas Preisler 2009-12-01 13:07:38 UTC
I'm having trouble reproducing this bug (before your fix) and don't quite understand why it is failing. Can you, please, explain why you think the exception happens and how your fix fixes this?
Comment 12 Thomas Preisler 2009-12-01 14:15:40 UTC
I have tested it thoroughly and don't see any problems with the fix, but please see my comment from before? Please explain what went wrong before your fix and how your fix fixes this.
Comment 13 Thomas Preisler 2009-12-01 21:10:14 UTC
OK, here is what I think is going on: if you move a file using drag&drop (and possible other methods) *while* the project is being analyzed ('Analyzing' is shoing in status bar), you get the exception. If you wait until the project has been analyzed, everything is fine. The analyzer phase may take less or more time depending on project size and cpu/disk speed so you may not always see the error. The project is incomplete until the analyzing phase has completed and certain operations like moving files are unsafe. If this assessment is correct, I wonder if the 'fix' is correct. Please explain.
Comment 14 Alexander Simon 2009-12-02 00:28:47 UTC
Analyzing phase consists from several internal steps:
1. get project items
2. read file system
3. analyze dwarf information
4. prepare configuration
5. write project items
Potential conflict can be only on step number 5.
The probability of it is low because step duration is small.
So IMHO use case in your last comment is hardly reproduced and at first failure will be in discovery.
Comment 15 Quality Engineering 2009-12-02 02:59:29 UTC
Integrated into 'main-golden', will be available in build *200912020200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/72726856e54e
User: Vladimir Voskresensky <vv159170@netbeans.org>
Log: fixed IZ#177856:  [68cat] NullPointerException at org.netbeans.modules.cnd.makeproject.api.configurations.Item.renameTo
Comment 16 Vladimir Voskresensky 2009-12-02 03:28:53 UTC
(In reply to comment #12)
> I have tested it thoroughly and don't see any problems with the fix, but please
> see my comment from before? Please explain what went wrong before your fix and
> how your fix fixes this.
1) It is reproducible in Files view on Solaris
2) It is reproducible in Project view on Linux
the issue is caused by mixing NB file events && D&D handling. 
A) the fix in renameTo checks that folder.addItem was successful. It is "not" when item already added in project in this folder. That could happen if file events come twice.
B) in setFolder I do not set folder to this.folder=folder if folder is "null". Otherwise copying configurations doesn't work even when configurations are stored as array or ItemConfiguration[] (ItemConfiguration has field of item which then asks item.getFolder().getConfiguration and NPE
Comment 17 Vladimir Voskresensky 2009-12-02 03:29:54 UTC
I'm sure there are a lot of other problems and this infrastructure needs careful redesign in 6.9 timeframe
Comment 18 Vladimir Voskresensky 2009-12-02 07:43:13 UTC
integrated into 68
http://hg.netbeans.org/release68?cmd=changeset;node=0fdad7657b91
Comment 19 Alexander Pepin 2009-12-03 05:02:52 UTC
verified in RC2 build 2009-12-02_22-00-34