JDK-8128071 : Updating selected text in textfield throws exception
  • Type: Bug
  • Component: javafx
  • Sub-Component: graphics
  • Affected Version: fx2.0.2
  • Priority: P1
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2011-10-18
  • Updated: 2015-06-17
  • Resolved: 2011-10-18
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
fx2.0.2Fixed
Related Reports
Blocks :  
Description
The fix for Fix for RT-16386 caused a critical exception in typing into a selected text field. To reproduce this, run StockQuote or any other example with a text field. Select all of the text in the text field, and type a character. You will get the following exception:

Exception in thread "JavaFX Application Thread" java.lang.StringIndexOutOfBounds
Exception: String index out of range: 4
        at java.lang.String.substring(String.java:1934)
        at com.sun.javafx.sg.prism.NGText.getRangeShapeImpl(NGText.java:1849)
        at com.sun.javafx.sg.prism.NGText.getSelectionShape(NGText.java:1722)
        at com.sun.javafx.tk.quantum.PrismTextHelper.getSelectionShape(PrismTextHelper.java:53)
        at javafx.scene.text.Text.getDecorationShapes(Text.java:1021)
        at javafx.scene.text.Text.impl_geomChanged(Text.java:637)
        at javafx.scene.text.Text$1.invalidated(Text.java:159)
        at javafx.beans.property.StringPropertyBase.markInvalid(StringPropertyBase.java:86)
        at javafx.beans.property.StringPropertyBase.access$100(StringPropertyBase.java:26)
        at javafx.beans.property.StringPropertyBase$Listener.invalidated(StringPropertyBase.java:195)
        at com.sun.javafx.binding.ExpressionHelper$SingleInvalidation.fireValueChangedEvent(ExpressionHelper.java:140)
        at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:64)
        at javafx.beans.binding.StringBinding.invalidate(StringBinding.java:150)
        at com.sun.javafx.binding.BindingHelperObserver.invalidated(BindingHelperObserver.java:29)
        at com.sun.javafx.binding.ExpressionHelper$MultipleInvalidation.fireValueChangedEvent(ExpressionHelper.java:301)
        at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:64)
        at javafx.beans.binding.BooleanBinding.invalidate(BooleanBinding.java:150)
        at com.sun.javafx.binding.BindingHelperObserver.invalidated(BindingHelperObserver.java:29)
        at com.sun.javafx.binding.ExpressionHelper$MultipleInvalidation.fireValueChangedEvent(ExpressionHelper.java:301)
        at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:64)
        at javafx.scene.control.TextInputControl$TextProperty.fireValueChangedEvent(TextInputControl.java:965)
        at javafx.scene.control.TextInputControl$TextProperty.markInvalid(TextInputControl.java:969)
        at javafx.scene.control.TextInputControl$TextProperty.invalidate(TextInputControl.java:909)
        at javafx.scene.control.TextInputControl$TextProperty.access$100(TextInputControl.java:886)
        at javafx.scene.control.TextInputControl$1.invalidated(TextInputControl.java:88)
        at com.sun.javafx.binding.ExpressionHelper$SingleInvalidation.fireValueChangedEvent(ExpressionHelper.java:140)
        at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:64)
        at javafx.scene.control.TextField$TextFieldContent.insert(TextField.java:49)
        at javafx.scene.control.TextInputControl.replaceText(TextInputControl.java:317)
        at com.sun.javafx.scene.control.skin.TextFieldSkin.replaceText(TextFieldSkin.java:386)
        at com.sun.javafx.scene.control.behavior.TextFieldBehavior.replaceText(TextFieldBehavior.java:105)
        at com.sun.javafx.scene.control.behavior.TextInputControlBehavior.defaultKeyTyped(TextInputControlBehavior.java:164)
        at com.sun.javafx.scene.control.behavior.TextInputControlBehavior.callAction(TextInputControlBehavior.java:93)
        at com.sun.javafx.scene.control.behavior.BehaviorBase.callActionForEvent(BehaviorBase.java:144)
        at com.sun.javafx.scene.control.behavior.TextInputControlBehavior.callActionForEvent(TextInputControlBehavior.java:86)
        at com.sun.javafx.scene.control.behavior.BehaviorBase$1.handle(BehaviorBase.java:106)
        at com.sun.javafx.scene.control.behavior.BehaviorBase$1.handle(BehaviorBase.java:104)
        at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:56)
        at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:162)
        at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:115)
        at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:38)
        at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:37)
        at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
        at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
        at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
        at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:47)
        at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:33)
        at javafx.event.Event.fireEvent(Event.java:171)
        at javafx.scene.Scene$KeyHandler.process(Scene.java:2908)
        at javafx.scene.Scene$KeyHandler.access$1600(Scene.java:2838)
        at javafx.scene.Scene.impl_processKeyEvent(Scene.java:1410)
        at javafx.scene.Scene$ScenePeerListener.keyEvent(Scene.java:1841)
        at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleKeyEvent(GlassViewEventHandler.java:107)
        at com.sun.glass.ui.View.handleKeyEvent(View.java:274)
        at com.sun.glass.ui.View.notifyKey(View.java:569)
        at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
        at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29)
        at com.sun.glass.ui.win.WinApplication$2$1.run(WinApplication.java:62)
        at java.lang.Thread.run(Thread.java:662)

Comments
Verified on 2.0.2b07 with HelloTextField application.
09-11-2011

This was caused by the following changeset: changeset: 14667:abdcd065e693 description: Fix RT-16386: Implement highlight-text-fill and fixed by backing out the above changeset with the following changeset: changeset: 14690:d86da82048e5 parent: 14667:abdcd065e693 description: Backed out changeset abdcd065e693 RT-17483: The fix for RT-16386 caused a critical regression in TextField. Backing it out until this can be resolved.
18-10-2011