You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by "Leon Torres (JIRA)" <ji...@apache.org> on 2007/08/07 22:36:00 UTC

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

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.


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

Posted by "Leon Torres (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OFBIZ-1187?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12590254#action_12590254 ] 

Leon Torres commented on OFBIZ-1187:
------------------------------------

Sure I agree it should check field name if rel-field-name is missing.  I never had a patch, this bug was just a report.  Fixing it should be trivial if someone wants to give it a shot.

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


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

Posted by "Jacques Le Roux (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OFBIZ-1187?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jacques Le Roux closed OFBIZ-1187.
----------------------------------

    Resolution: Fixed
      Assignee: Adam Heath

This have been fixed in r585838 

> 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
>            Assignee: Adam Heath
>             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.


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

Posted by "Leon Torres (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OFBIZ-1187?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12518247 ] 

Leon Torres commented on OFBIZ-1187:
------------------------------------

I made this major because once the crash happens, all keys after this one are not created.  For someone not familiar with how the entity engine works, this can be very mysterious, so we should at least log a warning.

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


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

Posted by "Marco Risaliti (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OFBIZ-1187?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Marco Risaliti updated OFBIZ-1187:
----------------------------------

          Component/s: order
        Fix Version/s: SVN trunk
    Affects Version/s: SVN trunk

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


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

Posted by "Jacques Le Roux (JIRA)" <ji...@apache.org>.
    [ 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.


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

Posted by "Jacopo Cappellato (JIRA)" <ji...@apache.org>.
    [ 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.