[ 
https://issues.apache.org/jira/browse/OFBIZ-742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12497124
 ] 

Jacopo Cappellato commented on OFBIZ-742:
-----------------------------------------

It seems good to me (even if the use case is pretty rare); are there 
comments/concerns before I test and commit?


> NullPointerException inside SqlJdbcUtil.java
> --------------------------------------------
>
>                 Key: OFBIZ-742
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-742
>             Project: OFBiz (The Open for Business Project)
>          Issue Type: Bug
>          Components: framework
>    Affects Versions: SVN trunk
>         Environment: SUSE Linux 10.1 with MySQL 5.0.18
>            Reporter: Michael Imhof
>         Assigned To: Jacopo Cappellato
>         Attachments: patch742.txt
>
>
>     <entity entity-name="Archivindex"
>             package-name="ch.nowhow.isgate.archiv"
>             title="Archiv Index Entity" no-auto-stamp="true">
>       <field name="id" type="id-num"></field>
>       <field name="date" type="date" not-null="true"></field>
>       <prim-key field="id"/>
>     </entity>
> <field-type-def type="date" sql-type="DATETIME" 
> java-type="java.util.Date"></field-type-def>
> If the date field on the database is NULL, we got an error in the 
> SqlJdbcUtil.java.
> Method:
> ======
> public static void setValue(SQLProcessor sqlP, ModelField modelField, String 
> entityName, Object fieldValue, ModelFieldTypeReader modelFieldTypeReader).
> Code:
> =====
>  case 14:
>                 sqlP.setValue(new java.sql.Date(((java.util.Date) 
> fieldValue).getTime()));
>                 break;
> Solution:
> ======
>  case 14: 
>                 if (fieldValue != null) {
>                     sqlP.setValue(new java.sql.Date(((java.util.Date) 
> fieldValue).getTime()));
>                 } else {
>                     sqlP.setValue((java.sql.Date)null);
>                 }
>                 break;
>      

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to