Openbravo Issue Tracking System - Retail Modules
View Issue Details
0039732Retail ModulesStoreServerpublic2018-12-03 11:132018-12-11 13:53
mtaal 
mtaal 
normalmajorhave not tried
closedfixed 
5
 
 
AugustoMauch
No
0039732: NPE When routing BP
See stacktrace [1]

[1]
Caused by: org.openbravo.base.exception.OBException: Error while routing a c_bpartner null
    at org.openbravo.retail.storeserver.synchronization.router.BusinessPartnerRouter.doRouteToNodes(BusinessPartnerRouter.java:62) ~[BusinessPartnerRouter.class:?]
    at org.openbravo.replication.symmetricds.extensions.AbstractClientFilteredRouter.routeToNodes(AbstractClientFilteredRouter.java:60) ~[AbstractClientFilteredRouter.class:?]
    at org.openbravo.retail.storeserver.synchronization.router.BusinessPartnerRouter$Proxy$_$$_WeldClientProxy.routeToNodes(BusinessPartnerRouter$Proxy$_$$_WeldClientProxy.java) ~[BusinessPartnerRouter.class:?]
    at org.jumpmind.symmetric.service.impl.RouterService.routeData(RouterService.java:940) ~[symmetric-core-3.8.24.jar:?]
    ... 15 more
Caused by: java.lang.NullPointerException
    at org.openbravo.retail.storeserver.synchronization.utils.BusinessPartnerSegmentationUtils.getNodesForBusinessPartner(BusinessPartnerSegmentationUtils.java:299) ~[BusinessPartnerSegmentationUtils.class:?]
    at org.openbravo.retail.storeserver.synchronization.router.BusinessPartnerRouter.doRouteToNodes(BusinessPartnerRouter.java:58) ~[BusinessPartnerRouter.class:?]
    at org.openbravo.replication.symmetricds.extensions.AbstractClientFilteredRouter.routeToNodes(AbstractClientFilteredRouter.java:60) ~[AbstractClientFilteredRouter.class:?]
    at org.openbravo.retail.storeserver.synchronization.router.BusinessPartnerRouter$Proxy$_$$_WeldClientProxy.routeToNodes(BusinessPartnerRouter$Proxy$_$$_WeldClientProxy.java) ~[BusinessPartnerRouter.class:?]
    at org.jumpmind.symmetric.service.impl.RouterService.routeData(RouterService.java:940) ~[symmetric-core-3.8.24.jar:?]
handle the case that the BP was deleted
set null value in BP record standard customer column
handle case that BP was deleted
use Boolean instead of boolean and assume null value = false
No tags attached.
Issue History
2018-12-03 11:13mtaalNew Issue
2018-12-03 11:13mtaalAssigned To => mtaal
2018-12-03 11:13mtaalTriggers an Emergency Pack => No
2018-12-03 18:30mtaalSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=17996#r17996
2018-12-03 18:30mtaalProposed Solution updated
2018-12-03 18:31hgbotCheckin
2018-12-03 18:31hgbotNote Added: 0108232
2018-12-03 18:31hgbotStatusnew => resolved
2018-12-03 18:31hgbotResolutionopen => fixed
2018-12-03 18:31hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.retail.storeserver.synchronization/rev/22b7915550a411ff8a41953cb4cdf6dcd77931d1 [^]
2018-12-09 22:06mtaalReview Assigned To => AugustoMauch
2018-12-10 16:11AugustoMauchNote Added: 0108364
2018-12-10 16:11AugustoMauchStatusresolved => new
2018-12-10 16:11AugustoMauchResolutionfixed => open
2018-12-10 22:37hgbotCheckin
2018-12-10 22:37hgbotNote Added: 0108376
2018-12-11 07:57hgbotCheckin
2018-12-11 07:57hgbotNote Added: 0108378
2018-12-11 07:57hgbotStatusnew => resolved
2018-12-11 07:57hgbotResolutionopen => fixed
2018-12-11 07:57hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/pmods/org.openbravo.retail.storeserver.synchronization/rev/22b7915550a411ff8a41953cb4cdf6dcd77931d1 [^] => http://code.openbravo.com/erp/pmods/org.openbravo.retail.storeserver.synchronization/rev/d145e0803b9252da89c2fb6984ff941988c3d142 [^]
2018-12-11 13:53AugustoMauchNote Added: 0108388
2018-12-11 13:53AugustoMauchStatusresolved => closed

