NullPointerException in sun.java2d.SunGraphics2D.validateColor

Hi,

I'm currently migrating our java 1.3 source codes to java 6. After resolving all compilation errors. I finally launched the application to get the following exception. I wonder if anyone has encountered this before? It seems NPE was thrown while creating the back buffer for double buffering but I have no clue as to what would cause that. I used the following java version to compile on AIX
bash-3.00$ java -version
java version "1.6.0"
Java(TM) SE Runtime Environment (build pap3260sr6-20090925_01(SR6))
IBM J9 VM (build 2.4, JRE 1.6.0 IBM J9 2.4 AIX ppc-32 jvmap3260sr6-20090923_42924 (JIT enabled, AOT enabled)
J9VM - 20090923_042924
JIT - r9_20090902_1330ifx1
GC - 20090817_AA)
JCL - 20090924_01

Would appreciate any help as my Swing knowledge is still quite limited. Thanks!

===
Exception in thread "AWT-EventQueue-0" Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at sun.java2d.SunGraphics2D.validateColor(SunGraphics2D.java:1635)
at sun.java2d.SunGraphics2D.<init>(SunGraphics2D.java:237)
at sun.awt.image.SunVolatileImage.createGraphics(SunVolatileImage.java:192)
at sun.awt.image.VolatileSurfaceManager.initContents(VolatileSurfaceManager.java:266)
at sun.awt.image.SunVolatileImage.<init>(SunVolatileImage.java:74)
at sun.awt.image.SunVolatileImage.<init>(SunVolatileImage.java:82)
at sun.awt.image.SunVolatileImage.<init>(SunVolatileImage.java:93)
at sun.awt.image.SunVolatileImage.<init>(SunVolatileImage.java:87)
at sun.awt.windows.WComponentPeer.createVolatileImage(WComponentPeer.java:604)
at java.awt.Component.createVolatileImage(Component.java:3363)
at java.awt.Component$BltBufferStrategy.createBackBuffers(Component.java:4085)
at java.awt.Component$BltBufferStrategy.<init>(Component.java:4030)
at java.awt.Component$BltSubRegionBufferStrategy.<init>(Component.java:4283)
at java.awt.Component.createBufferStrategy(Component.java:3614)
at java.awt.Window.createBufferStrategy(Window.java:3012)
at javax.swing.BufferStrategyPaintManager$BufferInfo.createBufferStrategy(BufferStrategyPaintManager.java:846)
at javax.swing.BufferStrategyPaintManager$BufferInfo.createBufferStrategy(BufferStrategyPaintManager.java:797)
at javax.swing.BufferStrategyPaintManager$BufferInfo.getBufferStrategy(BufferStrategyPaintManager.java:730)
at javax.swing.BufferStrategyPaintManager.prepare(BufferStrategyPaintManager.java:506)
at javax.swing.BufferStrategyPaintManager.paint(BufferStrategyPaintManager.java:264)
at javax.swing.RepaintManager.paint(RepaintManager.java:1220)
at javax.swing.JComponent.paint(JComponent.java:1015)
at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:21)
at sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:60)
at sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:97)
at java.awt.Container.paint(Container.java:1780)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:814)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:714)
at javax.swing.RepaintManager.seqPaintDirtyRegions(RepaintManager.java:694)
at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:128)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
===
LVL 1
rommeljohnsantosAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CEHJCommented:
Make sure you're also running with the same version



System.out.println(System.getProperty("java.vm.version"));

Open in new window

0
CEHJCommented:
>>I used the following java version to compile on AIX

Sorry, that was was wrong. That shows what version you will run with. Make sure you've compiled with the same version
0
CEHJCommented:
And

bash-3.00$ javac -version

will tell you that
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

objectsCommented:
looks like a vm bug

try the latest and greatest if you aren't already

> Make sure you've compiled with the same version

how is that going to make any difference???
0
objectsCommented:
if possible, also test the code on different hardware
0
rommeljohnsantosAuthor Commented:
hi, I used java 6 update 14 to compile and java 6 update 16 to run the application. I will try to compile using update 17 then. I seem to have read before that a bug related to BufferStrategy in java was fixed in update 10 so I'm quite perplexed with this exception. Would you know where to check for jvm bug reports? Im having difficulty finding the site. Thanks!
0
objectsCommented:
> . I will try to compile using update 17 then

cannot see how that will make any difference. Not sure why it was suggested

> seem to have read before that a bug related to BufferStrategy in java was fixed in update 10 so I'm quite perplexed with this exception.

there have been a few I think

> Would you know where to check for jvm bug reports? I

http://bugs.sun.com/
0
rommeljohnsantosAuthor Commented:
>looks like a vm bug

>try the latest and greatest if you aren't already

oh, i thought that was what you meant, latest java 6 update?
0
objectsCommented:
meant the latest vm, cannot see how recompiling would make any difference
0
rommeljohnsantosAuthor Commented:
oh i see, i will try that, thanks!
0
rommeljohnsantosAuthor Commented:
Hello, I tried using java 6 update 18 jre to run the application. I still get the same error. I've also tried to put all the UI creation inside the EDT using the SwingUtilities.invokeLater function but still same error. I wonder if you guys know of other workarounds? Any suggestion would be great! Thanks!
0
objectsCommented:
did you try running it on different hardware?

anything exotic in your swing code?
0
objectsCommented:
disabling double buffering is a possible workaround
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rommeljohnsantosAuthor Commented:
Was out yesterday. I tried disabling double buffering and it worked! Thanks!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Editors IDEs

From novice to tech pro — start learning today.