I am passing queryForList an ArrayList of Status, which is an Enum I
defined. I have registered a typeHandler for Status, as previously
discussed today on the list. The typeHandler works when querying for a
single object.

However, when querying for list, it gives the following exception: (See
below the stacktrace for diagnostics & question)

java.lang.StringIndexOutOfBoundsException: String index out of range: -2
        at java.lang.String.substring(String.java:1768)
        at com.ibatis.common.beans.GenericProbe.getObject(GenericProbe.java:55)
        at
com.ibatis.sqlmap.engine.exchange.ListDataExchange.getData(ListDataExchange.java:63)
        at
com.ibatis.sqlmap.engine.exchange.BaseDataExchange.getCacheKey(BaseDataExchange.java:35)
        at
com.ibatis.sqlmap.engine.mapping.parameter.BasicParameterMap.getCacheKey(BasicParameterMap.java:136)
        at
com.ibatis.sqlmap.engine.mapping.statement.BaseStatement.getCacheKey(BaseStatement.java:113)
        at
com.ibatis.sqlmap.engine.mapping.statement.CachingStatement.getCacheKey(CachingStatement.java:115)
        at
com.ibatis.sqlmap.engine.mapping.statement.CachingStatement.executeQueryForList(CachingStatement.java:89)
        at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:610)
        at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:584)
        at
com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:101)
        at
com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:78)



The line of code (com.ibatis.common.beans.GenericProbe.java:55) is:

      return ((List)object).get(new
Integer(name.substring(1,name.indexOf(END_INDEX))).intValue());

Here are the objects according to my debugger at this line:

object: java.lang.Object = [EMAIL PROTECTED] size = 1
[0] = [EMAIL PROTECTED]"READY"
name: java.lang.String = [EMAIL PROTECTED]"status"

Clearly, "READY" does not contain END_INDEX, which is "]". "READY" is a
Deployment$Status value.

Where is the bug?

Thanks

Reply via email to