ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From reub...@sonic.net
Subject Re: exception on queryForList with list of Enums
Date Fri, 28 Oct 2005 23:08:16 GMT
Agh, confused myself.

Let me clarify: the exception happens if I call queryForList with a
List<Enum> as the parameter. If I call queryForList with an Enum as the
parameter, no problem.

> 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 = {java.util.Arrays$ArrayList@1516} size = 1
> [0] = {com.foo.beans.Deployment$Status$6@1526}"READY"
> name: java.lang.String = {java.lang.String@1517}"status"
>
> Clearly, "READY" does not contain END_INDEX, which is "]". "READY" is a
> Deployment$Status value.
>
> Where is the bug?
>
> Thanks
>
>



Mime
View raw message