Page 1 of 1

Restore axes method throws an exception after unzoom

Posted: Fri Sep 12, 2014 11:58 am
by 17470167
To reproduce the ArrayIndexOutOfBoundsException, following actions have to be done:

Create a chart and e.g. add a line. Then zoom into and afterwards create a custom axis. Now if you unzoom an ArrayIndexOutOfBoundsException will be thrown.
As an attachment I add a code example.

Re: Restore axes method throws an exception after unzoom

Posted: Mon Sep 15, 2014 9:57 am
by yeray
Hello,

I can't reproduce this with TeeChart Java v3.2014.0519 SWT.
What version are you using?

Re: Restore axes method throws an exception after unzoom

Posted: Wed Sep 17, 2014 8:49 am
by 17470167
Hi Yeray,

thx for reply.

I use absolutely the same/newest version as you. Maybe you didn't reproduce it in the way I described it. :wink:

The code I attached, you should use in the following manner.

1) Start the TeeChart SWT Application by running the attached code.
2) Zoom into the Chart
3) press the button
4!) Zoom out -> ArrayIndexOutOfBoundsException will be thrown

I also debugged the source and on this position the source changed in comparison to the previous teechart version.

Stacktrace:

Code: Select all

java.lang.ArrayIndexOutOfBoundsException: 0
	at com.steema.teechart.Chart.restoreScales(Chart.java:1511)
	at com.steema.teechart.Chart.restoreAxisScales(Chart.java:654)
	at com.steema.teechart.Zoom.undo(Zoom.java:437)
	at com.steema.teechart.Chart.mouseReleased(Chart.java:1595)
	at com.steema.teechart.TChart.processMouseEvent(TChart.java:1191)
	at com.steema.teechart.TChart$5.handleEvent(TChart.java:372)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1262)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1060)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4172)

Re: Restore axes method throws an exception after unzoom

Posted: Thu Sep 18, 2014 9:53 am
by yeray
Hello Slix,

Excuse me, I didn't follow the steps correctly.
I could reproduce the problem now so I've added it to the public tracker:
http://bugs.teechart.net/show_bug.cgi?id=925

Re: Restore axes method throws an exception after unzoom

Posted: Thu Sep 18, 2014 10:04 am
by yeray
An I've fixed it for the next maintenance release too. :D

Re: Restore axes method throws an exception after unzoom

Posted: Thu Nov 13, 2014 12:39 pm
by 17470167
Hi Yeray,

thx for the fix! My question for the moment is, how am I able to download this maintenance release? I can't find it in my download area, it's really urgent. :) I hope you can help me.

Re: Restore axes method throws an exception after unzoom

Posted: Thu Nov 13, 2014 2:26 pm
by yeray
Hello,
Slix wrote:thx for the fix! My question for the moment is, how am I able to download this maintenance release? I can't find it in my download area, it's really urgent. :) I hope you can help me.
I'm afraid I can't tell you when the next maintenance release will be published.
However, I see you own the sources so you can apply the fix to the sources yourself.
At Chart.java you'll find a method called restoreScales(AllAxisSavedScales s). Change the line where says (line 1509 in Chart.java):

Code: Select all

        for (int i=0; i < axes.getCustom().size(); i++)
For this:

Code: Select all

        for (int i=0; i < s.customAxes.length; i++)