BufferedImage.flush() causing exception

The BufferedImage is not null at this point but the exception is always thrown. I am using 1.5.0.


java.lang.NullPointerException
        at sun.awt.windows.WinCachingSurfaceManager.flush(Unknown Source)
        at java.awt.image.BufferedImage.flush(Unknown Source)
        at net.java.games.jogl.GLJPanel$1.run(GLJPanel.java:137)
        at net.java.games.jogl.impl.GLContext.invokeGL(GLContext.java:232)
        at net.java.games.jogl.GLJPanel.display(GLJPanel.java:98)
        at net.java.games.jogl.Animator$1.run(Animator.java:104)
        at java.lang.Thread.run(Unknown Source)

[quote]The BufferedImage is not null at this point but the exception is always thrown. I am using 1.5.0.
[/quote]
This bug has been fixed already for 1.5-beta2, which will be released in the not so distant future. See bugid 4992282.

Thanks,
Chris

Sweet - fixed in less than 30 minutes after you reported it GKW. :slight_smile:

Perhaps I should also mention that java.sun.com is down. I am starting my stopwatch… now!

You couldn’t check that Bug Id either eh :)? Yeah, java.sun.com has been having a lot of trouble today. Highly unusual.

No kidding. I think this is the first time in the four years or so that I can remember the site being down.

Is there any reason that not flushing the BufferedImage would be harmful to an app? Right now I just null the thing as a workaround but do I really even need to do it?

[quote]Is there any reason that not flushing the BufferedImage would be harmful to an app? Right now I just null the thing as a workaround but do I really even need to do it?
[/quote]
It’s certainly not harmful to not call flush(). The benefit of flush() is that it is a synchronous way to clean up all the resources (cached copies, etc) used by the image. If you don’t call it (and just null the image out, as you’re doing), those resources will be freed up eventually when the garbage collector comes around.

Chris