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

Bindings unbindContent fails silently if arguments in wrong order

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • jfx20
    • javafx
    • None

      When binding an observable list to a normal list, and then removing the binding later with Bindings#unbindContent, the arguments must be in a specific order, even though unbindContent makes no such assertions. Providing them in the "wrong" order fails silently and the binding persists.

      The issue was found in modules/javafx.base/src/main/java/com/sun/javafx/binding/ContentBinding.java where it expects the arguments to be in a certain order.

      Sample program:

      ```
          public static void main(String[] args) {
              ObservableList<String> l = FXCollections.observableArrayList();
              List<String> x = new ArrayList<>();

              Bindings.bindContent(x, l);
              Bindings.unbindContent(l, x);

              l.add("A");

              System.out.println(x);
          }
      ```
      This will still modify the array list x, even though it shouldn't.

            jhendrikx John Hendrikx
            jhendrikx John Hendrikx
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: