?
Solved

NullPointerException in sun.java2d.SunGraphics2D.validateColor

Posted on 2010-03-23
14
Medium Priority
?
388 Views
Last Modified: 2013-11-23
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)
===
0
Comment
Question by:rommeljohnsantos
  • 6
  • 5
  • 3
14 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 28336644
Make sure you're also running with the same version



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

Open in new window

0
 
LVL 86

Expert Comment

by:CEHJ
ID: 28336797
>>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
 
LVL 86

Expert Comment

by:CEHJ
ID: 28336866
And

bash-3.00$ javac -version

will tell you that
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
LVL 92

Expert Comment

by:objects
ID: 28337456
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
 
LVL 92

Expert Comment

by:objects
ID: 28337551
if possible, also test the code on different hardware
0
 
LVL 1

Author Comment

by:rommeljohnsantos
ID: 28410364
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
 
LVL 92

Expert Comment

by:objects
ID: 28411197
> . 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
 
LVL 1

Author Comment

by:rommeljohnsantos
ID: 28411542
>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
 
LVL 92

Expert Comment

by:objects
ID: 28415110
meant the latest vm, cannot see how recompiling would make any difference
0
 
LVL 1

Author Comment

by:rommeljohnsantos
ID: 28421073
oh i see, i will try that, thanks!
0
 
LVL 1

Author Comment

by:rommeljohnsantos
ID: 28422995
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
 
LVL 92

Expert Comment

by:objects
ID: 28423066
did you try running it on different hardware?

anything exotic in your swing code?
0
 
LVL 92

Accepted Solution

by:
objects earned 1000 total points
ID: 28423244
disabling double buffering is a possible workaround
0
 
LVL 1

Author Comment

by:rommeljohnsantos
ID: 28667245
Was out yesterday. I tried disabling double buffering and it worked! Thanks!
0

Featured Post

Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

594 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question