ibatis-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "qxo (JIRA)" <ibatis-...@incubator.apache.org>
Subject [jira] Commented: (IBATIS-351) Primitive argument type cannot be null(in PropertyAccessPlan. setProperties)
Date Sun, 01 Oct 2006 13:44:22 GMT
    [ http://issues.apache.org/jira/browse/IBATIS-351?page=comments#action_12438973 ] 
            
qxo commented on IBATIS-351:
----------------------------

But if result is object, "Use a nullValue setting in your result map"  cannot solve the problem!

> Primitive argument type cannot be null(in PropertyAccessPlan. setProperties)
> ----------------------------------------------------------------------------
>
>                 Key: IBATIS-351
>                 URL: http://issues.apache.org/jira/browse/IBATIS-351
>             Project: iBatis for Java
>          Issue Type: Bug
>          Components: SQL Maps
>    Affects Versions: 2.1.7, 2.2.0
>            Reporter: qxo
>         Assigned To: Clinton Begin
>
> ResultObject  has a Primitive attribute and its result value is null,has problem.
> I fixed this proble as follow:
> public void setProperties(Object object, Object[] values) {
>   	int i = 0;
>     try {
>       Object[] arg = new Object[1];
>       for (i = 0; i < propertyNames.length; i++) {
>         arg[0] = values[i];
>         try {
>         	final Class[] parameterTypes = setters[i].getParameterTypes();
>         	if( null == arg[0] && parameterTypes[0].isPrimitive()){
>         		//FIXME Primitive argument type cannot be null
>         		return;
>         	}
>           setters[i].invoke(object, arg);
>         } catch (Throwable t) {
>           throw ClassInfo.unwrapThrowable(t);
>         }
>       }
>     } catch (Throwable t) {
>       throw new RuntimeException("Error setting property '" + setters[i].getName() +
"' of '" +
>       		                     object + "'.  Cause: " + t, t);
>     }
>   }

-- 
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

        

Mime
View raw message