Very sporadically (about four times a year) I noticed the following exception when loading lots of animated GIFs:
Caused by: java.lang.ArrayIndexOutOfBoundsException: 70
at com.sun.scenario.animation.AbstractMasterTimer.addPulseReceiver(AbstractMasterTimer.java:174)
at javafx.animation.Animation.addPulseReceiver(Animation.java:148)
at javafx.animation.Animation.startReceiver(Animation.java:154)
at javafx.animation.Animation.play(Animation.java:913)
at javafx.scene.image.Image$Animation.start(Image.java:895)
at javafx.scene.image.Image.initializeAnimatedImage(Image.java:862)
at javafx.scene.image.Image.finishImage(Image.java:822)
at javafx.scene.image.Image.initialize(Image.java:810)
at javafx.scene.image.Image.<init>(Image.java:707)
As apparently one cannot do anything wring with invoking an Image constructor, this rather looks like a bug inside of JavaFX than a user's fault. Unfortunately, due to the simplicitly of the invocation, and due to the very sporadic fail, it is rather impossible to provide more information or to set up a repeatable test case.
Possibly the fact that the image constructor is invoked in a background thread might cause the problem. An application programmer is not aware of the fact that the constructor of Image MUST run in the JFX thread, as the image is not part of the scene graph at that moment, but as a blocking operation is used to load the image, might like to use threads. AbstractMasterTimer is definitively not thread safe, so as a result, the Image constructor isn't, too. But the JavaDocs do not warn about this fact!
Caused by: java.lang.ArrayIndexOutOfBoundsException: 70
at com.sun.scenario.animation.AbstractMasterTimer.addPulseReceiver(AbstractMasterTimer.java:174)
at javafx.animation.Animation.addPulseReceiver(Animation.java:148)
at javafx.animation.Animation.startReceiver(Animation.java:154)
at javafx.animation.Animation.play(Animation.java:913)
at javafx.scene.image.Image$Animation.start(Image.java:895)
at javafx.scene.image.Image.initializeAnimatedImage(Image.java:862)
at javafx.scene.image.Image.finishImage(Image.java:822)
at javafx.scene.image.Image.initialize(Image.java:810)
at javafx.scene.image.Image.<init>(Image.java:707)
As apparently one cannot do anything wring with invoking an Image constructor, this rather looks like a bug inside of JavaFX than a user's fault. Unfortunately, due to the simplicitly of the invocation, and due to the very sporadic fail, it is rather impossible to provide more information or to set up a repeatable test case.
Possibly the fact that the image constructor is invoked in a background thread might cause the problem. An application programmer is not aware of the fact that the constructor of Image MUST run in the JFX thread, as the image is not part of the scene graph at that moment, but as a blocking operation is used to load the image, might like to use threads. AbstractMasterTimer is definitively not thread safe, so as a result, the Image constructor isn't, too. But the JavaDocs do not warn about this fact!