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

"A bound value cannot be set" when autoMoving node from BorderPane

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • 9
    • 8u40
    • javafx
    • x86_64
    • windows_7

      FULL PRODUCT VERSION :
      java version "1.8.0_20"
      Java(TM) SE Runtime Environment (build 1.8.0_20-b26)
      Java HotSpot(TM) Client VM (build 25.20-b23, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]

      A DESCRIPTION OF THE PROBLEM :
      AutoMove of a node bound to a BorderPositionProperty to somewhere else in the scene graph leads to RuntimeException "A bound value cannot be set"

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Bind a centerProperty (or any other BorderPositionProperty) of a BorderPane to a Property with a node
      2. Add the node somewhere else in the scene graph

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      No runtime exception, the node is moved from the BorderPane to its new place in the scene graph
      ACTUAL -
      A runtime exception as seen in the crash log

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: A bound value cannot be set.
      at javafx.beans.property.ObjectPropertyBase.set(ObjectPropertyBase.java:141)
      at javafx.scene.layout.BorderPane$BorderPositionProperty$1.onChanged(BorderPane.java:657)
      at com.sun.javafx.collections.ListListenerHelper$Generic.fireValueChangedEvent(ListListenerHelper.java:329)
      at com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:73)
      at com.sun.javafx.collections.VetoableListDecorator.lambda$new$22(VetoableListDecorator.java:76)
      at com.sun.javafx.collections.VetoableListDecorator$$Lambda$58/2440711.onChanged(Unknown Source)
      at com.sun.javafx.collections.ListListenerHelper$Generic.fireValueChangedEvent(ListListenerHelper.java:329)
      at com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:73)
      at javafx.collections.ObservableListBase.fireChange(ObservableListBase.java:233)
      at javafx.collections.ListChangeBuilder.commit(ListChangeBuilder.java:482)
      at javafx.collections.ListChangeBuilder.endChange(ListChangeBuilder.java:541)
      at javafx.collections.ObservableListBase.endChange(ObservableListBase.java:205)
      at javafx.collections.ModifiableObservableListBase.remove(ModifiableObservableListBase.java:183)
      at com.sun.javafx.collections.VetoableListDecorator.remove(VetoableListDecorator.java:332)
      at com.sun.javafx.collections.VetoableListDecorator.remove(VetoableListDecorator.java:221)
      at javafx.scene.Parent$1.onChanged(Parent.java:248)
      at com.sun.javafx.collections.TrackableObservableList.lambda$new$20(TrackableObservableList.java:45)
      at com.sun.javafx.collections.TrackableObservableList$$Lambda$53/9144295.onChanged(Unknown Source)
      at com.sun.javafx.collections.ListListenerHelper$Generic.fireValueChangedEvent(ListListenerHelper.java:329)
      at com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:73)
      at javafx.collections.ObservableListBase.fireChange(ObservableListBase.java:233)
      at javafx.collections.ListChangeBuilder.commit(ListChangeBuilder.java:482)
      at javafx.collections.ListChangeBuilder.endChange(ListChangeBuilder.java:541)
      at javafx.collections.ObservableListBase.endChange(ObservableListBase.java:205)
      at javafx.collections.ModifiableObservableListBase.add(ModifiableObservableListBase.java:155)
      at java.util.AbstractList.add(AbstractList.java:108)
      at com.sun.javafx.collections.VetoableListDecorator.add(VetoableListDecorator.java:209)
      at javafx.scene.layout.BorderPane$BorderPositionProperty.invalidated(BorderPane.java:680)
      at javafx.beans.property.ObjectPropertyBase.markInvalid(ObjectPropertyBase.java:111)
      at javafx.beans.property.ObjectPropertyBase.set(ObjectPropertyBase.java:145)
      at javafx.scene.layout.BorderPane.setCenter(BorderPane.java:260)
      at BorderPaneCenterBindingBug.start(BorderPaneCenterBindingBug.java:31)
      at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$153(LauncherImpl.java:821)
      at com.sun.javafx.application.LauncherImpl$$Lambda$50/574481.run(Unknown Source)
      at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$166(PlatformImpl.java:323)
      at com.sun.javafx.application.PlatformImpl$$Lambda$46/23110676.run(Unknown Source)
      at com.sun.javafx.application.PlatformImpl.lambda$null$164(PlatformImpl.java:292)
      at com.sun.javafx.application.PlatformImpl$$Lambda$48/32741295.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at com.sun.javafx.application.PlatformImpl.lambda$runLater$165(PlatformImpl.java:291)
      at com.sun.javafx.application.PlatformImpl$$Lambda$47/8040861.run(Unknown Source)
      at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
      at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
      at com.sun.glass.ui.win.WinApplication.lambda$null$141(WinApplication.java:102)
      at com.sun.glass.ui.win.WinApplication$$Lambda$38/188653.run(Unknown Source)
      at java.lang.Thread.run(Thread.java:745)


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javafx.application.Application;
      import javafx.beans.property.SimpleObjectProperty;
      import javafx.scene.Node;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.layout.BorderPane;
      import javafx.stage.Stage;

      public class BorderPaneCenterBindingBug extends Application {

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

          @Override
          public void start(Stage primaryStage) {
              BorderPane borderPane1 = new BorderPane();
              BorderPane borderPane2 = new BorderPane();
              BorderPane rootPane = new BorderPane();
              rootPane.setLeft(borderPane1);
              rootPane.setRight(borderPane2);

              Button contentToMove = new Button("x");
              borderPane1.centerProperty().bind(new SimpleObjectProperty<Node>(contentToMove));

              primaryStage.setScene(new Scene(rootPane));
              primaryStage.show();

              borderPane2.setCenter(contentToMove);
          }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Workaround is not to bind to centerProperty, topProperty, bottomProperty, leftProperty and rightProperty of BorderPane.

      The fix would be to add this line before the set(null) in line 657 of BorderPane:

      unbind();

            ckyang Chien Yang (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: