Improved: Fix some bugs Spotbugs reports (OFBIZ-12386)

Finally it's better to use || than | (did not check well last time) in
ProductSearchSession::makeSearchParametersString
kc.isAnyPrefix() || kc.isAnySuffix()
So also removes the exclusion

No problem for report field in AbstractReportThread as explained in exclude.xml
This commit is contained in:
Jacques Le Roux
2021-12-16 13:09:38 +01:00
parent 22b8ecb557
commit b9735b208a
2 changed files with 8 additions and 6 deletions
@@ -1188,7 +1188,7 @@ public class ProductSearchSession {
searchParamString.append("&SEARCH_ANYPRESUF");
searchParamString.append(keywordsCount);
searchParamString.append("=");
searchParamString.append(kc.isAnyPrefix() | kc.isAnySuffix() ? "Y" : "N");
searchParamString.append(kc.isAnyPrefix() || kc.isAnySuffix() ? "Y" : "N");
} else if (psc instanceof ProductSearch.ListPriceRangeConstraint) {
ProductSearch.ListPriceRangeConstraint lprc = (ProductSearch.ListPriceRangeConstraint) psc;
if (lprc.getLowPrice() != null || lprc.getHighPrice() != null) {
+7 -5
View File
@@ -119,11 +119,7 @@
<!-- v v not a problem, false positive -->
<Match>
<Class name="org.apache.ofbiz.product.product.ProductSearchSession" />
<Method name="makeSearchParametersString" />
<Bug pattern="NS_DANGEROUS_NON_SHORT_CIRCUIT" />
</Match>
<Match>
<!-- It's OK, cf. OFBIZ-9973 -->
<Class name="org.apache.ofbiz.product.imagemanagement.FrameImage" />
<Method name="previewFrameImage" />
<Bug pattern="PT_RELATIVE_PATH_TRAVERSAL" />
@@ -134,5 +130,11 @@
<Method name="XmlRpcTests" />
<Bug pattern="ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD" />
</Match>
<Match>
<!-- not a problem report is initialised by initHtmlReport and then feed by different threads -->
<Class name="org.apache.ofbiz.htmlreport.AbstractReportThread" />
<Field name="report" />
<Bug pattern="UWF_UNWRITTEN_FIELD " />
</Match>
<!-- ^ ^ not a problem, false positive -->
</FindBugsFilter>