This is an automated email from the ASF dual-hosted git repository.
jleroux pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/trunk by this push:
new da4b043 Improved: Fix some bugs Spotbugs reports (OFBIZ-12386)
da4b043 is described below
commit da4b0431ffbfddee9a560abeb992c077779febe6
Author: Jacques Le Roux <[email protected]>
AuthorDate: Mon Nov 29 10:09:21 2021 +0100
Improved: Fix some bugs Spotbugs reports (OFBIZ-12386)
Fixes possible null dereferencings
Follows a comment saying
// first check and see if we are already there; if so, just return success
---
.../main/java/org/apache/ofbiz/manufacturing/bom/BOMServices.java | 5 ++++-
.../src/main/java/org/apache/ofbiz/order/order/OrderServices.java | 7 +++++--
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git
a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMServices.java
b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMServices.java
index 225c31c..a019c5d 100644
---
a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMServices.java
+++
b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMServices.java
@@ -532,7 +532,10 @@ public class BOMServices {
if (orderShipment != null &&
!orderReadHelpers.containsKey(orderShipment.getString("orderId"))) {
orderReadHelpers.put(orderShipment.getString("orderId"), new
OrderReadHelper(delegator, orderShipment.getString("orderId")));
}
- OrderReadHelper orderReadHelper = (OrderReadHelper)
orderReadHelpers.get(orderShipment.getString("orderId"));
+ OrderReadHelper orderReadHelper = null;
+ if (orderShipment != null) {
+ orderReadHelper = (OrderReadHelper)
orderReadHelpers.get(orderShipment.getString("orderId"));
+ }
if (orderReadHelper != null) {
Map<String, Object> orderShipmentReadMap =
UtilMisc.toMap("orderShipment", orderShipment, "orderReadHelper",
orderReadHelper);
String partyId = (orderReadHelper.getPlacingParty() != null ?
orderReadHelper.getPlacingParty().getString("partyId") : null);
diff --git
a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java
b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java
index 36cc526..8c49f3b 100644
---
a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java
+++
b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java
@@ -1260,7 +1260,10 @@ public class OrderServices {
}
GenericValue orderItemShipGroup =
orderItemShipGroupAssoc.getRelatedOne("OrderItemShipGroup", false);
String shipGroupFacilityId =
orderItemShipGroup.getString("facilityId");
- String itemStatus = orderItem.getString("statusId");
+ String itemStatus = null;
+ if (orderItem != null) {
+ itemStatus = orderItem.getString("statusId");
+ }
if ("ITEM_REJECTED".equals(itemStatus) ||
"ITEM_CANCELLED".equals(itemStatus) || "ITEM_COMPLETED".equals(itemStatus)) {
Debug.logInfo("Order item [" +
orderItem.getString("orderId") + " / " + orderItem.getString("orderItemSeqId")
+ "] is not "
+ "in a proper status for reservation",
MODULE);
@@ -2610,7 +2613,7 @@ public class OrderServices {
// first check and see if we are already there; if so, just return
success
GenericValue testValue =
EntityQuery.use(delegator).from("OrderRole").where(fields).queryOne();
if (testValue != null) {
- ServiceUtil.returnSuccess();
+ return ServiceUtil.returnSuccess();
} else {
GenericValue value = delegator.makeValue("OrderRole", fields);
delegator.create(value);