You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bval.apache.org by mb...@apache.org on 2016/09/29 22:48:32 UTC

svn commit: r1762843 - in /bval/trunk: ./ bval-core/ bval-core/src/main/java/org/apache/bval/ bval-core/src/main/java/org/apache/bval/util/ bval-core/src/main/java/org/apache/bval/util/reflection/ bval-json/ bval-jsr/ bval-jsr/src/main/java/org/apache/...

Author: mbenson
Date: Thu Sep 29 22:48:32 2016
New Revision: 1762843

URL: http://svn.apache.org/viewvc?rev=1762843&view=rev
Log:
[BVAL-146] shade commons-lang; remove dependency on commons-beanutils wherever possible and reduce this to an optional dependency for BC purposes only

Added:
    bval/trunk/bval-core/src/main/java/org/apache/bval/util/BeanUtilsPropertyAccess.java   (with props)
Removed:
    bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr303/
Modified:
    bval/trunk/bval-core/   (props changed)
    bval/trunk/bval-core/pom.xml
    bval/trunk/bval-core/src/main/java/org/apache/bval/BeanValidationContext.java
    bval/trunk/bval-core/src/main/java/org/apache/bval/BeanValidator.java
    bval/trunk/bval-core/src/main/java/org/apache/bval/util/PropertyAccess.java
    bval/trunk/bval-core/src/main/java/org/apache/bval/util/reflection/Reflection.java
    bval/trunk/bval-json/   (props changed)
    bval/trunk/bval-json/pom.xml
    bval/trunk/bval-jsr/   (props changed)
    bval/trunk/bval-jsr/pom.xml
    bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/util/EnumerationConverter.java
    bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/util/ValidationContextTraversal.java
    bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/xml/ValidationMappingParser.java
    bval/trunk/bval-tck11/pom.xml
    bval/trunk/bval-xstream/   (props changed)
    bval/trunk/bval-xstream/pom.xml
    bval/trunk/pom.xml

Propchange: bval/trunk/bval-core/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Thu Sep 29 22:48:32 2016
@@ -9,3 +9,4 @@ target
 .idea
 .git
 .gitignore
+dependency-reduced-pom.xml

Modified: bval/trunk/bval-core/pom.xml
URL: http://svn.apache.org/viewvc/bval/trunk/bval-core/pom.xml?rev=1762843&r1=1762842&r2=1762843&view=diff
==============================================================================
--- bval/trunk/bval-core/pom.xml (original)
+++ bval/trunk/bval-core/pom.xml Thu Sep 29 22:48:32 2016
@@ -44,6 +44,7 @@
         <dependency>
             <groupId>commons-beanutils</groupId>
             <artifactId>commons-beanutils-core</artifactId>
+            <optional>true</optional>
         </dependency>
         <dependency>
             <groupId>org.apache.commons</groupId>
@@ -121,6 +122,40 @@ build.timestamp=${timestamp}
                         </goals>
                     </execution>
                 </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-shade-plugin</artifactId>
+                <configuration>
+                    <artifactSet>
+                        <includes>
+                            <include>org.apache.commons:commons-lang3</include>
+                        </includes>
+                    </artifactSet>
+                    <filters>
+                        <filter>
+                            <artifact>org.apache.commons:commons-lang3</artifact>
+                            <excludes>META-INF/maven/**</excludes>
+                        </filter>
+                    </filters>
+                    <relocations>
+                        <relocation>
+                            <pattern>org.apache.commons</pattern>
+                            <shadedPattern>org.apache.bval.core._oac</shadedPattern>
+                        </relocation>
+                    </relocations>
+                    <minimizeJar>true</minimizeJar>
+                    <promoteTransitiveDependencies>true</promoteTransitiveDependencies>
+                    <createSourcesJar>true</createSourcesJar>
+                    <shadeSourcesContent>true</shadeSourcesContent>
+                </configuration>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>shade</goal>
+                        </goals>
+                    </execution>
+                </executions>
             </plugin>
             <plugin>
             	<groupId>org.apache.commons</groupId>

Modified: bval/trunk/bval-core/src/main/java/org/apache/bval/BeanValidationContext.java
URL: http://svn.apache.org/viewvc/bval/trunk/bval-core/src/main/java/org/apache/bval/BeanValidationContext.java?rev=1762843&r1=1762842&r2=1762843&view=diff
==============================================================================
--- bval/trunk/bval-core/src/main/java/org/apache/bval/BeanValidationContext.java (original)
+++ bval/trunk/bval-core/src/main/java/org/apache/bval/BeanValidationContext.java Thu Sep 29 22:48:32 2016
@@ -156,7 +156,7 @@ public class BeanValidationContext<T ext
      */
     public Object getPropertyValue() {
         if (access == null) { // undefined access strategy
-            return getPropertyValue(new PropertyAccess(bean.getClass(), metaProperty.getName()));
+            return getPropertyValue(PropertyAccess.getInstance(bean.getClass(), metaProperty.getName()));
         }
         return getPropertyValue(access);
     }

