netbeans icon indicating copy to clipboard operation
netbeans copied to clipboard

Javadoc window causes NullPointerException followed by window rendering issues

Open fixbugbroken opened this issue 3 months ago • 1 comments

Apache NetBeans version

Apache NetBeans 27

What happened

The Netbeans Javadoc Documentation window crashes showing partially output, causing visual artifacts across netbeans (including garbage areas that are not refreshed properly). When this occurs Netbeans reports a NullPointerException. This behavior continues until Netbeans is restarted.

messages.log

  • Error reported by Netbeans (NullPointerException)
  • When the error appears the following issues also occur - Javadoc window shows partial results - GUI get corrupted with window not refreshing properly showing older garbage images - Can also get many ≺classname≻_n.dump files where n is some number. The classname will correspond to the class containing the javadoc that crashes Netbean's Javadoc window.

Language / Project Type / NetBeans Component

Java Ant project with existing sources.

How to reproduce

I have supplied a minimal Javadoc example that causes this issue. However I have found in general this occurs a lot with Netbeans when displaying Javadoc using Netbeans' built in viewer. This error occurs if the javadoc is for a class, member or package.

This error occurs every time for the supplied example. src.zip

Note: if 1) a closing ≺/pre≻ tag is added, 2) netbeans is restarted then the error goes away. If the text following the ≺pre≻ tag is removed the error also goes away. The text contains a combining diacritic.

Note: if the Javadoc window is not displayed then the error is not generated.

Did this work correctly in an earlier version?

No / Don't know

Operating System

macOS 15.6 (M2 cpu)

JDK

JDK 24.0.2

Apache NetBeans packaging

Third-party package

Anything else

The installer was downloaded from Friends of Apache NetBeans

Are you willing to submit a pull request?

No

fixbugbroken avatar Sep 17 '25 18:09 fixbugbroken

extracted the exception from the provided log:

NPE:

SEVERE [global]
java.lang.NullPointerException: Cannot invoke "javax.swing.text.View.getEndOffset()" because "child" is null
	at java.desktop/javax.swing.text.TextLayoutStrategy$AttributedSegment.getRunLimit(TextLayoutStrategy.java:472)
	at java.desktop/java.awt.font.StyledParagraph.<init>(StyledParagraph.java:105)
	at java.desktop/java.awt.font.TextMeasurer.initAll(TextMeasurer.java:224)
	at java.desktop/java.awt.font.TextMeasurer.<init>(TextMeasurer.java:168)
	at java.desktop/java.awt.font.LineBreakMeasurer.<init>(LineBreakMeasurer.java:311)
	at java.desktop/javax.swing.text.TextLayoutStrategy.sync(TextLayoutStrategy.java:320)
	at java.desktop/javax.swing.text.TextLayoutStrategy.insertUpdate(TextLayoutStrategy.java:79)
	at java.desktop/javax.swing.text.FlowView.loadChildren(FlowView.java:151)
	at java.desktop/javax.swing.text.CompositeView.setParent(CompositeView.java:137)
	at java.desktop/javax.swing.text.FlowView.setParent(FlowView.java:297)
	at java.desktop/javax.swing.text.html.ParagraphView.setParent(ParagraphView.java:75)
	at java.desktop/javax.swing.text.FlowView$LogicalView.forwardUpdateToView(FlowView.java:815)
	at java.desktop/javax.swing.text.View.forwardUpdate(View.java:1171)
	at java.desktop/javax.swing.text.FlowView$LogicalView.forwardUpdate(FlowView.java:826)
	at java.desktop/javax.swing.text.View.changedUpdate(View.java:798)
	at java.desktop/javax.swing.text.FlowView.changedUpdate(FlowView.java:291)
	at java.desktop/javax.swing.text.ParagraphView.changedUpdate(ParagraphView.java:780)
	at java.desktop/javax.swing.text.View.forwardUpdateToView(View.java:1240)
	at java.desktop/javax.swing.text.View.forwardUpdate(View.java:1171)
	at java.desktop/javax.swing.text.BoxView.forwardUpdate(BoxView.java:241)
	at java.desktop/javax.swing.text.View.changedUpdate(View.java:798)
	at java.desktop/javax.swing.text.html.BlockView.changedUpdate(BlockView.java:341)
	at java.desktop/javax.swing.text.View.forwardUpdateToView(View.java:1240)
	at java.desktop/javax.swing.text.View.forwardUpdate(View.java:1171)
	at java.desktop/javax.swing.text.BoxView.forwardUpdate(BoxView.java:241)
	at java.desktop/javax.swing.text.View.changedUpdate(View.java:798)
	at java.desktop/javax.swing.text.html.BlockView.changedUpdate(BlockView.java:341)
	at java.desktop/javax.swing.text.View.forwardUpdateToView(View.java:1240)
	at java.desktop/javax.swing.text.View.forwardUpdate(View.java:1171)
	at java.desktop/javax.swing.text.BoxView.forwardUpdate(BoxView.java:241)
	at java.desktop/javax.swing.text.View.changedUpdate(View.java:798)
	at java.desktop/javax.swing.text.html.BlockView.changedUpdate(BlockView.java:341)
	at java.desktop/javax.swing.plaf.basic.BasicTextUI$RootView.changedUpdate(BasicTextUI.java:1739)
	at java.desktop/javax.swing.plaf.basic.BasicTextUI$UpdateHandler.changedUpdate(BasicTextUI.java:2008)
	at java.desktop/javax.swing.text.AbstractDocument.fireChangedUpdate(AbstractDocument.java:249)
	at java.desktop/javax.swing.text.html.HTMLDocument.fireChangedUpdate(HTMLDocument.java:1789)
	at java.desktop/javax.swing.text.html.HTMLDocument$HTMLReader.adjustEndElement(HTMLDocument.java:2707)
	at java.desktop/javax.swing.text.html.HTMLDocument$HTMLReader.flush(HTMLDocument.java:2761)
	at java.desktop/javax.swing.text.html.HTMLEditorKit.read(HTMLEditorKit.java:318)
	at org.netbeans.modules.java.navigation.HTMLDocView$1.run(HTMLDocView.java:100)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:723)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:702)
	at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:136)
