JDK-5088756 : REGRESSION:NPE exception throws when argument is null in calling CSSFontSize.get
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2004-08-18
  • Updated: 2004-08-19
  • Resolved: 2004-08-19
Related Reports
Duplicate :  
Description
###@###.### 2004-08-18

J2SE Version (please include all output from java -version flag):
  java version "1.5.0-beta3"
  Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta3-b60)
  Java HotSpot(TM) Client VM (build 1.5.0-beta3-b60, mixed mode, sharing)

Does this problem occur on J2SE 1.3.x or 1.4.x?  Yes / No (pick one)
  I don't know because I used it within a new pure Tiger-API example.

Operating System Configuration Information (be specific):
  Windows XP/SP2 US/EN

Hardware Configuration Information (be specific):
  Sony Notebook GRX616

Bug Description:
  null arguments are not correctly handled for certain internal calls
  inside javax.swing.text.html.CSS.java, hence resulting in a
  NullPointerException.

Exception in thread "AWT-EventQueue-0" 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.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$RootView.paint(BasicTextUI.java:1350)
        at
javax.swing.plaf.basic.BasicTextUI.paintSafely(BasicTextUI.java:642)
        at
javax.swing.plaf.basic.BasicTextUI.paint(BasicTextUI.java:791)
        at
javax.swing.plaf.basic.BasicTextUI.update(BasicTextUI.java:759)
        at javax.swing.JComponent.paintComponent(JComponent.java:740)
        at javax.swing.JComponent.paint(JComponent.java:1003)
        at javax.swing.JComponent.paintChildren(JComponent.java:840)
        at javax.swing.JComponent.paint(JComponent.java:1012)
        at javax.swing.JViewport.paint(JViewport.java:728)
        at javax.swing.JComponent.paintChildren(JComponent.java:840)
        at javax.swing.JComponent.paint(JComponent.java:1012)
        at javax.swing.JComponent.paintChildren(JComponent.java:840)
        at javax.swing.JComponent.paint(JComponent.java:1012)
        at javax.swing.JComponent.paintChildren(JComponent.java:840)
        at javax.swing.JComponent.paint(JComponent.java:1012)
        at javax.swing.JLayeredPane.paint(JLayeredPane.java:559)
        at javax.swing.JComponent.paintChildren(JComponent.java:840)
        at javax.swing.JComponent.paint(JComponent.java:1012)
        at
javax.swing.JComponent.paintWithOffscreenBuffer(JComponent.java:4930)
        at
javax.swing.JComponent.paintDoubleBuffered(JComponent.java:4883)
        at
javax.swing.JComponent._paintImmediately(JComponent.java:4826)
        at javax.swing.JComponent.paintImmediately(JComponent.java:4633)
        at
javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:451)
        at
javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:114)
        at
java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
        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)



Steps to Reproduce (be specific):
  Use javax.swing.JEditorPane in combination with
  javax.swing.text.html.HTMLEditorKit and set an HTML page with a suitable
  StyleSheet that implicitly calls
  javax.swing.text.html.CSS.toStyleConstants() in line 1805.

  This will result in calling getValue(), which causes the
  NullPointerException in line 1672 because the second argument was null.

  Unfortunately, cannot supply a suitable page and stylesheet but the
  problem is obvious by simply looking to the source code.