Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4077475

Exception throwns while changing fonts in Styledocument

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.1.5
    • 1.1.4
    • client-libs
    • None
    • 1.1.5
    • generic
    • solaris_2.5
    • Not verified

      I am using Swing-0.4 on JDK1.1.4.
      steps to reproduce:
      1) launch swing demo Stylepad
      2) hightlight a paragraph
      3) select Font->Courier or Times Roman
      4) repeat step 2 and 3 a couple of times
      4) The Exception thrown

      Here is the stack trace:
      -------------------------
      Exception occurred during event dispatching:
      java.lang.NullPointerException
      at com.sun.java.swing.text.DefaultStyledDocument$ElementBuffer.canJoin(DefaultStyledDocument.java:885)
      at com.sun.java.swing.text.DefaultStyledDocument$ElementBuffer.removeElements(DefaultStyledDocument.java:862)
      at com.sun.java.swing.text.DefaultStyledDocument$ElementBuffer.removeElements(DefaultStyledDocument.java:844)
      at com.sun.java.swing.text.DefaultStyledDocument$ElementBuffer.removeUpdate(DefaultStyledDocument.java:630)
      at com.sun.java.swing.text.DefaultStyledDocument$ElementBuffer.remove(DefaultStyledDocument.java:586)
      at com.sun.java.swing.text.DefaultStyledDocument.removeUpdate(DefaultStyledDocument.java:384)
      at com.sun.java.swing.text.AbstractDocument.remove(AbstractDocument.java:144)
      at com.sun.java.swing.text.JTextComponent.cut(JTextComponent.java:223)
      at com.sun.java.swing.text.JTextComponent$CutAction.actionPerformed(JTextComponent.java:963)
      at com.sun.java.swing.AbstractButton$2.actionPerformed(AbstractButton.java:579)
      at com.sun.java.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:222)
      at com.sun.java.swing.AbstractButton.doClick(AbstractButton.java:130)
      at com.sun.java.swing.basic.BasicMenuUI$MenuListener.mouseReleased(BasicMenuUI.java:176)
      at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:236)
      at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:235)
      atException occurred during event dispatching:
      java.lang.StringIndexOutOfBoundsException: String index out of range: -135
      at java.lang.String.<init>(String.java)
      at com.sun.java.swing.text.Segment.toString(Segment.java:79)
      at com.sun.java.swing.text.LabelView.getPreferredShape(LabelView.java:111)
      at com.sun.java.swing.text.ParagraphView.determineSpan(ParagraphView.java:479)
      at com.sun.java.swing.text.ParagraphView.computeRow(ParagraphView.java:425)
      at com.sun.java.swing.text.ParagraphView.layout(ParagraphView.java:401)
      at com.sun.java.swing.text.ParagraphView.changedUpdate(ParagraphView.java:233)
      at com.sun.java.swing.text.CompositeView.changedUpdate(CompositeView.java:304)
      at com.sun.java.swing.plaf.DefaultTextUI$JViewFactory.changedUpdate(DefaultTextUI.java:505)
      at com.sun.java.swing.plaf.DefaultTextUI$JTextView.changedUpdate(DefaultTextUI.java:813)
      at com.sun.java.swing.text.AbstractDocument.externalNotifyChange(AbstractDocument.java:437)
      at com.sun.java.swing.text.DefaultStyledDocument.setCharacterAttributes(DefaultStyledDocument.java:247)
      at com.sun.java.swing.JTextPane.setCharacterAttributes(JTextPane.java:293)
      at com.sun.java.swing.JTextPane$FontFamilyAction.actionPerformed(JTextPane.java:463)
      at com.sun.java.swing.AbstractButton$2.actionPerformed(AbstractButton.java:579)
      at com.sun.java.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:222)
      at com.sun.java.swing.AbstractButton.doClick(AbstractButton.java:130)
      at com.sun.java.swing.basic.BasicMenuUI$MenuListener.mouseReleased(BasicMenuUI.java:176)
      at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:236)
      at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:235)
      at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:235)
      at java.awt.Component.processMouseEvent(Component.java:2284)
      at java.awt.Component.processEvent(Component.java:2129)
      at java.awt.Container.processEvent(Container.java:890)
      at java.awt.Component.dispatchEventImpl(Component.java:1764)
      at java.awt.Container.dispatchEventImpl(Container.java:935)
      at java.awt.Component.dispatchEvent(Component.java:1704)
      at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:1539)
      at java.awt.LightweightDispatcher.processMouseEvent(Container.java:1448)
      at java.awt.LightweightDispatcher.dispatchEvent(Container.java:1383)
      at java.awt.Container.dispatchEventImpl(Container.java:922)
      at java.awt.Window.dispatchEventImpl(Window.java:443)
      at java.awt.Component.dispatchEvent(Component.java:1704)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:63)
      Exception occurred during event dispatching:
      java.lang.NullPointerException
      at com.sun.java.swing.text.CompositeView.modelToView(CompositeView.java:193)
      at com.sun.java.swing.text.ParagraphView.modelToView(ParagraphView.java:135)
      at com.sun.java.swing.text.CompositeView.modelToView(CompositeView.java:197)
      at com.sun.java.swing.plaf.DefaultTextUI$JViewFactory.modelToView(DefaultTextUI.java:459)
      at com.sun.java.swing.plaf.DefaultTextUI$JTextView.modelToView(DefaultTextUI.java:696)
      at com.sun.java.swing.plaf.DefaultTextUI.modelToView(DefaultTextUI.java:246)
      at com.sun.java.swing.text.DefaultHighlighter.renderHighlight(DefaultHighlighter.java:169)
      at com.sun.java.swing.text.DefaultHighlighter.paint(DefaultHighlighter.java:58)
      at java.awt.Container.paint(Container.java:702)
      at com.sun.java.swing.JComponent.paint(JComponent.java:207)
      at java.awt.Container.paint(Container.java:702)
      at com.sun.java.swing.JComponent.paint(JComponent.java:207)
      at com.sun.java.swing.JViewport.paint(JViewport.java:193)
      at com.sun.java.swing.plaf.DefaultTextUI$JTextView.paint(DefaultTextUI.java:593)
      at java.awt.Container.paint(Container.java:702)
      at com.sun.java.swing.JComponent.paint(JComponent.java:207)
      at java.awt.Container.paint(Container.java:702)
      at com.sun.java.swing.JComponent.paint(JComponent.java:207)
      at java.awt.Container.paint(Container.java:702)
      at com.sun.java.swing.JComponent.paint(JComponent.java:207)
      at com.sun.java.swing.JBufferedPane.paint(JBufferedPane.java:238)
      at java.awt.Container.paint(Container.java:702)
      at com.sun.java.swing.JComponent.paint(JComponent.java:207)
      at com.sun.java.swing.JBufferedPane.paint(JBufferedPane.java:238)
      at java.awt.Container.paint(Container.java:702)
      at java.awt.Component.dispatchEventImpl(Component.java:1723)
      at java.awt.Container.dispatchEventImpl(Container.java:935)
      at java.awt.Window.dispatchEventImpl(Window.java:443)
      at java.awt.Component.dispatchEvent(Component.java:1704)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:63)
      Exception occurred during event dispatching:
      java.lang.NullPointerException
      at com.sun.java.swing.text.CompositeView.modelToView(CompositeView.java:193)
      at com.sun.java.swing.text.ParagraphView.modelToView(ParagraphView.java:135)
      at com.sun.java.swing.text.CompositeView.modelToView(CompositeView.java:197)
      at com.sun.java.swing.plaf.DefaultTextUI$JViewFactory.damageRange(DefaultTextUI.java:478)
      at com.sun.java.swing.plaf.DefaultTextUI$JTextView.damageRange(DefaultTextUI.java:710)
      at com.sun.java.swing.plaf.DefaultTextUI.damageRange(DefaultTextUI.java:271)
      at com.sun.java.swing.text.DefaultHighlighter.removeHighlight(DefaultHighlighter.java:117)
      at com.sun.java.swing.text.DefaultCaret.setDot(DefaultCaret.java:370)
      at com.sun.java.swing.text.JTextComponent.setCaretPosition(JTextComponent.java:327)
      at com.sun.java.swing.text.DefaultTextController.positionCursor(DefaultTextController.java:204)
      at com.sun.java.swing.text.DefaultTextController.mousePressed(DefaultTextController.java:292)
      at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:225)
      at java.awt.Component.processMouseEvent(Component.java:2281)
      at java.awt.Component.processEvent(Component.java:2129)
      at java.awt.Container.processEvent(Container.java:890)
      at java.awt.Component.dispatchEventImpl(Component.java:1764)
      at java.awt.Container.dispatchEventImpl(Container.java:935)
      at java.awt.Component.dispatchEvent(Component.java:1704)
      at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:1539)
      at java.awt.LightweightDispatcher.processMouseEvent(Container.java:1444)
      at java.awt.LightweightDispatcher.dispatchEvent(Container.java:1383)
      at java.awt.Container.dispatchEventImpl(Container.java:922)
      at java.awt.Window.dispatchEventImpl(Window.java:443)
      at java.awt.Component.dispatchEvent(Component.java:1704)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:63)
      Exception occurred during event dispatching:
      java.lang.NullPointerException
      at com.sun.java.swing.text.CompositeView.modelToView(CompositeView.java:193)
      at com.sun.java.swing.text.ParagraphView.modelToView(ParagraphView.java:135)
      at com.sun.java.swing.text.CompositeView.modelToView(CompositeView.java:197)
      at com.sun.java.swing.plaf.DefaultTextUI$JViewFactory.modelToView(DefaultTextUI.java:459)
      at com.sun.java.swing.plaf.DefaultTextUI$JTextView.modelToView(DefaultTextUI.java:696)
      at com.sun.java.swing.plaf.DefaultTextUI.modelToView(DefaultTextUI.java:246)
      at com.sun.java.swing.text.DefaultHighlighter.renderHighlight(DefaultHighlighter.java:169)
      at com.sun.java.swing.text.DefaultHighlighter.paint(DefaultHighlighter.java:58)
      at java.awt.Container.paint(Container.java:702)
      at com.sun.java.swing.JComponent.paint(JComponent.java:207)
      at java.awt.Container.paint(Container.java:702)
      at com.sun.java.swing.JComponent.paint(JComponent.java:207)
      at com.sun.java.swing.JViewport.paint(JViewport.java:193)
      at com.sun.java.swing.plaf.DefaultTextUI$JTextView.paint(DefaultTextUI.java:593)
      at java.awt.Container.paint(Container.java:702)
      at com.sun.java.swing.JComponent.paint(JComponent.java:207)
      at java.awt.Container.paint(Container.java:702)
      at com.sun.java.swing.JComponent.paint(JComponent.java:207)
      at java.awt.Container.paint(Container.java:702)
      at com.sun.java.swing.JComponent.paint(JComponent.java:207)
      at com.sun.java.swing.JBufferedPane.paint(JBufferedPane.java:238)
      at java.awt.Container.paint(Container.java:702)
      at com.sun.java.swing.JComponent.paint(JComponent.java:207)
      at com.sun.java.swing.JBufferedPane.paint(JBufferedPane.java:238)
      at com.sun.java.swing.JComponent._paintImmediately(JComponent.java:2248)
      at com.sun.java.swing.JComponent.paintImmediately(JComponent.java:2158)
      at com.sun.java.swing.DirtyRegionManager.paintDirtyRegions(DirtyRegionManager.java:277)
      at com.sun.java.swing.DirtyRegionManager.actionPerformed(DirtyRegionManager.java:208)
      at com.sun.java.swing.Timer$DummyComponent.processEvent(Timer.java:256)
      at java.awt.Component.dispatchEventImpl(Component.java:1764)
      at java.awt.Component.dispatchEvent(Component.java:1704)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:63)
      Exception occurred during event dispatching:
      java.lang.NullPointerException
      at com.sun.java.swing.text.CompositeView.modelToView(CompositeView.java:193)
      at com.sun.java.swing.text.ParagraphView.modelToView(ParagraphView.java:135)
      at com.sun.java.swing.text.CompositeView.modelToView(CompositeView.java:197)
      at com.sun.java.swing.plaf.DefaultTextUI$JViewFactory.modelToView(DefaultTextUI.java:459)
      at com.sun.java.swing.plaf.DefaultTextUI$JTextView.modelToView(DefaultTextUI.java:696)
      at com.sun.java.swing.plaf.DefaultTextUI.modelToView(DefaultTextUI.java:246)
      at com.sun.java.swing.text.DefaultHighlighter.renderHighlight(DefaultHighlighter.java:169)
      at com.sun.java.swing.text.DefaultHighlighter.paint(DefaultHighlighter.java:58)
      at java.awt.Container.paint(Container.java:702)
      at com.sun.java.swing.JComponent.paint(JComponent.java:207)
      at java.awt.Container.paint(Container.java:702)
      at com.sun.java.swing.JComponent.paint(JComponent.java:207)
      at com.sun.java.swing.JViewport.paint(JViewport.java:193)
      at com.sun.java.swing.plaf.DefaultTextUI$JTextView.paint(DefaultTextUI.java:593)
      at java.awt.Container.paint(Container.java:702)
      at com.sun.java.swing.JComponent.paint(JComponent.java:207)
      at java.awt.Container.paint(Container.java:702)
      at com.sun.java.swing.JComponent.paint(JComponent.java:207)
      at java.awt.Container.paint(Container.java:702)
      at com.sun.java.swing.JComponent.paint(JComponent.java:207)
      at com.sun.java.swing.JBufferedPane.paint(JBufferedPane.java:238)
      at java.awt.Container.paint(Container.java:702)
      at com.sun.java.swing.JComponent.paint(JComponent.java:207)
      at com.sun.java.swing.JBufferedPane.paint(JBufferedPane.java:238)
      at com.sun.java.swing.JComponent._paintImmediately(JComponent.java:2248)
      at com.sun.java.swing.JComponent.paintImmediately(JComponent.java:2158)
      at com.sun.java.swing.DirtyRegionManager.paintDirtyRegions(DirtyRegionManager.java:277)
      at com.sun.java.swing.DirtyRegionManager.actionPerformed(DirtyRegionManager.java:208)
      at com.sun.java.swing.Timer$DummyComponent.processEvent(Timer.java:256)
      at java.awt.Component.dispatchEventImpl(Component.java:1764)
      at java.awt.Component.dispatchEvent(Component.java:1704)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:63)

            tprinzing Tim Prinzing (Inactive)
            tsusunw Tina Su (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: