Page 1 of 1

Lacking Exception-handling in Series.calcX/YPos?

Posted: Mon May 19, 2008 1:46 pm
by 7667185
Hello. I have an enquiry:

It seems that there is an uncaught ArrayIndexOutOfBounds-exception occuring when Series.calcXPos() (maybe also calcYPos) gets a point-index that is too high for its current series (at least that is my assumption). Is this something you could look into? Since by using some quite nasty routines for calculating nearest point out of several series (as shown in another thread), I am not always in control over what is sent to the routine. So I often get the error shown underneath when the NearestPoint-tool "jumps" from e.g. a point with a high index to the end of a line-series (with perhaps only 2 data points). I have tried try-catching the call to calcXPos() but with no result.

I guess the "question" is, am I right on this? Can you see any potentially dangerous algorithms in the mentioned code? Or is the problem on my end? (Well I actually assume that the reason for the error is on my end, but I'd like to be able to do the erronous thing without crashing my program :) )

I am not able to give you a working program to illustrate, but perhaps the description of the problem along with the upmost part of the stack trace (which only presents your code I believe) can enable you to identify the problem?

Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 54
at com.steema.teechart.styles.Series.calcXPos(Series.java:1838)
at com.steema.teechart.tools.NearestPoint.paintHint(NearestPoint.java:202)
at com.steema.teechart.tools.NearestPoint.chartEvent(NearestPoint.java:249)
at com.steema.teechart.Chart.broadcastToolEvent(Chart.java:846)
at com.steema.teechart.Chart.internalDraw(Chart.java:690)
at com.steema.teechart.Chart.paint(Chart.java:1807)
at com.steema.teechart.TChart.paintComponent(TChart.java:568)

Thanks in advance!
Marius Lunde