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

TextField: undoable property incorrectly set to true when the field gets the focus

XMLWordPrintable

    • generic
    • generic

      FULL PRODUCT VERSION :
      java version "1.8.0_131"
      Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
      Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Ubuntu 16.04 LTS (4.4.0-75-generic)

      A DESCRIPTION OF THE PROBLEM :
      The undoable property incorrectly changes to true when an empty text field gets the focus.


      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      To get a stack trace which can be of some help to track where the problem occurs, an exception is thrown and caught in the provided source code:

      java.lang.RuntimeException
      at com.test.Text.lambda$0(Text.java:30)
      at com.sun.javafx.binding.ExpressionHelper$SingleChange.fireValueChangedEvent(ExpressionHelper.java:182)
      at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:81)
      at javafx.beans.property.ReadOnlyBooleanPropertyBase.fireValueChangedEvent(ReadOnlyBooleanPropertyBase.java:72)
      at javafx.beans.property.ReadOnlyBooleanWrapper.fireValueChangedEvent(ReadOnlyBooleanWrapper.java:103)
      at javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:110)
      at javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:144)
      at javafx.scene.control.TextInputControl.updateUndoRedoState(TextInputControl.java:1154)
      at javafx.scene.control.TextInputControl.updateContent(TextInputControl.java:588)
      at javafx.scene.control.TextInputControl.selectRange(TextInputControl.java:1028)
      at com.sun.javafx.scene.control.behavior.TextFieldBehavior.lambda$new$186(TextFieldBehavior.java:82)
      at javafx.beans.value.WeakChangeListener.changed(WeakChangeListener.java:89)
      at com.sun.javafx.binding.ExpressionHelper$SingleChange.fireValueChangedEvent(ExpressionHelper.java:182)
      at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:81)
      at javafx.beans.property.ReadOnlyObjectPropertyBase.fireValueChangedEvent(ReadOnlyObjectPropertyBase.java:74)
      at javafx.beans.property.ReadOnlyObjectWrapper.fireValueChangedEvent(ReadOnlyObjectWrapper.java:102)
      at javafx.beans.property.ObjectPropertyBase.markInvalid(ObjectPropertyBase.java:112)
      at javafx.beans.property.ObjectPropertyBase.set(ObjectPropertyBase.java:146)
      at javafx.scene.Scene$KeyHandler.setFocusOwner(Scene.java:3924)
      at javafx.scene.Scene$KeyHandler.requestFocus(Scene.java:3971)
      at javafx.scene.Scene$KeyHandler.access$1900(Scene.java:3910)
      at javafx.scene.Scene.requestFocus(Scene.java:2044)
      at javafx.scene.Node.requestFocus(Node.java:7881)
      at com.sun.javafx.scene.traversal.TopMostTraversalEngine.focusAndNotify(TopMostTraversalEngine.java:110)
      at com.sun.javafx.scene.traversal.TopMostTraversalEngine.traverseToFirst(TopMostTraversalEngine.java:132)
      at javafx.scene.Scene.focusInitial(Scene.java:2014)
      at javafx.scene.Scene.access$3300(Scene.java:159)
      at javafx.scene.Scene$ScenePulseListener.focusCleanup(Scene.java:2364)
      at javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2385)
      at com.sun.javafx.tk.Toolkit.lambda$runPulse$30(Toolkit.java:355)
      at java.security.AccessController.doPrivileged(Native Method)
      at com.sun.javafx.tk.Toolkit.runPulse(Toolkit.java:354)
      at com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:381)
      at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:510)
      at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:490)
      at com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$404(QuantumToolkit.java:319)
      at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
      at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
      at com.sun.glass.ui.gtk.GtkApplication.lambda$null$49(GtkApplication.java:139)
      at java.lang.Thread.run(Thread.java:748)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public void start(Stage pStage) {
      final BorderPane pane = new BorderPane();
      final Scene scene = new Scene(pane);
      pStage.setScene(scene);

      TextField tf = new TextField();

      pane.setCenter(tf);

      tf.undoableProperty().addListener((pObs, pOldVal, pNewVal) -> {
      System.err.println("undoable property changed: " + tf.isUndoable());
      try {
      throw new RuntimeException();
      } catch (Exception e) {
      e.printStackTrace();
      }
      });

      pStage.show();
      }
      ---------- END SOURCE ----------

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: