Author: britter
Date: Fri Dec 26 11:11:43 2014
New Revision: 1647957

URL: http://svn.apache.org/r1647957
Log:
Assign logger only once

Modified:
    
commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/GenericTypeValidator.java

Modified: 
commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/GenericTypeValidator.java
URL: 
http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/GenericTypeValidator.java?rev=1647957&r1=1647956&r2=1647957&view=diff
==============================================================================
--- 
commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/GenericTypeValidator.java
 (original)
+++ 
commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/GenericTypeValidator.java
 Fri Dec 26 11:11:43 2014
@@ -38,6 +38,8 @@ public class GenericTypeValidator implem
 
     private static final long serialVersionUID = 5487162314134261703L;
 
+    private static final Log LOG = 
LogFactory.getLog(GenericTypeValidator.class);
+
     /**
      * Checks if the value can safely be converted to a byte primitive.
      *
@@ -404,10 +406,9 @@ public class GenericTypeValidator implem
                 date = formatterDefault.parse(value);
             }
         } catch (ParseException e) {
-            // Bad date, so log and return null
-            Log log = LogFactory.getLog(GenericTypeValidator.class);
-            if (log.isDebugEnabled()) {
-                log.debug("Date parse failed value=[" + value + "], " +
+            // Bad date, so LOG and return null
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("Date parse failed value=[" + value + "], " +
                         "locale=[" + locale + "] " + e);
             }
         }
@@ -453,9 +454,8 @@ public class GenericTypeValidator implem
             }
         } catch (ParseException e) {
             // Bad date so return null
-            Log log = LogFactory.getLog(GenericTypeValidator.class);
-            if (log.isDebugEnabled()) {
-                log.debug("Date parse failed value=[" + value + "], " +
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("Date parse failed value=[" + value + "], " +
                         "pattern=[" + datePattern + "], " +
                         "strict=[" + strict + "] " + e);
             }


Reply via email to