[ofbiz-plugins] branch trunk updated: Improved: Checkstyle: Variable name must match pattern (OFBIZ-11926)

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

[ofbiz-plugins] branch trunk updated: Improved: Checkstyle: Variable name must match pattern (OFBIZ-11926)

jleroux@apache.org
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-plugins.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 6ac7dc9  Improved: Checkstyle: Variable name must match pattern (OFBIZ-11926)
6ac7dc9 is described below

commit 6ac7dc934adb0329f7fd585d46cd6cc7c72dd1d3
Author: Jacques Le Roux <[hidden email]>
AuthorDate: Tue Sep 15 15:24:55 2020 +0200

    Improved: Checkstyle: Variable name must match pattern (OFBIZ-11926)
   
    We have a lot of "do nothing" in Java code. In case of catch we should at least
    have Debug.logError(e, MODULE); and maybe an explanation in the comment.
---
 .../ofbiz/passport/user/GitHubAuthenticator.java   | 38 ++++++++++----------
 .../org/apache/ofbiz/htmlreport/HtmlReport.java    |  6 ++--
 .../apache/ofbiz/pricat/AbstractPricatParser.java  | 40 +++++++++++-----------
 .../java/org/apache/ofbiz/pricat/PricatEvents.java |  2 +-
 .../ofbiz/pricat/sample/SamplePricatParser.java    |  2 +-
 .../org/apache/ofbiz/solr/SolrProductSearch.java   | 24 ++++++-------
 6 files changed, 56 insertions(+), 56 deletions(-)

diff --git a/passport/src/main/java/org/apache/ofbiz/passport/user/GitHubAuthenticator.java b/passport/src/main/java/org/apache/ofbiz/passport/user/GitHubAuthenticator.java
index d09cebb..4b553fc 100644
--- a/passport/src/main/java/org/apache/ofbiz/passport/user/GitHubAuthenticator.java
+++ b/passport/src/main/java/org/apache/ofbiz/passport/user/GitHubAuthenticator.java
@@ -18,28 +18,15 @@
  *******************************************************************************/
 package org.apache.ofbiz.passport.user;
 
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
 import java.io.IOException;
 import java.io.Serializable;
 import java.sql.Timestamp;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
 
 import javax.transaction.Transaction;
 
-import org.apache.ofbiz.passport.event.GitHubEvents;
-import org.apache.ofbiz.passport.util.PassportUtil;
-import org.apache.ofbiz.common.authentication.api.Authenticator;
-import org.apache.ofbiz.common.authentication.api.AuthenticatorException;
-import org.apache.ofbiz.service.LocalDispatcher;
-import org.apache.ofbiz.service.GenericServiceException;
-import org.apache.ofbiz.service.ServiceUtil;
-import org.apache.ofbiz.entity.Delegator;
-import org.apache.ofbiz.entity.GenericValue;
-import org.apache.ofbiz.entity.GenericEntityException;
-import org.apache.ofbiz.entity.transaction.TransactionUtil;
-import org.apache.ofbiz.entity.transaction.GenericTransactionException;
-import org.apache.ofbiz.entity.util.EntityQuery;
 import org.apache.http.HttpStatus;
 import org.apache.http.client.ClientProtocolException;
 import org.apache.http.client.methods.CloseableHttpResponse;
@@ -50,11 +37,24 @@ import org.apache.http.impl.client.HttpClients;
 import org.apache.ofbiz.base.conversion.ConversionException;
 import org.apache.ofbiz.base.conversion.JSONConverters.JSONToMap;
 import org.apache.ofbiz.base.lang.JSON;
-import org.apache.ofbiz.base.util.UtilProperties;
 import org.apache.ofbiz.base.util.Debug;
-import org.apache.ofbiz.base.util.UtilMisc;
 import org.apache.ofbiz.base.util.UtilDateTime;
+import org.apache.ofbiz.base.util.UtilMisc;
+import org.apache.ofbiz.base.util.UtilProperties;
 import org.apache.ofbiz.base.util.UtilValidate;
+import org.apache.ofbiz.common.authentication.api.Authenticator;
+import org.apache.ofbiz.common.authentication.api.AuthenticatorException;
+import org.apache.ofbiz.entity.Delegator;
+import org.apache.ofbiz.entity.GenericEntityException;
+import org.apache.ofbiz.entity.GenericValue;
+import org.apache.ofbiz.entity.transaction.GenericTransactionException;
+import org.apache.ofbiz.entity.transaction.TransactionUtil;
+import org.apache.ofbiz.entity.util.EntityQuery;
+import org.apache.ofbiz.passport.event.GitHubEvents;
+import org.apache.ofbiz.passport.util.PassportUtil;
+import org.apache.ofbiz.service.GenericServiceException;
+import org.apache.ofbiz.service.LocalDispatcher;
+import org.apache.ofbiz.service.ServiceUtil;
 
 /**
  * GitHub OFBiz Authenticator
@@ -405,7 +405,7 @@ public class GitHubAuthenticator implements Authenticator {
                 try {
                     getResponse.close();
                 } catch (IOException e) {
-                    // do nothing
+                    Debug.logError(e, MODULE);
                 }
             }
         }
diff --git a/pricat/src/main/java/org/apache/ofbiz/htmlreport/HtmlReport.java b/pricat/src/main/java/org/apache/ofbiz/htmlreport/HtmlReport.java
index 4003573..34b2da4 100644
--- a/pricat/src/main/java/org/apache/ofbiz/htmlreport/HtmlReport.java
+++ b/pricat/src/main/java/org/apache/ofbiz/htmlreport/HtmlReport.java
@@ -31,6 +31,7 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
@@ -1228,7 +1229,7 @@ public class HtmlReport extends AbstractReport {
             try {
                 logFileOutputStream = new FileOutputStream(logFile);
             } catch (FileNotFoundException e) {
-                // do nothing
+                Debug.logError(e, MODULE);
             }
         }
     }
@@ -1238,13 +1239,12 @@ public class HtmlReport extends AbstractReport {
             try {
                 logFileOutputStream.flush();
             } catch (IOException e) {
-                // do nothing
+                Debug.logError(e, MODULE);
             } finally {
                 if (logFileOutputStream != null) {
                     try {
                         logFileOutputStream.close();
                     } catch (IOException e) {
-                        // do nothing
                         Debug.logError(e, MODULE);
                     }
                 }
diff --git a/pricat/src/main/java/org/apache/ofbiz/pricat/AbstractPricatParser.java b/pricat/src/main/java/org/apache/ofbiz/pricat/AbstractPricatParser.java
index 1a760ac..7c0052e 100644
--- a/pricat/src/main/java/org/apache/ofbiz/pricat/AbstractPricatParser.java
+++ b/pricat/src/main/java/org/apache/ofbiz/pricat/AbstractPricatParser.java
@@ -28,9 +28,28 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
+
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpSession;
 
+import org.apache.commons.fileupload.FileItem;
+import org.apache.ofbiz.base.util.Debug;
+import org.apache.ofbiz.base.util.FileUtil;
+import org.apache.ofbiz.base.util.UtilDateTime;
+import org.apache.ofbiz.base.util.UtilMisc;
+import org.apache.ofbiz.base.util.UtilProperties;
+import org.apache.ofbiz.base.util.UtilValidate;
+import org.apache.ofbiz.entity.Delegator;
+import org.apache.ofbiz.entity.GenericEntityException;
+import org.apache.ofbiz.entity.GenericValue;
+import org.apache.ofbiz.entity.condition.EntityCondition;
+import org.apache.ofbiz.entity.condition.EntityOperator;
+import org.apache.ofbiz.entity.util.EntityQuery;
+import org.apache.ofbiz.htmlreport.InterfaceReport;
+import org.apache.ofbiz.order.finaccount.FinAccountHelper;
+import org.apache.ofbiz.pricat.util.OFBizPricatUtil;
+import org.apache.ofbiz.service.LocalDispatcher;
+import org.apache.ofbiz.service.ServiceUtil;
 import org.apache.poi.hssf.usermodel.HSSFDataFormatter;
 import org.apache.poi.ss.usermodel.CellType;
 import org.apache.poi.ss.usermodel.ClientAnchor.AnchorType;
@@ -52,25 +71,6 @@ import org.apache.poi.xssf.usermodel.XSSFRow;
 import org.apache.poi.xssf.usermodel.XSSFShape;
 import org.apache.poi.xssf.usermodel.XSSFSheet;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
-import org.apache.commons.fileupload.FileItem;
-
-import org.apache.ofbiz.htmlreport.InterfaceReport;
-import org.apache.ofbiz.order.finaccount.FinAccountHelper;
-import org.apache.ofbiz.pricat.util.OFBizPricatUtil;
-import org.apache.ofbiz.base.util.Debug;
-import org.apache.ofbiz.base.util.FileUtil;
-import org.apache.ofbiz.base.util.UtilDateTime;
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.base.util.UtilProperties;
-import org.apache.ofbiz.base.util.UtilValidate;
-import org.apache.ofbiz.entity.Delegator;
-import org.apache.ofbiz.entity.GenericEntityException;
-import org.apache.ofbiz.entity.GenericValue;
-import org.apache.ofbiz.entity.condition.EntityCondition;
-import org.apache.ofbiz.entity.condition.EntityOperator;
-import org.apache.ofbiz.entity.util.EntityQuery;
-import org.apache.ofbiz.service.LocalDispatcher;
-import org.apache.ofbiz.service.ServiceUtil;
 
 /**
  * Abstract class of pricat parser.
@@ -762,7 +762,7 @@ public abstract class AbstractPricatParser implements InterfacePricatParser {
             }
             delegator.createOrStore(historyValue);
         } catch (GenericEntityException e) {
-            // do nothing
+            Debug.logError(e, MODULE);
         }
     }
 
diff --git a/pricat/src/main/java/org/apache/ofbiz/pricat/PricatEvents.java b/pricat/src/main/java/org/apache/ofbiz/pricat/PricatEvents.java
index b345d07..ad0b9fd 100644
--- a/pricat/src/main/java/org/apache/ofbiz/pricat/PricatEvents.java
+++ b/pricat/src/main/java/org/apache/ofbiz/pricat/PricatEvents.java
@@ -89,7 +89,7 @@ public class PricatEvents {
                     try {
                         sequenceNum = Long.valueOf(sequenceNumString);
                     } catch (NumberFormatException e) {
-                        // do nothing
+                        Debug.logError(e, MODULE);
                     }
                 }
                 String originalPricatFileName = (String) request.getSession().getAttribute(PricatParseExcelHtmlThread.PRICAT_FILE);
diff --git a/pricat/src/main/java/org/apache/ofbiz/pricat/sample/SamplePricatParser.java b/pricat/src/main/java/org/apache/ofbiz/pricat/sample/SamplePricatParser.java
index 85b76c8..441787c 100644
--- a/pricat/src/main/java/org/apache/ofbiz/pricat/sample/SamplePricatParser.java
+++ b/pricat/src/main/java/org/apache/ofbiz/pricat/sample/SamplePricatParser.java
@@ -614,7 +614,7 @@ public class SamplePricatParser extends AbstractPricatParser {
                         try {
                             cellValue = cell.getStringCellValue();
                         } catch (IllegalStateException e1) {
-                            // do nothing
+                            Debug.logError(e1, MODULE);
                         }
                     }
                     report.print(((i == 0) ? "" : ", ") + cellValue, InterfaceReport.FORMAT_NOTE);
diff --git a/solr/src/main/java/org/apache/ofbiz/solr/SolrProductSearch.java b/solr/src/main/java/org/apache/ofbiz/solr/SolrProductSearch.java
index 28dd9e6..314f9f0 100644
--- a/solr/src/main/java/org/apache/ofbiz/solr/SolrProductSearch.java
+++ b/solr/src/main/java/org/apache/ofbiz/solr/SolrProductSearch.java
@@ -32,14 +32,6 @@ import java.util.Locale;
 import java.util.Map;
 
 import org.apache.commons.lang.StringUtils;
-import org.apache.solr.client.solrj.SolrQuery;
-import org.apache.solr.client.solrj.SolrServerException;
-import org.apache.solr.client.solrj.impl.HttpSolrClient;
-import org.apache.solr.client.solrj.response.FacetField;
-import org.apache.solr.client.solrj.response.FacetField.Count;
-import org.apache.solr.client.solrj.response.QueryResponse;
-import org.apache.solr.client.solrj.response.SpellCheckResponse.Suggestion;
-import org.apache.solr.common.SolrInputDocument;
 import org.apache.ofbiz.base.util.Debug;
 import org.apache.ofbiz.base.util.UtilGenerics;
 import org.apache.ofbiz.base.util.UtilMisc;
@@ -54,6 +46,14 @@ import org.apache.ofbiz.service.DispatchContext;
 import org.apache.ofbiz.service.GenericServiceException;
 import org.apache.ofbiz.service.LocalDispatcher;
 import org.apache.ofbiz.service.ServiceUtil;
+import org.apache.solr.client.solrj.SolrQuery;
+import org.apache.solr.client.solrj.SolrServerException;
+import org.apache.solr.client.solrj.impl.HttpSolrClient;
+import org.apache.solr.client.solrj.response.FacetField;
+import org.apache.solr.client.solrj.response.FacetField.Count;
+import org.apache.solr.client.solrj.response.QueryResponse;
+import org.apache.solr.client.solrj.response.SpellCheckResponse.Suggestion;
+import org.apache.solr.common.SolrInputDocument;
 
 /**
  * Base class for OFBiz Test Tools test case implementations.
@@ -174,7 +174,7 @@ public abstract class SolrProductSearch {
                 try {
                     client.close();
                 } catch (IOException e) {
-                    // do nothing
+                    Debug.logError(e, MODULE);
                 }
             }
         }
@@ -247,7 +247,7 @@ public abstract class SolrProductSearch {
                 try {
                     client.close();
                 } catch (IOException e) {
-                    // do nothing
+                    Debug.logError(e, MODULE);
                 }
             }
         }
@@ -358,7 +358,7 @@ public abstract class SolrProductSearch {
                 try {
                     client.close();
                 } catch (IOException e) {
-                    // do nothing
+                    Debug.logError(e, MODULE);
                 }
             }
         }
@@ -723,7 +723,7 @@ public abstract class SolrProductSearch {
                 try {
                     client.close();
                 } catch (IOException e) {
-                    // do nothing
+                    Debug.logError(e, e.getMessage(), MODULE);
                 }
             }
         }