NullPointer this.layoutCache is null

Krishna Kumar kumaranbus at hotmail.com
Thu Feb 29 07:16:06 UTC 2024


I am encountering the following Null Pointer exception during runtime, however the application keeps working as intended.

Exception posted at the end to declutter the mail.

Google search for this exception took me to this thread

https://mail.openjdk.org/pipermail/openjfx-dev/2023-December/044343.html

but in my case the JVM doesn't crash, neither does the application crash. The application continues to work as intended. I am unable to identify the node that causes this as the stack trace doesn't originate from the Application code, could anyone throw some light. I am running the code on  /usr/lib/jvm/bellsoft-java21-full-amd64/bin/java


tion in thread "JavaFX Application Thread" java.lang.NullPointerException: Cannot read field "advances" because "this.layoutCache" is null
        at javafx.graphics/com.sun.javafx.text.PrismTextLayout.shape(PrismTextLayout.java:919)
        at javafx.graphics/com.sun.javafx.text.PrismTextLayout.layout(PrismTextLayout.java:1113)
        at javafx.graphics/com.sun.javafx.text.PrismTextLayout.ensureLayout(PrismTextLayout.java:230)
        at javafx.graphics/com.sun.javafx.text.PrismTextLayout.getBounds(PrismTextLayout.java:256)
        at javafx.graphics/javafx.scene.text.Text.getLogicalBounds(Text.java:432)
        at javafx.graphics/javafx.scene.text.Text.doComputeLayoutBounds(Text.java:1137)
        at javafx.graphics/javafx.scene.text.Text$1.doComputeLayoutBounds(Text.java:143)
        at javafx.graphics/com.sun.javafx.scene.shape.TextHelper.computeLayoutBoundsImpl(TextHelper.java:95)
        at javafx.graphics/com.sun.javafx.scene.NodeHelper.computeLayoutBounds(NodeHelper.java:108)
        at javafx.graphics/javafx.scene.Node$13.computeBounds(Node.java:3474)
        at javafx.graphics/javafx.scene.Node$LazyBoundsProperty.get(Node.java:9749)
        at javafx.graphics/javafx.scene.Node$LazyBoundsProperty.get(Node.java:9740)
        at javafx.graphics/javafx.scene.Node.getLayoutBounds(Node.java:3489)
        at javafx.graphics/javafx.scene.Node.prefWidth(Node.java:2989)
        at javafx.graphics/javafx.scene.Node.minWidth(Node.java:2930)
        at javafx.graphics/javafx.scene.layout.Region.computeChildMinAreaWidth(Region.java:1898)
        at javafx.graphics/javafx.scene.layout.HBox.getAreaWidths(HBox.java:462)
        at javafx.graphics/javafx.scene.layout.HBox.computeContentWidth(HBox.java:549)
        at javafx.graphics/javafx.scene.layout.HBox.computeMinWidth(HBox.java:409)
        at javafx.graphics/javafx.scene.Parent.minWidth(Parent.java:1049)
        at javafx.graphics/javafx.scene.layout.Region.minWidth(Region.java:1500)
        at javafx.graphics/javafx.scene.layout.Region.computeChildMinAreaWidth(Region.java:1898)
        at javafx.graphics/javafx.scene.layout.Region.getMaxAreaWidth(Region.java:2227)
        at javafx.graphics/javafx.scene.layout.Region.computeMaxMinAreaWidth(Region.java:2064)
        at javafx.graphics/javafx.scene.layout.VBox.computeMinWidth(VBox.java:399)
        at javafx.graphics/javafx.scene.Parent.minWidth(Parent.java:1049)
        at javafx.graphics/javafx.scene.layout.Region.minWidth(Region.java:1500)
        at javafx.graphics/javafx.scene.layout.Region.computeChildMinAreaWidth(Region.java:1898)
        at javafx.graphics/javafx.scene.layout.HBox.getAreaWidths(HBox.java:462)
        at javafx.graphics/javafx.scene.layout.HBox.computeContentWidth(HBox.java:549)
        at javafx.graphics/javafx.scene.layout.HBox.computeMinWidth(HBox.java:409)
        at javafx.graphics/javafx.scene.Parent.minWidth(Parent.java:1049)
        at javafx.graphics/javafx.scene.layout.Region.minWidth(Region.java:1500)
        at javafx.graphics/javafx.scene.layout.Region.computeChildMinAreaWidth(Region.java:1898)
        at javafx.graphics/javafx.scene.layout.Region.getMaxAreaWidth(Region.java:2227)
        at javafx.graphics/javafx.scene.layout.Region.computeMaxMinAreaWidth(Region.java:2064)
        at javafx.graphics/javafx.scene.layout.VBox.computeMinWidth(VBox.java:399)
        at javafx.graphics/javafx.scene.Parent.minWidth(Parent.java:1049)
        at javafx.graphics/javafx.scene.layout.Region.minWidth(Region.java:1500)
        at javafx.graphics/javafx.scene.layout.Region.computeChildMinAreaWidth(Region.java:1898)
        at javafx.graphics/javafx.scene.layout.HBox.getAreaWidths(HBox.java:462)
        at javafx.graphics/javafx.scene.layout.HBox.computeContentWidth(HBox.java:549)
        at javafx.graphics/javafx.scene.layout.HBox.computeMinWidth(HBox.java:409)
        at javafx.graphics/javafx.scene.Parent.minWidth(Parent.java:1049)
        at javafx.graphics/javafx.scene.layout.Region.minWidth(Region.java:1500)
        at javafx.graphics/javafx.scene.layout.Region.computeChildPrefAreaWidth(Region.java:1959)
        at javafx.graphics/javafx.scene.layout.Region.getMaxAreaWidth(Region.java:2228)
        at javafx.graphics/javafx.scene.layout.Region.computeMaxPrefAreaWidth(Region.java:2092)
        at javafx.graphics/javafx.scene.layout.VBox.computePrefWidth(VBox.java:420)
        at javafx.graphics/javafx.scene.Parent.prefWidth(Parent.java:1021)
        at javafx.graphics/javafx.scene.layout.Region.prefWidth(Region.java:1536)
        at javafx.graphics/javafx.scene.Node.autosize(Node.java:3138)
        at javafx.graphics/javafx.scene.Parent.layoutChildren(Parent.java:1239)
        at javafx.graphics/javafx.scene.Parent.layout(Parent.java:1208)
        at javafx.graphics/javafx.scene.Scene.doLayoutPass(Scene.java:594)
        at javafx.graphics/javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2600)
        at javafx.graphics/com.sun.javafx.tk.Toolkit.lambda$runPulse$2(Toolkit.java:401)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
        at javafx.graphics/com.sun.javafx.tk.Toolkit.runPulse(Toolkit.java:400)
        at javafx.graphics/com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:430)
        at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:592)
        at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:572)
        at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulseFromQueue(QuantumToolkit.java:565)
        at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$11(QuantumToolkit.java:352)
        at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
        at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
        at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$10(GtkApplication.java:263)
        at java.base/java.lang.Thread.run(Thread.java:1583)


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20240229/e5a21b4a/attachment-0001.htm>


More information about the openjfx-dev mailing list