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

TextField.setText(null) is accepted, but leads to Exception when focusing

    XMLWordPrintable

    Details

      Description

      TextInputControl.setText(String text) accepts 'null' as parameter (consistently with documentation),
      but, unfortunately,
      java.com.sun.javafx.scene.control.skin.Utils.getHitInsertionIndex(HitInfo hit, String text)
      does NOT check for a null text and this leads to an exception when trying to focus the TextField (obviously this happens also with PasswordField):

      Exception in thread "JavaFX Application Thread" java.lang.NullPointerException
          at java.text.StringCharacterIterator.<init>(Unknown Source)
          at java.text.StringCharacterIterator.<init>(Unknown Source)
          at java.text.BreakIterator.setText(Unknown Source)
          at com.sun.javafx.scene.control.skin.Utils.getHitInsertionIndex(Unknown Source)
          at com.sun.javafx.scene.control.behavior.TextFieldBehavior.mousePressed(Unknown Source)
          at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(Unknown Source)
          at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(Unknown Source)
          at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(Unknown Source)
          at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unknown Source)
          at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
          at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
          at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(Unknown Source)
          at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
          at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
          at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
          at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
          at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
          at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
          at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
          at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
          at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
          at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
          at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
          at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
          at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
          at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
          at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
          at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
          at com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source)
          at com.sun.javafx.event.EventUtil.fireEvent(Unknown Source)
          at javafx.event.Event.fireEvent(Unknown Source)
          at javafx.scene.Scene$MouseHandler.process(Unknown Source)
          at javafx.scene.Scene$MouseHandler.process(Unknown Source)
          at javafx.scene.Scene$MouseHandler.access$1900(Unknown Source)
          at javafx.scene.Scene.impl_processMouseEvent(Unknown Source)
          at javafx.scene.Scene$ScenePeerListener.mouseEvent(Unknown Source)
          at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(Unknown Source)
          at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(Unknown Source)
          at java.security.AccessController.doPrivileged(Native Method)
          at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(Unknown Source)
          at com.sun.glass.ui.View.handleMouseEvent(Unknown Source)
          at com.sun.glass.ui.View.notifyMouse(Unknown Source)
          at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
          at com.sun.glass.ui.win.WinApplication.access$300(Unknown Source)
          at com.sun.glass.ui.win.WinApplication$3$1.run(Unknown Source)
          at java.lang.Thread.run(Unknown Source)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              leifs Leif Samuelsson (Inactive)
              Reporter:
              mcondareljfx Mauro Condarelli (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported: