Random null pointer problems when saving charts to disk

Discussion about JFreeChart related to stockmarket charts.

Random null pointer problems when saving charts to disk

Postby darkraiyy » Sun Sep 16, 2012 9:51 am

Hi,

I am using the screenimage.java (available on source forge I believe) file to help me save some jfreecharts to disk but occasionally I get a null pointer problem when trying to do so.

I do not use the default jfreechart saving feature as I am saving multiple charts at once, all encapsulated in a jpanel.

The null pointer problem always occurs at the Paint() method of the graphics2d object in screenimage. I know that the object is not null, because I have them all become visible at the start of the run, but they may or may not be visible on screen when the call occurs.

Also once it has triggered a null pointer exception, the tab showing that panel also becomes blank. I have been trying for weeks to discover the source of the problem but I have yet to find it. It is especially frustrating as it only sometimes occurs.

Any assistance would be greatly appreciated!
Thanks!
darkraiyy
 
Posts: 3
Joined: Sat Sep 08, 2012 8:31 am

Re: Random null pointer problems when saving charts to disk

Postby david.gilbert » Mon Sep 17, 2012 9:16 pm

No-one can tell you the likely source of your NPE because you didn't post the stack trace and you didn't post the code that is generating the stack trace. I suggest that you step through the code with NetBeans or Eclipse (or whatever tool you like to use) and inspect the variables to determine what exactly is null.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Ask your company to buy the JFreeChart Developer Guide
:idea: Check out other products sold by my company Object Refinery Limited
david.gilbert
JFreeChart Project Leader
 
Posts: 11653
Joined: Fri Mar 14, 2003 10:29 am

Re: Random null pointer problems when saving charts to disk

Postby darkraiyy » Tue Sep 18, 2012 2:31 am

Hi David,

I know that there is too little information to determine the cause of the problem in my case, and to be frank my application is so large and so separate that trying to post the complete set of details I thought would be very confusing and obfuscate the problem at hand. I was wondering whether anyone else had any problems in saving a number of jfreechart objects contained in a JComponent to disk using the ScreenImage class or any other method, and how they managed to overcome the problem. Because the problem I have is that NONE of my objects are null, which makes me think it may be a more complicated issue (or bug in java) that comes from trying to paint a (possibly currently non-visible) object in swing.

But I will take your advice and debug my program some more, problem is that the error occurs somewhere inside the JComponent.paint(Graphics2D) method, which I cannot step through.

Thanks anyway!
darkraiyy
 
Posts: 3
Joined: Sat Sep 08, 2012 8:31 am

Re: Random null pointer problems when saving charts to disk

Postby angleblue63 » Tue Jan 08, 2013 6:10 am

Infact what is happening is that even though the week ends are excluded from the chart, there is still vertical grid line displayed for Saturday. In addition, there is a vertical grid line for Monday as it should be. However, there is very small gap between these two vertical grin lines. When the dates are shown for these two grid lines, they are mixed. Unfortunately, I don't know how to submit an image here.
We provide guarantee to pass Braindumps gmat with online exam training ISEB and University of California, San Diego , you can also get best quality examsheets mcat along with wikipedia mcat for your guaranteed success.
angleblue63
 
Posts: 1
Joined: Tue Jan 08, 2013 6:07 am


Return to JFreeChart - Stockmarket

Who is online

Users browsing this forum: No registered users and 1 guest