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 236349

Summary: NullPointerException during a drag&drop operation from/to Outline
Product: platform Reporter: mdobacz
Component: Outline&TreeTableAssignee: Jaroslav Havlin <jhavlin>
Status: RESOLVED FIXED    
Severity: normal Keywords: PATCH_AVAILABLE
Priority: P3    
Version: 7.3.1   
Hardware: PC   
OS: Mac OS X   
Issue Type: DEFECT Exception Reporter:
Attachments: test application, based on sample suggested in a comment
Proposed Patch

Description mdobacz 2013-09-25 08:14:34 UTC
On Mac OS X (10.7.5, 10.8.4) dragging a node from one Outline to another can fail randomly. 

Note: this is not to say the failure occurs /only/ when dragging from an Outline to an Outline. That's simply the only case we tested.

Logs show NPEs that are thrown from the Outline code, not trying to guess further.

Stack trace:

java.lang.NullPointerException\
	at org.openide.explorer.view.OutlineViewDropSupport.doDragOver(OutlineViewDropSupport.java:310)\
	at org.openide.explorer.view.OutlineViewDropSupport.dragOver(OutlineViewDropSupport.java:145)\
	at java.awt.dnd.DropTarget.dragOver(DropTarget.java:381)\
	at sun.awt.dnd.SunDropTargetContextPeer.processMotionMessage(SunDropTargetContextPeer.java:474)\
	at sun.lwawt.macosx.CDropTargetContextPeer.processMotionMessage(CDropTargetContextPeer.java:115)\
	at sun.awt.dnd.SunDropTargetContextPeer$EventDispatcher.dispatchMotionEvent(SunDropTargetContextPeer.java:823)\
	at sun.awt.dnd.SunDropTargetContextPeer$EventDispatcher.dispatchEvent(SunDropTargetContextPeer.java:769)\
	at sun.awt.dnd.SunDropTargetEvent.dispatch(SunDropTargetEvent.java:48)\
	at java.awt.Component.dispatchEventImpl(Component.java:4716)\
	at java.awt.Container.dispatchEventImpl(Container.java:2287)\
	at java.awt.Component.dispatchEvent(Component.java:4687)\
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)\
	at java.awt.LightweightDispatcher.processDropTargetEvent(Container.java:4566)\
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4417)\
	at java.awt.Container.dispatchEventImpl(Container.java:2273)\
	at java.awt.Window.dispatchEventImpl(Window.java:2719)\
	at java.awt.Component.dispatchEvent(Component.java:4687)\
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:735)\
	at java.awt.EventQueue.access$200(EventQueue.java:103)\
	at java.awt.EventQueue$3.run(EventQueue.java:694)\
	at java.awt.EventQueue$3.run(EventQueue.java:692)\
	at java.security.AccessController.doPrivileged(Native Method)\
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)\
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)\
	at java.awt.EventQueue$4.run(EventQueue.java:708)\
	at java.awt.EventQueue$4.run(EventQueue.java:706)\
	at java.security.AccessController.doPrivileged(Native Method)\
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)\
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:705)\
	at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:159)\
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)\
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)\
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)\
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)\
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)\
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)\




At least sometimes can be followed by:


