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

ArrayIndexOutOfBoundsException: at javafx.graphics@24-ea/com.sun.javafx.text.PrismTextLayout.computeTrailingSpaceWidth(PrismTextLayout.java:981)

XMLWordPrintable

    • x86_64
    • linux_ubuntu

      ADDITIONAL SYSTEM INFORMATION :
      JDK 21 LTS
      JavaFx 24-ea+

      Operating System: Kubuntu 24.04
      KDE Plasma Version: 5.27.11
      KDE Frameworks Version: 5.115.0
      Qt Version: 5.15.13
      Kernel Version: 6.8.0-44-generic (64-bit)
      Graphics Platform: X11
      Processors: 4 × Intel® Core™ i5-6500 CPU @ 3.20GHz
      Memory: 23.2 GiB of RAM
      Graphics Processor: NVIDIA GeForce GTX 750 Ti/PCIe/SSE2
      Manufacturer: HP
      Product Name: HP EliteDesk 800 G2 TWR

      A DESCRIPTION OF THE PROBLEM :
      Exception when arabic text inside Label with setWrap(true) overflows parent width

      Exception in thread "JavaFX Application Thread" java.lang.ArrayIndexOutOfBoundsException: Index -2 out of bounds for length 18
              at javafx.graphics@24-ea/com.sun.javafx.text.PrismTextLayout.computeTrailingSpaceWidth(PrismTextLayout.java:981)
              at javafx.graphics@24-ea/com.sun.javafx.text.PrismTextLayout.layout(PrismTextLayout.java:1364)
              at javafx.graphics@24-ea/com.sun.javafx.text.PrismTextLayout.ensureLayout(PrismTextLayout.java:229)
              at javafx.graphics@24-ea/com.sun.javafx.text.PrismTextLayout.getBounds(PrismTextLayout.java:255)
              at javafx.controls@24-ea/com.sun.javafx.scene.control.skin.Utils.computeTextHeight(Utils.java:144)
              at javafx.controls@24-ea/javafx.scene.control.skin.LabeledSkinBase.computePrefHeight(LabeledSkinBase.java:388)
              at javafx.controls@24-ea/javafx.scene.control.Control.computePrefHeight(Control.java:581)
              at javafx.graphics@24-ea/javafx.scene.Parent.prefHeight(Parent.java:1041)
              at javafx.graphics@24-ea/javafx.scene.layout.Region.prefHeight(Region.java:1552)
              at javafx.graphics@24-ea/javafx.scene.layout.Region.computeChildPrefAreaHeight(Region.java:1993)
              at javafx.graphics@24-ea/javafx.scene.layout.VBox.getAreaHeights(VBox.java:451)
              at javafx.graphics@24-ea/javafx.scene.layout.VBox.layoutChildren(VBox.java:572)
              at javafx.graphics@24-ea/javafx.scene.Parent.layout(Parent.java:1208)
              at javafx.graphics@24-ea/javafx.scene.Scene.doLayoutPass(Scene.java:596)
              at javafx.graphics@24-ea/javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2603)
              at javafx.graphics@24-ea/com.sun.javafx.tk.Toolkit.lambda$runPulse$2(Toolkit.java:401)
              at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
              at javafx.graphics@24-ea/com.sun.javafx.tk.Toolkit.runPulse(Toolkit.java:400)
              at javafx.graphics@24-ea/com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:430)
              at javafx.graphics@24-ea/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:598)
              at javafx.graphics@24-ea/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:578)
              at javafx.graphics@24-ea/com.sun.javafx.tk.quantum.QuantumToolkit.pulseFromQueue(QuantumToolkit.java:571)
              at javafx.graphics@24-ea/com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$11(QuantumToolkit.java:352)
              at javafx.graphics@24-ea/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
              at javafx.graphics@24-ea/com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
              at javafx.graphics@24-ea/com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$10(GtkApplication.java:264)
              at java.base/java.lang.Thread.run(Thread.java:1583)

      REGRESSION : Last worked in version 22.0.2

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Make a label with wrapText=true and text=arabic(RTL) text.
          Label label = new Label("مثال علي كلام باللغه العربيه");
          label.setWrapText(true);

      2. Put the label inside a scene and show the stage.
      3. Resize the window so the text overflows it.
      4. Exception breaks window ui and nothing becomes usable.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Text wraps correctly
      ACTUAL -
      Exception breaks window ui and nothing becomes usable.

      ---------- BEGIN SOURCE ----------
      package com.example;

      import javafx.application.Application;
      import javafx.geometry.NodeOrientation;
      import javafx.scene.Scene;
      import javafx.scene.control.Label;
      import javafx.stage.Stage;

      public class App extends Application {

          private static Scene scene;

          @Override
          public void start(Stage stage) throws IOException {
              Label label = new Label("مثال علي كلام باللغه العربيه");
              label.setWrapText(true);

              scene = new Scene(label, 640, 480);
              stage.setScene(scene);
              stage.show();
          }

          public static void main(String[] args) {
              launch();
          }

      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      none, using english letters doesn't produce the problem

      FREQUENCY : always


        1. Frame.png
          6 kB
          Anupam Dev
        2. Test.java
          0.6 kB
          Anupam Dev

            adev Anupam Dev
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: