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 31760 - NPE during startup
Summary: NPE during startup
Status: CLOSED INVALID
Alias: None
Product: platform
Classification: Unclassified
Component: Window System (show other bugs)
Version: 3.x
Hardware: PC Windows XP
: P4 blocker (vote)
Assignee: _ tboudreau
URL:
Keywords:
: 25346 33476 34601 34970 35012 35326 35391 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-03-07 09:12 UTC by Sergey Soldatov
Modified: 2011-03-21 16:58 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sergey Soldatov 2003-03-07 09:12:25 UTC
During the first start of IDE ( Build 200303060100) with 
JDK 1.4.0_03 I got following NPE. Unfortunately I was 
unable to reproduce it again. 

java.lang.NullPointerException

	at javax.swing.text.html.ParagraphView.paint
(ParagraphView.java:217)

	at javax.swing.text.html.TableView.paint
(TableView.java:726)

	at javax.swing.text.BoxView.paintChild
(BoxView.java:144)

	at javax.swing.text.BoxView.paint(BoxView.java:407)

	at javax.swing.text.html.BlockView.paint
(BlockView.java:264)

	at javax.swing.text.BoxView.paintChild
(BoxView.java:144)

	at javax.swing.text.BoxView.paint(BoxView.java:407)

	at javax.swing.text.html.TableView$RowView.paint
(TableView.java:1360)

	at javax.swing.text.html.TableView.paint
(TableView.java:726)

	at javax.swing.text.BoxView.paintChild
(BoxView.java:144)

	at javax.swing.text.BoxView.paint(BoxView.java:407)

	at javax.swing.text.html.BlockView.paint
(BlockView.java:264)

	at javax.swing.text.BoxView.paintChild
(BoxView.java:144)

	at javax.swing.text.BoxView.paint(BoxView.java:407)

	at javax.swing.text.html.BlockView.paint
(BlockView.java:264)

	at 
javax.swing.plaf.basic.BasicTextUI$RootView.paint
(BasicTextUI.java:1248)

	at javax.swing.plaf.basic.BasicTextUI.paintSafely
(BasicTextUI.java:565)

	at javax.swing.plaf.basic.BasicTextUI.paint
(BasicTextUI.java:699)

	at javax.swing.plaf.basic.BasicTextUI.update
(BasicTextUI.java:678)

	at javax.swing.JComponent.paintComponent
(JComponent.java:537)

	at javax.swing.JComponent.paint
(JComponent.java:804)

	at javax.swing.JComponent.paintChildren
(JComponent.java:643)

	at javax.swing.JComponent.paint
(JComponent.java:813)

	at javax.swing.JComponent.paintChildren
(JComponent.java:643)

	at javax.swing.JComponent.paint
(JComponent.java:813)

	at javax.swing.JViewport.paint(JViewport.java:707)

	at javax.swing.JComponent.paintChildren
(JComponent.java:643)

	at javax.swing.JComponent.paint
(JComponent.java:813)

	at javax.swing.JComponent.paintChildren
(JComponent.java:643)

	at javax.swing.JComponent.paint
(JComponent.java:813)

	at javax.swing.JComponent.paintChildren
(JComponent.java:643)

	at javax.swing.JComponent.paint
(JComponent.java:813)

	at 
org.netbeans.core.windows.frames.CloseButtonTabbedPane.pain
t(CloseButtonTabbedPane.java:209)

	at javax.swing.JComponent.paintChildren
(JComponent.java:643)

	at javax.swing.JComponent.paint
(JComponent.java:813)

	at 
org.netbeans.core.windows.frames.PerimeterPane.paint
(PerimeterPane.java:103)

	at javax.swing.JComponent.paintChildren
(JComponent.java:643)

	at javax.swing.JComponent.paint
(JComponent.java:813)

	at javax.swing.JComponent.paintChildren
(JComponent.java:643)

	at javax.swing.JComponent.paint
(JComponent.java:813)

	at javax.swing.JLayeredPane.paint
(JLayeredPane.java:552)

	at javax.swing.JComponent.paintChildren
(JComponent.java:643)

	at javax.swing.JComponent.paint
(JComponent.java:813)

	at javax.swing.JComponent.paintChildren
(JComponent.java:643)

	at javax.swing.JComponent.paint
(JComponent.java:813)

	at javax.swing.JComponent.paintChildren
(JComponent.java:643)

	at javax.swing.JComponent.paint
(JComponent.java:813)

	at javax.swing.JLayeredPane.paint
(JLayeredPane.java:552)

	at 
org.netbeans.core.windows.frames.DesktopPane$CenterDesktopP
ane.paint(DesktopPane.java:427)

	at javax.swing.JComponent.paintChildren
