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 212953 - [72cat] NullPointerException at org.netbeans.modules.form.FormDesigner.pointFromHandleToComponentLayer
Summary: [72cat] NullPointerException at org.netbeans.modules.form.FormDesigner.pointF...
Status: VERIFIED FIXED
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 7.2
Hardware: All All
: P1 normal with 5 votes (vote)
Assignee: issues@guibuilder
URL:
Keywords: REGRESSION
: 213575 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-05-24 12:56 UTC by Michel Graciano
Modified: 2012-07-02 16:09 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 188309


Attachments
stacktrace (2.68 KB, text/plain)
2012-05-24 12:56 UTC, Michel Graciano
Details
stacktrace (2.68 KB, text/plain)
2012-05-24 18:38 UTC, Michel Graciano
Details
Test case (1.35 MB, application/zip)
2012-05-24 18:42 UTC, Michel Graciano
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michel Graciano 2012-05-24 12:56:24 UTC
Build: NetBeans IDE Dev (Build 20120523-da4743d1f776)
VM: Java HotSpot(TM) Client VM, 23.0-b21, Java(TM) SE Runtime Environment, 1.7.0_04-b20
OS: Linux

User Comments:
hmichel: Opening a form




Stacktrace: 
java.lang.NullPointerException
   at org.netbeans.modules.form.FormDesigner.pointFromHandleToComponentLayer(FormDesigner.java:773)
   at org.netbeans.modules.form.HandleLayer.convertPointToComponent(HandleLayer.java:1811)
   at org.netbeans.modules.form.HandleLayer.checkLayoutResizing(HandleLayer.java:1546)
   at org.netbeans.modules.form.HandleLayer.checkResizing(HandleLayer.java:1467)
   at org.netbeans.modules.form.HandleLayer.mouseMoved(HandleLayer.java:2110)
   at java.awt.Component.processMouseMotionEvent(Component.java:6550)
Comment 1 Michel Graciano 2012-05-24 12:56:31 UTC
Created attachment 119817 [details]
stacktrace
Comment 2 Tomas Pavek 2012-05-24 17:20:48 UTC
Can you attach the form where this happened, or was it random?
Comment 3 Michel Graciano 2012-05-24 17:32:51 UTC
It is not random at build 20120523-da4743d1f776. I will try to attach a sample to you soon, since the panel I am facing it has some dependencies that I need to eliminate to make possible to you test it without our entire project.
Comment 4 Michel Graciano 2012-05-24 18:06:51 UTC
Correcting my last statement, actually it is kind of random. I am trying to create exactly steps to reproduce it, but looks like it just happen in certain conditions I am not sure yet, but looks related to libraries loading order or something like that.
Comment 5 Michel Graciano 2012-05-24 18:38:21 UTC
Created attachment 119839 [details]
stacktrace
Comment 6 Michel Graciano 2012-05-24 18:42:11 UTC
Created attachment 119840 [details]
Test case

To reproduce it, follow the steps:
1. Open the attached project and the design view for Test212953.java;
2. Restart the IDE with the design view for Test212953.java opened;
3. When you move the mouse cursor over the designer the exception should appear to you.

I have seen that another exceptions are present at the log file, but those are not shown by exception reporter but I am pretty sure that is the cause. i was able to reproduce it with the follow environment, using a clean user dir without importing previous settings:

Product Version: NetBeans IDE Dev (Build 20120523-da4743d1f776)
Java: 1.7.0_04; Java HotSpot(TM) Client VM 23.0-b21
System: Linux version 3.0.0-17-generic-pae running on i386; UTF-8; en_US (nb)
User directory: /home/mgraciano/.netbeans/dev_212953
Cache directory: /home/mgraciano/.cache/netbeans/dev_212953
Comment 7 Michel Graciano 2012-05-24 18:43:05 UTC
BTW, I was able to reproduce it just when my form extends JXTaskPane, which is the exactly case at my production project.
Comment 8 Tomas Pavek 2012-05-25 12:21:38 UTC
I was able to reproduce it according to the steps, does not happen always, but very often.

The problem is the first exception:
java.lang.NullPointerException
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:169)
        at org.jdesktop.swingx.plaf.LookAndFeelAddons.getUI(LookAndFeelAddons.java:280)
        at org.jdesktop.swingx.JXTaskPane.updateUI(JXTaskPane.java:239)
        at org.jdesktop.swingx.JXTaskPane.<init>(JXTaskPane.java:201)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at java.lang.Class.newInstance0(Class.java:355)
        at java.lang.Class.newInstance(Class.java:308)
        at org.netbeans.modules.form.CreationFactory.createDefaultInstance(CreationFactory.java:178)
        at org.netbeans.modules.form.RADComponent.createBeanInstance(RADComponent.java:252)