Notes
(0108232)
hgbot   
2018-12-03 18:31   
Repository: erp/pmods/org.openbravo.retail.storeserver.synchronization
Changeset: 22b7915550a411ff8a41953cb4cdf6dcd77931d1
Author: Martin Taal <martin.taal <at> openbravo.com>
Date: Mon Dec 03 18:31:06 2018 +0100
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.storeserver.synchronization/rev/22b7915550a411ff8a41953cb4cdf6dcd77931d1 [^]

Fixes issue 39732: NPE When routing BP
Handle null value in safe way, handle bp deletion also

---
M src/org/openbravo/retail/storeserver/synchronization/eventhandler/BusinessPartnerEventHandlerForStandardCustomerFlag.java
M src/org/openbravo/retail/storeserver/synchronization/eventhandler/GenericEventHandlerForStandardCustomerFlag.java
M src/org/openbravo/retail/storeserver/synchronization/router/BusinessPartnerLocationRouter.java
M src/org/openbravo/retail/storeserver/synchronization/router/LocationRouter.java
M src/org/openbravo/retail/storeserver/synchronization/utils/BusinessPartnerSegmentationUtils.java
---
(0108364)
AugustoMauch   
2018-12-10 16:11   
There are two topics that should be addressed:
- The isObstsynStoreCustomer is a not-null property, so no need to check it safely. It is the businessPartner itself that can be null.
- At this point [1], we cannot assume that the change was a business partner deletion. It could also be, for instance, an update on a user that referenced the missing business partner, and the referenced business partner was deleted before the user change was routed.

In that case, it seems the proper logic would be:
- If business partner is null->
      - It change is deletion -> send to all
      - otherwise (insert or update) -> send to none


[1] https://code.openbravo.com/erp/pmods/org.openbravo.retail.storeserver.synchronization/rev/22b7915550a411ff8a41953cb4cdf6dcd77931d1#l5.1 [^]
(0108376)
hgbot   
2018-12-10 22:37   
Repository: erp/pmods/org.openbravo.retail.storeserver.synchronization
Changeset: 9575f92a0a9eef71d6124253d3b7d1898425ab5b
Author: Martin Taal <martin.taal <at> openbravo.com>
Date: Mon Dec 10 22:24:47 2018 +0100
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.storeserver.synchronization/rev/9575f92a0a9eef71d6124253d3b7d1898425ab5b [^]

Related to issue 39732: NPE When routing BP
Backed out changeset 22b7915550a4

---
M src/org/openbravo/retail/storeserver/synchronization/eventhandler/BusinessPartnerEventHandlerForStandardCustomerFlag.java
M src/org/openbravo/retail/storeserver/synchronization/eventhandler/GenericEventHandlerForStandardCustomerFlag.java
M src/org/openbravo/retail/storeserver/synchronization/router/BusinessPartnerLocationRouter.java
M src/org/openbravo/retail/storeserver/synchronization/router/LocationRouter.java
M src/org/openbravo/retail/storeserver/synchronization/utils/BusinessPartnerSegmentationUtils.java
---
(0108378)
hgbot   
2018-12-11 07:57   
Repository: erp/pmods/org.openbravo.retail.storeserver.synchronization
Changeset: d145e0803b9252da89c2fb6984ff941988c3d142
Author: Martin Taal <martin.taal <at> openbravo.com>
Date: Tue Dec 11 07:57:42 2018 +0100
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.storeserver.synchronization/rev/d145e0803b9252da89c2fb6984ff941988c3d142 [^]

Fixes issue 39732: NPE When routing BP
Handle the delete in the user/bp routers, log error in case bp is found to be deleted later

---
M src/org/openbravo/retail/storeserver/synchronization/router/BusinessPartnerRouter.java
M src/org/openbravo/retail/storeserver/synchronization/router/UserRouter.java
M src/org/openbravo/retail/storeserver/synchronization/utils/BusinessPartnerSegmentationUtils.java
---
(0108388)
AugustoMauch   
2018-12-11 13:53   
Code reviewed and verified