changeset 9556:b58c02e7cae3 jdk-9+105

8147824: ClassCastException when unbinding observable lists
author vadim
date Fri, 05 Feb 2016 14:32:02 +0300
parents 8b632e2aae57
children 53ea5fc30179 2a8dfca75f1d
files modules/base/src/main/java/com/sun/javafx/binding/BidirectionalBinding.java modules/base/src/test/java/test/com/sun/javafx/binding/BidirectionalContentBindingListTest.java
diffstat 2 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/modules/base/src/main/java/com/sun/javafx/binding/BidirectionalBinding.java	Thu Feb 04 09:56:32 2016 -0800
+++ b/modules/base/src/main/java/com/sun/javafx/binding/BidirectionalBinding.java	Fri Feb 05 14:32:02 2016 +0300
@@ -104,7 +104,7 @@
         if (property1 instanceof ObservableValue) {
             ((ObservableValue) property1).removeListener(binding);
         }
-        if (property2 instanceof Observable) {
+        if (property2 instanceof ObservableValue) {
             ((ObservableValue) property2).removeListener(binding);
         }
     }
--- a/modules/base/src/test/java/test/com/sun/javafx/binding/BidirectionalContentBindingListTest.java	Thu Feb 04 09:56:32 2016 -0800
+++ b/modules/base/src/test/java/test/com/sun/javafx/binding/BidirectionalContentBindingListTest.java	Fri Feb 05 14:32:02 2016 +0300
@@ -279,4 +279,10 @@
         op1.set(0, 1);
         assertEquals(1, op2.get(0).intValue());
     }
+
+    @Test
+    public void testUnbindWrongMethod() {
+        Bindings.bindContentBidirectional(op1, op2);
+        Bindings.unbindBidirectional(op1, op2);
+    }
 }