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

StringIndexOutOfBoundsException in Labeled control

    Details

      Description

      The following code produces StringIndexOutOfBoundsException:

      {code}
      def label = javafx.scene.control.Label {
          textOverrun: javafx.scene.control.OverrunStyle.CLIP
      }

      def button = javafx.scene.control.Button {
          layoutY: 50.0
          action: function ():Void {
              label.text = "Ne B 1";
          }
      }

      javafx.stage.Stage {
          scene: javafx.scene.Scene {
              width: 100.0
              height: 100.0
              content: [ label, button ]
          }
      }
      {code}

      If run, the "label" is clipped to text "Ne1" and an exception is shown on console:

      java.lang.StringIndexOutOfBoundsException: String index out of range: -1
              at java.lang.String.charAt(String.java:686)
              at com.sun.javafx.scene.control.skin.Utils.computeClippedText(Utils.fx:189)
              at com.sun.javafx.scene.control.skin.LabelSkin$1BFunc$137.get$$bFuncRes$(LabelSkin.fx:296)
              at com.sun.javafx.scene.control.skin.LabelSkin$1BFunc$137.get$(LabelSkin.fx:296)
              at com.sun.javafx.runtime.Pointer.get(Pointer.java:88)
              at com.sun.javafx.scene.control.skin.LabelSkin.get$displayedText(LabelSkin.fx:24)
              at com.sun.javafx.scene.control.skin.LabelSkin.invalidate$displayedText(LabelSkin.fx:24)
              at com.sun.javafx.scene.control.skin.LabelSkin.update$(LabelSkin.fx:24)
              at com.sun.javafx.runtime.DependentsManager.notifyDependents(DependentsManager.java:100)
              at com.sun.javafx.runtime.FXBase.notifyDependents$(FXBase.java:211)
              at com.sun.javafx.runtime.FXBase.notifyDependents$(FXBase.java:207)
              at com.sun.javafx.scene.control.skin.LabelSkin$1BFunc$137.invalidate$$bFuncRes$(LabelSkin.fx:296)
              at com.sun.javafx.scene.control.skin.LabelSkin$1BFunc$137.invalidate$_$A2(LabelSkin.fx:296)
              at com.sun.javafx.scene.control.skin.LabelSkin$1BFunc$137.update$(LabelSkin.fx:296)
              at com.sun.javafx.runtime.DependentsManager.notifyDependents(DependentsManager.java:100)
              at com.sun.javafx.runtime.FXBase.notifyDependents$(FXBase.java:211)
              at com.sun.javafx.runtime.FXBase.notifyDependents$(FXBase.java:207)
              at javafx.scene.control.Labeled.invalidate$text(Labeled.fx:60)
              at javafx.scene.control.Label.invalidate$text(Label.fx:50)
              at javafx.scene.control.Labeled.set$text(Labeled.fx:60)
              at javafx.scene.control.Label.set$text(Label.fx:50)
              at desktopapplication17.NewJavaFXEmpty$NewJavaFXEmpty$Script.invoke$(NewJavaFXEmpty.fx:10)
              at desktopapplication17.NewJavaFXEmpty$NewJavaFXEmpty$Script.invoke$(NewJavaFXEmpty.fx:10)
              at com.sun.javafx.functions.Function0.invoke(Function0.java:44)
              at com.sun.javafx.functions.Function0.invoke$(Function0.java:38)
              at javafx.scene.control.Button.fire(Button.fx:80)
              at com.sun.javafx.scene.control.behavior.ButtonBehavior.keyReleased(ButtonBehavior.fx:181)
              at com.sun.javafx.scene.control.behavior.ButtonBehavior.callAction(ButtonBehavior.fx:69)
              at com.sun.javafx.scene.control.behavior.BehaviorBase.callActionForEvent(BehaviorBase.fx:152)
              at javafx.scene.control.Control.impl_processKeyEvent(Control.fx:163)
              at javafx.scene.Scene$KeyHandler.process(Scene.fx:1620)
              at javafx.scene.Scene.impl_processKeyEvent(Scene.fx:730)
              at javafx.scene.Scene$ScenePeerListener.keyEvent(Scene.fx:960)
              at com.sun.javafx.tk.swing.SwingScene$SwingScenePanel.doKeyEvent(SwingScene.java:488)
              at com.sun.javafx.tk.swing.SwingScene$SwingScenePanel.keyReleased(SwingScene.java:496)
              at java.awt.Component.processKeyEvent(Component.java:6224)
              at javax.swing.JComponent.processKeyEvent(JComponent.java:2801)
              at java.awt.Component.processEvent(Component.java:6040)
              at java.awt.Container.processEvent(Container.java:2041)
              at java.awt.Component.dispatchEventImpl(Component.java:4630)
              at java.awt.Container.dispatchEventImpl(Container.java:2099)
              at java.awt.Component.dispatchEvent(Component.java:4460)
              at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1848)
              at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:704)
              at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:969)
              at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:841)
              at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:668)
              at java.awt.Component.dispatchEventImpl(Component.java:4502)
              at java.awt.Container.dispatchEventImpl(Container.java:2099)
              at java.awt.Window.dispatchEventImpl(Window.java:2475)
              at java.awt.Component.dispatchEvent(Component.java:4460)
              at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
              at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
              at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
              at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
              at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

      This issue was originally filed as a part of RT-8260.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                naoto Naoto Sato
                Reporter:
                dkasparjfx David Kaspar (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported: