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 b9735b2 Improved: Fix some bugs Spotbugs reports (OFBIZ-12386)
b9735b2 is described below
commit b9735b208a4eec1271edb3ab9bb2c6dc9d20bf0e
Author: Jacques Le Roux <[email protected]>
AuthorDate: Thu Dec 16 13:09:38 2021 +0100
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
---
.../apache/ofbiz/product/product/ProductSearchSession.java | 2 +-
spotbugs/exclude.xml | 12 +++++++-----
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git
a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearchSession.java
b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearchSession.java
index 57c3b21..6e9c285 100644
---
a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearchSession.java
+++
b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearchSession.java
@@ -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)
{
diff --git a/spotbugs/exclude.xml b/spotbugs/exclude.xml
index 5146377..cc809aa 100644
--- a/spotbugs/exclude.xml
+++ b/spotbugs/exclude.xml
@@ -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>