You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by "Jacopo Cappellato (JIRA)" <ji...@apache.org> on 2007/09/14 11:14:32 UTC

[jira] Commented: (OFBIZ-1187) Leaving out rel-field-name in keymap causes NPE

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

Jacopo Cappellato commented on OFBIZ-1187:
------------------------------------------

Maybe, if the rel-field-name is missing, the system should look for the same field name as specified in field-name (I mean that the default should be rel-field-name = field-name)

What do other think?
Leon, do you have a patch for this?


> Leaving out rel-field-name in keymap causes NPE
> -----------------------------------------------
>
>                 Key: OFBIZ-1187
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1187
>             Project: OFBiz
>          Issue Type: Bug
>            Reporter: Leon Torres
>
> If you leave out the rel-field-name for a keymap that requires it, DatabaseUtil.java will crash with a NPE when trying to create it.
> To reproduce, add the following to an entityengine.xml,
>     <extend-entity entity-name="OrderAdjustment">
>         <field name="orderAdjustmentSubTypeId" type="id"/>
>         <relation type="one" fk-name="ORDER_ADJ_SUBTYPE" rel-entity-name="OrderAdjustmentType">
>             <key-map field-name="orderAdjustmentSubTypeId" />
>         </relation>
>     </extend-entity>
> Note that the <key-map> is missing a rel-field-name="orderAdjustmentTypeId".   Do an ant run-install to create the key.  It should crash with a NPE pointing to line 2150 in DatabaseUtil.java:
>             ModelField relField = relModelEntity.getField(keyMap.getRelFieldName());
> I believe it should be testing that getRelFieldName() is null, and if so then log a warning and skip the key.

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