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 0aa06d9  Improved: Fix some bugs Spotbugs reports (OFBIZ-12386)
0aa06d9 is described below

commit 0aa06d9c3d1fc88059fd491b6315c017b685ec7c
Author: Jacques Le Roux <jacques.le.r...@les7arts.com>
AuthorDate: Fri Dec 10 09:42:28 2021 +0100

    Improved: Fix some bugs Spotbugs reports (OFBIZ-12386)
    
    In WebToolsServices::entityImportDir fixes a possible null dereferencement
    In ProductionRunServices::createProductionRunFromConfiguration fixes a 
possible
    null dereferencement and remove 2 unused vars
---
 .../ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git 
a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java
 
b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java
index a18c266..ba2a145 100644
--- 
a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java
+++ 
b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java
@@ -2321,8 +2321,6 @@ public class ProductionRunServices {
         }
 
         // Optional input fields
-        Timestamp fromDate = (Timestamp) context.get("fromDate");
-        Timestamp toDate = (Timestamp) context.get("toDate");
         BigDecimal addQuantityProduced = (BigDecimal) 
context.get("addQuantityProduced");
         BigDecimal addQuantityRejected = (BigDecimal) 
context.get("addQuantityRejected");
         BigDecimal addSetupTime = (BigDecimal) context.get("addSetupTime");
@@ -2334,12 +2332,6 @@ public class ProductionRunServices {
         if (issueRequiredComponents == null) {
             issueRequiredComponents = Boolean.FALSE;
         }
-        if (fromDate == null) {
-            fromDate = UtilDateTime.nowTimestamp();
-        }
-        if (toDate == null) {
-            toDate = UtilDateTime.nowTimestamp();
-        }
         if (addQuantityProduced == null) {
             addQuantityProduced = BigDecimal.ZERO;
         }
@@ -2593,7 +2585,8 @@ public class ProductionRunServices {
         if (config == null && configId == null) {
             return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, 
"ManufacturingConfigurationNotAvailable", locale));
         }
-        if (config == null && configId != null) {
+        if (config == null
+                || config == null && configId != null) {
             // TODO: load the configuration
             return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, 
"ManufacturingProductionRunFromConfigurationNotYetImplemented",
                     locale));

Reply via email to