struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject [06/16] struts git commit: Uses dedicated logger instead the one from parent class
Date Fri, 24 Mar 2017 09:10:01 GMT
Uses dedicated logger instead the one from parent class


Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/16d1d60e
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/16d1d60e
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/16d1d60e

Branch: refs/heads/master
Commit: 16d1d60ed826c639d2298b77b27c184d9684f21c
Parents: 207ac17
Author: Lukasz Lenart <lukaszlenart@apache.org>
Authored: Fri Mar 17 07:51:57 2017 +0100
Committer: Lukasz Lenart <lukaszlenart@apache.org>
Committed: Fri Mar 17 07:51:57 2017 +0100

----------------------------------------------------------------------
 .../validators/ConditionalVisitorFieldValidator.java         | 6 +++++-
 .../xwork2/validator/validators/ExpressionValidator.java     | 8 ++++++--
 .../validator/validators/FieldExpressionValidator.java       | 8 ++++++--
 .../xwork2/validator/validators/VisitorFieldValidator.java   | 6 +++++-
 4 files changed, 22 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/16d1d60e/core/src/main/java/com/opensymphony/xwork2/validator/validators/ConditionalVisitorFieldValidator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/validator/validators/ConditionalVisitorFieldValidator.java
b/core/src/main/java/com/opensymphony/xwork2/validator/validators/ConditionalVisitorFieldValidator.java
index 7e92f3f..3952698 100644
--- a/core/src/main/java/com/opensymphony/xwork2/validator/validators/ConditionalVisitorFieldValidator.java
+++ b/core/src/main/java/com/opensymphony/xwork2/validator/validators/ConditionalVisitorFieldValidator.java
@@ -1,6 +1,8 @@
 package com.opensymphony.xwork2.validator.validators;
 
 import com.opensymphony.xwork2.validator.ValidationException;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 
 /**
  * <!-- START SNIPPET: javadoc -->
@@ -29,6 +31,8 @@ import com.opensymphony.xwork2.validator.ValidationException;
  */
 public class ConditionalVisitorFieldValidator extends VisitorFieldValidator {
 
+    private static final Logger LOG = LogManager.getLogger(ConditionalVisitorFieldValidator.class);
+
     private String expression;
 
     public void setExpression(String expression) {
@@ -75,7 +79,7 @@ public class ConditionalVisitorFieldValidator extends VisitorFieldValidator
{
         if ((obj != null) && (obj instanceof Boolean)) {
             answer = (Boolean) obj;
         } else {
-            log.warn("Got result of {} when trying to get Boolean.", obj);
+            LOG.warn("Got result of {} when trying to get Boolean.", obj);
         }
 
         return answer;

http://git-wip-us.apache.org/repos/asf/struts/blob/16d1d60e/core/src/main/java/com/opensymphony/xwork2/validator/validators/ExpressionValidator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/validator/validators/ExpressionValidator.java
b/core/src/main/java/com/opensymphony/xwork2/validator/validators/ExpressionValidator.java
index 6e59af2..f3e3da0 100644
--- a/core/src/main/java/com/opensymphony/xwork2/validator/validators/ExpressionValidator.java
+++ b/core/src/main/java/com/opensymphony/xwork2/validator/validators/ExpressionValidator.java
@@ -16,6 +16,8 @@
 package com.opensymphony.xwork2.validator.validators;
 
 import com.opensymphony.xwork2.validator.ValidationException;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 
 /**
  * <!-- START SNIPPET: javadoc -->
@@ -44,6 +46,8 @@ import com.opensymphony.xwork2.validator.ValidationException;
  */
 public class ExpressionValidator extends ValidatorSupport {
 
+    private static final Logger LOG = LogManager.getLogger(ExpressionValidator.class);
+
     private String expression;
 
     public void setExpression(String expression) {
@@ -69,11 +73,11 @@ public class ExpressionValidator extends ValidatorSupport {
         if ((obj != null) && (obj instanceof Boolean)) {
             answer = (Boolean) obj;
         } else {
-            log.warn("Got result of [{}] when trying to get Boolean.", obj);
+            LOG.warn("Got result of [{}] when trying to get Boolean.", obj);
         }
 
         if (!answer) {
-            log.debug("Validation failed on expression [{}] with validated object [{}]",
expression, object);
+            LOG.debug("Validation failed on expression [{}] with validated object [{}]",
expression, object);
             addActionError(object);
         }
     }

http://git-wip-us.apache.org/repos/asf/struts/blob/16d1d60e/core/src/main/java/com/opensymphony/xwork2/validator/validators/FieldExpressionValidator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/validator/validators/FieldExpressionValidator.java
b/core/src/main/java/com/opensymphony/xwork2/validator/validators/FieldExpressionValidator.java
index 12dd7c5..e1f5618 100644
--- a/core/src/main/java/com/opensymphony/xwork2/validator/validators/FieldExpressionValidator.java
+++ b/core/src/main/java/com/opensymphony/xwork2/validator/validators/FieldExpressionValidator.java
@@ -16,6 +16,8 @@
 package com.opensymphony.xwork2.validator.validators;
 
 import com.opensymphony.xwork2.validator.ValidationException;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 
 
 /**
@@ -55,6 +57,8 @@ import com.opensymphony.xwork2.validator.ValidationException;
  */
 public class FieldExpressionValidator extends FieldValidatorSupport {
 
+    private static final Logger LOG = LogManager.getLogger(FieldExpressionValidator.class);
+
     private String expression;
 
     public void setExpression(String expression) {
@@ -82,10 +86,10 @@ public class FieldExpressionValidator extends FieldValidatorSupport {
         if ((obj != null) && (obj instanceof Boolean)) {
             answer = (Boolean) obj;
         } else {
-            log.warn("Got result of {} when trying to get Boolean.", obj);
+            LOG.warn("Got result of {} when trying to get Boolean.", obj);
         }
 
-        if (!answer.booleanValue()) {
+        if (!answer) {
             addFieldError(fieldName, object);
         }
     }

http://git-wip-us.apache.org/repos/asf/struts/blob/16d1d60e/core/src/main/java/com/opensymphony/xwork2/validator/validators/VisitorFieldValidator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/validator/validators/VisitorFieldValidator.java
b/core/src/main/java/com/opensymphony/xwork2/validator/validators/VisitorFieldValidator.java
index 8fd62a6..ce87316 100644
--- a/core/src/main/java/com/opensymphony/xwork2/validator/validators/VisitorFieldValidator.java
+++ b/core/src/main/java/com/opensymphony/xwork2/validator/validators/VisitorFieldValidator.java
@@ -24,6 +24,8 @@ import com.opensymphony.xwork2.validator.ActionValidatorManager;
 import com.opensymphony.xwork2.validator.DelegatingValidatorContext;
 import com.opensymphony.xwork2.validator.ValidationException;
 import com.opensymphony.xwork2.validator.ValidatorContext;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 
 import java.util.Collection;
 import java.util.LinkedList;
@@ -85,6 +87,8 @@ import java.util.List;
  */
 public class VisitorFieldValidator extends FieldValidatorSupport {
 
+    private static final Logger LOG = LogManager.getLogger(VisitorFieldValidator.class);
+
     private String context;
     private boolean appendPrefix = true;
     private ActionValidatorManager actionValidatorManager;
@@ -125,7 +129,7 @@ public class VisitorFieldValidator extends FieldValidatorSupport {
         String fieldName = getFieldName();
         Object value = this.getFieldValue(fieldName, object);
         if (value == null) {
-            log.warn("The visited object is null, VisitorValidator will not be able to handle
validation properly. Please make sure the visited object is not null for VisitorValidator
to function properly");
+            LOG.warn("The visited object is null, VisitorValidator will not be able to handle
validation properly. Please make sure the visited object is not null for VisitorValidator
to function properly");
             return;
         }
         ValueStack stack = ActionContext.getContext().getValueStack();


Mime
View raw message