[catch] at org.netbeans.modules.form.RADComponent.cloneBeanInstance(RADComponent.java:412)
        at org.netbeans.modules.form.VisualReplicator.cloneComponent(VisualReplicator.java:696)
        at org.netbeans.modules.form.VisualReplicator.createClone(VisualReplicator.java:181)
        at org.netbeans.modules.form.VisualReplicator.createClone(VisualReplicator.java:169)
        at org.netbeans.modules.form.FormDesigner$FormListener.run(FormDesigner.java:2482)
        at org.netbeans.modules.form.FormLAF$3.run(FormLAF.java:322)
        at org.openide.util.Mutex.doEventAccess(Mutex.java:1363)
        at org.openide.util.Mutex.readAccess(Mutex.java:273)
        at org.netbeans.modules.form.FormLAF.executeWithLookAndFeel(FormLAF.java:305)
        at org.netbeans.modules.form.FormDesigner$FormListener.processEvents(FormDesigner.java:2464)
        at org.netbeans.modules.form.FormDesigner$FormListener.formChanged(FormDesigner.java:2430)
        at org.netbeans.modules.form.FormDesigner.updateWholeDesigner(FormDesigner.java:617)
        at org.netbeans.modules.form.FormDesigner.initialize(FormDesigner.java:270)
        at org.netbeans.modules.form.FormDesigner.loadingComplete(FormDesigner.java:1958)
        at org.netbeans.modules.nbform.FormDesignerTC.loadForm(FormDesignerTC.java:276)
        at org.netbeans.modules.nbform.FormDesignerTC.access$300(FormDesignerTC.java:86)
        at org.netbeans.modules.nbform.FormDesignerTC$PreLoadTask$1.run(FormDesignerTC.java:263)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
        at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:641)
        at java.awt.EventQueue.access$000(EventQueue.java:84)
        at java.awt.EventQueue$1.run(EventQueue.java:602)
        at java.awt.EventQueue$1.run(EventQueue.java:600)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:611)
        at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:158)
        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)

Instantiation of org.jdesktop.swingx.JXTaskPane fails due to missing "swingx/TaskPaneUI" value in UIManager (should be the UI class name for the component). It is the instance for the design view that fails, the instance held in the model is created fine before that. If this happens, the design view is completely broken, the form must be closed and opened again (then it works).
Comment 9 Michel Graciano 2012-05-25 12:31:51 UTC
You marked the Tm as Next, I really hope it could be fixed for 7.2, mainly because it is a regression and can affect a lot of users.
Comment 10 Tomas Pavek 2012-06-11 16:27:13 UTC
*** Bug 213575 has been marked as a duplicate of this bug. ***
Comment 11 Tomas Pavek 2012-06-11 17:38:00 UTC
Bug 213575 shows the same thing, just the SwingX components are used on the form, but the form itself is not a SwingX component.