java.lang.NullPointerException\
	at org.openide.explorer.view.OutlineViewDropSupport.removeDropLine(OutlineViewDropSupport.java:424)\
	at org.openide.explorer.view.OutlineViewDropSupport.stopDragging(OutlineViewDropSupport.java:433)\
	at org.openide.explorer.view.OutlineViewDropSupport.dragExit(OutlineViewDropSupport.java:420)\
	at java.awt.dnd.DropTarget.dragExit(DropTarget.java:426)\
	at sun.awt.dnd.SunDropTargetContextPeer.processExitMessage(SunDropTargetContextPeer.java:401)\
	at sun.awt.dnd.SunDropTargetContextPeer$EventDispatcher.dispatchExitEvent(SunDropTargetContextPeer.java:838)\
	at sun.awt.dnd.SunDropTargetContextPeer$EventDispatcher.dispatchEvent(SunDropTargetContextPeer.java:772)\
	at sun.awt.dnd.SunDropTargetEvent.dispatch(SunDropTargetEvent.java:48)\
	at java.awt.Component.dispatchEventImpl(Component.java:4716)\
	at java.awt.Container.dispatchEventImpl(Container.java:2287)\
	at java.awt.Component.dispatchEvent(Component.java:4687)\
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)\
	at java.awt.LightweightDispatcher.trackMouseEnterExit(Container.java:4612)\
	at java.awt.LightweightDispatcher.processDropTargetEvent(Container.java:4558)\
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4417)\
	at java.awt.Container.dispatchEventImpl(Container.java:2273)\
	at java.awt.Window.dispatchEventImpl(Window.java:2719)\
	at java.awt.Component.dispatchEvent(Component.java:4687)\
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:735)\
	at java.awt.EventQueue.access$200(EventQueue.java:103)\
	at java.awt.EventQueue$3.run(EventQueue.java:694)\
	at java.awt.EventQueue$3.run(EventQueue.java:692)\
	at java.security.AccessController.doPrivileged(Native Method)\
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)\
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)\
	at java.awt.EventQueue$4.run(EventQueue.java:708)\
	at java.awt.EventQueue$4.run(EventQueue.java:706)\
	at java.security.AccessController.doPrivileged(Native Method)\
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)\
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:705)\
	at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:159)\
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)\
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)\
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)\
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)\
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)\
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)}
Comment 1 ebakke 2013-11-06 16:44:36 UTC
I'm seeing this bug as well in my platform application. The bug seems to have been introduced recently, either in a recent JDK version or in RELEASE74--I certainly didn't use to have this bug before. Version details:

Product Version: NetBeans IDE 7.4 (Build 201310111528)
Java: 1.7.0_45; Java HotSpot(TM) 64-Bit Server VM 24.45-b08
Runtime: Java(TM) SE Runtime Environment 1.7.0_45-b18
System: Mac OS X version 10.9 running on x86_64; UTF-8; en_US (nb)
User directory: /Users/ebakke/Library/Application Support/NetBeans/7.4
Cache directory: /Users/ebakke/Library/Caches/NetBeans/7.4


In my case I'm _not_ dragging a node between two different OutlineViews, but simply dragging a node to reorder within a single OutlineView.

Stack trace:

java.lang.NullPointerException
	at org.openide.explorer.view.OutlineViewDropSupport.doDragOver(OutlineViewDropSupport.java:310)
	at org.openide.explorer.view.OutlineViewDropSupport.dragOver(OutlineViewDropSupport.java:145)
	at java.awt.dnd.DropTarget.dragOver(DropTarget.java:381)
	at sun.awt.dnd.SunDropTargetContextPeer.processMotionMessage(SunDropTargetContextPeer.java:474)
	at sun.lwawt.macosx.CDropTargetContextPeer.processMotionMessage(CDropTargetContextPeer.java:115)
	at sun.awt.dnd.SunDropTargetContextPeer$EventDispatcher.dispatchMotionEvent(SunDropTargetContextPeer.java:823)
	at sun.awt.dnd.SunDropTargetContextPeer$EventDispatcher.dispatchEvent(SunDropTargetContextPeer.java:769)
	at sun.awt.dnd.SunDropTargetEvent.dispatch(SunDropTargetEvent.java:48)
	at java.awt.Component.dispatchEventImpl(Component.java:4716)
	at java.awt.Container.dispatchEventImpl(Container.java:2287)
	at java.awt.Component.dispatchEvent(Component.java:4687)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
	at java.awt.LightweightDispatcher.processDropTargetEvent(Container.java:4566)
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4417)
	at java.awt.Container.dispatchEventImpl(Container.java:2273)
	at java.awt.Window.dispatchEventImpl(Window.java:2719)
	at java.awt.Component.dispatchEvent(Component.java:4687)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:735)
	at java.awt.EventQueue.access$200(EventQueue.java:103)
	at java.awt.EventQueue$3.run(EventQueue.java:694)
	at java.awt.EventQueue$3.run(EventQueue.java:692)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
	at java.awt.EventQueue$4.run(EventQueue.java:708)
	at java.awt.EventQueue$4.run(EventQueue.java:706)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:705)
	at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:159)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
