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 131830 - NPE at javax.swing.plaf.basic.BasicTextUI$TextDropTargetListener.restoreComponentStateForDrop
Summary: NPE at javax.swing.plaf.basic.BasicTextUI$TextDropTargetListener.restoreCompo...
Status: VERIFIED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Text (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: mslama
URL: http://statistics.netbeans.org/except...
Keywords:
: 148846 149316 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-04-02 14:26 UTC by crosati
Modified: 2008-12-22 14:00 UTC (History)
6 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 41469


Attachments
stacktrace (2.14 KB, text/plain)
2008-04-02 14:26 UTC, crosati
Details
stacktrace (2.14 KB, text/plain)
2008-04-02 18:21 UTC, crosati
Details
stacktrace (2.14 KB, text/plain)
2008-04-16 20:20 UTC, cmattmiller
Details
stacktrace (2.14 KB, text/plain)
2008-05-01 07:21 UTC, melling
Details
stacktrace (2.14 KB, text/plain)
2008-05-17 20:36 UTC, jostein
Details
stacktrace (2.14 KB, text/plain)
2008-05-22 12:49 UTC, Marek Fukala
Details
stacktrace (2.14 KB, text/plain)
2008-05-28 22:42 UTC, addaxt
Details
stacktrace (2.14 KB, text/plain)
2008-06-07 01:16 UTC, jyeary
Details
stacktrace (2.14 KB, text/plain)
2008-06-07 01:16 UTC, jyeary
Details
stacktrace (2.14 KB, text/plain)
2008-06-09 16:22 UTC, _ ludo
Details
stacktrace (2.14 KB, text/plain)
2008-06-27 04:18 UTC, johnson_156
Details
stacktrace (2.14 KB, text/plain)
2008-06-27 21:28 UTC, sworisbreathing
Details
stacktrace (2.14 KB, text/plain)
2008-07-25 17:10 UTC, nberkland
Details
stacktrace (2.14 KB, text/plain)
2008-09-11 20:41 UTC, jcrada
Details
stacktrace (2.14 KB, text/plain)
2008-09-29 16:11 UTC, Roman Mostyka
Details
stacktrace (2.14 KB, text/plain)
2008-09-30 16:14 UTC, Petr Chytil
Details
stacktrace (2.14 KB, text/plain)
2008-10-03 17:55 UTC, Lukas Hasik
Details
stacktrace (2.14 KB, text/plain)
2008-10-06 08:41 UTC, Petr Chytil
Details

Note You need to log in before you can comment on or make changes to this bug.
Description crosati 2008-04-02 14:26:20 UTC
Build: NetBeans IDE Dev (Build 200804020004)
VM: Java HotSpot(TM) Client VM, 1.5.0_13-119, Java(TM) 2 Runtime Environment, Standard Edition, 1.5.0_13-b05-237
OS: Mac OS X, 10.5.2, i386

User Comments:
Comment 1 crosati 2008-04-02 14:26:24 UTC
Created attachment 59547 [details]
stacktrace
Comment 2 crosati 2008-04-02 18:21:31 UTC
Build: NetBeans IDE Dev (Build 200804020004)
VM: Java HotSpot(TM) Client VM, 1.5.0_13-119, Java(TM) 2 Runtime Environment, Standard Edition, 1.5.0_13-b05-237
OS: Mac OS X, 10.5.2, i386

User Comments: 
Comment 3 crosati 2008-04-02 18:21:34 UTC
Created attachment 59569 [details]
stacktrace
Comment 4 Exceptions Reporter 2008-04-03 07:53:05 UTC
This issue has already 5 duplicates 
Comment 5 cmattmiller 2008-04-16 20:20:18 UTC
Build: NetBeans IDE 6.1 RC1 (Build 200804100130)
VM: Java HotSpot(TM) Client VM, 1.5.0_15-b04, Java(TM) 2 Runtime Environment, Standard Edition, 1.5.0_15-b04
OS: Windows 2000, 5.0, x86

User Comments: 
Comment 6 cmattmiller 2008-04-16 20:20:51 UTC
Created attachment 60308 [details]
stacktrace
Comment 7 Antonin Nebuzelsky 2008-04-17 15:15:22 UTC
Reassigning to new module owner mslama.
Comment 8 melling 2008-05-01 07:21:16 UTC
Build: NetBeans IDE 6.1 (Build 200804211638)
VM: Java HotSpot(TM) Client VM, 1.5.0_13-121, Java(TM) 2 Runtime Environment, Standard Edition, 1.5.0_13-b05-241
OS: Mac OS X, 10.4.11, i386

User Comments: 
Comment 9 melling 2008-05-01 07:21:19 UTC
Created attachment 60910 [details]
stacktrace
Comment 10 Exceptions Reporter 2008-05-13 13:06:57 UTC
This issue has already -1 duplicates 
Comment 11 Exceptions Reporter 2008-05-14 15:34:04 UTC
This issue has already 50 duplicates 
Comment 12 jostein 2008-05-17 20:36:14 UTC
Created attachment 61523 [details]
stacktrace
Comment 13 Marek Fukala 2008-05-22 12:49:47 UTC
Created attachment 61754 [details]
stacktrace
Comment 14 addaxt 2008-05-28 22:42:43 UTC
Created attachment 62089 [details]
stacktrace
Comment 15 jyeary 2008-06-07 01:16:21 UTC
Created attachment 62512 [details]
stacktrace
Comment 16 jyeary 2008-06-07 01:16:48 UTC
Created attachment 62513 [details]
stacktrace
Comment 17 _ ludo 2008-06-09 16:22:35 UTC
Created attachment 62571 [details]
stacktrace
Comment 18 Exceptions Reporter 2008-06-22 17:25:26 UTC
This issue has already 100 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=41469
Comment 19 mslama 2008-06-23 14:31:15 UTC
JTextComponent.getCaret() returns null but there is no check for it in Swing
BasicTextUI.TextDropTargetListener.restoreComponentStateForDrop. I am not able to reproduce this issue. It happens only
on JDK 5. On JDK 6 code in BasicTextUI is completely changed - this inner class is not there anymore.

Is there any way how to reproduce it? Our QuietEditorPane overwrites setCaret(Caret) method. Caret can be null only
during reinstallation of UI. Caret is set to null for short time only when editor is being opened. It should not be null
during editing/drag&drop.

Call of TextDropTargetListener.restoreComponentStateForDrop is performed only when drop is performed. When this problem
happens does it have any consequence in editor. Is text dropped? Is there any problem? If only this exception is shown
but otherwise editor functionality is not broken we could catch this exception in QuietEditorPane and just log it to IDE
log.

I filed issue #6717829 against Swing/JDK.
Comment 20 johnson_156 2008-06-27 04:18:19 UTC
Created attachment 63570 [details]
stacktrace
Comment 21 sworisbreathing 2008-06-27 21:28:03 UTC
Created attachment 63623 [details]
stacktrace
Comment 22 nberkland 2008-07-25 17:10:41 UTC
Build: NetBeans IDE 6.1 (Build 200805300101)
VM: Java HotSpot(TM) Client VM, 1.5.0_15-b04, Java(TM) 2 Runtime Environment, Standard Edition, 1.5.0_15-b04
OS: Windows XP, 5.1, x86

User Comments: 


Stacktrace: 
java.lang.NullPointerException
        at javax.swing.plaf.basic.BasicTextUI$TextDropTargetListener.restoreComponentStateForDrop(BasicTextUI.java:2114)
        at javax.swing.plaf.basic.BasicDropTargetListener.drop(BasicDropTargetListener.java:259)
        at javax.swing.TransferHandler$SwingDropTarget.drop(TransferHandler.java:614)
        at org.openide.text.QuietEditorPane$DelegatingDropTarget.drop(QuietEditorPane.java:385)
        at sun.awt.dnd.SunDropTargetContextPeer.processDropMessage(SunDropTargetContextPeer.java:500)
        at sun.awt.dnd.SunDropTargetContextPeer.access$800(SunDropTargetContextPeer.java:53)
Comment 23 nberkland 2008-07-25 17:10:49 UTC
Created attachment 65658 [details]
stacktrace
Comment 24 Lukas Hasik 2008-09-09 14:18:18 UTC
there is lot of duplicate (171) of this issue. Probably not all the duplicates are the same but anyway lot of 
duplicates.
Are we able to fix or workaround? Or is it jdk bug?
Comment 25 jcrada 2008-09-11 20:41:10 UTC
Build: NetBeans IDE 6.1 (Build 200805300101)
VM: Java HotSpot(TM) Client VM, 1.5.0_13-121, Java(TM) 2 Runtime Environment, Standard Edition, 1.5.0_13-b05-241
OS: Mac OS X, 10.4.11, i386

User Comments: 


Stacktrace: 
java.lang.NullPointerException
        at javax.swing.plaf.basic.BasicTextUI$TextDropTargetListener.restoreComponentStateForDrop(BasicTextUI.java:2115)
        at javax.swing.plaf.basic.BasicDropTargetListener.drop(BasicDropTargetListener.java:259)
        at javax.swing.TransferHandler$SwingDropTarget.drop(TransferHandler.java:614)
        at org.openide.text.QuietEditorPane$DelegatingDropTarget.drop(QuietEditorPane.java:385)
        at sun.awt.dnd.SunDropTargetContextPeer.processDropMessage(SunDropTargetContextPeer.java:500)
        at sun.awt.dnd.SunDropTargetContextPeer.access$800(SunDropTargetContextPeer.java:53)
Comment 26 jcrada 2008-09-11 20:41:15 UTC
Created attachment 69685 [details]
stacktrace
Comment 27 Roman Mostyka 2008-09-29 16:11:34 UTC
Build: NetBeans IDE Dev (Build 080929)
VM: Java HotSpot(TM) Client VM, 1.5.0_13-121, Java(TM) 2 Runtime Environment, Standard Edition, 1.5.0_13-b05-241
OS: Mac OS X, 10.4.11, i386

User Comments: 
1. Created web application with JSF framework.
2. DnD "Use Bean" component to the page, but pressed Esc button in appeared dialog.

Result: NullPointerException arises.

Stacktrace: 
java.lang.NullPointerException
        at javax.swing.plaf.basic.BasicTextUI$TextDropTargetListener.restoreComponentStateForDrop(BasicTextUI.java:2115)
        at javax.swing.plaf.basic.BasicDropTargetListener.drop(BasicDropTargetListener.java:259)
        at javax.swing.TransferHandler$SwingDropTarget.drop(TransferHandler.java:614)
        at org.openide.text.QuietEditorPane$DelegatingDropTarget.drop(QuietEditorPane.java:419)
        at sun.awt.dnd.SunDropTargetContextPeer.processDropMessage(SunDropTargetContextPeer.java:500)
        at sun.awt.dnd.SunDropTargetContextPeer.access$800(SunDropTargetContextPeer.java:53)
Comment 28 Roman Mostyka 2008-09-29 16:11:49 UTC
Created attachment 70809 [details]
stacktrace
Comment 29 Petr Chytil 2008-09-30 16:14:39 UTC
Build: NetBeans IDE Dev (Build 200809300201)
VM: Java HotSpot(TM) Client VM, 1.5.0_16-133, Java(TM) 2 Runtime Environment, Standard Edition, 1.5.0_16-b06-284
OS: Mac OS X, 10.5.5, i386

User Comments: 
Just d'n'd selected line of text in build.xml file (freeform project)

Stacktrace: 
java.lang.NullPointerException
        at javax.swing.plaf.basic.BasicTextUI$TextDropTargetListener.restoreComponentStateForDrop(BasicTextUI.java:2115)
        at javax.swing.plaf.basic.BasicDropTargetListener.drop(BasicDropTargetListener.java:259)
        at javax.swing.TransferHandler$SwingDropTarget.drop(TransferHandler.java:614)
        at org.openide.text.QuietEditorPane$DelegatingDropTarget.drop(QuietEditorPane.java:419)
        at sun.awt.dnd.SunDropTargetContextPeer.processDropMessage(SunDropTargetContextPeer.java:500)
        at sun.awt.dnd.SunDropTargetContextPeer.access$800(SunDropTargetContextPeer.java:53)
Comment 30 Petr Chytil 2008-09-30 16:14:49 UTC
Created attachment 70915 [details]
stacktrace
Comment 31 mslama 2008-10-01 08:30:33 UTC
It looks like side effect of JDK issue http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6511815. Closing as WONTFIX.
Fixed in JDK 7(b09), 6u2(b02).
Comment 32 mslama 2008-10-01 08:38:08 UTC
Second NPE does not happen when reproducing with web project so probably not the same issue. Reopening. I will check if
we can do anything now when we have reproducible case.
Comment 33 Michal Skvor 2008-10-02 09:59:09 UTC
*** Issue 148846 has been marked as a duplicate of this issue. ***
Comment 34 Lukas Hasik 2008-10-03 17:55:41 UTC
Build: NetBeans IDE Dev (Build 081002)
VM: Java HotSpot(TM) Client VM, 1.5.0_14-b03, Java(TM) 2 Runtime Environment, Standard Edition, 1.5.0_14-b03
OS: Windows XP, 5.1, x86

User Comments: 


Stacktrace: 
java.lang.NullPointerException
        at javax.swing.plaf.basic.BasicTextUI$TextDropTargetListener.restoreComponentStateForDrop(BasicTextUI.java:2114)
        at javax.swing.plaf.basic.BasicDropTargetListener.drop(BasicDropTargetListener.java:259)
        at javax.swing.TransferHandler$SwingDropTarget.drop(TransferHandler.java:614)
        at org.openide.text.QuietEditorPane$DelegatingDropTarget.drop(QuietEditorPane.java:419)
        at sun.awt.dnd.SunDropTargetContextPeer.processDropMessage(SunDropTargetContextPeer.java:500)
        at sun.awt.dnd.SunDropTargetContextPeer.access$800(SunDropTargetContextPeer.java:53)
Comment 35 Lukas Hasik 2008-10-03 17:55:50 UTC
Created attachment 71133 [details]
stacktrace
Comment 36 Petr Chytil 2008-10-06 08:41:23 UTC
Build: NetBeans IDE Dev (Build 200810060201)
VM: Java HotSpot(TM) Client VM, 1.5.0_16-133, Java(TM) 2 Runtime Environment, Standard Edition, 1.5.0_16-b06-284
OS: Mac OS X, 10.5.5, i386

User Comments: 
DnD line in java editor. Just simple class was opened, nothing special.

Stacktrace: 
java.lang.NullPointerException
        at javax.swing.plaf.basic.BasicTextUI$TextDropTargetListener.restoreComponentStateForDrop(BasicTextUI.java:2115)
        at javax.swing.plaf.basic.BasicDropTargetListener.drop(BasicDropTargetListener.java:259)
        at javax.swing.TransferHandler$SwingDropTarget.drop(TransferHandler.java:614)
        at org.openide.text.QuietEditorPane$DelegatingDropTarget.drop(QuietEditorPane.java:419)
        at sun.awt.dnd.SunDropTargetContextPeer.processDropMessage(SunDropTargetContextPeer.java:500)
        at sun.awt.dnd.SunDropTargetContextPeer.access$800(SunDropTargetContextPeer.java:53)
Comment 37 Petr Chytil 2008-10-06 08:41:27 UTC
Created attachment 71176 [details]
stacktrace
Comment 38 mslama 2008-10-07 13:50:27 UTC
We have fix for this. Waiting for qa feedback. I will update JDK bug info. Shortly: We have inner class
QuietEditorPane.DelegatingDropTarget extends java.awt.dnd.DropTarget we either process drop event here or delegate to
standard DropTarget. Problem is that DropTargetListener is registered 2 times once in Swing when UI is installed and
second time when our addDropTargetListener is called by Swing when editor kit is set. There is no check in Swing that
the same listener is added two times. Current drop event processor in BasicTextUI does not handle seocnd call well as
first call clean context so component is null when second listener call is processed. It is changed completely in JDK 6.
Workaround in our code is first call removeDropTargetListener and then addDropTargetListener to make sure listener is
registered as least once and only once (provided it was not registered before or was registered juts once).
Comment 39 mslama 2008-10-08 07:55:22 UTC
Fixed core-main #0b091f567548
Comment 40 Roman Mostyka 2008-10-08 15:26:04 UTC
Verified.
Comment 41 Quality Engineering 2008-10-09 05:56:51 UTC
Integrated into 'main-golden', will be available in build *200810090201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/0b091f567548
User: Marek Slama <mslama@netbeans.org>
Log: #131830: Register DropTargetListener just once.
Comment 42 Michal Skvor 2008-10-30 11:26:05 UTC
*** Issue 149316 has been marked as a duplicate of this issue. ***