Re: svn commit: r1858350 - in /ofbiz/ofbiz-plugins/trunk: pricat/src/main/java/org/apache/ofbiz/pricat/AbstractPricatParser.java pricat/src/main/java/org/apache/ofbiz/pricat/sample/SamplePricatParser.

2019-04-29 Thread Jacques Le Roux

Yes I reverted it

Thanks Mathieu

Jacques

Le 29/04/2019 à 11:17, Mathieu Lirzin a écrit :

Hello Jacques,

jler...@apache.org writes:


Modified: 
ofbiz/ofbiz-plugins/trunk/pricat/src/main/java/org/apache/ofbiz/pricat/sample/SamplePricatParser.java
URL: 
http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/pricat/src/main/java/org/apache/ofbiz/pricat/sample/SamplePricatParser.java?rev=1858350=1858349=1858350=diff
==
--- 
ofbiz/ofbiz-plugins/trunk/pricat/src/main/java/org/apache/ofbiz/pricat/sample/SamplePricatParser.java
 (original)
+++ 
ofbiz/ofbiz-plugins/trunk/pricat/src/main/java/org/apache/ofbiz/pricat/sample/SamplePricatParser.java
 Mon Apr 29 09:09:20 2019
@@ -346,20 +346,20 @@ public class SamplePricatParser extends
  public boolean isFacilityOk(XSSFRow row, String facilityName, String 
facilityId) {
  if (!facilities.containsKey(facilityId)) {
  if (UtilValidate.isEmpty(facilityId) && 
facilities.keySet().size() == 1) {
-if (UtilValidate.isEmpty(facilityName)) {
-return true;
-} else {
-String theFacilityId = (String) 
facilities.keySet().toArray()[0];
-String name = facilities.get(theFacilityId)[0];
-if (!name.equals(facilityName)) {
-String errorMessage = UtilProperties.getMessage(resource, 
"FacilityNameNotMatchId", new Object[]{theFacilityId, name, facilityName}, 
locale);
-report.println();
-report.print(errorMessage, 
InterfaceReport.FORMAT_ERROR);
-XSSFCell cell = row.getCell(0);
-errorMessages.put(new CellReference(cell), 
errorMessage);
-return false;
-}
+
+return UtilValidate.isEmpty(facilityName);
+
+String theFacilityId = (String) 
facilities.keySet().toArray()[0];
+String name = facilities.get(theFacilityId)[0];
+if (!name.equals(facilityName)) {
+String errorMessage = UtilProperties.getMessage(resource, 
"FacilityNameNotMatchId", new Object[]{theFacilityId, name, facilityName}, 
locale);
+report.println();
+report.print(errorMessage, InterfaceReport.FORMAT_ERROR);
+XSSFCell cell = row.getCell(0);
+errorMessages.put(new CellReference(cell), errorMessage);
+return false;
  
This change seems fishy since it introduces code after a ‘return’

statement in the same block, which mean that this is dead code.

Thanks.



Re: svn commit: r1858350 - in /ofbiz/ofbiz-plugins/trunk: pricat/src/main/java/org/apache/ofbiz/pricat/AbstractPricatParser.java pricat/src/main/java/org/apache/ofbiz/pricat/sample/SamplePricatParser.

2019-04-29 Thread Mathieu Lirzin
Hello Jacques,

jler...@apache.org writes:

> Modified: 
> ofbiz/ofbiz-plugins/trunk/pricat/src/main/java/org/apache/ofbiz/pricat/sample/SamplePricatParser.java
> URL: 
> http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/pricat/src/main/java/org/apache/ofbiz/pricat/sample/SamplePricatParser.java?rev=1858350=1858349=1858350=diff
> ==
> --- 
> ofbiz/ofbiz-plugins/trunk/pricat/src/main/java/org/apache/ofbiz/pricat/sample/SamplePricatParser.java
>  (original)
> +++ 
> ofbiz/ofbiz-plugins/trunk/pricat/src/main/java/org/apache/ofbiz/pricat/sample/SamplePricatParser.java
>  Mon Apr 29 09:09:20 2019
> @@ -346,20 +346,20 @@ public class SamplePricatParser extends
>  public boolean isFacilityOk(XSSFRow row, String facilityName, String 
> facilityId) {
>  if (!facilities.containsKey(facilityId)) {
>  if (UtilValidate.isEmpty(facilityId) && 
> facilities.keySet().size() == 1) {
> -if (UtilValidate.isEmpty(facilityName)) {
> -return true;
> -} else {
> -String theFacilityId = (String) 
> facilities.keySet().toArray()[0];
> -String name = facilities.get(theFacilityId)[0];
> -if (!name.equals(facilityName)) {
> -String errorMessage = 
> UtilProperties.getMessage(resource, "FacilityNameNotMatchId", new 
> Object[]{theFacilityId, name, facilityName}, locale);
> -report.println();
> -report.print(errorMessage, 
> InterfaceReport.FORMAT_ERROR);
> -XSSFCell cell = row.getCell(0);
> -errorMessages.put(new CellReference(cell), 
> errorMessage);
> -return false;
> -}
> +
> +return UtilValidate.isEmpty(facilityName);
> +
> +String theFacilityId = (String) 
> facilities.keySet().toArray()[0];
> +String name = facilities.get(theFacilityId)[0];
> +if (!name.equals(facilityName)) {
> +String errorMessage = 
> UtilProperties.getMessage(resource, "FacilityNameNotMatchId", new 
> Object[]{theFacilityId, name, facilityName}, locale);
> +report.println();
> +report.print(errorMessage, InterfaceReport.FORMAT_ERROR);
> +XSSFCell cell = row.getCell(0);
> +errorMessages.put(new CellReference(cell), errorMessage);
> +return false;
 
This change seems fishy since it introduces code after a ‘return’
statement in the same block, which mean that this is dead code.

Thanks.

-- 
Mathieu Lirzin
GPG: F2A3 8D7E EB2B 6640 5761  070D 0ADE E100 9460 4D37