Comment 2 Jaroslav Havlin 2014-01-07 15:43:04 UTC
I cannot reproduce the bug on Windows, we'll need to check it on Mac too.

It would be great if you could provide a simple test case (sources of a basic platform application) that we could debug.

Thank you for reporting.
Comment 3 Jaroslav Havlin 2014-01-07 15:54:06 UTC
Can you please try whether drag&drop works fine for you in sample application available in this Subversion repository URL:
https://svn.java.net/svn/nb-api-samples~api-samples/versions/7.1/misc/DragDrop
(See also https://blogs.oracle.com/geertjan/entry/node_cut_copy_paste_delete.)
Thank you.
Comment 4 mdobacz 2014-01-10 11:06:03 UTC
(In reply to Jaroslav Havlin from comment #3)
> Can you please try whether drag&drop works fine for you in sample
> application available in this Subversion repository URL:
> https://svn.java.net/svn/nb-api-samples~api-samples/versions/7.1/misc/
> DragDrop
> (See also
> https://blogs.oracle.com/geertjan/entry/node_cut_copy_paste_delete.)
> Thank you.

Thanks!

I was able to reproduce this problem with this application, with some modifications, but I never saw it on any other platform than Mac. So you'll probably need Mac to test.

Few important things:

- the key seems to be that the target outline must have it's root node hidden. I was not able to reproduce this until I set it to hidden.

- the problem is not 100% reproducible, it just happens once in a while, and perhaps it is so that you either get it on the first try after running the app, or you never do. So if you can't reproduce, then restart and restart often.

- I never had it using just one outline, which is why I added the second one. But could be that I did not try long enough

- There are few different variants of this exception and it's pretty random which one occurs. All are NPE and all have something to do with the drop line. The one with line 310 seems most common.

I'm attaching the code as I had it. The changes I made are:

- some minor dependency etc. tweaking, btw I just opened it in NB IDE 7.3.1 and was consequently built with NBP 7.3.1 - that's the version I tested

- changed from BeanTreeView to OutlineView

- brutally duplicated the top component to have 2 of them

- hid the root on the left one and changed the root context to be one of the child nodes (to have no hierarchy there - seemed to increase the chances)

As I said this is not reproducible 100%, but you might have luck trying the following:

- run the app
- grab D&D 1 in editor mode and drag it over the outline in explorer mode
 - it doesn't matter what you drag really, it can happen with Tom as well

With some luck you'll get no drop line showing and an exception in the log.

Above I'm tempted to add "_quickly_ drag", and it might help to first drag it into the empty space under the nodes in the target outline, and only then to go up. But I might be imagining things here.

Hope this helps!
Comment 5 mdobacz 2014-01-10 11:06:44 UTC
Created attachment 143785 [details]
test application, based on sample suggested in a comment
Comment 6 Jaroslav Havlin 2014-01-31 15:36:33 UTC
Created attachment 144642 [details]
Proposed Patch

We should probably ensure that dropPane field is initialised in OutlineViewDropSupport.checkStoredGlassPane.

Thank you very much for sample application and steps to reproduce.
Comment 7 Jaroslav Havlin 2014-02-06 07:29:44 UTC
Applied as http://hg.netbeans.org/core-main/rev/7557d8797c9c
Thank you, Martin, for checking the patch.
Comment 8 Quality Engineering 2014-02-07 02:40:02 UTC
Integrated into 'main-silver', will be available in build *201402070001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/7557d8797c9c
User: Jaroslav Havlin <jhavlin@netbeans.org>
Log: #236349: NullPointerException during a drag&drop operation from/to Outline