Ich habe eine ziemlich große JavaFX-Anwendung, die die meiste Zeit gut funktioniert. Manchmal bekomme ich jedoch zufällige ArrayIndexOutOfBoundsExceptions, wenn ich durch die Anwendung klicke. Ich kann die Fehler nicht reproduzieren und weiß nicht, wann sie angezeigt werden: Manchmal kann ich problemlos durch die Anwendung klicken und manchmal stürzt die App ab und der Stacktrace erscheint.Random ArrayIndexOutOfBoundsException in JavaFX-Anwendung
Exception in thread "JavaFX Application Thread" java.lang.ArrayIndexOutOfBoundsException: -1
at java.util.ArrayList.elementData(ArrayList.java:418)
at java.util.ArrayList.get(ArrayList.java:431)
at javafx.scene.Parent.updateCachedBounds(Parent.java:1591)
at javafx.scene.Parent.recomputeBounds(Parent.java:1535)
at javafx.scene.Parent.impl_computeGeomBounds(Parent.java:1388)
at javafx.scene.layout.Region.impl_computeGeomBounds(Region.java:3078)
at javafx.scene.Node.updateGeomBounds(Node.java:3577)
at javafx.scene.Node.getGeomBounds(Node.java:3530)
at javafx.scene.Node.getLocalBounds(Node.java:3478)
at javafx.scene.Node.updateTxBounds(Node.java:3641)
at javafx.scene.Node.getTransformedBounds(Node.java:3424)
at javafx.scene.Node.updateBounds(Node.java:559)
at javafx.scene.Parent.updateBounds(Parent.java:1719)
at javafx.scene.Parent.updateBounds(Parent.java:1717)
at javafx.scene.Parent.updateBounds(Parent.java:1717)
at javafx.scene.Parent.updateBounds(Parent.java:1717)
at javafx.scene.Parent.updateBounds(Parent.java:1717)
at javafx.scene.Parent.updateBounds(Parent.java:1717)
at javafx.scene.Parent.updateBounds(Parent.java:1717)
at javafx.scene.Parent.updateBounds(Parent.java:1717)
at javafx.scene.Parent.updateBounds(Parent.java:1717)
at javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2404)
at com.sun.javafx.tk.Toolkit.lambda$runPulse$30(Toolkit.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.tk.Toolkit.runPulse(Toolkit.java:354)
at com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:381)
at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:510)
at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:490)
at com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$404(QuantumToolkit.java:319)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
at java.lang.Thread.run(Thread.java:745)
Wenn die Stacktrace zu lesen, das einzige, was meine Aufmerksamkeit erregt ist, dass der Fehler auch in einige meinen Code nicht geschieht. Kennt jemand von euch solche Probleme und hat eine Idee, wo ich anfangen könnte zu untersuchen oder was könnte dieses Problem verursachen?
ich es auf JDK 1.8.0_74 versucht (Windows 8.1 x64), JDK 1.8.0_77 (Windows 8.1 x64) und JDK 1.8.0_91 (O X 10.11)
Aktualisieren Sie die ui von einem anderen Thread als dem Anwendungsthread. In den letzten Tagen gab es einige ähnliche Probleme, die mit der Aktualisierung der Benutzeroberfläche aus dem falschen Thread zusammenhingen. – fabian
Sie haben eine entsprechende Stacktrace hier http://StackOverflow.com/Questions/19769896/Unexpected-ArrayIndexOutofBoundException-in-Javafx-Application-Refering-to-No vielleicht kann es helfen herauszufinden, was los ist –
Vielleicht würde eine Ausnahme Breakpoint helfen Sie können durch jeden Frame im Stack springen und Variablen und Felder analysieren, um die Wurzel des Problems zu finden. – Caelum