JDK-5104376 : NPE during html rendering at javax.swing.text.html CSS$FontSize.getValue metho
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 5.0
  • Priority: P2
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2004-09-20
  • Updated: 2004-09-20
  • Resolved: 2004-09-20
Related Reports
Duplicate :  
Description
Steps to reproduce:

1) Run Netbeans IDE, version 4.0 beta (see http://www.netbeans.info/downloads/download.php?a=b&p=1&b_bt=1&rv=4.0 for download)

2) JDK 5.0 build starting from b60 (b59 and older work

3) Create some java project (menu File / New project)

4) change Web Browser (menu Tools / Setup Wizard) to Swing HTML
Browser

5) Invoke popup menu over Java Project node (in Projects tab), select
"create Javadoc for Project"

-> never ending NPE rises:

java.lang.NullPointerException
        at javax.swing.text.html.CSS$FontSize.getValue(CSS.java:1672)
        at javax.swing.text.html.CSS$FontSize.toStyleConstants(CSS.java:1805)
        at javax.swing.text.html.StyleSheet$ViewAttributeSet.getAttribute(StyleSheet.java:2630)
        at javax.swing.text.StyleConstants.getFontSize(StyleConstants.java:358)
        at javax.swing.text.html.CSS$FontSize.getValue(CSS.java:1678)
        at javax.swing.text.html.CSS.getFontSize(CSS.java:614)
        at javax.swing.text.html.CSS.getFont(CSS.java:574)
        at javax.swing.text.html.StyleSheet.getFont(StyleSheet.java:867)
        at javax.swing.text.DefaultStyledDocument.getFont(DefaultStyledDocument.java:777)
        at javax.swing.text.LabelView.setPropertiesFromAttributes(LabelView.java:128)
        at javax.swing.text.html.InlineView.setPropertiesFromAttributes(InlineView.java:229)
        at javax.swing.text.LabelView.sync(LabelView.java:39)
        at javax.swing.text.LabelView.getFont(LabelView.java:189)
        at javax.swing.text.GlyphPainter1.sync(GlyphPainter1.java:194)
        at javax.swing.text.GlyphPainter1.getSpan(GlyphPainter1.java:42)
        at javax.swing.text.GlyphView.getPreferredSpan(GlyphView.java:536)
        at javax.swing.text.FlowView$LogicalView.getPreferredSpan(FlowView.java:692)
        at javax.swing.text.FlowView.calculateMinorAxisRequirements(FlowView.java:216)
        at javax.swing.text.html.ParagraphView.calculateMinorAxisRequirements(ParagraphView.java:128)
        at javax.swing.text.BoxView.checkRequests(BoxView.java:911)
        at javax.swing.text.BoxView.getMinimumSpan(BoxView.java:542)
        at javax.swing.text.html.ParagraphView.getMinimumSpan(ParagraphView.java:257)
        at javax.swing.text.BoxView.calculateMinorAxisRequirements(BoxView.java:879)
        at javax.swing.text.html.BlockView.calculateMinorAxisRequirements(BlockView.java:129)
        at javax.swing.text.BoxView.checkRequests(BoxView.java:911)
        at javax.swing.text.BoxView.getMinimumSpan(BoxView.java:542)
        at javax.swing.text.html.BlockView.getMinimumSpan(BlockView.java:362)
        at javax.swing.text.html.TableView.checkSingleColumnCell(TableView.java:434)
        at javax.swing.text.html.TableView.calculateColumnRequirements(TableView.java:397)
        at javax.swing.text.html.TableView.calculateMinorAxisRequirements(TableView.java:519)
        at javax.swing.text.BoxView.checkRequests(BoxView.java:911)
        at javax.swing.text.BoxView.getMinimumSpan(BoxView.java:542)
        at javax.swing.text.BoxView.calculateMinorAxisRequirements(BoxView.java:879)
        at javax.swing.text.html.BlockView.calculateMinorAxisRequirements(BlockView.java:129)
        at javax.swing.text.BoxView.checkRequests(BoxView.java:911)
        at javax.swing.text.BoxView.getMinimumSpan(BoxView.java:542)
        at javax.swing.text.html.BlockView.getMinimumSpan(BlockView.java:362)
        at javax.swing.text.BoxView.calculateMinorAxisRequirements(BoxView.java:879)
        at javax.swing.text.html.BlockView.calculateMinorAxisRequirements(BlockView.java:129)
        at javax.swing.text.BoxView.checkRequests(BoxView.java:911)
        at javax.swing.text.BoxView.setSpanOnAxis(BoxView.java:325)
        at javax.swing.text.BoxView.layout(BoxView.java:682)
        at javax.swing.text.BoxView.setSize(BoxView.java:379)
        at javax.swing.plaf.basic.BasicTextUI$RootView.setSize(BasicTextUI.java:1631)
        at javax.swing.plaf.basic.BasicTextUI.getPreferredSize(BasicTextUI.java:825)
        at javax.swing.JComponent.getPreferredSize(JComponent.java:1582)
        at javax.swing.JEditorPane.getPreferredSize(JEditorPane.java:1227)
        at javax.swing.text.JTextComponent.getPreferredScrollableViewportSize(JTextComponent.java:1712)
        at javax.swing.ViewportLayout.preferredLayoutSize(ViewportLayout.java:75)
        at java.awt.Container.preferredSize(Container.java:1558)
        at java.awt.Container.getPreferredSize(Container.java:1543)
        at javax.swing.JComponent.getPreferredSize(JComponent.java:1584)
        at javax.swing.ScrollPaneLayout.preferredLayoutSize(ScrollPaneLayout.java:475)
        at java.awt.Container.preferredSize(Container.java:1558)
        at java.awt.Container.getPreferredSize(Container.java:1543)
        at javax.swing.JComponent.getPreferredSize(JComponent.java:1584)
        at javax.swing.text.ComponentView$Invalidator.cacheChildSizes(ComponentView.java:404)
        at javax.swing.text.ComponentView$Invalidator.doLayout(ComponentView.java:383)
        at java.awt.Container.validateTree(Container.java:1473)
        at java.awt.Container.validate(Container.java:1448)
        at javax.swing.text.ComponentView$Invalidator.validateIfNecessary(ComponentView.java:396)
        at javax.swing.text.ComponentView$Invalidator.getPreferredSize(ComponentView.java:443)
        at javax.swing.text.ComponentView.getPreferredSpan(ComponentView.java:119)
        at javax.swing.text.BoxView.calculateMajorAxisRequirements(BoxView.java:848)
        at javax.swing.text.BoxView.checkRequests(BoxView.java:906)
        at javax.swing.text.BoxView.getMinimumSpan(BoxView.java:542)
        at javax.swing.text.BoxView.calculateMinorAxisRequirements(BoxView.java:879)
        at javax.swing.text.html.BlockView.calculateMinorAxisRequirements(BlockView.java:129)
        at javax.swing.text.BoxView.checkRequests(BoxView.java:911)
        at javax.swing.text.BoxView.getMinimumSpan(BoxView.java:542)
        at javax.swing.text.html.BlockView.getMinimumSpan(BlockView.java:362)
        at javax.swing.text.BoxView.calculateMinorAxisRequirements(BoxView.java:879)
        at javax.swing.text.html.BlockView.calculateMinorAxisRequirements(BlockView.java:129)
        at javax.swing.text.BoxView.checkRequests(BoxView.java:911)
        at javax.swing.text.BoxView.setSpanOnAxis(BoxView.java:325)
        at javax.swing.text.BoxView.layout(BoxView.java:682)
        at javax.swing.text.BoxView.setSize(BoxView.java:379)
        at javax.swing.plaf.basic.BasicTextUI$RootView.setSize(BasicTextUI.java:1631)
        at javax.swing.plaf.basic.BasicTextUI.getPreferredSize(BasicTextUI.java:825)
        at javax.swing.JComponent.getPreferredSize(JComponent.java:1582)
        at javax.swing.JEditorPane.getPreferredSize(JEditorPane.java:1227)
        at javax.swing.ScrollPaneLayout.layoutContainer(ScrollPaneLayout.java:769)
        at java.awt.Container.layout(Container.java:1401)
        at java.awt.Container.doLayout(Container.java:1390)
        at java.awt.Container.validateTree(Container.java:1473)
        at java.awt.Container.validateTree(Container.java:1480)
        at java.awt.Container.validateTree(Container.java:1480)
        at java.awt.Container.validateTree(Container.java:1480)
        at java.awt.Container.validateTree(Container.java:1480)
        at java.awt.Container.validateTree(Container.java:1480)
        at java.awt.Container.validateTree(Container.java:1480)
        at java.awt.Container.validateTree(Container.java:1480)
        at java.awt.Container.validateTree(Container.java:1480)
        at java.awt.Container.validateTree(Container.java:1480)
        at java.awt.Container.validateTree(Container.java:1480)
        at java.awt.Container.validateTree(Container.java:1480)
        at java.awt.Container.validateTree(Container.java:1480)
        at java.awt.Container.validateTree(Container.java:1480)
        at java.awt.Container.validateTree(Container.java:1480)
        at java.awt.Container.validate(Container.java:1448)
        at javax.swing.RepaintManager.validateInvalidComponents(RepaintManager.java:379)
        at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:113)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
[catch] at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:234)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

exceptions rises again and again
-  try to restart IDE
-> NPE rises again, user can do nothing !

Comments
WORK AROUND Well, I would be happy if jdk-swing team could advice us how to work around this in Netbeans, as this is pretty critical for us.
22-09-2004

SUGGESTED FIX problems are at line 1672, CSS.java. I would suggest to add null check for variable ss (StyleSheet) in code: if (lu.type == 0) { return lu.getValue(ss.isW3CLengthUnits()); } Apparently ss can be null, for example follwing call from toStyleConstants call: Object toStyleConstants(StyleConstants key, View v) { if (v != null) { return new Integer((int) getValue(v.getAttributes(), null)); } return new Integer((int) getValue(null, null)); }
22-09-2004

EVALUATION Name: sh120115 Date: 09/20/2004 This is a duplicate of 5089077, which is to be fixed in 1.5.0_01. ###@###.### 2004-09-20 ======================================================================
20-09-2004