You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by "Jacques Le Roux (JIRA)" <ji...@apache.org> on 2008/04/13 01:36:04 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&focusedCommentId=12588346#action_12588346 ] 

Jacques Le Roux commented on OFBIZ-1187:
----------------------------------------

Hi Jacopo,

Was just reading your comment by chance. Yes this makes sense to me. Maybe that's the reason why Leon forgot it, Leon ?

> 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
>          Components: order
>    Affects Versions: SVN trunk
>            Reporter: Leon Torres
>             Fix For: SVN trunk
>
>
> 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.