ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  NullPointerException has occurred when I use "outSVG"
Posted by LJ on Mar-10-2023 14:36
Hi

I updated to ChartDirector 6.3 For Java.

and I got NullPointerException when I use the code below:


xyChart.getDrawArea().outSVG(svgOutputStream, "noxmldecl;nodoctype;"); // svgOutputStream has 4096 bytes for default.


Caused by: java.lang.NullPointerException
at ChartDirector.ba.b(SourceFile:1577)
at ChartDirector.ba.a(SourceFile:1470)
at ChartDirector.ca.b(SourceFile:2226)
at ChartDirector.ca.a(SourceFile:1853)
at ChartDirector.ca.a(SourceFile:1841)
at ChartDirector.DrawArea.outSVG(SourceFile:4533)
at ChartDirector.DrawArea.outSVG(SourceFile:4525)


How can I use "outSVG" API with ByteArrayOutputStream?
or Do I have to use another way?

  Re: NullPointerException has occurred when I use "outSVG"
Posted by Peter Kwan on Mar-10-2023 15:39
Hi LJ,

Thanks for reporting this problem to us. From the stack trace, we suspect the problem is related to the text in the chart. Certain combinations of control characters (like the "tab" character, or CDML <*advance*> or <*advanceTo*>) may trigger this problem. If our guess is correct, we should be able to fix it within 24 hours. I will keep you updated on our progress.

Best Regards
Peter Kwan

  Re: NullPointerException has occurred when I use "outSVG"
Posted by LJ on Mar-13-2023 13:44
When can I get the patched version?

  Re: NullPointerException has occurred when I use "outSVG"
Posted by Peter Kwan on Mar-13-2023 13:51
Hi LJ,

We have tested a lot of possibilities, but we still cannot reproduce the problem. So may be the problem is not about control characters.

Anyway, we have produced an updated version of ChartDirector.jar that should not have the null pointer exception as shown in your stack trace. Please try it and kindly let me know if it can solve the problem.

https://www.advsofteng.com/support/cdjava704.zip

Best Regards
Peter Kwan

  Re: NullPointerException has occurred when I use "outSVG"
Posted by LJ on Mar-14-2023 13:09
After replacing with new jar file, the problem has been resolved.


What I've found so far is the chart is giving an error because the text size of label on the X2/Y2 axis is '0'.

If the font size is set to ‘1’ or higher, the error does not occur.

However, it doesn't necessarily cause the error.

it seems to happen in combination with some other option.



When can I get the full version?

  Re: NullPointerException has occurred when I use "outSVG"
Posted by Peter Kwan on Mar-14-2023 17:39
Hi HJ,

We have just updated the our official ChartDirector for Java release to include the updated ChartDirector.jar file. You can download the official release from our web site at:

https://www.advsofteng.com/download.html

Noe that the official release contains the same ChartDirector.jar file as the cdjava704.zip. The official release also includes sample code and documentation. If you do not need the sample code and documentation, you can use your existing cdjava704.zip. It is the same.

Also, the ChartDirector for Java now has two downloads. One is for J2EE/Java EE support, and the other for Jakarta EE support. The one you use is for J2EE/Java EE support. Please refer to https://www.advsofteng.com/j2ee_jakartaee.html for what is the difference.

Best Regards
Peter Kwan