The same failure (cloning SwingX component) can also be seen in bug 212751, where 
also plain JFileChooser seems to be broken (FileChooserUI not found UIManager).
Comment 12 MackSix 2012-06-12 21:52:53 UTC
(In reply to comment #9)
> You marked the Tm as Next, I really hope it could be fixed for 7.2, mainly
> because it is a regression and can affect a lot of users.

If this is regression, it should be marked P1 should it not?
Comment 13 Michel Graciano 2012-06-13 12:42:26 UTC
(In reply to comment #12)
> If this is regression, it should be marked P1 should it not?

IMHO, it should be, at least a P2 [1].

[1] http://wiki.netbeans.org/BugPriorityGuidelines
Comment 14 Tomas Pavek 2012-06-13 14:19:46 UTC
Why do you think it is a regression? The log from bug 212751 contains the same exception that happened in 7.0.

java.lang.NullPointerException
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:169)
	at org.jdesktop.swingx.plaf.LookAndFeelAddons.getUI(LookAndFeelAddons.java:303)
	at org.jdesktop.swingx.calendar.JXMonthView.updateUI(JXMonthView.java:305)
	at org.jdesktop.swingx.calendar.JXMonthView.<init>(JXMonthView.java:261)
...

Is it happening more often now?
Comment 15 Michel Graciano 2012-06-13 14:28:54 UTC
(In reply to comment #14)
> Why do you think it is a regression? The log from bug 212751 contains the same
> exception that happened in 7.0.
> 
> java.lang.NullPointerException
>     at java.lang.Class.forName0(Native Method)
>     at java.lang.Class.forName(Class.java:169)
>     at
> org.jdesktop.swingx.plaf.LookAndFeelAddons.getUI(LookAndFeelAddons.java:303)
>     at org.jdesktop.swingx.calendar.JXMonthView.updateUI(JXMonthView.java:305)
>     at org.jdesktop.swingx.calendar.JXMonthView.<init>(JXMonthView.java:261)
> ...
> 
> Is it happening more often now?

I don't have this problem before 7.2. All my forms which match with this scenario can be opened without any problem before 7.2, and now this problem happens very often.
Comment 16 Michel Graciano 2012-06-18 14:03:26 UTC
Sorry, but I can't use 7.2 for several forms we have at our project, and this forms are OK at 7.X. It is a stopper for 7.2 and my team will not be able to migrate to 7.2 because this issue.
Comment 17 Jan Stola 2012-06-19 14:00:55 UTC
As Tomas wrote already, the exception shows that there is missing "swingx/TaskPaneUI" key in UIDefaults. We perform some complex magic with UIDefaults. This magic is to blame. The goal of this magic is (among others) to provide the default (=unmodified) UIDefaults to the designed form despite modifications done by NetBeans IDE (to implement its UI tweaks).

Due to the nature of UIDefaults and the way it is handled by custom Swing components, this functionality cannot be absolutely reliable. That's why exceptions like this can be found even in older builds/releases of NetBeans.

Unfortunately, it seems that for NB 7.2 we made a change that made these problems more frequent.

The culprit seems to be the fix of issue 207413. FormClassLoader is held too weakly after this change. In fact, debugging of the attached test-case shows that this classloader is garbage collected during opening of the form. Hence, a new classloader is created which breaks classloader-sensitive part of UIDefault magic.

We should make sure that FormClassLoader is held strongly until the form is closed.
Comment 18 Tomas Pavek 2012-06-19 14:12:45 UTC
I've made a fix which should eliminate this problem due to the class loader dropped out of the cache.

Integrated into main.
http://hg.netbeans.org/jet-main/rev/a2f8994a7d18

Please test and verify once nightly build is available.
Comment 19 Michel Graciano 2012-06-19 14:15:53 UTC
As soon as it hits the main repo I will rebuild my IDE and test it for sure. Thanks a lot.
Comment 20 Jan Stola 2012-06-19 14:32:15 UTC
Target Milestone should be set to 7.3 until the fix is merged into release72 branch, see http://wiki.netbeans.org/NetBeans_72_HighResistance
Comment 21 Michel Graciano 2012-06-19 14:39:24 UTC
(In reply to comment #20)
> Target Milestone should be set to 7.3 until the fix is merged into release72
> branch, see http://wiki.netbeans.org/NetBeans_72_HighResistance

Thanks for pointing me this, I was unaware of it.
Comment 22 Michel Graciano 2012-06-20 20:45:08 UTC
Definitely I can't reproduce it anymore. I tried hard but I just couldn't. Thanks for the fix.

v. NetBeans IDE Dev (Build 20120620-c587ba686a6a)
Comment 23 Jan Stola 2012-06-21 12:45:06 UTC
I have reviewed the fix. It seems to be correct and safe for integration into NB 7.2.
Comment 24 Tomas Pavek 2012-06-21 16:08:02 UTC
http://hg.netbeans.org/releases/rev/477b5ddf3bf5
Comment 25 Quality Engineering 2012-06-22 04:21:30 UTC
Integrated into 'releases', will be available in build *201206212341* or newer. Wait for official and publicly available build.
Changeset: http://hg.netbeans.org/releases/rev/477b5ddf3bf5
User: Tomas Pavek <tpavek@netbeans.org>
Log: #212953: need to keep the same project classloader instance during the opened form lifetime (the classloader cache was too "weak")
Comment 26 Quality Engineering 2012-06-22 04:51:37 UTC
Integrated into 'main-golden', will be available in build *201206220002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/a2f8994a7d18
User: Tomas Pavek <tpavek@netbeans.org>
Log: #212953: need to keep the same project classloader instance during the opened form lifetime (the classloader cache was too "weak")
Comment 27 Marian Mirilovic 2012-06-24 20:57:51 UTC
... pending verification in NB 7.2
Comment 28 asenk 2012-06-25 13:21:24 UTC
I am not able to reproduce this bug with: 
Product Version: NetBeans IDE 7.2 RC1 (Build 201206242201)
Java: 1.7.0_06-ea; Java HotSpot(TM) Client VM 23.2-b05
System: Linux version 3.2.0-25-generic-pae running on i386; UTF-8; en_US (nb)

I think it would be fine if Michel verifies this bug too in 72branch. So I leave the status of this bug as RESOLVED, until 72 build becomes public (it should happen this weak) and Michel add his comment.
Comment 29 Michel Graciano 2012-07-02 16:09:37 UTC
Product Version: NetBeans IDE 7.2 (Build 201206291011)
Java: 1.7.0_05; Java HotSpot(TM) Client VM 23.1-b03
System: Linux version 3.0.0-17-generic-pae running on i386; UTF-8; en_US (nb)