logo       

exception on queryForList with list of Enums: msg#00337

Subject: exception on queryForList with list of Enums
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




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
web.pylons.gene...    hurd.l4/2002-10...    kernel.commits....    user-groups.lin...    yellowdog.gener...    java.drools.use...    security.openva...    package-managem...    linux.debian.us...    qnx.openqnx.dev...    genealogy.gramp...    file-systems.if...    voip.wengophone...    tex.context/200...    ietf.smime/2003...    audio.csound.de...    culture.region....    xfree86.devel/2...    mobile.kannel.u...    distributed.con...    education.engli...    org.user-groups...    bug-tracking.gn...    recreation.bicy...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe