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 346c63b Improved: Checkstyle: Variable name must match pattern
(OFBIZ-11926)
346c63b is described below
commit 346c63bfdf89be1354291ff2d8c4f564930d50c2
Author: Jacques Le Roux <[email protected]>
AuthorDate: Tue Sep 15 15:24:45 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.
---
.../accounting/thirdparty/verisign/PayflowPro.java | 2 +-
.../order/shoppingcart/CartEventListener.java | 2 +-
.../ofbiz/order/shoppingcart/ShoppingCart.java | 2 +-
.../order/shoppinglist/ShoppingListEvents.java | 3 +--
.../communication/CommunicationEventServices.java | 2 +-
.../product/product/ProductSearchSession.java | 2 +-
.../workeffort/workeffort/ICalRecurConverter.java | 5 ++++-
.../java/org/apache/ofbiz/base/util/UtilHtml.java | 23 +++++++++++-----------
.../org/apache/ofbiz/entity/GenericDelegator.java | 3 +--
.../entity/condition/EntityConditionSubSelect.java | 6 ++----
.../entity/condition/EntityConditionValue.java | 6 +++++-
.../ofbiz/entity/condition/EntityFieldValue.java | 3 ++-
.../ofbiz/service/engine/EntityAutoEngine.java | 2 +-
.../ofbiz/webapp/control/LoginEventListener.java | 4 ++++
.../widget/renderer/macro/MacroFormRenderer.java | 2 ++
15 files changed, 39 insertions(+), 28 deletions(-)
diff --git
a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/verisign/PayflowPro.java
b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/verisign/PayflowPro.java
index 01dbfe2..63c6547 100644
---
a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/verisign/PayflowPro.java
+++
b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/verisign/PayflowPro.java
@@ -881,7 +881,7 @@ public class PayflowPro {
Object valueObj = context.get(name);
if (valueObj == null || (valueObj instanceof String) && ((String)
valueObj).isEmpty()) {
- // not valid; do nothing
+ Debug.logError("not valid; do nothing", MODULE);
} else {
String value = valueObj.toString();
diff --git
a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/CartEventListener.java
b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/CartEventListener.java
index c43b7c1..e3f5e44 100644
---
a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/CartEventListener.java
+++
b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/CartEventListener.java
@@ -42,7 +42,7 @@ public class CartEventListener implements HttpSessionListener
{
@Override
public void sessionCreated(HttpSessionEvent event) {
- //for this one do nothing when the session is created...
+ Debug.logInfo("Do nothing when the session is created.", MODULE);
}
@Override
diff --git
a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java
b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java
index 31e46aa..2aa519a 100644
---
a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java
+++
b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java
@@ -2619,7 +2619,7 @@ public class ShoppingCart implements
Iterable<ShoppingCartItem>, Serializable {
/** positionItemToGroup */
public void positionItemToGroup(ShoppingCartItem item, BigDecimal
quantity, int fromIndex, int toIndex, boolean clearEmptyGroups) {
if (fromIndex == toIndex || quantity.compareTo(BigDecimal.ZERO) <= 0) {
- // do nothing
+ Debug.logError("Wrong index", MODULE);
return;
}
diff --git
a/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListEvents.java
b/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListEvents.java
index 6407ff4..08a1112 100644
---
a/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListEvents.java
+++
b/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListEvents.java
@@ -337,8 +337,7 @@ public class ShoppingListEvents {
try {
quantity = new BigDecimal(quantityStr);
} catch (NumberFormatException e) {
- // do nothing, just won't pass to service if it is null
- Debug.logError(e, MODULE);
+ Debug.logError(e, "do nothing, just won't pass to service if it is
null", MODULE);
}
Map<String, Object> serviceInMap = new HashMap<>();
diff --git
a/applications/party/src/main/java/org/apache/ofbiz/party/communication/CommunicationEventServices.java
b/applications/party/src/main/java/org/apache/ofbiz/party/communication/CommunicationEventServices.java
index e484bb2..35b999a 100644
---
a/applications/party/src/main/java/org/apache/ofbiz/party/communication/CommunicationEventServices.java
+++
b/applications/party/src/main/java/org/apache/ofbiz/party/communication/CommunicationEventServices.java
@@ -1006,7 +1006,7 @@ public class CommunicationEventServices {
if (userLogin.get("partyId") == null && partyIdTo != null) {
int ch = 0;
for (ch = partyIdTo.length(); ch > 0 &&
Character.isDigit(partyIdTo.charAt(ch - 1)); ch--) {
- // TODO: Do nothing here, this should be removed.
+ Debug.log("Increase partyIdTo string to create a prefix",
MODULE);
}
userLogin.put("partyId", partyIdTo.substring(0, ch)); //allow
services to be called to have prefix
}
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 57603eb..b8d7688 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
@@ -477,7 +477,7 @@ public class ProductSearchSession {
} else if ("KOTT_OFBURL".equals(targetTypeEnumId))
{
target = rh.makeLink(request, response,
target, false, false, false);
} else if ("KOTT_AURL".equals(targetTypeEnumId)) {
- // do nothing, is absolute URL
+ Debug.log("Do nothing, is absolute URL",
MODULE);
} else {
Debug.logError("The targetTypeEnumId[] is not
recognized, not doing keyword override", MODULE);
// might as well see if there are any others...
diff --git
a/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/ICalRecurConverter.java
b/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/ICalRecurConverter.java
index cf7460f..04b5d24 100644
---
a/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/ICalRecurConverter.java
+++
b/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/ICalRecurConverter.java
@@ -25,6 +25,8 @@ import java.util.List;
import java.util.Set;
import java.util.Stack;
+import org.apache.ofbiz.base.util.Debug;
+import org.apache.ofbiz.base.util.ObjectType;
import org.apache.ofbiz.service.calendar.TemporalExpression;
import org.apache.ofbiz.service.calendar.TemporalExpressionVisitor;
import org.apache.ofbiz.service.calendar.TemporalExpressions;
@@ -62,6 +64,7 @@ import net.fortuna.ical4j.model.property.RRule;
*/
public class ICalRecurConverter implements TemporalExpressionVisitor {
protected static final WeekDay DAY_OF_WEEK_ARRAY[] = {WeekDay.SU,
WeekDay.MO, WeekDay.TU, WeekDay.WE, WeekDay.TH, WeekDay.FR, WeekDay.SA};
+ private static final String MODULE = ObjectType.class.getName();
@SuppressWarnings("unchecked")
public static void convert(TemporalExpression expr, PropertyList
eventProps) {
@@ -209,7 +212,7 @@ public class ICalRecurConverter implements
TemporalExpressionVisitor {
@Override
public void visit(Substitution expr) {
- // iCalendar format does not support substitutions. Do nothing for now.
+ Debug.log("iCalendar format does not support substitutions. Do nothing
for now", MODULE);
}
@Override
diff --git
a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHtml.java
b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHtml.java
index bbafaaf..5265304 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHtml.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHtml.java
@@ -18,16 +18,6 @@
*******************************************************************************/
package org.apache.ofbiz.base.util;
-import org.apache.ofbiz.widget.model.ThemeFactory;
-import org.jsoup.parser.ParseError;
-import org.jsoup.parser.Parser;
-
-import javax.xml.stream.XMLEventReader;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.events.EndElement;
-import javax.xml.stream.events.StartElement;
-import javax.xml.stream.events.XMLEvent;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
@@ -38,6 +28,17 @@ import java.util.Collections;
import java.util.List;
import java.util.Stack;
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.events.EndElement;
+import javax.xml.stream.events.StartElement;
+import javax.xml.stream.events.XMLEvent;
+
+import org.apache.ofbiz.widget.model.ThemeFactory;
+import org.jsoup.parser.ParseError;
+import org.jsoup.parser.Parser;
+
public final class UtilHtml {
private static final String MODULE = UtilHtml.class.getName();
@@ -108,7 +109,7 @@ public final class UtilHtml {
try {
eventReader.close();
} catch (XMLStreamException e) {
- // do nothing
+ Debug.logError(e, MODULE);
}
}
}
diff --git
a/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericDelegator.java
b/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericDelegator.java
index ab97c3b..7cf5a27 100644
---
a/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericDelegator.java
+++
b/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericDelegator.java
@@ -2763,8 +2763,7 @@ public class GenericDelegator implements Delegator {
* @return the distributed cache clear
*/
protected DistributedCacheClear createDistributedCacheClear() {
- // If useDistributedCacheClear is false do nothing: the
distributedCacheClear member field with a null value would cause dcc code to do
- // nothing
+ // If useDistributedCacheClear is false do nothing: the DCC member
field with a null value would cause DCC code to do nothing
if (useDistributedCacheClear()) {
//time to do some tricks with manual class loading that resolves
circular dependencies, like calling services
ClassLoader loader =
Thread.currentThread().getContextClassLoader();
diff --git
a/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionSubSelect.java
b/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionSubSelect.java
index ecc67f9..e770cd3 100644
---
a/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionSubSelect.java
+++
b/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionSubSelect.java
@@ -136,23 +136,21 @@ public class EntityConditionSubSelect extends
EntityConditionValue {
@Override
public ModelField getModelField(ModelEntity modelEntity) {
- // do nothing for now
return null;
}
@Override
public void setModelField(ModelField modelEntity) {
- // do nothing for now
+ Debug.logInfo("Logging to avoid checkstyle issue.", MODULE);
}
@Override
public Comparable<?> getValue(Delegator delegator, Map<String, ? extends
Object> map) {
- // do nothing for now
return null;
}
@Override
public void validateSql(ModelEntity modelEntity) throws
GenericModelException {
- // do nothing for now
+ Debug.logInfo("Logging to avoid checkstyle issue.", MODULE);
}
}
diff --git
a/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionValue.java
b/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionValue.java
index 1d3ef93..ef3bfe0 100644
---
a/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionValue.java
+++
b/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionValue.java
@@ -25,12 +25,14 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.apache.ofbiz.base.util.Debug;
import org.apache.ofbiz.entity.Delegator;
import org.apache.ofbiz.entity.GenericEntity;
import org.apache.ofbiz.entity.GenericModelException;
import org.apache.ofbiz.entity.config.model.Datasource;
import org.apache.ofbiz.entity.model.ModelEntity;
import org.apache.ofbiz.entity.model.ModelField;
+import org.apache.ofbiz.minilang.operation.Convert;
/**
* Base class for condition expression values.
@@ -40,6 +42,8 @@ import org.apache.ofbiz.entity.model.ModelField;
public abstract class EntityConditionValue implements Serializable {
private static final Map<String, String> EMPTY_ALIASES =
Collections.unmodifiableMap(new HashMap<>());
+ private static final String MODULE = Convert.class.getName();
+
public static EntityConditionValue constantNumber(Number value) {
return new ConstantNumberValue(value);
}
@@ -68,7 +72,7 @@ public abstract class EntityConditionValue implements
Serializable {
@Override
public void setModelField(ModelField field) {
- // Do nothing;
+ Debug.logInfo("Logging to avoid checkstyle issue.", MODULE);
}
@Override
diff --git
a/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityFieldValue.java
b/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityFieldValue.java
index d81ec0d..57daffa 100644
---
a/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityFieldValue.java
+++
b/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityFieldValue.java
@@ -25,6 +25,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import org.apache.ofbiz.base.util.Debug;
import org.apache.ofbiz.base.util.UtilMisc;
import org.apache.ofbiz.base.util.UtilValidate;
import org.apache.ofbiz.entity.Delegator;
@@ -148,7 +149,7 @@ public class EntityFieldValue extends EntityConditionValue {
@Override
public void setModelField(ModelField field) {
- // do nothing
+ Debug.logInfo("Logging to avoid checkstyle issue.", MODULE);
}
@Override
diff --git
a/framework/service/src/main/java/org/apache/ofbiz/service/engine/EntityAutoEngine.java
b/framework/service/src/main/java/org/apache/ofbiz/service/engine/EntityAutoEngine.java
index c7bd446..c8e7a80 100644
---
a/framework/service/src/main/java/org/apache/ofbiz/service/engine/EntityAutoEngine.java
+++
b/framework/service/src/main/java/org/apache/ofbiz/service/engine/EntityAutoEngine.java
@@ -180,7 +180,7 @@ public final class EntityAutoEngine extends
GenericAsyncEngine {
doublePkPrimaryInParam = secondPkParam;
doublePkSecondaryOutParam = firstPkParam;
doublePkSecondaryOutField = firstPkField;
- //} else {
+ // } else {
// we don't have an IN and an OUT... so do nothing and leave
them null
}
}
diff --git
a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/LoginEventListener.java
b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/LoginEventListener.java
index e96f73b..82f7481 100644
---
a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/LoginEventListener.java
+++
b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/LoginEventListener.java
@@ -23,6 +23,8 @@ import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;
+import org.apache.ofbiz.base.util.Debug;
+
/**
* HttpSessionListener that finalizes login information
*/
@@ -36,6 +38,8 @@ public class LoginEventListener implements
HttpSessionListener {
public void sessionCreated(HttpSessionEvent event) {
//for this one do nothing when the session is created...
//HttpSession session = event.getSession();
+ Debug.log("do nothing, it's an ignored field; could add a comment or
something if we wanted to", MODULE);
+
}
@Override
diff --git
a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java
b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java
index 1d05630..a6af891 100644
---
a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java
+++
b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java
@@ -1328,6 +1328,8 @@ public final class MacroFormRenderer implements
FormStringRenderer {
@Override
public void renderIgnoredField(Appendable writer, Map<String, Object>
context, IgnoredField ignoredField) {
// do nothing, it's an ignored field; could add a comment or something
if we wanted to
+ Debug.logError("do nothing, it's an ignored field; could add a comment
or something if we wanted to", MODULE);
+
}
@Override