New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FX2D does not have exception handler #4339

Closed
HostileRobot opened this Issue Feb 28, 2016 · 6 comments

Comments

Projects
None yet
2 participants
@HostileRobot

HostileRobot commented Feb 28, 2016

Hello,
When attempting to run my sketch, everything seems to work fine, but about 5 seconds later, I am greeted with a crash coupled with the following error message:

Exception in thread "JavaFX Application Thread" java.util.ConcurrentModificationException
at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:901)
at java.util.ArrayList$Itr.next(ArrayList.java:851)
at EvolutionSimulator.draw(EvolutionSimulator.java:42)
at processing.core.PApplet.handleDraw(PApplet.java:2402)
at processing.javafx.PSurfaceFX$1.handle(PSurfaceFX.java:75)
at processing.javafx.PSurfaceFX$1.handle(PSurfaceFX.java:1)
at com.sun.scenario.animation.shared.TimelineClipCore.visitKeyFrame(TimelineClipCore.java:239)
at com.sun.scenario.animation.shared.TimelineClipCore.playTo(TimelineClipCore.java:197)
at javafx.animation.Timeline.impl_playTo(Timeline.java:176)
at javafx.animation.AnimationAccessorImpl.playTo(AnimationAccessorImpl.java:39)
at com.sun.scenario.animation.shared.InfiniteClipEnvelope.timePulse(InfiniteClipEnvelope.java:126)
at javafx.animation.Animation.impl_timePulse(Animation.java:1102)
at javafx.animation.Animation$1.lambda$timePulse$25(Animation.java:186)
at java.security.AccessController.doPrivileged(Native Method)
at javafx.animation.Animation$1.timePulse(Animation.java:185)
at com.sun.scenario.animation.AbstractMasterTimer.timePulseImpl(AbstractMasterTimer.java:344)
at com.sun.scenario.animation.AbstractMasterTimer$MainLoop.run(AbstractMasterTimer.java:267)
at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:506)
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)
handleDraw() called before finishing
Could not run the sketch (Target VM failed to initialize).
For more information, read revisions.txt and Help ? Troubleshooting.

I have a general suspicion of what's causing it, but I can't really say for sure why it's happening, as the error points to a non-existent line in my code(EvolutionSimulator.java:42 while my file is only 37 lines long).

I have attempted to switch renderer(from FX2D), but both JAVA2D and P2D just plain out stop responding without any error messages.

I will be happy to supply any other information needed upon request.

Cheers.
(Sorry for bad English, I'm not from the U.S.)

@JakubValtar

This comment has been minimized.

Show comment
Hide comment
@JakubValtar

JakubValtar Feb 29, 2016

Contributor

Can you please post your code?

Contributor

JakubValtar commented Feb 29, 2016

Can you please post your code?

@HostileRobot

This comment has been minimized.

Show comment
Hide comment
@HostileRobot

HostileRobot Feb 29, 2016

Which part of it exactly? Or all of it?

HostileRobot commented Feb 29, 2016

Which part of it exactly? Or all of it?

@JakubValtar

This comment has been minimized.

Show comment
Hide comment
@JakubValtar

JakubValtar Feb 29, 2016

Contributor

All of it would be great.

Contributor

JakubValtar commented Feb 29, 2016

All of it would be great.

@HostileRobot

This comment has been minimized.

Show comment
Hide comment
@HostileRobot

HostileRobot Feb 29, 2016

EvolutionSimulator.zip
It's a couple of files, so I zipped them up.

HostileRobot commented Feb 29, 2016

EvolutionSimulator.zip
It's a couple of files, so I zipped them up.

@JakubValtar

This comment has been minimized.

Show comment
Hide comment
@JakubValtar

JakubValtar Feb 29, 2016

Contributor

The problem is here, you can't remove from collection while looping over it:

for (Egg e : eggs) {
  if (e.hatchTime > 0) {
    e.draw();
  } else {
    eggs.remove(e);
  }
}

IF you need more help with your code, please visit https://forum.processing.org

Default renderer will highlight the line where the problem is. However, FX2D does not have exception mapping yet. Thanks for your report, it will be added!

Contributor

JakubValtar commented Feb 29, 2016

The problem is here, you can't remove from collection while looping over it:

for (Egg e : eggs) {
  if (e.hatchTime > 0) {
    e.draw();
  } else {
    eggs.remove(e);
  }
}

IF you need more help with your code, please visit https://forum.processing.org

Default renderer will highlight the line where the problem is. However, FX2D does not have exception mapping yet. Thanks for your report, it will be added!

@JakubValtar JakubValtar changed the title from ConcurrentModificationException Crash to FX2D does not have exception handler Feb 29, 2016

@HostileRobot

This comment has been minimized.

Show comment
Hide comment
@HostileRobot

HostileRobot Feb 29, 2016

Ok, thank you.

HostileRobot commented Feb 29, 2016

Ok, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment