CompareTo ArrayIndexOutOfBoundsException

  • Peter Chapman

    Peter Chapman - 2010-02-17


    I've been trying to implement a test script using T-Plan Robot and its Java API. I'm running the following line of code in a class extending DefaultJavaTestScript.

    compareTo(new File { new File("/home/peter/images/maximize.png") }, "search");

    The following runtime error occurs:

    java.lang.ArrayIndexOutOfBoundsException: -1
    at com.tplan.robot.imagecomparison.histogram.ImageHistogram.getSortedListOfColors(
    at com.tplan.robot.scripting.commands.impl.CompareToCommand.handleCompareToEvent(
    at com.tplan.robot.scripting.commands.impl.CompareToCommand.execute(
    at com.tplan.robot.scripting.AbstractJavaTestScript.runScriptCommand(
    at com.tplan.robot.scripting.DefaultJavaTestScript.compareTo(
    at com.tplan.robot.scripting.DefaultJavaTestScript.compareTo(

    Any thoughts as to the cause?

  • Robert Pes

    Robert Pes - 2010-02-18

    This is a bug which has been fixed in the code of ImageHistogram approx 2 weeks ago. It happens when the template image has a particular combination of color counters. Have you put any transparency into the template image?

    You have 3 options at the moment:

    1. Get the latest code from CVS and build the tool on your own
    2. Wait until the next release (anywhere between a week to a month from now)
    3. Recreate the template image in a way which changes the colors contained in it (such as make it smaller/bigger or cut it from a bit different part of the screen).

    BTW nice name of the test script class :-)

  • Peter Chapman

    Peter Chapman - 2010-02-18

    Thank you!

  • Robert Pes

    Robert Pes - 2010-03-29

    The fix was released in 2.0.3 today.


Log in to post a comment.