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.java solr/src/main/java/org/apache/ofbiz/solr/SolrUtil.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

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.java solr/src/main/java/org/apache/ofbiz/solr/SolrUtil.java

Mathieu Lirzin
Hello Jacques,

[hidden email] 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&r1=1858349&r2=1858350&view=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
Reply | Threaded
Open this post in threaded view
|

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.java solr/src/main/java/org/apache/ofbiz/solr/SolrUtil.java

Jacques Le Roux
Administrator
Yes I reverted it

Thanks Mathieu

Jacques

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

> Hello Jacques,
>
> [hidden email] 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&r1=1858349&r2=1858350&view=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.
>