This is an automated email from the ASF dual-hosted git repository.
arunpati 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 4207a253bd Fixed: NullPointerException in BOMNode.substituteNode for
rules without quantity (OFBIZ-13694) (#2416)
4207a253bd is described below
commit 4207a253bd55636857464fa25e8371194a019c5c
Author: Arun Patidar <[email protected]>
AuthorDate: Sat Oct 24 12:59:06 2026 +0530
Fixed: NullPointerException in BOMNode.substituteNode for rules without
quantity (OFBIZ-13694) (#2416)
Fixed: NullPointerException in BOMNode.substituteNode for rules without
quantity (OFBIZ-13694)
GenericValue.getBigDecimal returns null for an empty field instead of
throwing, so the try/catch around the ProductManufacturingRule quantity
never ran and ruleQuantity stayed null. The following compareTo then
failed with a NullPointerException and the whole BOM explosion aborted,
although quantity is optional on ProductManufacturingRule and in the
addProductManufacturingRule service.
Treat a missing quantity as zero, which already means "keep the BOM
line's own quantity", and drop the unreachable try/catch.
Thanks Jamal Tex Chi for reporting the issue
---
.../src/main/java/org/apache/ofbiz/manufacturing/bom/BOMNode.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git
a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMNode.java
b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMNode.java
index 28ae89635a..cc4ef7ccad 100644
---
a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMNode.java
+++
b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMNode.java
@@ -154,10 +154,10 @@ public class BOMNode {
String ruleCondition = (String) rule.get("productFeature");
String ruleOperator = (String) rule.get("ruleOperator");
String newPart = (String) rule.get("productIdInSubst");
- BigDecimal ruleQuantity = BigDecimal.ZERO;
- try {
- ruleQuantity = rule.getBigDecimal("quantity");
- } catch (Exception exc) {
+ // quantity is optional on ProductManufacturingRule: a missing
value means
+ // "keep the BOM line's own quantity", the same as zero
(OFBIZ-13694)
+ BigDecimal ruleQuantity = rule.getBigDecimal("quantity");
+ if (ruleQuantity == null) {
ruleQuantity = BigDecimal.ZERO;
}