[ 
http://issues.apache.org/jira/browse/IBATIS-361?page=comments#action_12445701 ] 
            
Reuben Firmin commented on IBATIS-361:
--------------------------------------

Working back up the trace, I found the bug. It's in GenericProbe#151 - the 
logic seems to be totally broken.

public Class getPropertyTypeForGetter(Object object, String name) {
    if (object instanceof Class) {
      return getClassPropertyTypeForGetter((Class) object, name);
    } else if (object instanceof org.w3c.dom.Document) {
      return DOM_PROBE.getPropertyTypeForGetter(object, name);
    } else if (name.indexOf('[') > -1) {
      return BEAN_PROBE.getIndexedType(object,name);
    } else {
      return BEAN_PROBE.getPropertyTypeForGetter(object, name);
    }
}

Name in this case is physicalAddress.addressLine[0], but of course the third 
branch is never reached, since all objects are instanceof Class. 

>  Problem addressing list index in a parameter declaration
> ---------------------------------------------------------
>
>                 Key: IBATIS-361
>                 URL: http://issues.apache.org/jira/browse/IBATIS-361
>             Project: iBatis for Java
>          Issue Type: Bug
>          Components: SQL Maps
>    Affects Versions: 2.2.0
>            Reporter: Reuben Firmin
>
> I have the following code:
> public class Buyer
> {
> ...
>     private Address mailingAddress;
>  
> ...
> public class Address
> {
>     private List<String> addressLine;
> ...
>     public List<String> getAddressLine()
>     {
> In my insert statement, I'm addressing this as:
> #mailingAddress.addressLine[0]#, #mailingAddress.addressLine[1]#,
> When I start the webapp, I'm getting this exception:
> ...
> [11:08:02.736] Caused by: com.ibatis.common.beans.ProbeException: There is no 
> READABLE property named 'addressLine[0]' in class 
> 'com.copart.c2.buyer.bo.Address'
> [11:08:02.736]        at 
> com.ibatis.common.beans.ClassInfo.getGetterType(ClassInfo.java:240)
> [11:08:02.736]        at 
> com.ibatis.common.beans.GenericProbe.getClassPropertyTypeForGetter(GenericProbe.java:221)
> [11:08:02.736]        at 
> com.ibatis.common.beans.GenericProbe.getPropertyTypeForGetter(GenericProbe.java:153)
> [11:08:02.736]        at 
> com.ibatis.sqlmap.engine.mapping.parameter.InlineParameterMapParser.resolveTypeHandler(InlineParameterMapParser.java:229)
> [11:08:02.736]        at 
> com.ibatis.sqlmap.engine.mapping.parameter.InlineParameterMapParser.newParseMapping(InlineParameterMapParser.java:138)
> [11:08:02.736]        at 
> com.ibatis.sqlmap.engine.mapping.parameter.InlineParameterMapParser.parseInlineParameterMap(InlineParameterMapParser.java:50)
> [11:08:02.736]        at 
> com.ibatis.sqlmap.engine.builder.xml.SqlStatementParser.applyInlineParameterMap(SqlStatementParser.java:428)
> [11:08:02.736]        at 
> com.ibatis.sqlmap.engine.builder.xml.SqlStatementParser.processSqlStatement(SqlStatementParser.java:216)
> [11:08:02.736]        at 
> com.ibatis.sqlmap.engine.builder.xml.SqlStatementParser.parseGeneralStatement(SqlStatementParser.java:121)
> [11:08:02.736]        at 
> com.ibatis.sqlmap.engine.builder.xml.SqlMapParser$19.process(SqlMapParser.java:553)
> [11:08:02.736]        at 
> com.ibatis.common.xml.NodeletParser.processNodelet(NodeletParser.java:111)
> I will debug further and will append to this bug.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to