[catch] at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

followed by various index out of bounds exceptions and other NPEs:

SEVERE [global]
java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 2
	at java.desktop/javax.swing.text.CompositeView.getView(CompositeView.java:158)
	at java.desktop/javax.swing.text.TextLayoutStrategy$AttributedSegment.getFont(TextLayoutStrategy.java:403)
	at java.desktop/javax.swing.text.TextLayoutStrategy$AttributedSegment.getAttribute(TextLayoutStrategy.java:530)
	at java.desktop/javax.swing.text.TextLayoutStrategy$AttributedSegment.getAttributes(TextLayoutStrategy.java:513)
	at java.desktop/java.awt.font.TextLine.getFontAtCurrentPos(TextLine.java:1284)
	at java.desktop/java.awt.font.TextMeasurer.initAll(TextMeasurer.java:237)
	at java.desktop/java.awt.font.TextMeasurer.<init>(TextMeasurer.java:168)
	at java.desktop/java.awt.font.LineBreakMeasurer.<init>(LineBreakMeasurer.java:311)
	at java.desktop/javax.swing.text.TextLayoutStrategy.sync(TextLayoutStrategy.java:320)
	at java.desktop/javax.swing.text.TextLayoutStrategy.insertUpdate(TextLayoutStrategy.java:79)
	at java.desktop/javax.swing.text.FlowView.loadChildren(FlowView.java:151)
	at java.desktop/javax.swing.text.CompositeView.setParent(CompositeView.java:137)
	at java.desktop/javax.swing.text.FlowView.setParent(FlowView.java:297)
	at java.desktop/javax.swing.text.html.ParagraphView.setParent(ParagraphView.java:75)
	at java.desktop/javax.swing.text.CompositeView.replace(CompositeView.java:217)
	at java.desktop/javax.swing.text.BoxView.replace(BoxView.java:182)
	at java.desktop/javax.swing.text.CompositeView.loadChildren(CompositeView.java:112)
	at java.desktop/javax.swing.text.CompositeView.setParent(CompositeView.java:137)
	at java.desktop/javax.swing.text.html.BlockView.setParent(BlockView.java:72)
	at java.desktop/javax.swing.text.CompositeView.replace(CompositeView.java:217)
	at java.desktop/javax.swing.text.BoxView.replace(BoxView.java:182)
	at java.desktop/javax.swing.text.View.updateChildren(View.java:1129)
	at java.desktop/javax.swing.text.View.removeUpdate(View.java:750)
	at java.desktop/javax.swing.text.View.forwardUpdateToView(View.java:1238)
	at java.desktop/javax.swing.text.View.forwardUpdate(View.java:1171)
	at java.desktop/javax.swing.text.BoxView.forwardUpdate(BoxView.java:241)
	at java.desktop/javax.swing.text.View.removeUpdate(View.java:756)
	at java.desktop/javax.swing.plaf.basic.BasicTextUI$RootView.removeUpdate(BasicTextUI.java:1725)
	at java.desktop/javax.swing.plaf.basic.BasicTextUI$UpdateHandler.removeUpdate(BasicTextUI.java:1993)
	at java.desktop/javax.swing.text.AbstractDocument.fireRemoveUpdate(AbstractDocument.java:278)
	at java.desktop/javax.swing.text.AbstractDocument.handleRemove(AbstractDocument.java:645)
	at java.desktop/javax.swing.text.AbstractDocument.remove(AbstractDocument.java:613)
	at org.netbeans.modules.java.navigation.HTMLDocView$1.run(HTMLDocView.java:99)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:723)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:702)
	at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:136)
[catch] at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

or

SEVERE [global]
java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
	at java.desktop/javax.swing.text.html.BlockView.layoutMinorAxis(BlockView.java:262)
	at java.desktop/javax.swing.text.BoxView.setSpanOnAxis(BoxView.java:345)
	at java.desktop/javax.swing.text.BoxView.layout(BoxView.java:709)
	at java.desktop/javax.swing.text.BoxView.setSize(BoxView.java:398)
	at java.desktop/javax.swing.text.BoxView.updateChildSizes(BoxView.java:367)
	at java.desktop/javax.swing.text.BoxView.setSpanOnAxis(BoxView.java:335)
	at java.desktop/javax.swing.text.BoxView.layout(BoxView.java:710)
	at java.desktop/javax.swing.text.BoxView.setSize(BoxView.java:398)
	at java.desktop/javax.swing.text.BoxView.updateChildSizes(BoxView.java:367)
	at java.desktop/javax.swing.text.BoxView.setSpanOnAxis(BoxView.java:335)
	at java.desktop/javax.swing.text.BoxView.layout(BoxView.java:710)
	at java.desktop/javax.swing.text.BoxView.setSize(BoxView.java:398)
...

or

SEVERE [global]
java.lang.NullPointerException: Cannot invoke "javax.swing.text.html.StyleSheet$BoxPainter.paint(java.awt.Graphics, float, float, float, float, javax.swing.text.View)" because "this.painter" is null
	at java.desktop/javax.swing.text.html.BlockView.paint(BlockView.java:281)
	at java.desktop/javax.swing.text.BoxView.paintChild(BoxView.java:162)
	at java.desktop/javax.swing.text.BoxView.paint(BoxView.java:434)
	at java.desktop/javax.swing.text.html.BlockView.paint(BlockView.java:282)
	at java.desktop/javax.swing.text.BoxView.paintChild(BoxView.java:162)
	at java.desktop/javax.swing.text.BoxView.paint(BoxView.java:434)
	at java.desktop/javax.swing.text.html.BlockView.paint(BlockView.java:282)
	at java.desktop/javax.swing.plaf.basic.BasicTextUI$RootView.paint(BasicTextUI.java:1535)
	at java.desktop/javax.swing.plaf.basic.BasicTextUI.paintSafely(BasicTextUI.java:754)
	at java.desktop/javax.swing.plaf.basic.BasicTextUI.paint(BasicTextUI.java:912)
	at java.desktop/javax.swing.plaf.basic.BasicTextUI.update(BasicTextUI.java:891)
	at java.desktop/javax.swing.JComponent.paintComponent(JComponent.java:852)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1128)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:961)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1137)
	at java.desktop/javax.swing.JViewport.paint(JViewport.java:736)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:961)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1137)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:961)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1137)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:961)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1137)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:961)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1137)
	at org.netbeans.swing.tabcontrol.TabbedContainer.paint(TabbedContainer.java:975)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:961)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1137)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:961)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1137)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:961)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1137)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:961)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1137)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:961)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1137)
	at java.desktop/javax.swing.JLayeredPane.paint(JLayeredPane.java:586)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:961)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1137)
	at java.desktop/javax.swing.JComponent.paintToOffscreen(JComponent.java:5324)
	at java.desktop/javax.swing.RepaintManager$PaintManager.paintDoubleBufferedImpl(RepaintManager.java:1599)
	at java.desktop/javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(RepaintManager.java:1574)
	at java.desktop/javax.swing.RepaintManager$PaintManager.paint(RepaintManager.java:1512)
	at java.desktop/javax.swing.RepaintManager.paint(RepaintManager.java:1279)
	at java.desktop/javax.swing.JComponent._paintImmediately(JComponent.java:5272)
	at java.desktop/javax.swing.JComponent.paintImmediately(JComponent.java:5082)
	at java.desktop/javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:825)
	at java.desktop/javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:788)
	at java.desktop/javax.swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:738)
	at java.desktop/javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1840)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:723)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:702)
	at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:136)
[catch] at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

mbien avatar Oct 15 '25 20:10 mbien