Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0028977Openbravo ERPA. Platformpublic2015-02-18 10:432015-11-23 21:17
alostale 
caristu 
normalminorhave not tried
closedfixed 
5
 
3.0PR16Q1 
alostale
Core
No
0028977: NPE if property field can not reach the complete path
When there is a property field which path can not be completed because there is a null object within it, a NPE is thrown when the tab containing it is opened.
As system admin role:
 * Create a new field in the Sales Invoice - Header tab
 * Add the following value in the Property field:
     businessPartner.priceList.name

As group admin role:
 * Create a new record in the Sales Invoice window
 * Check the following error message is shown in the log
     1f923ef8 357624 [http-8080-7] ERROR org.openbravo.client.application.window.FormInitializationComponent - Couldn't get data for column Name
java.lang.NullPointerException
    at org.openbravo.dal.core.DalUtil.getValueFromPath(DalUtil.java:174)
    at org.openbravo.client.application.window.FormInitializationComponent.computeColumnValues(FormInitializationComponent.java:625)
    at org.openbravo.client.application.window.FormInitializationComponent.execute(FormInitializationComponent.java:258)

The problem is businessPartner is null, so it is trying to get priceList from a null object resulting in a NPE.
in this case the field property value should be null, without NPE in the logs
No tags attached.
related to defect 00284383.0PR15Q2 closed alostale Property fields cannot be included in validations 
related to defect 00257543.0PR14Q2 closed shankarb Wrong behavior when calculating the value of a property field for a new record (FIC) 
has duplicate defect 0031305 closed platform NullPointerException when creating a new record on the header having a property field 
Issue History
2015-02-18 10:43alostaleNew Issue
2015-02-18 10:43alostaleAssigned To => AugustoMauch
2015-02-18 10:43alostaleModules => Core
2015-02-18 10:43alostaleTriggers an Emergency Pack => No
2015-02-18 10:43alostaleRelationship addedrelated to 0028438
2015-03-11 09:49alostalePrioritynormal => high
2015-03-11 09:49alostaleStatusnew => acknowledged
2015-03-17 14:37alostaleAssigned ToAugustoMauch => platform
2015-11-11 11:37alostalePriorityhigh => normal
2015-11-12 19:41caristuAssigned Toplatform => caristu
2015-11-12 19:41caristuStatusacknowledged => scheduled
2015-11-13 08:44hgbotCheckin
2015-11-13 08:44hgbotNote Added: 0081800
2015-11-13 08:44hgbotStatusscheduled => resolved
2015-11-13 08:44hgbotResolutionopen => fixed
2015-11-13 08:44hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/3fd452d82f3582f226bc4c9c2d289c518a47ec68 [^]
2015-11-13 08:46caristuRelationship addedhas duplicate 0031305
2015-11-13 08:48caristuRelationship addedrelated to 0025754
2015-11-13 14:19alostaleReview Assigned To => alostale
2015-11-13 14:19alostaleNote Added: 0081825
2015-11-13 14:19alostaleStatusresolved => closed
2015-11-13 14:19alostaleFixed in Version => 3.0PR16Q1
2015-11-23 21:17hudsonbotCheckin
2015-11-23 21:17hudsonbotNote Added: 0082222

Notes
(0081800)
hgbot   
2015-11-13 08:44   
Repository: erp/devel/pi
Changeset: 3fd452d82f3582f226bc4c9c2d289c518a47ec68
Author: Carlos Aristu <carlos.aristu <at> openbravo.com>
Date: Fri Nov 13 08:43:20 2015 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/3fd452d82f3582f226bc4c9c2d289c518a47ec68 [^]

fixes issue 28977: NPE if property field can not reach the complete path

The NPE was thrown when defining a property field in the header tab. The FIC is using the getValueFromPath() method to calculate the value of the property field on NEW mode. It is sending as parameter the reference to the parent record for the cases where the value of the property field can be retrieved using the parent information. As in the header tabs we do not have a reference to a parent record, the parameter is null in these cases.

To solve the problem now we first check in getValueFromPath() method if the bob passed as parameter is null. In that case we return null in order to avoid the NPE.

---
M src/org/openbravo/dal/core/DalUtil.java
---
(0081825)
alostale   
2015-11-13 14:19   
code reviewed

tested:
* Following steps to reproduce: new record
* With same property path, removing price list for a BP that is used in invoice, show a record in Sales Invoice for that BP.

2nd case is not covered by current fix but by existent code:

      if (value instanceof BaseOBObject) {
        currentBob = (BaseOBObject) value;
      } else {
        return value;
      }

when null 1st if is false
(0082222)
hudsonbot   
2015-11-23 21:17   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/7b56bebaaa88 [^]
Maturity status: Test