-
Bug
-
Resolution: Fixed
-
P3
-
fx2.1
-
mac, windows
Our apps/internal HenleyHOL code is made up of FXML and code that uses JavaFX Service and Task. We have a ProgressIndicator in the FXML:
<GridPane xmlns:fx="http://javafx.com/fxml" fx:controller="henleyclient.SalesForm" hgap="10" vgap="10">
<padding><Insets top="10" right="10" bottom="10" left="10"/></padding>
<columnConstraints>
...
</columnConstraints>
<children>
<Label text="Product:" GridPane.columnIndex="0" GridPane.rowIndex="0"/>
<ChoiceBox fx:id="productsChoiceBox" GridPane.columnIndex="2" GridPane.rowIndex="0"/>
<ProgressIndicator fx:id="productsProgress" maxWidth="16" maxHeight="16" GridPane.columnIndex="3" GridPane.rowIndex="0"/>
...
In the controller we have:
...
@FXML private ChoiceBox<Product> productsChoiceBox;
@FXML private ProgressIndicator productsProgress;
...
@Override
public void initialize(URL url, ResourceBundle rb) {
// update states choice box when region changes
...
// fetch list of products in background
final Task<List<Product>> getProductsTask = new Task<List<Product>>() {
@Override protected List<Product> call() throws Exception {
//Code to fetch and return a List<Product> here...
}
};
getProductsTask.stateProperty().addListener(new ChangeListener<Worker.State>() {
@Override public void changed(ObservableValue<? extends State> ov, State oldState, State newState) {
if (newState == Worker.State.SUCCEEDED) {
...
productsProgress.setVisible(false); // <====This statement causes an NPE and the stack trace below
}
}
});
new Thread(getProductsTask).start();
java.lang.NullPointerException
at com.sun.javafx.scene.control.skin.ProgressIndicatorSkin.layoutChildren(ProgressIndicatorSkin.java:193)
at javafx.scene.Parent.layout(Parent.java:932)
at javafx.scene.Parent.layout(Parent.java:942)
at javafx.scene.Parent.layout(Parent.java:942)
at javafx.scene.Parent.layout(Parent.java:942)
at javafx.scene.Scene.layoutDirtyRoots(Scene.java:495)
at javafx.scene.Scene.doLayoutPass(Scene.java:468)
at javafx.scene.Scene.access$3000(Scene.java:154)
at javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:1866)
at com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:357)
at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:459)
at com.sun.javafx.tk.quantum.QuantumToolkit$8.run(QuantumToolkit.java:326)
This code used to work with JavaFX 2.1 up until roughly a week or two ago.
<GridPane xmlns:fx="http://javafx.com/fxml" fx:controller="henleyclient.SalesForm" hgap="10" vgap="10">
<padding><Insets top="10" right="10" bottom="10" left="10"/></padding>
<columnConstraints>
...
</columnConstraints>
<children>
<Label text="Product:" GridPane.columnIndex="0" GridPane.rowIndex="0"/>
<ChoiceBox fx:id="productsChoiceBox" GridPane.columnIndex="2" GridPane.rowIndex="0"/>
<ProgressIndicator fx:id="productsProgress" maxWidth="16" maxHeight="16" GridPane.columnIndex="3" GridPane.rowIndex="0"/>
...
In the controller we have:
...
@FXML private ChoiceBox<Product> productsChoiceBox;
@FXML private ProgressIndicator productsProgress;
...
@Override
public void initialize(URL url, ResourceBundle rb) {
// update states choice box when region changes
...
// fetch list of products in background
final Task<List<Product>> getProductsTask = new Task<List<Product>>() {
@Override protected List<Product> call() throws Exception {
//Code to fetch and return a List<Product> here...
}
};
getProductsTask.stateProperty().addListener(new ChangeListener<Worker.State>() {
@Override public void changed(ObservableValue<? extends State> ov, State oldState, State newState) {
if (newState == Worker.State.SUCCEEDED) {
...
productsProgress.setVisible(false); // <====This statement causes an NPE and the stack trace below
}
}
});
new Thread(getProductsTask).start();
java.lang.NullPointerException
at com.sun.javafx.scene.control.skin.ProgressIndicatorSkin.layoutChildren(ProgressIndicatorSkin.java:193)
at javafx.scene.Parent.layout(Parent.java:932)
at javafx.scene.Parent.layout(Parent.java:942)
at javafx.scene.Parent.layout(Parent.java:942)
at javafx.scene.Parent.layout(Parent.java:942)
at javafx.scene.Scene.layoutDirtyRoots(Scene.java:495)
at javafx.scene.Scene.doLayoutPass(Scene.java:468)
at javafx.scene.Scene.access$3000(Scene.java:154)
at javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:1866)
at com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:357)
at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:459)
at com.sun.javafx.tk.quantum.QuantumToolkit$8.run(QuantumToolkit.java:326)
This code used to work with JavaFX 2.1 up until roughly a week or two ago.
- duplicates
-
JDK-8118708 NullPointerException in ProgressIndicatorSkin
- Closed