Modified: bval/trunk/bval-core/src/main/java/org/apache/bval/BeanValidator.java
URL: http://svn.apache.org/viewvc/bval/trunk/bval-core/src/main/java/org/apache/bval/BeanValidator.java?rev=1762843&r1=1762842&r2=1762843&view=diff
==============================================================================
--- bval/trunk/bval-core/src/main/java/org/apache/bval/BeanValidator.java (original)
+++ bval/trunk/bval-core/src/main/java/org/apache/bval/BeanValidator.java Thu Sep 29 22:48:32 2016
@@ -220,7 +220,7 @@ public class BeanValidator<T extends Val
             final Object bean = context.getBean();
             final MetaBean mbean = context.getMetaBean();
             // modify context state for relationship-target bean
-            context.moveDown(prop, new PropertyAccess(bean.getClass(), prop.getName()));
+            context.moveDown(prop, PropertyAccess.getInstance(bean.getClass(), prop.getName()));
             ValidationHelper.validateContext(context, new BeanValidatorCallback(context), treatMapsLikeBeans);
             // restore old values in context
             context.moveUp(bean, mbean);

Added: bval/trunk/bval-core/src/main/java/org/apache/bval/util/BeanUtilsPropertyAccess.java
URL: http://svn.apache.org/viewvc/bval/trunk/bval-core/src/main/java/org/apache/bval/util/BeanUtilsPropertyAccess.java?rev=1762843&view=auto
==============================================================================
--- bval/trunk/bval-core/src/main/java/org/apache/bval/util/BeanUtilsPropertyAccess.java (added)
+++ bval/trunk/bval-core/src/main/java/org/apache/bval/util/BeanUtilsPropertyAccess.java Thu Sep 29 22:48:32 2016
@@ -0,0 +1,45 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.bval.util;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.apache.commons.beanutils.DynaBean;
+import org.apache.commons.beanutils.PropertyUtils;
+
+/**
+ * Commons BeanUtils-specific {@link PropertyAccess} subclass.
+ * 
+ * @since 1.1.2
+ */
+class BeanUtilsPropertyAccess extends PropertyAccess {
+
+    public BeanUtilsPropertyAccess(Class<?> clazz, String propertyName) {
+        super(clazz, propertyName);
+    }
+
+    @Override
+    protected Object getPublicProperty(Object bean)
+        throws InvocationTargetException, NoSuchMethodException,
+        IllegalAccessException {
+        if (bean instanceof DynaBean) {
+            return PropertyUtils.getSimpleProperty(bean, getPropertyName());
+        }
+        return super.getPublicProperty(bean);
+    }
+
+}

Propchange: bval/trunk/bval-core/src/main/java/org/apache/bval/util/BeanUtilsPropertyAccess.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: bval/trunk/bval-core/src/main/java/org/apache/bval/util/PropertyAccess.java
URL: http://svn.apache.org/viewvc/bval/trunk/bval-core/src/main/java/org/apache/bval/util/PropertyAccess.java?rev=1762843&r1=1762842&r2=1762843&view=diff
==============================================================================
--- bval/trunk/bval-core/src/main/java/org/apache/bval/util/PropertyAccess.java (original)
+++ bval/trunk/bval-core/src/main/java/org/apache/bval/util/PropertyAccess.java Thu Sep 29 22:48:32 2016
@@ -17,21 +17,96 @@
 package org.apache.bval.util;
 
 import org.apache.bval.util.reflection.Reflection;
-import org.apache.commons.beanutils.PropertyUtils;
+import org.apache.commons.weaver.privilizer.Privilizing;
+import org.apache.commons.weaver.privilizer.Privilizing.CallTo;
 
+import java.beans.BeanInfo;
+import java.beans.IntrospectionException;
+import java.beans.Introspector;
 import java.beans.PropertyDescriptor;
 import java.lang.annotation.ElementType;
+import java.lang.reflect.Constructor;
 import java.lang.reflect.Field;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.lang.reflect.Type;
+import java.util.Collections;
+import java.util.HashMap;
 import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 /**
- * Description: Undefined dynamic strategy (FIELD or METHOD access) Uses PropertyUtils or tries to determine field to
- * access the value<br/>
+ * Description: Undefined dynamic strategy (FIELD or METHOD access). Uses Apache
+ * Commons BeanUtils (if present) to support its {@code DynaBean} type. Otherwise the
+ * {@code java.beans} APIs are used for Java bean property methods and we fall
+ * back to accessing field values directly.
  */
