bval-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject [bval] 06/50: BVAL-103: switch BVal from slf4j to java.util.logging - Changed code to use java.util.logging - Changed pom.xml files: + Removed slf4j as a dependency + slf4j is only there as a test dependency used by some ASF commons library
Date Mon, 10 Jun 2019 05:02:00 GMT
This is an automated email from the ASF dual-hosted git repository.

rmannibucau pushed a commit to tag 0.4
in repository https://gitbox.apache.org/repos/asf/bval.git

commit 6164ebc27654f11137fd658ec3090b97eefb3018
Author: mnour <mnour@13f79535-47bb-0310-9956-ffa450edef68>
AuthorDate: Sat Mar 31 16:28:29 2012 +0000

    BVAL-103: switch BVal from slf4j to java.util.logging
      - Changed code to use java.util.logging
      - Changed pom.xml files:
        + Removed slf4j as a dependency
        + slf4j is only there as a test dependency used by some ASF commons library
    
    
    
    git-svn-id: http://svn.apache.org/repos/asf/bval/trunk@1307843 13f79535-47bb-0310-9956-ffa450edef68
---
 bval-core/pom.xml                                  |  4 ----
 .../main/java/org/apache/bval/MetaBeanBuilder.java | 10 ++++----
 bval-guice/pom.xml                                 |  5 ----
 bval-json/pom.xml                                  |  6 -----
 bval-jsr303/pom.xml                                | 21 +++++++++--------
 .../bval/jsr303/AnnotationConstraintBuilder.java   |  8 +++----
 .../org/apache/bval/jsr303/ConfigurationImpl.java  |  5 ++--
 .../org/apache/bval/jsr303/ConstraintDefaults.java | 13 ++++++-----
 .../bval/jsr303/DefaultMessageInterpolator.java    | 12 +++++-----
 .../apache/bval/jsr303/Jsr303MetaBeanFactory.java  |  8 +++----
 .../resolver/DefaultTraversableResolver.java       | 19 +++++++--------
 .../apache/bval/jsr303/xml/AnnotationIgnores.java  | 11 ++++-----
 .../apache/bval/jsr303/xml/ValidationParser.java   | 27 +++++++++++-----------
 bval-tck/pom.xml                                   | 24 -------------------
 bval-xstream/pom.xml                               | 13 ++++++-----
 .../org/apache/bval/xml/XMLMetaBeanFactory.java    |  8 +++----
 pom.xml                                            | 26 +++++++++------------
 17 files changed, 90 insertions(+), 130 deletions(-)

diff --git a/bval-core/pom.xml b/bval-core/pom.xml
index b18c6b9..3a42ca9 100644
--- a/bval-core/pom.xml
+++ b/bval-core/pom.xml
@@ -42,10 +42,6 @@
             <artifactId>commons-lang3</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-        </dependency>
-        <dependency>
             <groupId>commons-beanutils</groupId>
             <artifactId>commons-beanutils-core</artifactId>
         </dependency>
diff --git a/bval-core/src/main/java/org/apache/bval/MetaBeanBuilder.java b/bval-core/src/main/java/org/apache/bval/MetaBeanBuilder.java
index 055e489..745b0fa 100644
--- a/bval-core/src/main/java/org/apache/bval/MetaBeanBuilder.java
+++ b/bval-core/src/main/java/org/apache/bval/MetaBeanBuilder.java
@@ -19,8 +19,9 @@ package org.apache.bval;
 import org.apache.bval.model.MetaBean;
 import org.apache.commons.lang3.ArrayUtils;
 import org.apache.commons.lang3.ClassUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -30,7 +31,8 @@ import java.util.Map;
  * factories<br/>
  */
 public class MetaBeanBuilder {
-    private static final Logger log = LoggerFactory.getLogger(MetaBeanBuilder.class);
+
+    private static final Logger log =  Logger.getLogger(MetaBeanBuilder.class.getName());
 
     /**
      * here you can install different kinds of factories to create MetaBeans
@@ -106,7 +108,7 @@ public class MetaBeanBuilder {
             try {
                 return ClassUtils.getClass(className);
             } catch (ClassNotFoundException e) {
-                log.trace("class not found: " + className, e);
+            	log.log(Level.FINE, String.format("Class not found: %s", className), e);
             }
         }
         return null;
diff --git a/bval-guice/pom.xml b/bval-guice/pom.xml
index 529e091..c6c58f6 100644
--- a/bval-guice/pom.xml
+++ b/bval-guice/pom.xml
@@ -62,11 +62,6 @@
             <artifactId>junit</artifactId>
             <scope>test</scope>
         </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-simple</artifactId>
-            <scope>test</scope>
-        </dependency>
     </dependencies>
 
     <profiles>
diff --git a/bval-json/pom.xml b/bval-json/pom.xml
index 200ace5..7458781 100644
--- a/bval-json/pom.xml
+++ b/bval-json/pom.xml
@@ -70,12 +70,6 @@
             <type>test-jar</type>
             <scope>test</scope>
         </dependency>
-        <!-- need for testcase logging -->
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-simple</artifactId>
-            <scope>test</scope>
-        </dependency>
     </dependencies>
 
     <build>
diff --git a/bval-jsr303/pom.xml b/bval-jsr303/pom.xml
index fa8b8dd..b4a023a 100644
--- a/bval-jsr303/pom.xml
+++ b/bval-jsr303/pom.xml
@@ -101,10 +101,6 @@
             <version>${project.version}</version>
         </dependency>
         <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-        </dependency>
-        <dependency>
             <groupId>org.apache.commons</groupId>
             <artifactId>commons-lang3</artifactId>
         </dependency>
@@ -135,12 +131,17 @@
             <scope>provided</scope>
             <optional>true</optional>
         </dependency>
-        <!-- need for testcase logging -->
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-simple</artifactId>
-            <scope>test</scope>
-        </dependency>
+        <!-- Testing dependencies -->
+            <dependency>
+                <groupId>org.slf4j</groupId>
+                <artifactId>jcl-over-slf4j</artifactId>
+                <scope>test</scope>
+            </dependency>
+            <dependency>
+                <groupId>org.slf4j</groupId>
+                <artifactId>slf4j-simple</artifactId>
+                <scope>test</scope>
+            </dependency>
     </dependencies>
 
     <build>
diff --git a/bval-jsr303/src/main/java/org/apache/bval/jsr303/AnnotationConstraintBuilder.java
b/bval-jsr303/src/main/java/org/apache/bval/jsr303/AnnotationConstraintBuilder.java
index ad11ed6..be64f29 100644
--- a/bval-jsr303/src/main/java/org/apache/bval/jsr303/AnnotationConstraintBuilder.java
+++ b/bval-jsr303/src/main/java/org/apache/bval/jsr303/AnnotationConstraintBuilder.java
@@ -30,6 +30,8 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 import javax.validation.ConstraintDeclarationException;
 import javax.validation.ConstraintValidator;
@@ -41,8 +43,6 @@ import org.apache.bval.jsr303.groups.GroupsComputer;
 import org.apache.bval.jsr303.util.SecureActions;
 import org.apache.bval.jsr303.xml.AnnotationProxyBuilder;
 import org.apache.bval.util.AccessStrategy;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * Description: helper class that builds a {@link ConstraintValidation} or its
@@ -50,7 +50,7 @@ import org.slf4j.LoggerFactory;
  * providing information (e.g. for @OverridesAttributes) <br/>
  */
 final class AnnotationConstraintBuilder<A extends Annotation> {
-    private static final Logger log = LoggerFactory.getLogger(AnnotationConstraintBuilder.class);
+    private static final Logger log = Logger.getLogger(AnnotationConstraintBuilder.class.getName());
 
     private final ConstraintValidation<?> constraintValidation;
     private List<ConstraintOverrides> overrides;
@@ -94,7 +94,7 @@ final class AnnotationConstraintBuilder<A extends Annotation> {
                                         method.invoke(constraintValidation.getAnnotation()));
                                 }
                             } catch (Exception e) { // do nothing
-                                log.warn("error processing annotation: " + constraintValidation.getAnnotation(),
e);
+                                log.log(Level.WARNING, String.format("Error processing annotation:
%s ", constraintValidation.getAnnotation()), e);
                             }
                         }
                     }
diff --git a/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConfigurationImpl.java b/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConfigurationImpl.java
index 221f392..7cdd60e 100644
--- a/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConfigurationImpl.java
+++ b/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConfigurationImpl.java
@@ -22,8 +22,6 @@ package org.apache.bval.jsr303;
 import org.apache.bval.jsr303.resolver.DefaultTraversableResolver;
 import org.apache.bval.jsr303.util.SecureActions;
 import org.apache.bval.jsr303.xml.ValidationParser;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import javax.validation.*;
 import javax.validation.spi.BootstrapState;
@@ -31,6 +29,7 @@ import javax.validation.spi.ConfigurationState;
 import javax.validation.spi.ValidationProvider;
 import java.io.InputStream;
 import java.util.*;
+import java.util.logging.Logger;
 
 /**
  * Description: used to configure apache-validation for jsr303.
@@ -39,7 +38,7 @@ import java.util.*;
  * <br/>
  */
 public class ConfigurationImpl implements ApacheValidatorConfiguration, ConfigurationState
{
-    private static final Logger log = LoggerFactory.getLogger(ConfigurationImpl.class);
+    private static final Logger log = Logger.getLogger(ConfigurationImpl.class.getName());
 
     /**
      * Configured {@link ValidationProvider}
diff --git a/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintDefaults.java b/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintDefaults.java
index 36ca08f..eb10e77 100644
--- a/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintDefaults.java
+++ b/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintDefaults.java
@@ -19,8 +19,6 @@
 package org.apache.bval.jsr303;
 
 import org.apache.bval.jsr303.util.SecureActions;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import javax.validation.ConstraintValidator;
 import java.io.IOException;
@@ -28,13 +26,15 @@ import java.io.InputStream;
 import java.lang.annotation.Annotation;
 import java.security.PrivilegedAction;
 import java.util.*;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 /**
  * Description: Provides access to the default constraints/validator implementation classes
built into the framework.
  * These are configured in DefaultConstraints.properties.<br/>
  */
 public class ConstraintDefaults {
-    private static final Logger log = LoggerFactory.getLogger(ConstraintDefaults.class);
+    private static final Logger log = Logger.getLogger(ConstraintDefaults.class.getName());
     private static final String DEFAULT_CONSTRAINTS =
           "org/apache/bval/jsr303/DefaultConstraints.properties";
     
@@ -78,11 +78,12 @@ public class ConstraintDefaults {
             try {
                 constraintProperties.load(stream);
             } catch (IOException e) {
-                log.error("cannot load " + resource, e);
+                log.log(Level.SEVERE, String.format("Cannot load %s", resource), e);
             }
         } else {
-            log.warn("cannot find {}", resource);
+            log.log(Level.WARNING, String.format("Cannot find %s", resource));
         }
+
         Map<String, Class<? extends ConstraintValidator<?, ?>>[]> loadedConstraints
                 = new HashMap<String, Class<? extends ConstraintValidator<?,?>>[]>();
         for (Map.Entry<Object, Object> entry : constraintProperties.entrySet()) {
@@ -98,7 +99,7 @@ public class ConstraintDefaults {
                               try {
                                   return Class.forName(eachClassName, true, classloader);
                               } catch (ClassNotFoundException e) {
-                                  log.error("Cannot find class " + eachClassName, e);
+                                  log.log(Level.SEVERE, String.format("Cannot find class
%s", eachClassName), e);
                                   return null;
                               }
                           }
diff --git a/bval-jsr303/src/main/java/org/apache/bval/jsr303/DefaultMessageInterpolator.java
b/bval-jsr303/src/main/java/org/apache/bval/jsr303/DefaultMessageInterpolator.java
index b4e2230..0a341a6 100644
--- a/bval-jsr303/src/main/java/org/apache/bval/jsr303/DefaultMessageInterpolator.java
+++ b/bval-jsr303/src/main/java/org/apache/bval/jsr303/DefaultMessageInterpolator.java
@@ -23,6 +23,8 @@ import java.util.Map;
 import java.util.MissingResourceException;
 import java.util.ResourceBundle;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -30,8 +32,6 @@ import javax.validation.MessageInterpolator;
 
 import org.apache.bval.jsr303.util.SecureActions;
 import org.apache.commons.lang3.ArrayUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * Description: Resource bundle backed message interpolator.
@@ -40,7 +40,7 @@ import org.slf4j.LoggerFactory;
  * This class is threadsafe.<br/>
  */
 public class DefaultMessageInterpolator implements MessageInterpolator {
-    private static final Logger log = LoggerFactory.getLogger(DefaultMessageInterpolator.class);
+    private static final Logger log = Logger.getLogger(DefaultMessageInterpolator.class.getName());
     private static final String DEFAULT_VALIDATION_MESSAGES =
           "org.apache.bval.jsr303.ValidationMessages";
     private static final String USER_VALIDATION_MESSAGES = "ValidationMessages";
@@ -180,9 +180,9 @@ public class DefaultMessageInterpolator implements MessageInterpolator
{
             );
         }
         if (rb != null) {
-            log.debug("{} found", USER_VALIDATION_MESSAGES);
+            log.log(Level.FINEST, String.format("%s found", USER_VALIDATION_MESSAGES));
         } else {
-            log.debug("{} not found. Delegating to {}", USER_VALIDATION_MESSAGES, DEFAULT_VALIDATION_MESSAGES);
+        	log.log(Level.FINEST, String.format("%s not found. Delegating to %s", USER_VALIDATION_MESSAGES,
DEFAULT_VALIDATION_MESSAGES));
         }
         return rb;
     }
@@ -193,7 +193,7 @@ public class DefaultMessageInterpolator implements MessageInterpolator
{
         try {
             rb = ResourceBundle.getBundle(USER_VALIDATION_MESSAGES, locale, classLoader);
         } catch (MissingResourceException e) {
-            log.trace(message);
+            log.fine(message);
         }
         return rb;
     }
diff --git a/bval-jsr303/src/main/java/org/apache/bval/jsr303/Jsr303MetaBeanFactory.java b/bval-jsr303/src/main/java/org/apache/bval/jsr303/Jsr303MetaBeanFactory.java
index 3f3c744..296e8b1 100644
--- a/bval-jsr303/src/main/java/org/apache/bval/jsr303/Jsr303MetaBeanFactory.java
+++ b/bval-jsr303/src/main/java/org/apache/bval/jsr303/Jsr303MetaBeanFactory.java
@@ -26,6 +26,8 @@ import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 import javax.validation.Constraint;
 import javax.validation.GroupDefinitionException;
@@ -43,8 +45,6 @@ import org.apache.bval.model.MetaProperty;
 import org.apache.bval.util.AccessStrategy;
 import org.apache.bval.util.FieldAccess;
 import org.apache.bval.util.MethodAccess;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * Description: process the class annotations for JSR303 constraint validations to build
the MetaBean with information
@@ -53,7 +53,7 @@ import org.slf4j.LoggerFactory;
 public class Jsr303MetaBeanFactory implements MetaBeanFactory {
     /** Shared log instance */
     // of dubious utility as it's static :/
-    protected static final Logger log = LoggerFactory.getLogger(Jsr303MetaBeanFactory.class);
+    protected static final Logger log = Logger.getLogger(Jsr303MetaBeanFactory.class.getName());
 
     /** {@link ApacheFactoryContext} used */
     protected final ApacheFactoryContext factoryContext;
@@ -278,7 +278,7 @@ public class Jsr303MetaBeanFactory implements MetaBeanFactory {
         if (!containsDefault) {
             throw new GroupDefinitionException("Redefined default group sequence must contain
" + beanClass.getName());
         }
-        log.debug("Default group sequence for bean {} is: {}", beanClass.getName(), groupSeq);
+        log.log(Level.FINEST, String.format("Default group sequence for bean %s is: %s",
beanClass.getName(), groupSeq));
     }
 
     /**
diff --git a/bval-jsr303/src/main/java/org/apache/bval/jsr303/resolver/DefaultTraversableResolver.java
b/bval-jsr303/src/main/java/org/apache/bval/jsr303/resolver/DefaultTraversableResolver.java
index 92d8fce..ad91f9f 100644
--- a/bval-jsr303/src/main/java/org/apache/bval/jsr303/resolver/DefaultTraversableResolver.java
+++ b/bval-jsr303/src/main/java/org/apache/bval/jsr303/resolver/DefaultTraversableResolver.java
@@ -19,6 +19,8 @@ package org.apache.bval.jsr303.resolver;
 import java.lang.annotation.ElementType;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 import javax.validation.Path;
 import javax.validation.TraversableResolver;
@@ -26,12 +28,10 @@ import javax.validation.TraversableResolver;
 import org.apache.bval.jsr303.util.ClassHelper;
 import org.apache.bval.util.PrivilegedActions;
 import org.apache.commons.lang3.ClassUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /** @see javax.validation.TraversableResolver */
 public class DefaultTraversableResolver implements TraversableResolver, CachingRelevant {
-    private static final Logger log = LoggerFactory.getLogger(DefaultTraversableResolver.class);
+    private static final Logger log = Logger.getLogger(DefaultTraversableResolver.class.getName());
 
     /** Class to load to check whether JPA 2 is on the classpath. */
     private static final String PERSISTENCE_UTIL_CLASSNAME =
@@ -77,9 +77,9 @@ public class DefaultTraversableResolver implements TraversableResolver,
CachingR
         final ClassLoader classLoader = getClassLoader();
         try {
             PrivilegedActions.getUtilClass(classLoader, PERSISTENCE_UTIL_CLASSNAME);
-            log.debug("Found {} on classpath.", PERSISTENCE_UTIL_CLASSNAME);
+            log.log(Level.FINEST, String.format("Found %s on classpath.", PERSISTENCE_UTIL_CLASSNAME));
         } catch (Exception e) {
-            log.debug("Cannot find {} on classpath. All properties will per default be traversable.",
PERSISTENCE_UTIL_CLASSNAME);
+            log.log(Level.FINEST, String.format("Cannot find %s on classpath. All properties
will per default be traversable.", PERSISTENCE_UTIL_CLASSNAME));
             return;
         }
 
@@ -88,11 +88,12 @@ public class DefaultTraversableResolver implements TraversableResolver,
CachingR
               (Class<? extends TraversableResolver>)
                 ClassUtils.getClass(classLoader, JPA_AWARE_TRAVERSABLE_RESOLVER_CLASSNAME,
true);
             jpaTR = jpaAwareResolverClass.newInstance();
-            log.debug("Instantiated an instance of {}.", JPA_AWARE_TRAVERSABLE_RESOLVER_CLASSNAME);
+            log.log(Level.FINEST, String.format("Instantiated an instance of %s.", JPA_AWARE_TRAVERSABLE_RESOLVER_CLASSNAME));
         } catch (Exception e) {
-            log.warn("Unable to load or instanciate JPA aware resolver " +
-                  JPA_AWARE_TRAVERSABLE_RESOLVER_CLASSNAME +
-                  ". All properties will per default be traversable.", e);
+			log.log(Level.WARNING,
+					String.format(
+							"Unable to load or instanciate JPA aware resolver %s. All properties will per default
be traversable.",
+							JPA_AWARE_TRAVERSABLE_RESOLVER_CLASSNAME, e));
         }
     }
 
diff --git a/bval-jsr303/src/main/java/org/apache/bval/jsr303/xml/AnnotationIgnores.java b/bval-jsr303/src/main/java/org/apache/bval/jsr303/xml/AnnotationIgnores.java
index 0dc0da9..fa508be 100644
--- a/bval-jsr303/src/main/java/org/apache/bval/jsr303/xml/AnnotationIgnores.java
+++ b/bval-jsr303/src/main/java/org/apache/bval/jsr303/xml/AnnotationIgnores.java
@@ -18,15 +18,14 @@
  */
 package org.apache.bval.jsr303.xml;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 import java.lang.reflect.Field;
 import java.lang.reflect.Member;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 /**
  * Description: This class instantiated during the parsing of the XML configuration
@@ -34,7 +33,7 @@ import java.util.Map;
  */
 public final class AnnotationIgnores {
 
-    private static final Logger log = LoggerFactory.getLogger(AnnotationIgnores.class);
+    private static final Logger log = Logger.getLogger(AnnotationIgnores.class.getName());
 
     /**
      * Keeps track whether the 'ignore-annotations' flag is set on bean level in the
@@ -118,7 +117,7 @@ public final class AnnotationIgnores {
         } else {
             type = "Property";
         }
-        log.debug("{} level annotations are getting ignored for {}.{}", new Object[]{type,
clazz.getName(), member.getName()});
+        log.log(Level.FINEST, String.format("%s level annotations are getting ignored for
%s.%s", type, clazz.getName(), member.getName()));
     }
 
     /**
@@ -143,7 +142,7 @@ public final class AnnotationIgnores {
             ignoreAnnotation = getDefaultIgnoreAnnotation(clazz);
         }
         if (ignoreAnnotation) {
-            log.debug("Class level annotation are getting ignored for {}", clazz.getName());
+        	log.log(Level.FINEST, String.format("Class level annotation are getting ignored
for %s", clazz.getName()));
         }
         return ignoreAnnotation;
     }
diff --git a/bval-jsr303/src/main/java/org/apache/bval/jsr303/xml/ValidationParser.java b/bval-jsr303/src/main/java/org/apache/bval/jsr303/xml/ValidationParser.java
index cfe672d..83accb2 100644
--- a/bval-jsr303/src/main/java/org/apache/bval/jsr303/xml/ValidationParser.java
+++ b/bval-jsr303/src/main/java/org/apache/bval/jsr303/xml/ValidationParser.java
@@ -23,8 +23,6 @@ import org.apache.bval.jsr303.ConfigurationImpl;
 import org.apache.bval.jsr303.util.IOUtils;
 import org.apache.bval.jsr303.util.SecureActions;
 import org.apache.bval.util.PrivilegedActions;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.xml.sax.SAXException;
 
 import javax.validation.ConstraintValidatorFactory;
@@ -46,6 +44,8 @@ import java.net.URL;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.util.Enumeration;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 /**
  * Description: uses jaxb to parse validation.xml<br/>
@@ -55,7 +55,7 @@ public class ValidationParser {
     private static final String DEFAULT_VALIDATION_XML_FILE = "META-INF/validation.xml";
     private static final String VALIDATION_CONFIGURATION_XSD =
             "META-INF/validation-configuration-1.0.xsd";
-    private static final Logger log = LoggerFactory.getLogger(ValidationParser.class);
+    private static final Logger log = Logger.getLogger(ValidationParser.class.getName());
     protected final String validationXmlFile;
 
     /**
@@ -88,11 +88,11 @@ public class ValidationParser {
         try {
             inputStream = getInputStream(validationXmlFile);
             if (inputStream == null) {
-                log.debug("No {} found. Using annotation based configuration only.", validationXmlFile);
+            	log.log(Level.FINEST, String.format("No %s found. Using annotation based configuration
only.", validationXmlFile));
                 return null;
             }
 
-            log.debug("{} found.", validationXmlFile);
+            log.log(Level.FINEST, String.format("%s found.", validationXmlFile));
 
             Schema schema = getSchema();
             JAXBContext jc = JAXBContext.newInstance(ValidationConfigType.class);
@@ -149,7 +149,7 @@ public class ValidationParser {
         try {
             return sf.newSchema(schemaUrl);
         } catch (SAXException e) {
-            log.warn("Unable to parse schema: " + xsd, e);
+            log.log(Level.WARNING, String.format("Unable to parse schema: %s", xsd), e);
             return null;
         }
     }
@@ -165,9 +165,8 @@ public class ValidationParser {
 
     private void applyProperties(ValidationConfigType xmlConfig, ConfigurationImpl target)
{
         for (PropertyType property : xmlConfig.getProperty()) {
-            if (log.isDebugEnabled()) {
-                log.debug("Found property '" + property.getName() + "' with value '" +
-                        property.getValue() + "' in " + validationXmlFile);
+            if (log.isLoggable(Level.FINEST)) {
+                log.log(Level.FINEST, String.format("Found property '%s' with value '%s'
in %s", property.getName(), property.getValue(), validationXmlFile));
             }
             target.addProperty(property.getName(), property.getValue());
         }
@@ -180,7 +179,7 @@ public class ValidationParser {
             Class<? extends ValidationProvider<?>> clazz =
                     (Class<? extends ValidationProvider<?>>) loadClass(providerClassName);
             target.setProviderClass(clazz);
-            log.info("Using {} as validation provider.", providerClassName);
+            log.log(Level.INFO, String.format("Using %s as validation provider.", providerClassName));
         }
     }
 
@@ -193,7 +192,7 @@ public class ValidationParser {
                 Class<MessageInterpolator> clazz = (Class<MessageInterpolator>)
                         loadClass(messageInterpolatorClass);
                 target.messageInterpolator(newInstance(clazz));
-                log.info("Using {} as message interpolator.", messageInterpolatorClass);
+                log.log(Level.INFO, String.format("Using %s as message interpolator.", messageInterpolatorClass));
             }
         }
     }
@@ -207,7 +206,7 @@ public class ValidationParser {
                 Class<TraversableResolver> clazz = (Class<TraversableResolver>)
                         loadClass(traversableResolverClass);
                 target.traversableResolver(newInstance(clazz));
-                log.info("Using {} as traversable resolver.", traversableResolverClass);
+                log.log(Level.INFO, String.format("Using %s as traversable resolver.", traversableResolverClass));
             }
         }
     }
@@ -233,7 +232,7 @@ public class ValidationParser {
                 Class<ConstraintValidatorFactory> clazz = (Class<ConstraintValidatorFactory>)
                         loadClass(constraintFactoryClass);
                 target.constraintValidatorFactory(newInstance(clazz));
-                log.info("Using {} as constraint factory.", constraintFactoryClass);
+                log.log(Level.INFO, String.format("Using %s as constraint factory.", constraintFactoryClass));
             }
         }
     }
@@ -246,7 +245,7 @@ public class ValidationParser {
                 // Classloader needs a path without a starting /
                 mappingFileName = mappingFileName.substring(1);
             }
-            log.debug("Trying to open input stream for {}", mappingFileName);
+            log.log(Level.FINEST, String.format("Trying to open input stream for %s", mappingFileName));
             InputStream in = null;
             try {
                 in = getInputStream(mappingFileName);
diff --git a/bval-tck/pom.xml b/bval-tck/pom.xml
index f64629a..b1f0e9f 100644
--- a/bval-tck/pom.xml
+++ b/bval-tck/pom.xml
@@ -120,12 +120,6 @@
                     <artifactId>geronimo-validation_1.0_spec</artifactId>
                 </dependency>
                 <dependency>
-                    <groupId>org.slf4j</groupId>
-                    <artifactId>slf4j-log4j12</artifactId>
-                    <version>1.6.1</version>
-                    <scope>runtime</scope>
-                </dependency>
-                <dependency>
                     <groupId>org.testng</groupId>
                     <artifactId>testng</artifactId>
                     <classifier>jdk15</classifier>
@@ -252,24 +246,6 @@
                                             <overWrite>true</overWrite>
                                             <outputDirectory>${project.build.directory}/dependency/lib</outputDirectory>
                                         </artifactItem>
-                                        <artifactItem>
-                                            <groupId>org.slf4j</groupId>
-                                            <artifactId>slf4j-api</artifactId>
-                                            <overWrite>true</overWrite>
-                                            <outputDirectory>${project.build.directory}/dependency/lib</outputDirectory>
-                                        </artifactItem>
-                                        <artifactItem>
-                                            <groupId>org.slf4j</groupId>
-                                            <artifactId>jcl-over-slf4j</artifactId>
-                                            <overWrite>true</overWrite>
-                                            <outputDirectory>${project.build.directory}/dependency/lib</outputDirectory>
-                                        </artifactItem>
-                                        <artifactItem>
-                                            <groupId>org.slf4j</groupId>
-                                            <artifactId>slf4j-log4j12</artifactId>
-                                            <overWrite>true</overWrite>
-                                            <outputDirectory>${project.build.directory}/dependency/lib</outputDirectory>
-                                        </artifactItem>
                                     </artifactItems>
                                 </configuration>
                             </execution>
diff --git a/bval-xstream/pom.xml b/bval-xstream/pom.xml
index 07a8c66..a702c29 100644
--- a/bval-xstream/pom.xml
+++ b/bval-xstream/pom.xml
@@ -46,11 +46,7 @@
       <groupId>com.thoughtworks.xstream</groupId>
       <artifactId>xstream</artifactId>
     </dependency>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
-    </dependency>
+    <!-- Test dependencies -->
     <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-simple</artifactId>
@@ -59,7 +55,12 @@
     <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>jcl-over-slf4j</artifactId>
-      <scope>runtime</scope>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
     </dependency>
   </dependencies>
 
diff --git a/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanFactory.java b/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanFactory.java
index 8935f44..384ad3a 100644
--- a/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanFactory.java
+++ b/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanFactory.java
@@ -21,11 +21,11 @@ import org.apache.bval.model.FeaturesCapable;
 import org.apache.bval.model.MetaBean;
 import org.apache.bval.model.MetaProperty;
 import org.apache.bval.routines.StandardValidation;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import java.io.IOException;
 import java.util.*;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 import static org.apache.bval.model.Features.Property.JAVASCRIPT_VALIDATION_FUNCTIONS;
 
@@ -33,7 +33,7 @@ import static org.apache.bval.model.Features.Property.JAVASCRIPT_VALIDATION_FUNC
  * Description: Create or enrich MetaBeans from apache beanInfos xml<br/>
  */
 public class XMLMetaBeanFactory implements MetaBeanFactory {
-    private static final Logger log = LoggerFactory.getLogger(XMLMetaBeanFactory.class);
+    private static final Logger loggger = Logger.getLogger(XMLMetaBeanFactory.class.getName());
 
     // use LinkedHashMap to keep sequence of loaders
     private final Map<XMLMetaBeanLoader, XMLMetaBeanInfos> resources =
@@ -230,7 +230,7 @@ public class XMLMetaBeanFactory implements MetaBeanFactory {
     }
 
     public void handleLoadException(Object loader, IOException e) {
-        log.error("error loading " + loader, e);
+        loggger.log(Level.SEVERE, String.format("Error loading %s", loader), e);
     }
 
 }
diff --git a/pom.xml b/pom.xml
index 66948ec..a0e94ec 100644
--- a/pom.xml
+++ b/pom.xml
@@ -307,21 +307,6 @@
                 <version>3.1</version>
             </dependency>
             <dependency>
-                <groupId>org.slf4j</groupId>
-                <artifactId>slf4j-api</artifactId>
-                <version>1.6.1</version>
-            </dependency>
-            <dependency>
-                <groupId>org.slf4j</groupId>
-                <artifactId>jcl-over-slf4j</artifactId>
-                <version>1.6.1</version>
-            </dependency>
-            <dependency>
-                <groupId>org.slf4j</groupId>
-                <artifactId>slf4j-simple</artifactId>
-                <version>1.6.1</version>
-            </dependency>
-            <dependency>
                 <groupId>commons-beanutils</groupId>
                 <artifactId>commons-beanutils-core</artifactId>
                 <version>1.8.3</version>
@@ -359,6 +344,17 @@
                 <artifactId>aopalliance</artifactId>
                 <version>1.0</version>
             </dependency>
+            <!-- Added mainly for testing -->
+            <dependency>
+                <groupId>org.slf4j</groupId>
+                <artifactId>jcl-over-slf4j</artifactId>
+                <version>1.6.1</version>
+            </dependency>
+            <dependency>
+                <groupId>org.slf4j</groupId>
+                <artifactId>slf4j-simple</artifactId>
+                <version>1.6.1</version>
+            </dependency>
         </dependencies>
     </dependencyManagement>
 


Mime
View raw message