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 100272 - NullPointerException everytime DnD a component onto new page (ubuntu and solaris)
Summary: NullPointerException everytime DnD a component onto new page (ubuntu and sola...
Status: RESOLVED DUPLICATE of bug 82142
Alias: None
Product: platform
Classification: Unclassified
Component: Window System (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Antonin Nebuzelsky
URL: http://bugs.sun.com/bugdatabase/view_...
Keywords:
Depends on:
Blocks: 100628
  Show dependency tree
 
Reported: 2007-04-07 01:04 UTC by rdelaplante
Modified: 2008-12-22 11:36 UTC (History)
6 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
snapshot (135.63 KB, image/png)
2007-04-29 00:34 UTC, _ hlu
Details

Note You need to log in before you can comment on or make changes to this bug.
Description rdelaplante 2007-04-07 01:04:36 UTC
I've just installed NetBeans 6.0 M8 and VWP M8 on Ubuntu Linux with JDK 1.6.  
I created a new visual web application, opend Page1 and drag/dropped a
Calendar component onto the page.  Right away I was shown an exception.

java.lang.NullPointerException
	at sun.awt.X11.XSelection.checkChange(XSelection.java:749)
	at sun.awt.X11.XSelection.access$200(XSelection.java:30)
	at sun.awt.X11.XSelection$SelectionEventHandler.dispatchEvent(XSelection.java:758)
	at sun.awt.X11.XToolkit.dispatchEvent(XToolkit.java:482)
	at sun.awt.X11.XToolkit.run(XToolkit.java:626)

In fact, every single component I drop onto a page causes this problem.

	at sun.awt.X11.XToolkit.run(XToolkit.java:560)
[catch] at java.lang.Thread.run(Thread.java:619)
Comment 1 Peter Zavadsky 2007-04-07 01:17:42 UTC
Not a designer bug. Passing to platform.

There was already such issue filled before (I don't remember the number).

Note this reported JDK bug, which might be the actual problem:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182905
Comment 2 Lark Fitzgerald 2007-04-19 16:04:19 UTC
raising visibility for M9.  If this is component specific please let me know 
so I can get it to the woodstock folks.
Comment 3 Ch Nguyen 2007-04-20 19:23:02 UTC
Is this still reproducible in M9 and with JDK 1.5?

I'm trying to install GlassFish on the ubuntu test machine in the lab
(rave-opteron1) but not successful.  I sent a email to
users@glassfish.dev.java.net already and haven't gotten a reply yet.  Can you
provide a ubuntu system that I can look at?

The error I got when trying to extracting the bits from the jar (I'm using
jdk1.5.0_11):
java -Xmx256m -jar glassfish-installer-v2-b33.jar 
Exception in thread "main" java.awt.AWTError: Cannot load AWT toolkit:
gnu.java.awt.peer.gtk.GtkToolkit
   at java.awt.Toolkit.getDefaultToolkit(libgcj.so.70)
   at java.awt.Font.tk(libgcj.so.70)
   at java.awt.Font.getPeerFromToolkit(libgcj.so.70)
   at java.awt.Font.<init>(libgcj.so.70)
   at javax.swing.plaf.FontUIResource.<init>(libgcj.so.70)
   at javax.swing.plaf.metal.DefaultMetalTheme.<clinit>(libgcj.so.70)
   at java.lang.Class.initializeClass(libgcj.so.70)
   at java.lang.Class.initializeClass(libgcj.so.70)
   at javax.swing.plaf.metal.MetalLookAndFeel.createDefaultTheme(libgcj.so.70)
   at javax.swing.plaf.metal.MetalLookAndFeel.<init>(libgcj.so.70)
   at javax.swing.UIManager.<clinit>(libgcj.so.70)
   at java.lang.Class.initializeClass(libgcj.so.70)
   at com.sun.tools.xjc.installer.Main.setUILookAndFeel(Main.java:83)
   at com.sun.tools.xjc.installer.Main.main(Main.java:50)
Caused by: java.lang.UnsatisfiedLinkError: libgtkpeer: libgtkpeer.so: cannot
open shared object file: No such file or directory
   at java.lang.Runtime._load(libgcj.so.70)
   at java.lang.Runtime.loadLibrary(libgcj.so.70)
   at java.lang.System.loadLibrary(libgcj.so.70)
   at gnu.java.awt.peer.gtk.GtkToolkit.<clinit>(libgcj.so.70)
   at java.lang.Class.initializeClass(libgcj.so.70)
   at java.lang.Class.forName(libgcj.so.70)
   at java.awt.Toolkit.getDefaultToolkit(libgcj.so.70)
   ...13 more
Comment 4 Ch Nguyen 2007-04-20 23:20:23 UTC
Also, can the IDE still function normally even though the exception is thrown?
Comment 5 Joanne Lau 2007-04-20 23:47:33 UTC
NB 070420
Glassfish: build b41c-beta2

I'm able to reproduce this problem on my ubuntu system. 
Every drop of any component also throws this error.
I deploy the app with the calendar component and it runs fine. 
Comment 6 Ch Nguyen 2007-04-21 00:36:03 UTC
Peter, can you use the suggestion as described in this
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182905 ?  It does sound like
the same issue.  The suggestion says to not use
Toolkit.getDefaultToolkit().getSystemClipboard().addFlavorListener() but it
doesn't say what can be used in place of this.

Can you catch this particular exception and not to show to error as another option?

I'm reassigning this bug to you since you're the owner of the designer and just
now raised the related JDK issue to P1.  I hope we hear something soon.
Comment 7 Ch Nguyen 2007-04-21 00:47:26 UTC
*** Issue 95457 has been marked as a duplicate of this issue. ***
Comment 8 Peter Zavadsky 2007-04-23 17:48:39 UTC
Designer doesn't use the flavor listener.
I believe it is used by NB code or other code (try to find it).
Comment 9 Ch Nguyen 2007-04-24 03:00:54 UTC
This issue is now resolved in jdk 1.7.0 ea b7 or later.  There is no patch in
jdk 1.6 or 1.5 for this issue AFAIK since it's not a serious bug.  It shouldn't
be a P1 either.
Comment 10 rdelaplante 2007-04-24 04:00:17 UTC
It would be nice if the JDK guys add this fix to JDK 1.5 and 1.6 in the next
release because requiring developers use JDK 1.7 which isn't released yet to use
Visual Web Pack on Linux without getting an error every single time they drop a
component onto a page is serious enough to make me consider not using Visual Web
Pack.  However, I don't plan on using NB 6 at work until the release candidates,
so this may not be an issue by then. 
Comment 11 Peter Zavadsky 2007-04-24 17:43:20 UTC
Chau, the code using the flavor listener is 
core/src/org/netbeans/core/NbClipboard.java (you can grep addFlavorListener to see).

If it is the case, depending on the use, maybe that code could avoid the flavor
listener usage. At least for the linux platform (especially if it doesn't work).
Comment 12 Ch Nguyen 2007-04-26 08:30:02 UTC
Can someone in core take a look to see if the suggested workaround is an easy
fix for M9?  The exception is harmless but quite annoying for Visual web. Every
time a component is dropped into the designer, the Warning dialog pops up with
this exception.  Thanks.
Comment 13 Winston Prakash 2007-04-27 00:51:09 UTC
*** Issue 102683 has been marked as a duplicate of this issue. ***
Comment 14 _ hlu 2007-04-27 01:37:19 UTC
change to P1 because it happens every time when drag and drop a component and it
happens on more platforms(ubuntu and solaris).
Comment 15 _ hlu 2007-04-27 01:38:04 UTC
change to P1 because it happens every time when drag and drop a component and it
happens on more platforms(ubuntu and solaris).
Comment 16 Marian Mirilovic 2007-04-27 09:31:57 UTC
hlu,
please look at the http://qa.netbeans.org/bugzilla/bug_priority_guidelines.html
none of there mentioned cases for P1 fits to this issue.

This issue is JDK bug
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6511815
fixed in JDK 6.0_u2 (02) & JDK 7.0(09) . If you want them to fix this for JDK
1.5.0, please escalate this bug. (WONTFIX)

As I understand it, this happens only if you DnD (drag and drop) component from
palette to designer. So if you just select component in palette and click into
the designer - does it work ? It works for me NB BigIDE 200704260000
JDK1.5.0_11, Linux (WORKSFORME)
Comment 17 _ hlu 2007-04-27 18:09:26 UTC
Selecting component in palette and clicking into
the designer work. Lower it to P2 because it is a critical usability problem.

The NPE seems harmless, so is it possible to catch it and not to throw? or is it
possible throw it in the log file so that user does not need to close the NPE
window every time drag and drop a component?

The NPE also happens when DnD a file from one directory to another directory
within a java project.
 
Comment 18 Ch Nguyen 2007-04-27 23:43:28 UTC
Tonda already checked in a quick workaround for this and going through nb-tech
review of the changes.  If things go well with the review, you can verify it
using the next NBI build. 
Comment 19 Marian Mirilovic 2007-04-28 20:46:25 UTC
Tonda, 
did I miss something ? Hiding exceptions dialog is the workaround ? Agreed with
hiding, but it is not a workaround of this issue!

Look at issue 82142 (with bunch of duplicates), also it has been already added
to RN for M9 - see issue 97558.

*** This issue has been marked as a duplicate of 82142 ***
Comment 20 _ hlu 2007-04-29 00:31:12 UTC
Using nbi build200704280000. The NPE window does not pop up, and instead a small
red dot at right bottom of ide window appears. see attachment for the snapshot.
Comment 21 _ hlu 2007-04-29 00:34:20 UTC
Created attachment 41934 [details]
snapshot
Comment 22 Antonin Nebuzelsky 2007-04-30 09:41:04 UTC
> Tonda, did I miss something ? Hiding exceptions dialog is the workaround ?
> Agreed with hiding, but it is not a workaround of this issue!

Not a workaround for the issue, but a way to make the functionality demoable
with the Preview (M9).
Comment 23 Ch Nguyen 2007-04-30 16:46:19 UTC
I mistated it.  It was not a workaround for the issue.  The issue is still
there, it's just hidden.