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

JEditorPane throws NPE when launching for the first time

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3 P3
    • None
    • 6
    • client-libs

      I am launching a test which creates a JEditorPane passing a URL in the constructor. I am adding this JEditorPane to a scrollpane and making it visible. As soon as the JFrame is launched, I am seeing a NullPointerException on the console.

      This exception is intermittent but I am able to reproduce it 1 out of 3 times. I reproduced this on WinXP as well as SolSparc10. The probability of seeing the exception is more when using a local JDK and not the one on the network. I reproduced it with JDK7-b07 as well as JDK6-b105 (both are local). Reproducible across look & feels.

      I have attached a sample test. Execute it as follows -
      java JEditorPaneTest PrintQL_Procedures.html
      Run it quickly a few times and you will see the below exception on the console -

      Exception in thread "Thread-2" java.lang.NullPointerException
      at javax.swing.text.CompositeView.replace(CompositeView.java:200)
      at javax.swing.text.BoxView.replace(BoxView.java:164)
      at javax.swing.text.CompositeView.loadChildren(CompositeView.java:97)
      at javax.swing.text.CompositeView.setParent(CompositeView.java:122)
      at javax.swing.text.html.BlockView.setParent(BlockView.java:55)
      at javax.swing.text.CompositeView.replace(CompositeView.java:200)
      at javax.swing.text.BoxView.replace(BoxView.java:164)
      at javax.swing.text.html.TableView$RowView.replace(TableView.java:1457)
      at javax.swing.text.CompositeView.loadChildren(CompositeView.java:97)
      at javax.swing.text.CompositeView.setParent(CompositeView.java:122)
      at javax.swing.text.CompositeView.replace(CompositeView.java:200)
      at javax.swing.text.BoxView.replace(BoxView.java:164)
      at javax.swing.text.html.TableView.replace(TableView.java:896)
      at javax.swing.text.CompositeView.loadChildren(CompositeView.java:97)
      at javax.swing.text.CompositeView.setParent(CompositeView.java:122)
      at javax.swing.text.html.TableView.setParent(TableView.java:800)
      at javax.swing.text.CompositeView.replace(CompositeView.java:200)
      at javax.swing.text.BoxView.replace(BoxView.java:164)
      at javax.swing.text.View.updateChildren(View.java:1095)
      at javax.swing.text.View.insertUpdate(View.java:679)
      at javax.swing.text.View.forwardUpdateToView(View.java:1186)
      at javax.swing.text.View.forwardUpdate(View.java:1161)
      at javax.swing.text.BoxView.forwardUpdate(BoxView.java:223)
      at javax.swing.text.View.insertUpdate(View.java:685)
      at javax.swing.plaf.basic.BasicTextUI$RootView.insertUpdate(BasicTextUI.java:1589)
      at javax.swing.plaf.basic.BasicTextUI$UpdateHandler.insertUpdate(BasicTextUI.java:1848)
      at javax.swing.text.AbstractDocument.fireInsertUpdate(AbstractDocument.java:185)
      at javax.swing.text.DefaultStyledDocument.insert(DefaultStyledDocument.java:206)
      at javax.swing.text.html.HTMLDocument.insert(HTMLDocument.java:417)
      at javax.swing.text.html.HTMLDocument$HTMLReader.flushBuffer(HTMLDocument.java:3704)
      at javax.swing.text.html.HTMLDocument$HTMLReader.flush(HTMLDocument.java:2506)
      at javax.swing.text.html.HTMLEditorKit.read(HTMLEditorKit.java:231)
      at javax.swing.JEditorPane.read(JEditorPane.java:556)
      at javax.swing.JEditorPane.read(JEditorPane.java:584)
      at javax.swing.JEditorPane$PageLoader.run(JEditorPane.java:647)

            peterz Peter Zhelezniakov
            pmohansunw Praveen Mohan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: