-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
8, 9
-
x86
-
other
FULL PRODUCT VERSION :
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) Client VM (build 25.121-b13, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [version 10.0.14393]
A DESCRIPTION OF THE PROBLEM :
If multiple ChangeListener are added to a non-map/list property (StringProperty for instance). Then all ChangeListener will be called if the value of the string property change. EVEN if one of them fails with an uncaught exception.
But in the case where multiple ChangeListener are added to a ListProperty (or MapProperty) if one of them fail then other listeners will not be called.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
- Instanciate a ListProperty
- Add two changeListener
- Throw an exception from the first one
- Check that the second one will not be called
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The second listener should be called, even if the previous one fails
ACTUAL -
The second listener is never called
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javafx.beans.property.ListProperty;
import javafx.beans.property.SimpleListProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.collections.FXCollections;
public class ListenerExceptionsTest {
private static class Project {
public ListProperty<String> listProperty = new SimpleListProperty<>(FXCollections.observableArrayList());
public StringProperty stringProperty = new SimpleStringProperty();
}
public static void main(String[] args) {
Project project = new Project();
project.listProperty.addListener((observable, oldValue, newValue) -> {
System.out.println("First list listener");
throw new NullPointerException();
});
project.listProperty.addListener((observable, oldValue, newValue) -> {
System.out.println("Second list listener");
});
project.listProperty.add("LIST_STRING");
project.stringProperty.addListener((observable, oldValue, newValue) -> {
System.out.println("First string listener");
throw new NullPointerException();
});
project.stringProperty.addListener((observable, oldValue, newValue) -> {
System.out.println("Second string listener");
});
project.stringProperty.set("STRING");
}
}
---------- END SOURCE ----------
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) Client VM (build 25.121-b13, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [version 10.0.14393]
A DESCRIPTION OF THE PROBLEM :
If multiple ChangeListener are added to a non-map/list property (StringProperty for instance). Then all ChangeListener will be called if the value of the string property change. EVEN if one of them fails with an uncaught exception.
But in the case where multiple ChangeListener are added to a ListProperty (or MapProperty) if one of them fail then other listeners will not be called.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
- Instanciate a ListProperty
- Add two changeListener
- Throw an exception from the first one
- Check that the second one will not be called
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The second listener should be called, even if the previous one fails
ACTUAL -
The second listener is never called
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javafx.beans.property.ListProperty;
import javafx.beans.property.SimpleListProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.collections.FXCollections;
public class ListenerExceptionsTest {
private static class Project {
public ListProperty<String> listProperty = new SimpleListProperty<>(FXCollections.observableArrayList());
public StringProperty stringProperty = new SimpleStringProperty();
}
public static void main(String[] args) {
Project project = new Project();
project.listProperty.addListener((observable, oldValue, newValue) -> {
System.out.println("First list listener");
throw new NullPointerException();
});
project.listProperty.addListener((observable, oldValue, newValue) -> {
System.out.println("Second list listener");
});
project.listProperty.add("LIST_STRING");
project.stringProperty.addListener((observable, oldValue, newValue) -> {
System.out.println("First string listener");
throw new NullPointerException();
});
project.stringProperty.addListener((observable, oldValue, newValue) -> {
System.out.println("Second string listener");
});
project.stringProperty.set("STRING");
}
}
---------- END SOURCE ----------
- duplicates
-
JDK-8088928 javafx.beans.property.SimpleMapProperty with multiple addListeners does not call them.
-
- Open
-