+@Privilizing(@CallTo(Reflection.class))
 public class PropertyAccess extends AccessStrategy {
+    private static final Logger log =  Logger.getLogger(PropertyAccess.class.getName());
+    private static final String BEANUTILS =
+        "org.apache.commons.beanutils.BeanUtils";
+    private static final String BEANUTILS_PROPERTY_ACCESS =
+        "org.apache.bval.util.BeanUtilsPropertyAccess";
+    private static final Constructor<? extends PropertyAccess> BEANUTILS_PROPERTY_ACCESS_CTOR;
+    private static final ConcurrentMap<Class<?>, Map<String, PropertyDescriptor>> PROPERTY_DESCRIPTORS =
+        new ConcurrentHashMap<Class<?>, Map<String, PropertyDescriptor>>();
+
+    static {
+        final ClassLoader cl = Reflection.getClassLoader(PropertyAccess.class);
+        boolean useBeanUtils;
+        try {
+            Reflection.getClass(cl, BEANUTILS);
+            useBeanUtils = true;
+        } catch (Exception e) {
+            useBeanUtils = false;
+        }
+        Constructor<? extends PropertyAccess> ctor;
+        if (useBeanUtils) {
+            try {
+                final Class<?> beanUtilsPropertyAccess =
+                    Reflection.getClass(cl, BEANUTILS_PROPERTY_ACCESS);
+
+                ctor = Reflection.getDeclaredConstructor(
+                    beanUtilsPropertyAccess.asSubclass(PropertyAccess.class),
+                    Class.class, String.class);
+
+            } catch (Exception e) {
+                ctor = null;
+            }
+        } else {
+            ctor = null;
+        }
+        BEANUTILS_PROPERTY_ACCESS_CTOR = ctor;
+    }
+
+    /**
+     * Obtain a {@link PropertyAccess} instance.
+     * @param clazz
+     * @param propertyName
+     * @return PropertyAccess
+     * @since 1.1.2
+     */
+    public static PropertyAccess getInstance(Class<?> clazz,
+        String propertyName) {
+        if (BEANUTILS_PROPERTY_ACCESS_CTOR != null) {
+            try {
+                return BEANUTILS_PROPERTY_ACCESS_CTOR.newInstance(clazz,
+                    propertyName);
+            } catch (Exception e) {
+                log.log(Level.WARNING,
+                    String.format(
+                        "Exception encountered attempting to instantiate %s(%s, %s)",
+                        BEANUTILS_PROPERTY_ACCESS_CTOR, clazz, propertyName),
+                    e);
+            }
+        }
+        return new PropertyAccess(clazz, propertyName);
+    }
+
     private final Class<?> beanClass;
     private final String propertyName;
     private Field rememberField;
@@ -42,6 +117,8 @@ public class PropertyAccess extends Acce
      * @param clazz
      * @param propertyName
      */
+    @Deprecated
+    // keep as protected
     public PropertyAccess(Class<?> clazz, String propertyName) {
         this.beanClass = clazz;
         this.propertyName = propertyName;
@@ -54,12 +131,23 @@ public class PropertyAccess extends Acce
         return rememberField != null ? ElementType.FIELD : ElementType.METHOD;
     }
 
-    private static Object getPublicProperty(Object bean, String property) throws InvocationTargetException,
+    protected Object getPublicProperty(Object bean) throws InvocationTargetException,
         NoSuchMethodException, IllegalAccessException {
         if (bean instanceof Map<?, ?>) {
-            return ((Map<?, ?>) bean).get(property);
-        } else { // supports DynaBean and standard Objects
-            return PropertyUtils.getSimpleProperty(bean, property);
+            return ((Map<?, ?>) bean).get(propertyName);
+        }
+        final Method readMethod =
+            getPropertyReadMethod(propertyName, bean.getClass());
+        if (readMethod == null) {
+            throw new NoSuchMethodException(toString());
+        }
+        final boolean unset = Reflection.setAccessible(readMethod, true);
+        try {
+            return readMethod.invoke(bean);
+        } finally {
+            if (unset) {
+                Reflection.setAccessible(readMethod, false);
+            }
         }
     }
 
@@ -73,9 +161,10 @@ public class PropertyAccess extends Acce
      * @throws NoSuchMethodException
      * @throws IllegalAccessException
      */
-    public static Object getProperty(Object bean, String propertyName) throws InvocationTargetException,
-        NoSuchMethodException, IllegalAccessException {
-        return new PropertyAccess(bean.getClass(), propertyName).get(bean);
+    public static Object getProperty(Object bean, String propertyName)
+        throws InvocationTargetException, NoSuchMethodException,
+        IllegalAccessException {
+        return getInstance(bean.getClass(), propertyName).get(bean);
     }
 
     /**
@@ -123,11 +212,12 @@ public class PropertyAccess extends Acce
         return null;
     }
 
-    private static Method getPropertyReadMethod(String propertyName, Class<?> beanClass) {
-        for (PropertyDescriptor each : PropertyUtils.getPropertyDescriptors(beanClass)) {
-            if (each.getName().equals(propertyName)) {
-                return each.getReadMethod();
-            }
+    private static Method getPropertyReadMethod(String propertyName,
+        Class<?> beanClass) {
+        final Map<String, PropertyDescriptor> propertyDescriptors =
+            getPropertyDescriptors(beanClass);
+        if (propertyDescriptors.containsKey(propertyName)) {
+            return propertyDescriptors.get(propertyName).getReadMethod();
         }
         return null;
     }
@@ -177,7 +267,7 @@ public class PropertyAccess extends Acce
                 return readField(rememberField, bean);
             }
             try { // try public method
-                return getPublicProperty(bean, propertyName);
+                return getPublicProperty(bean);
             } catch (NoSuchMethodException ex) {
                 return getFieldValue(bean);
             }
@@ -226,4 +316,27 @@ public class PropertyAccess extends Acce
         result = 31 * result + propertyName.hashCode();
         return result;
     }
+    
+    private static Map<String, PropertyDescriptor> getPropertyDescriptors(Class<?> type) {
+        if (PROPERTY_DESCRIPTORS.containsKey(type)) {
+            return PROPERTY_DESCRIPTORS.get(type);
+        }
+        Map<String, PropertyDescriptor> m;
+        try {
+            final PropertyDescriptor[] propertyDescriptors = Introspector.getBeanInfo(type).getPropertyDescriptors();
+            if (propertyDescriptors == null) {
+                m = Collections.emptyMap();
+            } else {
+                m = new HashMap<String, PropertyDescriptor>();
+                for (PropertyDescriptor pd : propertyDescriptors) {
+                    m.put(pd.getName(), pd);
+                }
+            }
+        } catch (IntrospectionException e) {
+            log.log(Level.SEVERE, String.format("Cannot locate %s for ", BeanInfo.class.getSimpleName(), type), e);
+            m = Collections.emptyMap();
+        }
+        final Map<String, PropertyDescriptor> faster = PROPERTY_DESCRIPTORS.putIfAbsent(type, m);
+        return faster == null ? m : faster;
+    }
 }

Modified: bval/trunk/bval-core/src/main/java/org/apache/bval/util/reflection/Reflection.java
URL: http://svn.apache.org/viewvc/bval/trunk/bval-core/src/main/java/org/apache/bval/util/reflection/Reflection.java?rev=1762843&r1=1762842&r2=1762843&view=diff
==============================================================================
--- bval/trunk/bval-core/src/main/java/org/apache/bval/util/reflection/Reflection.java (original)
+++ bval/trunk/bval-core/src/main/java/org/apache/bval/util/reflection/Reflection.java Thu Sep 29 22:48:32 2016
@@ -30,8 +30,6 @@ import org.apache.commons.weaver.privili
 
 /**
  * Security-agnostic "blueprint" class for reflection-related operations. Intended for use by Apache BVal code.
- * 
- * @version $Rev$ $Date$
  */
 public class Reflection {
     /**

Propchange: bval/trunk/bval-json/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Thu Sep 29 22:48:32 2016
@@ -9,3 +9,4 @@ target
 .idea
 .git
 .gitignore
+dependency-reduced-pom.xml

Modified: bval/trunk/bval-json/pom.xml
URL: http://svn.apache.org/viewvc/bval/trunk/bval-json/pom.xml?rev=1762843&r1=1762842&r2=1762843&view=diff
==============================================================================
--- bval/trunk/bval-json/pom.xml (original)
+++ bval/trunk/bval-json/pom.xml Thu Sep 29 22:48:32 2016
@@ -81,6 +81,36 @@
             </resource>
         </resources>
 
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-shade-plugin</artifactId>
+                <configuration>
+                    <artifactSet>
+                        <includes>
+                            <include>org.freemarker:*</include>
+                        </includes>
+                    </artifactSet>
+                    <relocations>
+                        <relocation>
+                            <pattern>freemarker</pattern>
+                            <shadedPattern>org.apache.bval.json._fm</shadedPattern>
+                        </relocation>
+                    </relocations>
+                    <minimizeJar>true</minimizeJar>
+                    <promoteTransitiveDependencies>true</promoteTransitiveDependencies>
+                    <createSourcesJar>true</createSourcesJar>
+                    <shadeSourcesContent>true</shadeSourcesContent>
+                </configuration>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>shade</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
     </build>
 </project>
 

Propchange: bval/trunk/bval-jsr/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Thu Sep 29 22:48:32 2016
@@ -9,3 +9,4 @@ target
 .idea
 .git
 .gitignore
+dependency-reduced-pom.xml

Modified: bval/trunk/bval-jsr/pom.xml
URL: http://svn.apache.org/viewvc/bval/trunk/bval-jsr/pom.xml?rev=1762843&r1=1762842&r2=1762843&view=diff
==============================================================================
--- bval/trunk/bval-jsr/pom.xml (original)
+++ bval/trunk/bval-jsr/pom.xml Thu Sep 29 22:48:32 2016
@@ -15,7 +15,7 @@
     License.
 -->
 <!--
-	Maven release plugin requires the project tag to be on a single line.
+  Maven release plugin requires the project tag to be on a single line.
 -->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 
@@ -33,6 +33,9 @@
 
     <description>Implementation specific classes for JSR 349 Bean Validation 1.1</description>
 
+    <properties>
+        <jaxb.version>2.2.6</jaxb.version>
+    </properties>
     <profiles>
         <!--
             default profile using geronimo-validation_1.0_spec.jar active when
@@ -164,6 +167,11 @@
             <artifactId>commons-lang3</artifactId>
         </dependency>
         <dependency>
+            <groupId>commons-beanutils</groupId>
+            <artifactId>commons-beanutils-core</artifactId>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
             <groupId>org.apache.commons</groupId>
             <artifactId>commons-weaver-privilizer-api</artifactId>
         </dependency>
@@ -215,26 +223,28 @@
             <scope>provided</scope>
         </dependency>
 
+        <dependency>
+            <groupId>javax.xml.bind</groupId>
+            <artifactId>jaxb-api</artifactId>
+            <version>${jaxb.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>com.sun.xml.bind</groupId>
+            <artifactId>jaxb-impl</artifactId>
+            <version>${jaxb.version}</version>
+        </dependency>
+
         <!-- Testing dependencies -->
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
+            <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>org.mockito</groupId>
             <artifactId>mockito-core</artifactId>
             <scope>test</scope>
         </dependency>
-        <dependency>
-            <groupId>javax.xml.bind</groupId>
-            <artifactId>jaxb-api</artifactId>
-            <version>2.2.6</version>
-        </dependency>
-        <dependency>
-            <groupId>com.sun.xml.bind</groupId>
-            <artifactId>jaxb-impl</artifactId>
-            <version>2.2.6</version>
-        </dependency>
     </dependencies>
 
     <build>
@@ -285,6 +295,40 @@
                     </execution>
                 </executions>
             </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-shade-plugin</artifactId>
+                <configuration>
+                    <artifactSet>
+                        <includes>
+                            <include>org.apache.commons:commons-lang3</include>
+                        </includes>
+                    </artifactSet>
+                    <filters>
+                        <filter>
+                            <artifact>org.apache.commons:commons-lang3</artifact>
+                            <excludes>META-INF/maven/**</excludes>
+                        </filter>
+                    </filters>
+                    <relocations>
+                        <relocation>
+                            <pattern>org.apache.commons</pattern>
+                            <shadedPattern>org.apache.bval.jsr._oac</shadedPattern>
+                        </relocation>
+                    </relocations>
+                    <minimizeJar>true</minimizeJar>
+                    <promoteTransitiveDependencies>true</promoteTransitiveDependencies>
+                    <createSourcesJar>true</createSourcesJar>
+                    <shadeSourcesContent>true</shadeSourcesContent>
+                </configuration>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>shade</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-surefire-plugin</artifactId>

Modified: bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/util/EnumerationConverter.java
URL: http://svn.apache.org/viewvc/bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/util/EnumerationConverter.java?rev=1762843&r1=1762842&r2=1762843&view=diff
==============================================================================
--- bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/util/EnumerationConverter.java (original)
+++ bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/util/EnumerationConverter.java Thu Sep 29 22:48:32 2016
@@ -23,9 +23,8 @@ import org.apache.commons.beanutils.Conv
 /**
  * A {@code org.apache.commons.beanutils.Converter} implementation to handle
  * Enumeration type.
- *
- * $Id: EnumerationConverter.java 1226560 2012-01-02 22:18:19Z mbenson $
  */
+@Deprecated
 public final class EnumerationConverter implements Converter {
 
     /**

Modified: bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/util/ValidationContextTraversal.java
URL: http://svn.apache.org/viewvc/bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/util/ValidationContextTraversal.java?rev=1762843&r1=1762842&r2=1762843&view=diff
==============================================================================
--- bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/util/ValidationContextTraversal.java (original)
+++ bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/util/ValidationContextTraversal.java Thu Sep 29 22:48:32 2016
@@ -30,6 +30,7 @@ import org.apache.bval.util.PropertyAcce
 import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.reflect.TypeUtils;
 
+import java.lang.annotation.ElementType;
 import java.lang.reflect.Type;
 
 /**
@@ -38,7 +39,8 @@ import java.lang.reflect.Type;
  * @version $Rev: 1137074 $ $Date: 2011-06-17 18:20:30 -0500 (Fri, 17 Jun 2011) $
  */
 public class ValidationContextTraversal extends CallbackProcedure {
-    private static class NullSafePropertyAccess extends PropertyAccess {
+    private static class NullSafePropertyAccess extends AccessStrategy {
+        private final PropertyAccess wrapped;
 
         /**
          * Create a new NullSafePropertyAccess instance.
@@ -47,7 +49,7 @@ public class ValidationContextTraversal
          * @param propertyName
          */
         public NullSafePropertyAccess(Class<?> clazz, String propertyName) {
-            super(clazz, propertyName);
+            wrapped = PropertyAccess.getInstance(clazz, propertyName);
         }
 
         /**
@@ -55,7 +57,22 @@ public class ValidationContextTraversal
          */
         @Override
         public Object get(Object bean) {
-            return bean == null ? null : super.get(bean);
+            return bean == null ? null : wrapped.get(bean);
+        }
+
+        @Override
+        public ElementType getElementType() {
+            return wrapped.getElementType();
+        }
+
+        @Override
+        public Type getJavaType() {
+            return wrapped.getJavaType();
+        }
+
+        @Override
+        public String getPropertyName() {
+            return wrapped.getPropertyName();
         }
     }
 
@@ -126,7 +143,7 @@ public class ValidationContextTraversal
         if (mp == null) {
             // TODO this could indicate a property hosted on a superclass; should we shunt the context traversal down a path based on that type?
 
-            PropertyAccess access = new PropertyAccess(rawType, token);
+            PropertyAccess access = PropertyAccess.getInstance(rawType, token);
             if (access.isKnown()) {
                 // add heretofore unknown, but valid, property on the fly:
                 mp = JsrMetaBeanFactory.addMetaProperty(metaBean, access);

Modified: bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/xml/ValidationMappingParser.java
URL: http://svn.apache.org/viewvc/bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/xml/ValidationMappingParser.java?rev=1762843&r1=1762842&r2=1762843&view=diff
==============================================================================
--- bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/xml/ValidationMappingParser.java (original)
+++ bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/xml/ValidationMappingParser.java Thu Sep 29 22:48:32 2016
@@ -47,13 +47,10 @@ import javax.xml.validation.Schema;
 
 import org.apache.bval.jsr.ApacheValidatorFactory;
 import org.apache.bval.jsr.ConstraintAnnotationAttributes;
-import org.apache.bval.jsr.util.EnumerationConverter;
 import org.apache.bval.jsr.util.IOs;
 import org.apache.bval.util.FieldAccess;
 import org.apache.bval.util.MethodAccess;
 import org.apache.bval.util.reflection.Reflection;
-import org.apache.commons.beanutils.ConvertUtils;
-import org.apache.commons.beanutils.Converter;
 import org.apache.commons.lang3.ArrayUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.weaver.privilizer.Privileged;
@@ -65,7 +62,6 @@ import org.apache.commons.weaver.privili
  */
 @Privilizing(@CallTo(Reflection.class))
 public class ValidationMappingParser {
-    //    private static final Log log = LogFactory.getLog(ValidationMappingParser.class);
     private static final String VALIDATION_MAPPING_XSD = "META-INF/validation-mapping-1.1.xsd";
 
     private static final Set<ConstraintAnnotationAttributes> RESERVED_PARAMS = Collections.unmodifiableSet(EnumSet.of(
@@ -266,8 +262,25 @@ public class ValidationMappingParser {
          * spec: Note that if the raw string is unqualified,
          * default package is taken into account.
          */
+        if (returnType.equals(String.class)) {
+            return value;
+        }
         if (returnType.equals(Class.class)) {
-            value = toQualifiedClassName(value, defaultPackage);
+            ClassLoader cl = Reflection.getClassLoader(ValidationMappingParser.class);
+            try {
+                return Reflection.getClass(cl, toQualifiedClassName(value, defaultPackage));
+            } catch (Exception e) {
+                throw new ValidationException(e);
+            }
+        }
+        if (returnType.isEnum()) {
+            try {
+                @SuppressWarnings({ "rawtypes", "unchecked" })
+                final Enum e = Enum.valueOf(returnType.asSubclass(Enum.class), value);
+                return e;
+            } catch (IllegalArgumentException e) {
+                throw new ValidationException(e);
+            }
         }
         if (Byte.class.equals(returnType) || byte.class.equals(returnType)) { // spec mandates it
             return Byte.parseByte(value);
@@ -296,17 +309,7 @@ public class ValidationMappingParser {
             }
             return value.charAt(0);
         }
-
-        /* Converter lookup */
-        Converter converter = ConvertUtils.lookup(returnType);
-        if (converter == null && returnType.isEnum()) {
-            converter = EnumerationConverter.getInstance();
-        }
-
-        if (converter == null) {
-            return converter;
-        }
-        return converter.convert(returnType, value);
+        throw new ValidationException(String.format("Unknown annotation value type %s", returnType.getName()));
     }
 
     private <A extends Annotation> Annotation createAnnotation(AnnotationType annotationType,

Modified: bval/trunk/bval-tck11/pom.xml
URL: http://svn.apache.org/viewvc/bval/trunk/bval-tck11/pom.xml?rev=1762843&r1=1762842&r2=1762843&view=diff
==============================================================================
--- bval/trunk/bval-tck11/pom.xml (original)
+++ bval/trunk/bval-tck11/pom.xml Thu Sep 29 22:48:32 2016
@@ -41,10 +41,8 @@ under the License.
         <dependency>
           <groupId>org.apache.geronimo.specs</groupId>
             <artifactId>geronimo-validation_1.1_spec</artifactId>
-            <version>1.0-alpha-1</version>
             <scope>provided</scope>
         </dependency>
-
         <dependency>
             <groupId>org.apache.geronimo.specs</groupId>
             <artifactId>geronimo-atinject_1.0_spec</artifactId>
@@ -79,7 +77,6 @@ under the License.
             <groupId>org.apache.tomcat</groupId>
             <artifactId>tomcat-el-api</artifactId>
         </dependency>
-
         <dependency>
             <groupId>org.apache.bval</groupId>
             <artifactId>bval-core</artifactId>
@@ -90,7 +87,6 @@ under the License.
             <artifactId>bval-jsr</artifactId>
             <version>${project.version}</version>
         </dependency>
-
         <dependency>
             <groupId>org.jboss.arquillian.container</groupId>
             <artifactId>arquillian-container-test-spi</artifactId>
@@ -108,14 +104,12 @@ under the License.
             <version>${owb.version}</version>
             <scope>test</scope>
         </dependency>
-
         <dependency>
             <groupId>org.apache.tomcat</groupId>
             <artifactId>tomcat-jasper-el</artifactId>
             <version>7.0.42</version>
             <scope>provided</scope>
         </dependency>
-
         <dependency>
             <groupId>org.hibernate.beanvalidation.tck</groupId>
             <artifactId>beanvalidation-tck-tests</artifactId>

Propchange: bval/trunk/bval-xstream/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Thu Sep 29 22:48:32 2016
@@ -9,3 +9,4 @@ target
 .idea
 .git
 .gitignore
+dependency-reduced-pom.xml

Modified: bval/trunk/bval-xstream/pom.xml
URL: http://svn.apache.org/viewvc/bval/trunk/bval-xstream/pom.xml?rev=1762843&r1=1762842&r2=1762843&view=diff
==============================================================================
--- bval/trunk/bval-xstream/pom.xml (original)
+++ bval/trunk/bval-xstream/pom.xml Thu Sep 29 22:48:32 2016
@@ -20,84 +20,122 @@
 <!--
 	Maven release plugin requires the project tag to be on a single line.
 -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 
-  <modelVersion>4.0.0</modelVersion>
+    <modelVersion>4.0.0</modelVersion>
 
-  <parent>
-    <groupId>org.apache.bval</groupId>
-    <artifactId>bval-parent</artifactId>
-    <version>1.1.2-SNAPSHOT</version>
-  </parent>
-
-  <artifactId>bval-xstream</artifactId>
-  <name>Apache BVal :: bval-xstream (optional)</name>
-  <packaging>jar</packaging>
-
-  <description>BVal XML Metadata with XStream</description>
-
-  <dependencies>
-    <dependency>
-      <groupId>org.apache.bval</groupId>
-      <artifactId>bval-core</artifactId>
-      <version>${project.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>com.thoughtworks.xstream</groupId>
-      <artifactId>xstream</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.commons</groupId>
-      <artifactId>commons-weaver-privilizer-api</artifactId>
-    </dependency>
-    <!-- Test dependencies -->
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
-    </dependency>
-  </dependencies>
-
-  <build>
-    <plugins>
-      <!-- create mainClass attribute -->
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-jar-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>default-jar</id>
-            <goals>
-              <goal>jar</goal>
-            </goals>
-            <configuration>
-              <archive>
-                <manifest>
-                  <mainClass>org.apache.bval.util.BValVersion</mainClass>
-                </manifest>
-              </archive>
-            </configuration>
-          </execution>
-          <execution>
-            <id>attach-tests</id>
-            <goals>
-              <goal>test-jar</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
-        <groupId>org.codehaus.mojo</groupId>
-        <artifactId>findbugs-maven-plugin</artifactId>
-        <configuration>
-            <excludeFilterFile>findbugs-exclude-filter.xml</excludeFilterFile>
-        </configuration>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.commons</groupId>
-        <artifactId>commons-weaver-maven-plugin</artifactId>
-      </plugin>
-    </plugins>
-  </build>
+    <parent>
+        <groupId>org.apache.bval</groupId>
+        <artifactId>bval-parent</artifactId>
+        <version>1.1.2-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>bval-xstream</artifactId>
+    <name>Apache BVal :: bval-xstream (optional)</name>
+    <packaging>jar</packaging>
+
+    <description>BVal XML Metadata with XStream</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.bval</groupId>
+            <artifactId>bval-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-lang3</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.thoughtworks.xstream</groupId>
+            <artifactId>xstream</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-weaver-privilizer-api</artifactId>
+        </dependency>
+        <!-- Test dependencies -->
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <!-- create mainClass attribute -->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>default-jar</id>
+                        <goals>
+                            <goal>jar</goal>
+                        </goals>
+                        <configuration>
+                            <archive>
+                                <manifest>
+                                    <mainClass>org.apache.bval.util.BValVersion</mainClass>
+                                </manifest>
+                            </archive>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>attach-tests</id>
+                        <goals>
+                            <goal>test-jar</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-shade-plugin</artifactId>
+                <configuration>
+                    <artifactSet>
+                        <includes>
+                            <include>org.apache.commons:commons-lang3</include>
+                        </includes>
+                    </artifactSet>
+                    <filters>
+                        <filter>
+                            <artifact>org.apache.commons:commons-lang3</artifact>
+                            <excludes>META-INF/maven/**</excludes>
+                        </filter>
+                    </filters>
+                    <relocations>
+                        <relocation>
+                            <pattern>org.apache.commons</pattern>
+                            <shadedPattern>org.apache.bval.xstream._oac</shadedPattern>
+                        </relocation>
+                    </relocations>
+                    <minimizeJar>true</minimizeJar>
+                    <promoteTransitiveDependencies>true</promoteTransitiveDependencies>
+                    <createSourcesJar>true</createSourcesJar>
+                    <shadeSourcesContent>true</shadeSourcesContent>
+                </configuration>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>shade</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>findbugs-maven-plugin</artifactId>
+                <configuration>
+                    <excludeFilterFile>findbugs-exclude-filter.xml</excludeFilterFile>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.commons</groupId>
+                <artifactId>commons-weaver-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
 </project>
-

Modified: bval/trunk/pom.xml
URL: http://svn.apache.org/viewvc/bval/trunk/pom.xml?rev=1762843&r1=1762842&r2=1762843&view=diff
==============================================================================
--- bval/trunk/pom.xml (original)
+++ bval/trunk/pom.xml Thu Sep 29 22:48:32 2016
@@ -445,6 +445,11 @@
                     </executions>
                 </plugin>
                 <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-shade-plugin</artifactId>
+                    <version>2.4.3</version>
+                </plugin>
+                <plugin>
                     <groupId>org.codehaus.mojo</groupId>
                     <artifactId>jdepend-maven-plugin</artifactId>
                     <version>2.0-beta-2</version>
@@ -513,6 +518,7 @@
                             <exclude>**/*.ipr</exclude>
                             <exclude>**/*.iws</exclude>
                             <exclude>**/META-INF/services/*</exclude> <!-- depending service loader it can fail if a comment is added -->
+                            <exclude>**/dependency-reduced-pom.xml</exclude>
                         </excludes>
                     </configuration>
                 </plugin>
@@ -674,7 +680,6 @@
         <module>bval-jsr</module>
         <module>bval-json</module>
         <module>bval-extras</module>
-	<!--<module>bval-tck</module> dependencies are hard to find today and we have tck11 -->
         <module>bval-tck11</module>
         <module>bundle</module>
     </modules>