JDK-4959489 : NPE in javax.swing.text.html.ParagraphView.paint()
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: arrow-ea,1.4.2
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_2000,windows_xp
  • CPU: generic,x86
  • Submitted: 2003-11-25
  • Updated: 2004-10-25
  • Resolved: 2004-09-14
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other JDK 6
5.0u1 betaFixed 6Fixed
Description
An NPE occasionally occurs either when opening the (HTML JavaHelp) help window in NetBeans/Sun Java Studio, or on startup if the HTML welcome screen is displayed.

I had previously added some comments to bug 4760435, but after an exhaustive search, I have not found the same stack trace in any of the bug reports, so I am reporting it separately.
###@###.### 10/25/04 19:19 GMT

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: 1.5.0_01 mustang FIXED IN: 1.5.0_01 mustang INTEGRATED IN: 1.5.0_01 mustang
28-09-2004

EVALUATION Name: pzR10082 Date: 12/01/2003 BoxView.getChildAllocation() can return null if layout is invalid, in which case we probably should not try to paint anything. I suggest adding a check to ParagraphView.paint() and return when allocation is null. ###@###.### ======================================================================
28-09-2004

SUGGESTED FIX Ensure a non-null rectangle will be used for the shape for the child. BoxView.getChildAllocation() is documented to return null under certain circumstances. Name: pzR10082 Date: 12/02/2003 *** /net/crown/export1/zpm/webrev/src/share/classes/javax/swing/text/html/ParagraphView.java- Mon Dec 1 17:42:10 2003 --- ParagraphView.java Mon Dec 1 16:20:52 2003 *************** *** 210,215 **** --- 210,219 ---- * @see View#paint */ public void paint(Graphics g, Shape a) { + if (a == null) { + return; + } + Rectangle r; if (a instanceof Rectangle) { r = (Rectangle) a; ###@###.### ======================================================================
28-09-2004