(JComponent.java:643)

	at javax.swing.JComponent.paint
(JComponent.java:813)

	at javax.swing.JViewport.paint(JViewport.java:707)

	at javax.swing.JComponent.paintChildren
(JComponent.java:643)

	at javax.swing.JComponent.paint
(JComponent.java:813)

	at javax.swing.JComponent.paintWithOffscreenBuffer
(JComponent.java:4735)

	at javax.swing.JComponent.paintDoubleBuffered
(JComponent.java:4688)

	at javax.swing.JComponent._paintImmediately
(JComponent.java:4632)

	at javax.swing.JComponent.paintImmediately
(JComponent.java:4464)

	at javax.swing.RepaintManager.paintDirtyRegions
(RepaintManager.java:410)

[catch] at 
javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.
run(SystemEventQueueUtilities.java:117)

	at java.awt.event.InvocationEvent.dispatch
(InvocationEvent.java:178)

	at java.awt.EventQueue.dispatchEvent
(EventQueue.java:443)

	at 
java.awt.EventDispatchThread.pumpOneEventForHierarchy
(EventDispatchThread.java:191)

	at 
java.awt.EventDispatchThread.pumpEventsForHierarchy
(EventDispatchThread.java:144)

	at java.awt.EventDispatchThread.pumpEvents
(EventDispatchThread.java:138)

	at java.awt.EventDispatchThread.pumpEvents
(EventDispatchThread.java:130)

	at java.awt.EventDispatchThread.run
(EventDispatchThread.java:98)
Comment 1 _ tboudreau 2003-03-07 10:58:33 UTC
Looks like the famous, elusive html rendering timing bug in Swing
html rendering.  It pops up from time to time when using the internal
web browser as well.

Unfortunately, this is a JDK bug (as far as I know nobody's been
able to create a case where it happens consistently).  Closing as
invalid - there's nothing we can do to fix it on the in NetBeans'
code.


The code in question is:

    public void paint(Graphics g, Shape a) {
	Rectangle r;
	if (a instanceof Rectangle) {
	    r = (Rectangle) a;
	} else {
	    r = a.getBounds();  //NULL POINTER EXCEPTION HERE
	}
	painter.paint(g, r.x, r.y, r.width, r.height, this);
        super.paint(g, a);
    }

Walking the stack trace a bit, the offending rectangle is a 
"scratchpad" object allocated in the constructor of 
javax.swing.text.BoxView.  The only way I can see for it to be
null is as follows:

 - one thread constructs the BoxView instance
 - the thread scheduler switches contexts and the thread
   running the constructor is starved for a while, while
   still early in the BoxView constructor
 - another thread asks the new BoxView to paint itself before it's
   fully initialized

You might be able to achieve this once in a while
with something like SwingUtilities.invokeLater (new
BoxView(blah).paint(...)).

There is a call to 

javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.
run(SystemEventQueueUtilities.java:117)

deep in the stack trace, which suggests that could be exactly
what's happening.  I'll try to put together enough data to file
a JDK bug.
Comment 2 Jesse Glick 2003-03-07 23:47:52 UTC
IMHO we can file a bug just from the stack trace - TableView.paint
calls View.paint (ParagraphView) with a null second Shape param, not
permitted for that method, which it got from calling
BoxView.getChildAllocation, which is documented to sometimes return
null. No idea what happened to the view that caused the child shape
allocation to be invalid, but anyway the code should be more robust
and produce a useful exception with helpful diagnostics.

Also see possibly related:

Issue #12907: AIIOBE from BoxView.updateLayoutArray, NPE from
CompositeView.replace, NPE from FlowView.FlowStrategy.adjustRow

Issue #16993: NPE from CompositeView.replace

Issue #20760: NPE from CompositeView.replace again, as well as NPE
from BoxView.calculateMajorAxisRequirements

Issue #26506: NPE from CompositeView.replace again, plus NPE from
FlowView.FlowStrategy.layoutRow, plus AIOOBE from
BoxView.updateLayoutArray, plus NPE from BoxView.layout

Issue #30188: AIIOBE from VariableHeightLayoutCache.getNode

Issue #30517: NPE from CompositeView.replace, AIOOBE from
BoxView.updateLayoutArray
Comment 3 Jesse Glick 2003-03-07 23:56:26 UTC
Also see other bugs with ParagraphView.paint, pls. check to see if
they are the same:

Issue #9979
Issue #12907
Issue #27069
Issue #28219
Issue #29662
Comment 4 _ tboudreau 2003-03-11 11:02:15 UTC
Found a related JDK bug 4760435 and attached link and notes.
Closing.
Comment 5 Jesse Glick 2003-03-11 13:09:11 UTC
Hmm, I'm not convinced all of these bugs have anything to do with
#4760435, though some of them do. The Swing folks will probably ask
you to collate these stack traces better. Or they will just fix the
single exception for which a test case was given and ignore or not
notice the rest.
Comment 6 _ tboudreau 2003-04-17 12:55:15 UTC
*** Issue 25346 has been marked as a duplicate of this issue. ***
Comment 7 Marian Mirilovic 2003-05-09 09:43:02 UTC
*** Issue 33476 has been marked as a duplicate of this issue. ***
Comment 8 pzajac 2003-06-26 09:05:31 UTC
*** Issue 34601 has been marked as a duplicate of this issue. ***
Comment 9 Marian Mirilovic 2003-07-18 12:48:43 UTC
*** Issue 34970 has been marked as a duplicate of this issue. ***
Comment 10 Marian Mirilovic 2003-07-21 13:19:40 UTC
*** Issue 35012 has been marked as a duplicate of this issue. ***
Comment 11 Marian Mirilovic 2003-07-24 14:12:59 UTC
Not our bug - closing.
Comment 12 Marian Mirilovic 2003-08-25 14:10:47 UTC
*** Issue 35326 has been marked as a duplicate of this issue. ***
Comment 13 Vitezslav Stejskal 2003-11-24 16:25:03 UTC
*** Issue 35391 has been marked as a duplicate of this issue. ***
Comment 14 henri127 2011-03-21 16:53:36 UTC
I was having the follwing maybe related error when running my program (netbeans was not running) which contains debug code, but also libraries which don't. Therefore probably all Unknown Source references. The exception occured when selecting a cell from a table. Program had to be finished, by task manager. The code lines do not contain reference to any of my code. The program contains a lot of threading. So it is possible to be a thread issue. Note that the final routine in which the error occurs is called recursively, maybe it is possible to create code that will create this error, and/or a solution can be obtained. In my case it did not reproduce. I realize it is not a netbeans error but assume that it will reach those who are interested from here.

Thread Stopped: null null
Stack Trace: null
null
javax.swing.text.BoxView.calculateMajorAxisRequirements(Unknown Source)
javax.swing.text.BoxView.checkRequests(Unknown Source)
javax.swing.text.BoxView.getMinimumSpan(Unknown Source)
javax.swing.text.BoxView.calculateMajorAxisRequirements(Unknown Source)
javax.swing.text.BoxView.checkRequests(Unknown Source)
javax.swing.text.BoxView.setSpanOnAxis(Unknown Source)
javax.swing.text.BoxView.layout(Unknown Source)
javax.swing.text.BoxView.setSize(Unknown Source)
javax.swing.plaf.basic.BasicTextUI$RootView.setSize(Unknown Source)
javax.swing.plaf.basic.BasicTextUI$RootView.paint(Unknown Source)
javax.swing.plaf.basic.BasicTextUI.paintSafely(Unknown Source)
javax.swing.plaf.basic.BasicTextUI.paint(Unknown Source)
javax.swing.plaf.basic.BasicTextUI.update(Unknown Source)
javax.swing.JComponent.paintComponent(Unknown Source)
javax.swing.JComponent.paint(Unknown Source)
javax.swing.JComponent.paintChildren(Unknown Source)
javax.swing.JComponent.paint(Unknown Source)
javax.swing.JViewport.paint(Unknown Source)
javax.swing.JComponent.paintChildren(Unknown Source)
javax.swing.JComponent.paint(Unknown Source)
javax.swing.JComponent.paintToOffscreen(Unknown Source)
javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Unknown Source)
javax.swing.RepaintManager$PaintManager.paint(Unknown Source)
javax.swing.BufferStrategyPaintManager.paint(Unknown Source)
javax.swing.RepaintManager.paint(Unknown Source)
javax.swing.JComponent._paintImmediately(Unknown Source)
javax.swing.JComponent.paintImmediately(Unknown Source)
javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source)
javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)
java.awt.event.InvocationEvent.dispatch(Unknown Source)
java.awt.EventQueue.dispatchEvent(Unknown Source)
java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
java.awt.EventDispatchThread.pumpEvents(Unknown Source)
java.awt.EventDispatchThread.pumpEvents(Unknown Source)
java.awt.EventDispatchThread.run(Unknown Source)
Comment 15 Jesse Glick 2011-03-21 16:58:00 UTC
(In reply to comment #14)
> I was having the follwing maybe related error when running my program (netbeans
> was not running)

Then file a bug for Java directly - bugs.sun.com last I checked.