incubator-bval-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r1166289 [1/2] - in /incubator/bval/sandbox/lang3-work: ./ bval-core/ bval-core/src/main/java/org/apache/bval/ bval-core/src/main/java/org/apache/bval/model/ bval-core/src/main/java/org/apache/bval/routines/ bval-core/src/main/java/org/apac...
Date Wed, 07 Sep 2011 18:11:12 GMT
Author: mbenson
Date: Wed Sep  7 18:11:09 2011
New Revision: 1166289

URL: http://svn.apache.org/viewvc?rev=1166289&view=rev
Log:
fully merge from trunk

Added:
    incubator/bval/sandbox/lang3-work/bval-extras/   (props changed)
      - copied from r1069984, incubator/bval/trunk/bval-extras/
    incubator/bval/sandbox/lang3-work/bval-extras/pom.xml
      - copied, changed from r1069984, incubator/bval/trunk/bval-extras/pom.xml
    incubator/bval/sandbox/lang3-work/bval-extras/src/
      - copied from r1069984, incubator/bval/trunk/bval-extras/src/
    incubator/bval/sandbox/lang3-work/bval-extras/src/main/
      - copied from r1069984, incubator/bval/trunk/bval-extras/src/main/
    incubator/bval/sandbox/lang3-work/bval-extras/src/main/java/
      - copied from r1069984, incubator/bval/trunk/bval-extras/src/main/java/
    incubator/bval/sandbox/lang3-work/bval-extras/src/main/java/org/
      - copied from r1069984, incubator/bval/trunk/bval-extras/src/main/java/org/
    incubator/bval/sandbox/lang3-work/bval-extras/src/main/java/org/apache/
      - copied from r1069984, incubator/bval/trunk/bval-extras/src/main/java/org/apache/
    incubator/bval/sandbox/lang3-work/bval-extras/src/main/java/org/apache/bval/
      - copied from r1069984, incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/
    incubator/bval/sandbox/lang3-work/bval-extras/src/main/java/org/apache/bval/extras/
      - copied from r1069984, incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/
    incubator/bval/sandbox/lang3-work/bval-extras/src/main/java/org/apache/bval/extras/constraints/
      - copied from r1069984, incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/
    incubator/bval/sandbox/lang3-work/bval-extras/src/main/java/org/apache/bval/extras/constraints/Directory.java
      - copied unchanged from r1166256, incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/Directory.java
    incubator/bval/sandbox/lang3-work/bval-extras/src/main/java/org/apache/bval/extras/constraints/DirectoryValidator.java
      - copied unchanged from r1166256, incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/DirectoryValidator.java
    incubator/bval/sandbox/lang3-work/bval-extras/src/main/java/org/apache/bval/extras/constraints/NotDirectory.java
      - copied unchanged from r1166256, incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/NotDirectory.java
    incubator/bval/sandbox/lang3-work/bval-extras/src/main/java/org/apache/bval/extras/constraints/NotDirectoryValidator.java
      - copied unchanged from r1166256, incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/NotDirectoryValidator.java
    incubator/bval/sandbox/lang3-work/bval-extras/src/main/java/org/apache/bval/extras/constraints/Symlink.java
      - copied unchanged from r1166256, incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/Symlink.java
    incubator/bval/sandbox/lang3-work/bval-extras/src/main/java/org/apache/bval/extras/constraints/SymlinkValidator.java
      - copied unchanged from r1166256, incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/SymlinkValidator.java
    incubator/bval/sandbox/lang3-work/bval-extras/src/main/java/org/apache/bval/extras/constraints/package-info.java
      - copied unchanged from r1166256, incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/package-info.java
    incubator/bval/sandbox/lang3-work/bval-extras/src/main/java/org/apache/bval/extras/routines/
      - copied from r1069984, incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/routines/
    incubator/bval/sandbox/lang3-work/bval-extras/src/main/resources/
      - copied from r1069984, incubator/bval/trunk/bval-extras/src/main/resources/
    incubator/bval/sandbox/lang3-work/bval-extras/src/test/
      - copied from r1069984, incubator/bval/trunk/bval-extras/src/test/
    incubator/bval/sandbox/lang3-work/bval-extras/src/test/java/
      - copied from r1069984, incubator/bval/trunk/bval-extras/src/test/java/
    incubator/bval/sandbox/lang3-work/bval-extras/src/test/resources/
      - copied from r1069984, incubator/bval/trunk/bval-extras/src/test/resources/
Modified:
    incubator/bval/sandbox/lang3-work/   (props changed)
    incubator/bval/sandbox/lang3-work/CHANGES.txt
    incubator/bval/sandbox/lang3-work/README.txt
    incubator/bval/sandbox/lang3-work/bval-core/pom.xml
    incubator/bval/sandbox/lang3-work/bval-core/src/main/java/org/apache/bval/BeanValidationContext.java   (props changed)
    incubator/bval/sandbox/lang3-work/bval-core/src/main/java/org/apache/bval/BeanValidator.java
    incubator/bval/sandbox/lang3-work/bval-core/src/main/java/org/apache/bval/Validate.java
    incubator/bval/sandbox/lang3-work/bval-core/src/main/java/org/apache/bval/model/MetaProperty.java   (props changed)
    incubator/bval/sandbox/lang3-work/bval-core/src/main/java/org/apache/bval/routines/EMailValidationUtils.java   (contents, props changed)
    incubator/bval/sandbox/lang3-work/bval-core/src/main/java/org/apache/bval/util/FieldAccess.java
    incubator/bval/sandbox/lang3-work/bval-core/src/main/java/org/apache/bval/util/MethodAccess.java
    incubator/bval/sandbox/lang3-work/bval-core/src/test/java/org/apache/bval/model/ExampleEnum.java   (contents, props changed)
    incubator/bval/sandbox/lang3-work/bval-guice/pom.xml
    incubator/bval/sandbox/lang3-work/bval-guice/src/main/java/org/apache/bval/guice/Validate.java
    incubator/bval/sandbox/lang3-work/bval-guice/src/main/java/org/apache/bval/guice/ValidateMethodInterceptor.java
    incubator/bval/sandbox/lang3-work/bval-guice/src/test/java/org/apache/bval/guice/DummyCountryDao.java
    incubator/bval/sandbox/lang3-work/bval-guice/src/test/java/org/apache/bval/guice/DummyException.java
    incubator/bval/sandbox/lang3-work/bval-guice/src/test/java/org/apache/bval/guice/GuiceAwareValidationTestCase.java
    incubator/bval/sandbox/lang3-work/bval-json/pom.xml
    incubator/bval/sandbox/lang3-work/bval-json/src/test/java/org/apache/bval/json/JSONGeneratorTest.java   (contents, props changed)
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/provider/pom.xml
    incubator/bval/sandbox/lang3-work/bval-jsr303/pom.xml
    incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/   (props changed)
    incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/ApacheFactoryContext.java
    incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/ApacheValidatorFactory.java
    incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/AppendValidationToBuilder.java   (props changed)
    incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/BaseAppendValidation.java   (props changed)
    incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/BeanDescriptorImpl.java
    incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/ClassValidator.java
    incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintDescriptorImpl.java   (props changed)
    incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintValidation.java   (contents, props changed)
    incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintValidationListener.java   (props changed)
    incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintValidatorIdentity.java   (props changed)
    incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/ElementDescriptorImpl.java
    incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/GraphBeanIdentity.java   (props changed)
    incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/Jsr303Features.java
    incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/Jsr303MetaBeanFactory.java
    incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/UnknownPropertyException.java   (props changed)
    incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/extensions/MethodValidatorMetaBeanFactory.java
    incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/extensions/ParameterAccess.java   (props changed)
    incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/extensions/ReturnAccess.java   (props changed)
    incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/ClassHelper.java   (contents, props changed)
    incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/ConstraintDefinitionValidator.java   (contents, props changed)
    incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/xml/AnnotationProxyBuilder.java
    incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/xml/ValidationMappingParser.java   (props changed)
    incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/resources/org/apache/bval/jsr303/ValidationMessages_en.properties   (props changed)
    incubator/bval/sandbox/lang3-work/bval-jsr303/src/test/java/org/apache/bval/constraints/DecimalMinMaxValidatorsTest.java   (props changed)
    incubator/bval/sandbox/lang3-work/bval-jsr303/src/test/java/org/apache/bval/constraints/MinMaxValidatorsForNumberTest.java   (props changed)
    incubator/bval/sandbox/lang3-work/bval-jsr303/src/test/java/org/apache/bval/jsr303/BeanDescriptorTest.java   (contents, props changed)
    incubator/bval/sandbox/lang3-work/bval-jsr303/src/test/java/org/apache/bval/jsr303/CircularReferencesTest.java   (props changed)
    incubator/bval/sandbox/lang3-work/bval-jsr303/src/test/java/org/apache/bval/jsr303/ConstraintDefinitionsTest.java   (props changed)
    incubator/bval/sandbox/lang3-work/bval-jsr303/src/test/java/org/apache/bval/jsr303/ExceptionsContractTest.java   (props changed)
    incubator/bval/sandbox/lang3-work/bval-jsr303/src/test/java/org/apache/bval/jsr303/TckReproducerTest.java   (props changed)
    incubator/bval/sandbox/lang3-work/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Continent.java   (props changed)
    incubator/bval/sandbox/lang3-work/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/GroupSequenceIsolationTest.java   (props changed)
    incubator/bval/sandbox/lang3-work/bval-tck/pom.xml   (props changed)
    incubator/bval/sandbox/lang3-work/bval-tck/src/main/resources/META-INF/jboss-test-harness.properties   (props changed)
    incubator/bval/sandbox/lang3-work/bval-tck/src/test/resources/jndi.properties   (props changed)
    incubator/bval/sandbox/lang3-work/bval-tck/src/test/resources/log4j.xml   (props changed)
    incubator/bval/sandbox/lang3-work/bval-xstream/   (props changed)
    incubator/bval/sandbox/lang3-work/bval-xstream/pom.xml   (contents, props changed)
    incubator/bval/sandbox/lang3-work/bval-xstream/src/main/java/org/apache/bval/routines/StandardValidation.java   (props changed)
    incubator/bval/sandbox/lang3-work/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanBuilder.java   (props changed)
    incubator/bval/sandbox/lang3-work/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanManager.java   (props changed)
    incubator/bval/sandbox/lang3-work/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanManagerFactory.java   (props changed)
    incubator/bval/sandbox/lang3-work/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanURLLoader.java   (props changed)
    incubator/bval/sandbox/lang3-work/bval-xstream/src/test/java/org/apache/bval/example/BusinessEnum.java   (props changed)
    incubator/bval/sandbox/lang3-work/bval-xstream/src/test/java/org/apache/bval/example/BusinessObject.java   (props changed)
    incubator/bval/sandbox/lang3-work/bval-xstream/src/test/java/org/apache/bval/example/BusinessObjectAddress.java   (props changed)
    incubator/bval/sandbox/lang3-work/bval-xstream/src/test/java/org/apache/bval/example/BusinessObjectBeanInfo.java   (props changed)
    incubator/bval/sandbox/lang3-work/bval-xstream/src/test/java/org/apache/bval/routines/StandardValidationTest.java   (props changed)
    incubator/bval/sandbox/lang3-work/bval-xstream/src/test/java/org/apache/bval/xml/BeanValidatorTest.java   (props changed)
    incubator/bval/sandbox/lang3-work/bval-xstream/src/test/java/org/apache/bval/xml/XMLMetaBeanInfosTest.java   (props changed)
    incubator/bval/sandbox/lang3-work/bval-xstream/src/test/java/org/apache/bval/xml/XMLMetaBeanManagerTest.java   (props changed)
    incubator/bval/sandbox/lang3-work/bval-xstream/src/test/resources/org/apache/bval/example/test-beanInfos-custom.xml   (props changed)
    incubator/bval/sandbox/lang3-work/bval-xstream/src/test/resources/org/apache/bval/example/test-beanInfos.xml   (props changed)
    incubator/bval/sandbox/lang3-work/pom.xml

Propchange: incubator/bval/sandbox/lang3-work/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Sep  7 18:11:09 2011
@@ -1 +1 @@
-/incubator/bval/trunk:992143,992401,992406,992412,992510,992648,993404-993438,996236,996240,997154,1002445,1031642,1035416-1036603,1069985,1073929,1073944,1073946,1073949,1089957,1145260-1165833
+/incubator/bval/trunk:992138-1166256

Modified: incubator/bval/sandbox/lang3-work/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/CHANGES.txt?rev=1166289&r1=1166288&r2=1166289&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/CHANGES.txt (original)
+++ incubator/bval/sandbox/lang3-work/CHANGES.txt Wed Sep  7 18:11:09 2011
@@ -64,6 +64,22 @@ How do I Contribute?
   * Bugs and other issues can be posted on the project JIRA.
 
 
+Release Notes for 0.3-incubating
+================================
+
+Bug
+---
+    * [BVAL-84] - CNFEX org.slf4j.impl.StaticLoggerBinder building xstream and guice
+    * [BVAL-86] - Missing DecimalMax/DecimalMin constraint messages in ValidationMessages.properties
+    * [BVAL-87] - Java 2 security violations in ClassValidator.validate
+    * [BVAL-88] - Cascaded validation adds a constraint violation for valid child property
+
+Improvement
+-----------
+    * [BVAL-60] - Use SLF4J API for logging
+    * [BVAL-85] - bval-core has no dependency on slf4j-jcl*
+
+
 Release Notes for 0.2-incubating
 ================================
 

Modified: incubator/bval/sandbox/lang3-work/README.txt
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/README.txt?rev=1166289&r1=1166288&r2=1166289&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/README.txt (original)
+++ incubator/bval/sandbox/lang3-work/README.txt Wed Sep  7 18:11:09 2011
@@ -46,7 +46,7 @@ Most testing has been done with Java SE 
 Building
 ==========================
 To build from source code:
-  - Sources require Java SE 5 or higher. (Tested with JDK 1.5.0_22 and 1.6.0_20)
+  - Sources require Java SE 5 or higher. (Tested with JDK 1.5.0_22 and 1.6.0_21)
   - The project is built with Apache Maven 2 (suggested is 2.2.1).
     You need to download and install Maven 2 from: http://maven.apache.org/
   - Invoke maven in the root directory or a module subdirectory:

Modified: incubator/bval/sandbox/lang3-work/bval-core/pom.xml
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-core/pom.xml?rev=1166289&r1=1166288&r2=1166289&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-core/pom.xml (original)
+++ incubator/bval/sandbox/lang3-work/bval-core/pom.xml Wed Sep  7 18:11:09 2011
@@ -54,11 +54,6 @@
             <artifactId>junit</artifactId>
             <scope>test</scope>
         </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>jcl-over-slf4j</artifactId>
-            <scope>runtime</scope>
-        </dependency>
     </dependencies>
 
     <build>

Propchange: incubator/bval/sandbox/lang3-work/bval-core/src/main/java/org/apache/bval/BeanValidationContext.java
            ('svn:mergeinfo' removed)

Modified: incubator/bval/sandbox/lang3-work/bval-core/src/main/java/org/apache/bval/BeanValidator.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-core/src/main/java/org/apache/bval/BeanValidator.java?rev=1166289&r1=1166288&r2=1166289&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-core/src/main/java/org/apache/bval/BeanValidator.java (original)
+++ incubator/bval/sandbox/lang3-work/bval-core/src/main/java/org/apache/bval/BeanValidator.java Wed Sep  7 18:11:09 2011
@@ -32,237 +32,249 @@ import org.apache.bval.util.ValidationHe
 // TODO: centralize treatMapsLikeBeans
 
 /**
- * Description: Top-Level API-class to validate objects or object-trees.
- * You can invoke, extend or utilize this class if you need other ways to integrate
+ * Description: Top-Level API-class to validate objects or object-trees. You can
+ * invoke, extend or utilize this class if you need other ways to integrate
  * validation in your application.
  * <p/>
- * This class supports cyclic object graphs by keeping track of
- * validated instances in the validation context.<br/>
+ * This class supports cyclic object graphs by keeping track of validated
+ * instances in the validation context.<br/>
  */
 public class BeanValidator<T extends ValidationListener> {
-  private final MetaBeanFinder metaBeanFinder;
+    private final MetaBeanFinder metaBeanFinder;
 
-  /**
-   * Create a new BeanValidator instance.
-   * Convenience constructor. Use the global instance of MetaBeanManagerFactory.getFinder().
-   */
-  public BeanValidator() {
-    this(MetaBeanManagerFactory.getFinder());
-  }
-
-  /**
-   * Create a new BeanValidator instance.
-   * @param metaBeanFinder
-   */
-  public BeanValidator(MetaBeanFinder metaBeanFinder) {
-    this.metaBeanFinder = metaBeanFinder;
-  }
-
-  /**
-   * Convenience API. validate a root object with all related objects
-   * with its default metaBean definition.
-   *
-   * @param bean
-   * @return results - validation results found
-   */
-  public T validate(Object bean) {
-    MetaBean metaBean =
-        getMetaBeanFinder().findForClass(bean.getClass());
-    return validate(bean, metaBean);
-  }
-
-  /**
-   * Convenience API. validate a root object with all related objects
-   * according to the metaBean.
-   *
-   * @param bean - a single bean or a collection of beans (that share the same metaBean!)
-   * @param metaBean
-   * @return results - validation results found
-   */
-  public T validate(Object bean, MetaBean metaBean) {
-    ValidationContext<T> context = createContext();
-    context.setBean(bean, metaBean);
-    ValidationHelper.validateContext(context, new BeanValidatorCallback(context), treatMapsLikeBeans);
-    return context.getListener();
-  }
-
-  /**
-   * Validate the method parameters based on @Validate annotations.
-   * Requirements:
-   * Parameter, that are to be validated must be annotated with @Validate
-   *
-   * @param method     -  a method
-   * @param parameters - the parameters suitable to the method
-   * @return a validation result or null when there was nothing to validate
-   * @see Validate
-   */
-  public T validateCall(Method method, Object[] parameters) {
-    if (parameters.length > 0) {
-      // shortcut (for performance!)
-      Annotation[][] annotations = method.getParameterAnnotations();
-      ValidationContext<T> context = null;
-      for (int i = 0; i < parameters.length; i++) {
-        for (Annotation anno : annotations[i]) {
-          if (anno instanceof Validate) {
-            if (context == null) context = createContext();
-            if (determineMetaBean((Validate) anno, parameters[i], context)) {
-              ValidationHelper.validateContext(context, new BeanValidatorCallback(context), treatMapsLikeBeans);
-              break; // next parameter
+    /**
+     * Create a new BeanValidator instance. Convenience constructor. Use the
+     * global instance of MetaBeanManagerFactory.getFinder().
+     */
+    public BeanValidator() {
+        this(MetaBeanManagerFactory.getFinder());
+    }
+
+    /**
+     * Create a new BeanValidator instance.
+     * 
+     * @param metaBeanFinder
+     */
+    public BeanValidator(MetaBeanFinder metaBeanFinder) {
+        this.metaBeanFinder = metaBeanFinder;
+    }
+
+    /**
+     * Convenience API. validate a root object with all related objects with its
+     * default metaBean definition.
+     * 
+     * @param bean
+     * @return results - validation results found
+     */
+    public T validate(Object bean) {
+        MetaBean metaBean = getMetaBeanFinder().findForClass(bean.getClass());
+        return validate(bean, metaBean);
+    }
+
+    /**
+     * Convenience API. validate a root object with all related objects
+     * according to the metaBean.
+     * 
+     * @param bean
+     *            - a single bean or a collection of beans (that share the same
+     *            metaBean!)
+     * @param metaBean
+     * @return results - validation results found
+     */
+    public T validate(Object bean, MetaBean metaBean) {
+        ValidationContext<T> context = createContext();
+        context.setBean(bean, metaBean);
+        ValidationHelper.validateContext(context, new BeanValidatorCallback(context), treatMapsLikeBeans);
+        return context.getListener();
+    }
+
+    /**
+     * Validate the method parameters based on @Validate annotations.
+     * Requirements: Parameter, that are to be validated must be annotated with @Validate
+     * 
+     * @param method
+     *            - a method
+     * @param parameters
+     *            - the parameters suitable to the method
+     * @return a validation result or null when there was nothing to validate
+     * @see Validate
+     */
+    public T validateCall(Method method, Object[] parameters) {
+        if (parameters.length > 0) {
+            // shortcut (for performance!)
+            Annotation[][] annotations = method.getParameterAnnotations();
+            ValidationContext<T> context = null;
+            for (int i = 0; i < parameters.length; i++) {
+                for (Annotation anno : annotations[i]) {
+                    if (anno instanceof Validate) {
+                        if (context == null)
+                            context = createContext();
+                        if (determineMetaBean((Validate) anno, parameters[i], context)) {
+                            ValidationHelper.validateContext(context, new BeanValidatorCallback(context),
+                                treatMapsLikeBeans);
+                            break; // next parameter
+                        }
+                    }
+                }
             }
-          }
+            return context != null ? context.getListener() : null;
         }
-      }
-      return context != null ? context.getListener() : null;
+        return null;
     }
-    return null;
-  }
 
-  /**
-   * Determine the metabean for the given object.
-   * @param <VL>
-   * @param validate
-   * @param parameter
-   * @param context
-   * @return true when validation should happen, false to skip it
-   */
-  protected <VL extends ValidationListener> boolean determineMetaBean(Validate validate, Object parameter,
-                                                                      ValidationContext<VL> context) {
-    if (validate.value().length() == 0) {
-      if (parameter == null) return false;
-      Class<?> beanClass;
-      if (parameter instanceof Collection<?>) {   // do not validate empty collection
-        Collection<?> coll = ((Collection<?>) parameter);
-        if (coll.isEmpty()) return false;
-        beanClass = coll.iterator().next().getClass(); // get first object
-      } else if (parameter.getClass().isArray()) {
-        beanClass = parameter.getClass().getComponentType();
-      } else {
-        beanClass = parameter.getClass();
-      }
-      context.setBean(parameter, getMetaBeanFinder().findForClass(beanClass));
-    } else {
-      context.setBean(parameter, getMetaBeanFinder().findForId(validate.value()));
-    }
-    return true;
-  }
-
-  /**
-   * factory method -
-   * overwrite in subclasses
-   * 
-   * @return ValidationListener of the proper type
-   */
-  @SuppressWarnings("unchecked")
-  protected T createResults() {
-    return (T) new ValidationResults();
-  }
-
-  /**
-   * factory method -
-   * overwrite in subclasses
-   * 
-   * @return ValidationContext parameterized with our listener type
-   */
-  protected ValidationContext<T> createContext() {
-    return new BeanValidationContext<T>(createResults());
-  }
-
-  /**
-   * Convenience API. validate a single property.
-   *
-   * @param bean         - the root object
-   * @param metaProperty - metadata for the property
-   * @return validation results
-   */
-  public T validateProperty(Object bean, MetaProperty metaProperty) {
-    ValidationContext<T> context = createContext();
-    context.setBean(bean);
-    context.setMetaProperty(metaProperty);
-    ValidationHelper.validateProperty(context);
-    return context.getListener();
-  }
-
-  /**
-   * {@inheritDoc}
-   * internal validate a bean (=not a collection of beans) and its related beans
-   */
-  protected <VL extends ValidationListener> void validateBeanNet(ValidationContext<VL> context) {
-    if (context.collectValidated()) {
-      ValidationHelper.validateBean(context);
-      for (MetaProperty prop : context.getMetaBean().getProperties()) {
-        validateRelatedBean(context, prop);
-      }
-    }
-  }
-
-  /**
-   * Validate a property of a graph.
-   * @param <VL>
-   * @param context
-   * @param prop
-   */
-  protected <VL extends ValidationListener> void validateRelatedBean(ValidationContext<VL> context, MetaProperty prop) {
-    AccessStrategy[] access = prop.getFeature(Features.Property.REF_CASCADE);
-    if (access == null && prop.getMetaBean() != null) { // single property access strategy
-      // save old values from context
-      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()));
-      ValidationHelper.validateContext(context, new BeanValidatorCallback(context), treatMapsLikeBeans);
-      // restore old values in context
-      context.moveUp(bean, mbean);
-    } else if (access != null) { // different accesses to relation
-      // save old values from context
-      final Object bean = context.getBean();
-      final MetaBean mbean = context.getMetaBean();
-      for (AccessStrategy each : access) {
-        // modify context state for relationship-target bean
-        context.moveDown(prop, each);
-        ValidationHelper.validateContext(context, new BeanValidatorCallback(context), treatMapsLikeBeans);
-        // restore old values in context
-        context.moveUp(bean, mbean);
-      }
-    }
-  }
-
-  private boolean treatMapsLikeBeans = false;
-  
-  public boolean isTreatMapsLikeBeans() {
-    return treatMapsLikeBeans;
-  }
-    
-  public void setTreatMapsLikeBeans(boolean treatMapsLikeBeans) {
-    this.treatMapsLikeBeans = treatMapsLikeBeans;
-  }
-  
-  /**
-   * Get the metabean finder associated with this validator.
-   *
-   * @return a MetaBeanFinder
-   * @see org.apache.bval.MetaBeanManagerFactory#getFinder()
-   */
-  public MetaBeanFinder getMetaBeanFinder() {
-    return metaBeanFinder;
-  }
-
-  /**
-   * Dispatches a call from {@link #validate()} to
-   * {@link BeanValidator#validateBeanNet(ValidationContext)} with the current
-   * context set.
-   */
-  private class BeanValidatorCallback implements ValidationHelper.ValidateCallback {
-
-    private final ValidationContext<?> context;
-    
-    public BeanValidatorCallback(ValidationContext<?> context) {
-        this.context = context;
+    /**
+     * Determine the metabean for the given object.
+     * 
+     * @param <VL>
+     * @param validate
+     * @param parameter
+     * @param context
+     * @return true when validation should happen, false to skip it
+     */
+    protected <VL extends ValidationListener> boolean determineMetaBean(Validate validate, Object parameter,
+        ValidationContext<VL> context) {
+        if (validate.value().length() == 0) {
+            if (parameter == null)
+                return false;
+            Class<?> beanClass;
+            if (parameter instanceof Collection<?>) { // do not validate empty
+                                                      // collection
+                Collection<?> coll = ((Collection<?>) parameter);
+                if (coll.isEmpty())
+                    return false;
+                beanClass = coll.iterator().next().getClass(); // get first
+                                                               // object
+            } else if (parameter.getClass().isArray()) {
+                beanClass = parameter.getClass().getComponentType();
+            } else {
+                beanClass = parameter.getClass();
+            }
+            context.setBean(parameter, getMetaBeanFinder().findForClass(beanClass));
+        } else {
+            context.setBean(parameter, getMetaBeanFinder().findForId(validate.value()));
+        }
+        return true;
+    }
+
+    /**
+     * factory method - overwrite in subclasses
+     * 
+     * @return ValidationListener of the proper type
+     */
+    @SuppressWarnings("unchecked")
+    protected T createResults() {
+        return (T) new ValidationResults();
+    }
+
+    /**
+     * factory method - overwrite in subclasses
+     * 
+     * @return ValidationContext parameterized with our listener type
+     */
+    protected ValidationContext<T> createContext() {
+        return new BeanValidationContext<T>(createResults());
+    }
+
+    /**
+     * Convenience API. validate a single property.
+     * 
+     * @param bean
+     *            - the root object
+     * @param metaProperty
+     *            - metadata for the property
+     * @return validation results
+     */
+    public T validateProperty(Object bean, MetaProperty metaProperty) {
+        ValidationContext<T> context = createContext();
+        context.setBean(bean);
+        context.setMetaProperty(metaProperty);
+        ValidationHelper.validateProperty(context);
+        return context.getListener();
+    }
+
+    /**
+     * {@inheritDoc} internal validate a bean (=not a collection of beans) and
+     * its related beans
+     */
+    protected <VL extends ValidationListener> void validateBeanNet(ValidationContext<VL> context) {
+        if (context.collectValidated()) {
+            ValidationHelper.validateBean(context);
+            for (MetaProperty prop : context.getMetaBean().getProperties()) {
+                validateRelatedBean(context, prop);
+            }
+        }
+    }
+
+    /**
+     * Validate a property of a graph.
+     * 
+     * @param <VL>
+     * @param context
+     * @param prop
+     */
+    protected <VL extends ValidationListener> void validateRelatedBean(ValidationContext<VL> context, MetaProperty prop) {
+        AccessStrategy[] access = prop.getFeature(Features.Property.REF_CASCADE);
+        if (access == null && prop.getMetaBean() != null) { // single property
+                                                            // access strategy
+            // save old values from context
+            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()));
+            ValidationHelper.validateContext(context, new BeanValidatorCallback(context), treatMapsLikeBeans);
+            // restore old values in context
+            context.moveUp(bean, mbean);
+        } else if (access != null) { // different accesses to relation
+            // save old values from context
+            final Object bean = context.getBean();
+            final MetaBean mbean = context.getMetaBean();
+            for (AccessStrategy each : access) {
+                // modify context state for relationship-target bean
+                context.moveDown(prop, each);
+                ValidationHelper.validateContext(context, new BeanValidatorCallback(context), treatMapsLikeBeans);
+                // restore old values in context
+                context.moveUp(bean, mbean);
+            }
+        }
     }
 
-    public void validate() {
-        validateBeanNet(context);
+    private boolean treatMapsLikeBeans = false;
+
+    public boolean isTreatMapsLikeBeans() {
+        return treatMapsLikeBeans;
+    }
+
+    public void setTreatMapsLikeBeans(boolean treatMapsLikeBeans) {
+        this.treatMapsLikeBeans = treatMapsLikeBeans;
+    }
+
+    /**
+     * Get the metabean finder associated with this validator.
+     * 
+     * @return a MetaBeanFinder
+     * @see org.apache.bval.MetaBeanManagerFactory#getFinder()
+     */
+    public MetaBeanFinder getMetaBeanFinder() {
+        return metaBeanFinder;
+    }
+
+    /**
+     * Dispatches a call from {@link #validate()} to
+     * {@link BeanValidator#validateBeanNet(ValidationContext)} with the current
+     * context set.
+     */
+    private class BeanValidatorCallback implements ValidationHelper.ValidateCallback {
+
+        private final ValidationContext<?> context;
+
+        public BeanValidatorCallback(ValidationContext<?> context) {
+            this.context = context;
+        }
+
+        public void validate() {
+            validateBeanNet(context);
+        }
+
     }
 
-  }
-  
 }

Modified: incubator/bval/sandbox/lang3-work/bval-core/src/main/java/org/apache/bval/Validate.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-core/src/main/java/org/apache/bval/Validate.java?rev=1166289&r1=1166288&r2=1166289&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-core/src/main/java/org/apache/bval/Validate.java (original)
+++ incubator/bval/sandbox/lang3-work/bval-core/src/main/java/org/apache/bval/Validate.java Wed Sep  7 18:11:09 2011
@@ -16,18 +16,26 @@
  */
 package org.apache.bval;
 
-import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
 
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
 /**
  * Description: Annotate an element (parameter) to be validated.
  * <br>
  */
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.PARAMETER, ElementType.METHOD})
+@Target({METHOD, FIELD, CONSTRUCTOR, PARAMETER})
+@Retention(RUNTIME)
 public @interface Validate {
-    /** (optional) the MetaBean.id to use */
+    /**
+     * (optional) the MetaBean.id to use
+     */
     String value() default "";
+
+    /**
+     * to Support groups on @Valid(ate) in method/return validation
+     */
+    Class<?>[] groups() default {};
 }

Propchange: incubator/bval/sandbox/lang3-work/bval-core/src/main/java/org/apache/bval/model/MetaProperty.java
            ('svn:mergeinfo' removed)

Modified: incubator/bval/sandbox/lang3-work/bval-core/src/main/java/org/apache/bval/routines/EMailValidationUtils.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-core/src/main/java/org/apache/bval/routines/EMailValidationUtils.java?rev=1166289&r1=1166288&r2=1166289&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-core/src/main/java/org/apache/bval/routines/EMailValidationUtils.java (original)
+++ incubator/bval/sandbox/lang3-work/bval-core/src/main/java/org/apache/bval/routines/EMailValidationUtils.java Wed Sep  7 18:11:09 2011
@@ -26,46 +26,49 @@ import java.util.regex.Pattern;
  * Time: 10:40:59<br>
  */
 public class EMailValidationUtils {
-  private static String ATOM =
-      "[^\\x00-\\x1F^\\(^\\)^\\<^\\>^\\@^\\,^\\;^\\:^\\\\^\\\"^\\.^\\[^\\]^\\s]";
-  private static String DOMAIN = "(" + ATOM + "+(\\." + ATOM + "+)*";
-  private static String IP_DOMAIN = "\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\]";
-  public static final java.util.regex.Pattern DEFAULT_EMAIL_PATTERN;
+    private static String ATOM = "[^\\x00-\\x1F^\\(^\\)^\\<^\\>^\\@^\\,^\\;^\\:^\\\\^\\\"^\\.^\\[^\\]^\\s]";
+    private static String DOMAIN = "(" + ATOM + "+(\\." + ATOM + "+)*";
+    private static String IP_DOMAIN = "\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\]";
+    public static final java.util.regex.Pattern DEFAULT_EMAIL_PATTERN;
 
-  static {
-    DEFAULT_EMAIL_PATTERN = java.util.regex.Pattern.compile(
-        "^" + ATOM + "+(\\." + ATOM + "+)*@"
-            + DOMAIN
-            + "|"
-            + IP_DOMAIN
-            + ")$",
-        java.util.regex.Pattern.CASE_INSENSITIVE
-    );
-  }
+    static {
+        DEFAULT_EMAIL_PATTERN =
+            java.util.regex.Pattern.compile("^" + ATOM + "+(\\." + ATOM + "+)*@" + DOMAIN + "|" + IP_DOMAIN + ")$",
+                java.util.regex.Pattern.CASE_INSENSITIVE);
+    }
 
-  /**
-   * Learn whether a given object is a valid email address.
-   * @param value to check
-   * @return <code>true</code> if the validation passes
-   */
-  public static boolean isValid(Object value) {
-    return isValid(value, DEFAULT_EMAIL_PATTERN);
-  }
+    /**
+     * Learn whether a given object is a valid email address.
+     * 
+     * @param value
+     *            to check
+     * @return <code>true</code> if the validation passes
+     */
+    public static boolean isValid(Object value) {
+        return isValid(value, DEFAULT_EMAIL_PATTERN);
+    }
 
-  /**
-   * Learn whether a particular value matches a given pattern per {@link Matcher#matches()}.
-   * @param value
-   * @param aPattern
-   * @return <code>true</code> if <code>value</code> was a <code>String</code> matching <code>aPattern</code>
-   */
-  //TODO it would seem to make sense to move or reduce the visibility of this method as it is more general than email.
-  public static boolean isValid(Object value, Pattern aPattern) {
-    if (value == null) return true;
-    if (!(value instanceof CharSequence)) return false;
-    CharSequence seq = (CharSequence) value;
-    if (seq.length() == 0) return true;
-    Matcher m = aPattern.matcher(seq);
-    return m.matches();
-  }
+    /**
+     * Learn whether a particular value matches a given pattern per
+     * {@link Matcher#matches()}.
+     * 
+     * @param value
+     * @param aPattern
+     * @return <code>true</code> if <code>value</code> was a <code>String</code>
+     *         matching <code>aPattern</code>
+     */
+    // TODO it would seem to make sense to move or reduce the visibility of this
+    // method as it is more general than email.
+    public static boolean isValid(Object value, Pattern aPattern) {
+        if (value == null)
+            return true;
+        if (!(value instanceof CharSequence))
+            return false;
+        CharSequence seq = (CharSequence) value;
+        if (seq.length() == 0)
+            return true;
+        Matcher m = aPattern.matcher(seq);
+        return m.matches();
+    }
 
 }

Propchange: incubator/bval/sandbox/lang3-work/bval-core/src/main/java/org/apache/bval/routines/EMailValidationUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/bval/sandbox/lang3-work/bval-core/src/main/java/org/apache/bval/util/FieldAccess.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-core/src/main/java/org/apache/bval/util/FieldAccess.java?rev=1166289&r1=1166288&r2=1166289&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-core/src/main/java/org/apache/bval/util/FieldAccess.java (original)
+++ incubator/bval/sandbox/lang3-work/bval-core/src/main/java/org/apache/bval/util/FieldAccess.java Wed Sep  7 18:11:09 2011
@@ -32,10 +32,15 @@ public class FieldAccess extends AccessS
      * Create a new FieldAccess instance.
      * @param field
      */
-    public FieldAccess(Field field) {
+    public FieldAccess(final Field field) {
         this.field = field;
         if(!field.isAccessible()) {
-            field.setAccessible(true);
+            PrivilegedActions.run( new PrivilegedAction<Object>() {
+                public Object run() {
+                    field.setAccessible(true);
+                    return (Object) null;
+                }
+            });
         }
     }
 

Modified: incubator/bval/sandbox/lang3-work/bval-core/src/main/java/org/apache/bval/util/MethodAccess.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-core/src/main/java/org/apache/bval/util/MethodAccess.java?rev=1166289&r1=1166288&r2=1166289&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-core/src/main/java/org/apache/bval/util/MethodAccess.java (original)
+++ incubator/bval/sandbox/lang3-work/bval-core/src/main/java/org/apache/bval/util/MethodAccess.java Wed Sep  7 18:11:09 2011
@@ -43,11 +43,16 @@ public class MethodAccess extends Access
      * @param propertyName
      * @param method
      */
-    public MethodAccess(String propertyName, Method method) {
+    public MethodAccess(String propertyName, final Method method) {
         this.method = method;
         this.propertyName = propertyName;
         if (!method.isAccessible()) {
-            method.setAccessible(true);
+            PrivilegedActions.run( new PrivilegedAction<Object>() {
+                public Object run() {
+                    method.setAccessible(true);
+                    return (Object) null;
+                }
+            });
         }
     }
 

Modified: incubator/bval/sandbox/lang3-work/bval-core/src/test/java/org/apache/bval/model/ExampleEnum.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-core/src/test/java/org/apache/bval/model/ExampleEnum.java?rev=1166289&r1=1166288&r2=1166289&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-core/src/test/java/org/apache/bval/model/ExampleEnum.java (original)
+++ incubator/bval/sandbox/lang3-work/bval-core/src/test/java/org/apache/bval/model/ExampleEnum.java Wed Sep  7 18:11:09 2011
@@ -23,5 +23,5 @@ package org.apache.bval.model;
  * Time: 18:00:12<br>
  */
 public enum ExampleEnum {
-  VALUE1, VALUE2, VALUE3
+    VALUE1, VALUE2, VALUE3
 }

Propchange: incubator/bval/sandbox/lang3-work/bval-core/src/test/java/org/apache/bval/model/ExampleEnum.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/bval/sandbox/lang3-work/bval-extras/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Sep  7 18:11:09 2011
@@ -0,0 +1 @@
+target

Copied: incubator/bval/sandbox/lang3-work/bval-extras/pom.xml (from r1069984, incubator/bval/trunk/bval-extras/pom.xml)
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-extras/pom.xml?p2=incubator/bval/sandbox/lang3-work/bval-extras/pom.xml&p1=incubator/bval/trunk/bval-extras/pom.xml&r1=1069984&r2=1166289&rev=1166289&view=diff
==============================================================================
--- incubator/bval/trunk/bval-extras/pom.xml (original)
+++ incubator/bval/sandbox/lang3-work/bval-extras/pom.xml Wed Sep  7 18:11:09 2011
@@ -49,6 +49,49 @@
         </dependency>
     </dependencies>
 
+    <profiles>
+        <!--
+            default profile using geronimo-validation_1.0_spec.jar
+            active when property "ri" is not present.
+        -->
+        <profile>
+            <id>geronimo</id>
+            <activation>
+                <property>
+                    <name>!ri</name>
+                </property>
+            </activation>
+            <dependencies>
+                <dependency>
+                    <groupId>org.apache.geronimo.specs</groupId>
+                    <artifactId>geronimo-validation_1.0_spec</artifactId>
+                    <!-- allow users to choose an API provider -->
+                    <scope>provided</scope>
+                </dependency>
+            </dependencies>
+        </profile>
+        <!--
+            optional profile using javax.validation/validation-api.jar
+            from RI manually active when property "-Pri" is provided.
+        -->
+        <profile>
+            <id>ri</id>
+            <activation>
+                <property>
+                    <name>ri</name>
+                </property>
+            </activation>
+            <dependencies>
+                <dependency>
+                    <groupId>javax.validation</groupId>
+                    <artifactId>validation-api</artifactId>
+                    <!-- allow users to choose an API provider -->
+                    <scope>provided</scope>
+                </dependency>
+            </dependencies>
+        </profile>
+    </profiles>
+
     <build>
         <defaultGoal>install</defaultGoal>
 

Modified: incubator/bval/sandbox/lang3-work/bval-guice/pom.xml
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-guice/pom.xml?rev=1166289&r1=1166288&r2=1166289&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-guice/pom.xml (original)
+++ incubator/bval/sandbox/lang3-work/bval-guice/pom.xml Wed Sep  7 18:11:09 2011
@@ -62,6 +62,11 @@
             <artifactId>junit</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-simple</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
     <profiles>

Modified: incubator/bval/sandbox/lang3-work/bval-guice/src/main/java/org/apache/bval/guice/Validate.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-guice/src/main/java/org/apache/bval/guice/Validate.java?rev=1166289&r1=1166288&r2=1166289&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-guice/src/main/java/org/apache/bval/guice/Validate.java (original)
+++ incubator/bval/sandbox/lang3-work/bval-guice/src/main/java/org/apache/bval/guice/Validate.java Wed Sep  7 18:11:09 2011
@@ -58,4 +58,15 @@ public @interface Validate {
      */
     Class<? extends Throwable> rethrowExceptionsAs() default ConstraintViolationException.class;
 
+    /**
+     * A custom error message when throwing the custom exception.
+     *
+     * It supports java.util.Formatter place holders, intercepted method
+     * arguments will be used as message format arguments.
+     *
+     * @return a custom error message when throwing the custom exception.
+     * @see java.util.Formatter#format(String, Object...)
+     */
+    String exceptionMessage() default "";
+
 }

Modified: incubator/bval/sandbox/lang3-work/bval-guice/src/main/java/org/apache/bval/guice/ValidateMethodInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-guice/src/main/java/org/apache/bval/guice/ValidateMethodInterceptor.java?rev=1166289&r1=1166288&r2=1166289&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-guice/src/main/java/org/apache/bval/guice/ValidateMethodInterceptor.java (original)
+++ incubator/bval/sandbox/lang3-work/bval-guice/src/main/java/org/apache/bval/guice/ValidateMethodInterceptor.java Wed Sep  7 18:11:09 2011
@@ -26,6 +26,7 @@ import javax.inject.Inject;
 import javax.validation.ConstraintViolation;
 import javax.validation.ConstraintViolationException;
 import javax.validation.Validator;
+import javax.validation.ValidatorFactory;
 
 import org.aopalliance.intercept.MethodInterceptor;
 import org.aopalliance.intercept.MethodInvocation;
@@ -38,19 +39,23 @@ import org.apache.bval.jsr303.extensions
  */
 public final class ValidateMethodInterceptor implements MethodInterceptor {
 
+    private static final Class<?>[] CAUSE_TYPES = new Class[]{ Throwable.class };
+
+    private static final Class<?>[] MESSAGE_CAUSE_TYPES = new Class[]{ String.class, Throwable.class };
+
     /**
-     * The {@link ValidatorProvider} reference.
+     * The {@link ValidatorFactory} reference.
      */
     @Inject
-    private ValidatorProvider validatorProvider;
+    private ValidatorFactory validatorFactory;
 
     /**
-     * Sets the {@link ValidatorProvider} reference.
+     * Sets the {@link ValidatorFactory} reference.
      *
-     * @param validatorProvider the {@link ValidatorProvider} reference.
+     * @param validatorFactory the {@link ValidatorFactory} reference
      */
-    public void setValidatorProvider(ValidatorProvider validatorProvider) {
-        this.validatorProvider = validatorProvider;
+    public void setValidatorFactory(ValidatorFactory validatorFactory) {
+        this.validatorFactory = validatorFactory;
     }
 
     /**
@@ -59,7 +64,7 @@ public final class ValidateMethodInterce
     public Object invoke(MethodInvocation invocation) throws Throwable {
         Validate validate = invocation.getMethod().getAnnotation(Validate.class);
 
-        Validator validator = this.validatorProvider.get();
+        Validator validator = this.validatorFactory.getValidator();
         MethodValidator methodValidator = validator.unwrap(MethodValidator.class);
 
         Set<ConstraintViolation<?>> constraintViolations = new HashSet<ConstraintViolation<?>>();
@@ -74,22 +79,30 @@ public final class ValidateMethodInterce
                 groups));
 
         if (!constraintViolations.isEmpty()) {
-            throw getException(new ConstraintViolationException("Validation error when calling method '"
-                        + method
-                        + "' with arguments "
-                        + Arrays.deepToString(arguments), constraintViolations),
-                    validate.rethrowExceptionsAs());
+            throw getException(new ConstraintViolationException(
+                    String.format("Validation error when calling method '%s' with arguments ",
+                            method,
+                            Arrays.deepToString(arguments)),
+                    constraintViolations),
+                    validate.rethrowExceptionsAs(),
+                    validate.exceptionMessage(),
+                    arguments);
         }
 
         Object returnedValue = invocation.proceed();
 
         if (validate.validateReturnedValue()) {
             constraintViolations.addAll(methodValidator.validateReturnedValue(clazz, method, returnedValue, groups));
+
             if (!constraintViolations.isEmpty()) {
-                throw getException(new ConstraintViolationException("Method '"
-                        + method
-                        + "' returned a not valid value "
-                        + returnedValue, constraintViolations), validate.rethrowExceptionsAs());
+                throw getException(new ConstraintViolationException(
+                        String.format("Method '%s' returned a not valid value ",
+                                method,
+                                returnedValue),
+                        constraintViolations),
+                        validate.rethrowExceptionsAs(),
+                        validate.exceptionMessage(),
+                        arguments);
             }
         }
 
@@ -105,7 +118,9 @@ public final class ValidateMethodInterce
      * @return the {@link Throwable} has o be thrown.
      */
     private static Throwable getException(ConstraintViolationException exception,
-            Class<? extends Throwable> exceptionWrapperClass) {
+            Class<? extends Throwable> exceptionWrapperClass,
+            String exceptionMessage,
+            Object[] arguments) {
         // check the thrown exception is of same re-throw type
         if (exceptionWrapperClass == ConstraintViolationException.class) {
             return exception;
@@ -114,16 +129,53 @@ public final class ValidateMethodInterce
         // re-throw the exception as new exception
         Throwable rethrowEx = null;
 
-        try {
-            Constructor<? extends Throwable> constructor = exceptionWrapperClass.getConstructor(Throwable.class);
-            rethrowEx = constructor.newInstance(exception);
-        } catch (Exception e) {
-            rethrowEx = new RuntimeException("Impossible to re-throw '"
-                    + exceptionWrapperClass
-                    + "', it needs the constructor with <Throwable> argument.", e);
+        String errorMessage;
+        Object[] initargs;
+        Class<?>[] initargsType;
+
+        if (exceptionMessage.length() != 0) {
+            errorMessage = String.format(exceptionMessage, arguments);
+            initargs = new Object[]{ errorMessage, exception };
+            initargsType = MESSAGE_CAUSE_TYPES;
+        } else {
+            initargs = new Object[]{ exception };
+            initargsType = CAUSE_TYPES;
+        }
+
+        Constructor<? extends Throwable> exceptionConstructor = getMatchingConstructor(exceptionWrapperClass, initargsType);
+        if (exceptionConstructor != null) {
+            try {
+                rethrowEx = exceptionConstructor.newInstance(initargs);
+            } catch (Exception e) {
+                errorMessage = String.format("Impossible to re-throw '%s', it needs the constructor with %s argument(s).",
+                        exceptionWrapperClass.getName(),
+                        Arrays.toString(initargsType));
+                rethrowEx = new RuntimeException(errorMessage, e);
+            }
+        } else {
+            errorMessage = String.format("Impossible to re-throw '%s', it needs the constructor with %s or %s argument(s).",
+                    exceptionWrapperClass.getName(),
+                    Arrays.toString(CAUSE_TYPES),
+                    Arrays.toString(MESSAGE_CAUSE_TYPES));
+            rethrowEx = new RuntimeException(errorMessage);
         }
 
         return rethrowEx;
     }
 
+    @SuppressWarnings("unchecked")
+    private static <E extends Throwable> Constructor<E> getMatchingConstructor(Class<E> type,
+            Class<?>[] argumentsType) {
+        Class<? super E> currentType = type;
+        while (Object.class != currentType) {
+            for (Constructor<?> constructor : currentType.getConstructors()) {
+                if (Arrays.equals(argumentsType, constructor.getParameterTypes())) {
+                    return (Constructor<E>) constructor;
+                }
+            }
+            currentType = currentType.getSuperclass();
+        }
+        return null;
+    }
+
 }

Modified: incubator/bval/sandbox/lang3-work/bval-guice/src/test/java/org/apache/bval/guice/DummyCountryDao.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-guice/src/test/java/org/apache/bval/guice/DummyCountryDao.java?rev=1166289&r1=1166288&r2=1166289&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-guice/src/test/java/org/apache/bval/guice/DummyCountryDao.java (original)
+++ incubator/bval/sandbox/lang3-work/bval-guice/src/test/java/org/apache/bval/guice/DummyCountryDao.java Wed Sep  7 18:11:09 2011
@@ -30,8 +30,8 @@ import javax.validation.constraints.Size
 public class DummyCountryDao {
 
     @Validate(
-            groups = { Insert.class },
-            validateReturnedValue = true
+        groups = { Insert.class },
+        validateReturnedValue = true
     )
     public Country insertCountry(@NotNull(groups = { Insert.class }) String name,
             @NotNull(groups = { Insert.class }) @Size(max = 2, groups = { Insert.class, Update.class }) String iso2Code,
@@ -44,8 +44,9 @@ public class DummyCountryDao {
     }
 
     @Validate(
-            groups = { Update.class },
-            rethrowExceptionsAs = DummyException.class
+        groups = { Update.class },
+        rethrowExceptionsAs = DummyException.class,
+        exceptionMessage = "This is just a dummy message %s"
     )
     public int updateCountry(@Valid Country country) {
         return 0;

Modified: incubator/bval/sandbox/lang3-work/bval-guice/src/test/java/org/apache/bval/guice/DummyException.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-guice/src/test/java/org/apache/bval/guice/DummyException.java?rev=1166289&r1=1166288&r2=1166289&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-guice/src/test/java/org/apache/bval/guice/DummyException.java (original)
+++ incubator/bval/sandbox/lang3-work/bval-guice/src/test/java/org/apache/bval/guice/DummyException.java Wed Sep  7 18:11:09 2011
@@ -29,4 +29,8 @@ public final class DummyException extend
         super(cause);
     }
 
+    public DummyException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
 }

Modified: incubator/bval/sandbox/lang3-work/bval-guice/src/test/java/org/apache/bval/guice/GuiceAwareValidationTestCase.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-guice/src/test/java/org/apache/bval/guice/GuiceAwareValidationTestCase.java?rev=1166289&r1=1166288&r2=1166289&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-guice/src/test/java/org/apache/bval/guice/GuiceAwareValidationTestCase.java (original)
+++ incubator/bval/sandbox/lang3-work/bval-guice/src/test/java/org/apache/bval/guice/GuiceAwareValidationTestCase.java Wed Sep  7 18:11:09 2011
@@ -88,6 +88,7 @@ public final class GuiceAwareValidationT
             fail("org.apache.bval.guice.DummyException expected");
         } catch (Exception e) {
             assertEquals(DummyException.class, e.getClass());
+            assertTrue(e.getMessage().startsWith("This is just a dummy message "));
         }
     }
 

Modified: incubator/bval/sandbox/lang3-work/bval-json/pom.xml
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-json/pom.xml?rev=1166289&r1=1166288&r2=1166289&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-json/pom.xml (original)
+++ incubator/bval/sandbox/lang3-work/bval-json/pom.xml Wed Sep  7 18:11:09 2011
@@ -70,6 +70,12 @@
             <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>

Modified: incubator/bval/sandbox/lang3-work/bval-json/src/test/java/org/apache/bval/json/JSONGeneratorTest.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-json/src/test/java/org/apache/bval/json/JSONGeneratorTest.java?rev=1166289&r1=1166288&r2=1166289&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-json/src/test/java/org/apache/bval/json/JSONGeneratorTest.java (original)
+++ incubator/bval/sandbox/lang3-work/bval-json/src/test/java/org/apache/bval/json/JSONGeneratorTest.java Wed Sep  7 18:11:09 2011
@@ -34,74 +34,71 @@ import java.util.List;
  * Author: roman.stumm<br>
  */
 public class JSONGeneratorTest extends TestCase {
-  private XMLMetaBeanManager mbm;
+    private XMLMetaBeanManager mbm;
 
-  public JSONGeneratorTest(String name) {
-    super(name);
-  }
-
-  public void setUp() throws Exception {
-    super.setUp();
-    mbm = new XMLMetaBeanManager();
-    mbm.addLoader(new XMLMetaBeanURLLoader(
-        BusinessObject.class.getResource("test-beanInfos.xml")));
-  }
-
-  public void testBeanInfosCustomPatchGenerated()
-      throws Exception {
-    MetaBean mbean = mbm.findForClass(BusinessObject.class);
-    MetaProperty mprop = mbean.getProperty("lastName");
-    assertTrue(mprop.isMandatory());
-
-    mbm.getCache().removeFromCache(mbean);
-    mbm.addLoader(new XMLMetaBeanURLLoader(
-        BusinessObject.class.getResource("test-beanInfos-custom.xml")));
-    mbean = mbm.findForClass(BusinessObject.class);
-    mprop = mbean.getProperty("lastName");
-    assertTrue(!mprop.isMandatory());
-
-    JSONGenerator converter = new JSONGenerator();
-
-    List<MetaBean> metaBeans = new ArrayList(2);
-    metaBeans.add(mbean);
-    MetaBean mbean2 = mbm.findForId("UnknownObject");
-    metaBeans.add(mbean2);
-    String json = converter.toJSON(metaBeans);
-    assertNotNull(json);
-    //System.out.println(json);
-  }
-
-  public void testJSON() throws Exception {
-    MetaBean info = mbm.findForClass(BusinessObject.class);
-    MetaBean info2 = info.getProperty("address").getMetaBean();
-
-    // empty default bean without xml backup
-    MetaBean info3 = mbm.findForClass(BusinessObjectAddress.class);
-    JSONGenerator converter = new JSONGenerator();
-
-    List<MetaBean> metaBeans = new ArrayList(2);
-    metaBeans.add(info);
-    metaBeans.add(info2);
-    metaBeans.add(info3);
-    String json = converter.toJSON(metaBeans);
-    assertNotNull(json);
-    //System.out.println(json);
-  }
-
-  public void testJSON_dynaTypeEnum() throws Exception {
-    MetaBean info = mbm.findForClass(BusinessObject.class);
-    MetaProperty choice = info.getProperty("choice");
-    choice.setType(new DynaTypeEnum(BusinessEnum.class, "CUSTOM_1", "CUSTOM_2"));
-
-    JSONGenerator converter = new JSONGenerator();
-
-    List<MetaBean> metaBeans = new ArrayList(1);
-    metaBeans.add(info);
-    String json = converter.toJSON(metaBeans);
-    assertNotNull(json);
-//        System.out.println(json);
-    assertTrue(json.indexOf("CUSTOM_1") > 0);
-    assertTrue(json.indexOf("CUSTOM_2") > 0);
-    assertTrue(json.indexOf("VALUE1") < 0);
-  }
+    public JSONGeneratorTest(String name) {
+        super(name);
+    }
+
+    public void setUp() throws Exception {
+        super.setUp();
+        mbm = new XMLMetaBeanManager();
+        mbm.addLoader(new XMLMetaBeanURLLoader(BusinessObject.class.getResource("test-beanInfos.xml")));
+    }
+
+    public void testBeanInfosCustomPatchGenerated() throws Exception {
+        MetaBean mbean = mbm.findForClass(BusinessObject.class);
+        MetaProperty mprop = mbean.getProperty("lastName");
+        assertTrue(mprop.isMandatory());
+
+        mbm.getCache().removeFromCache(mbean);
+        mbm.addLoader(new XMLMetaBeanURLLoader(BusinessObject.class.getResource("test-beanInfos-custom.xml")));
+        mbean = mbm.findForClass(BusinessObject.class);
+        mprop = mbean.getProperty("lastName");
+        assertTrue(!mprop.isMandatory());
+
+        JSONGenerator converter = new JSONGenerator();
+
+        List<MetaBean> metaBeans = new ArrayList(2);
+        metaBeans.add(mbean);
+        MetaBean mbean2 = mbm.findForId("UnknownObject");
+        metaBeans.add(mbean2);
+        String json = converter.toJSON(metaBeans);
+        assertNotNull(json);
+        // System.out.println(json);
+    }
+
+    public void testJSON() throws Exception {
+        MetaBean info = mbm.findForClass(BusinessObject.class);
+        MetaBean info2 = info.getProperty("address").getMetaBean();
+
+        // empty default bean without xml backup
+        MetaBean info3 = mbm.findForClass(BusinessObjectAddress.class);
+        JSONGenerator converter = new JSONGenerator();
+
+        List<MetaBean> metaBeans = new ArrayList(2);
+        metaBeans.add(info);
+        metaBeans.add(info2);
+        metaBeans.add(info3);
+        String json = converter.toJSON(metaBeans);
+        assertNotNull(json);
+        // System.out.println(json);
+    }
+
+    public void testJSON_dynaTypeEnum() throws Exception {
+        MetaBean info = mbm.findForClass(BusinessObject.class);
+        MetaProperty choice = info.getProperty("choice");
+        choice.setType(new DynaTypeEnum(BusinessEnum.class, "CUSTOM_1", "CUSTOM_2"));
+
+        JSONGenerator converter = new JSONGenerator();
+
+        List<MetaBean> metaBeans = new ArrayList(1);
+        metaBeans.add(info);
+        String json = converter.toJSON(metaBeans);
+        assertNotNull(json);
+        // System.out.println(json);
+        assertTrue(json.indexOf("CUSTOM_1") > 0);
+        assertTrue(json.indexOf("CUSTOM_2") > 0);
+        assertTrue(json.indexOf("VALUE1") < 0);
+    }
 }

Propchange: incubator/bval/sandbox/lang3-work/bval-json/src/test/java/org/apache/bval/json/JSONGeneratorTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/provider/pom.xml
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/provider/pom.xml?rev=1166289&r1=1166288&r2=1166289&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/provider/pom.xml (original)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/provider/pom.xml Wed Sep  7 18:11:09 2011
@@ -60,6 +60,11 @@
             <scope>test</scope>
         </dependency>
         <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>jcl-over-slf4j</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>org.apache.commons</groupId>
             <artifactId>commons-proxy2-stub</artifactId>
             <optional>true</optional>

Modified: incubator/bval/sandbox/lang3-work/bval-jsr303/pom.xml
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303/pom.xml?rev=1166289&r1=1166288&r2=1166289&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303/pom.xml (original)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303/pom.xml Wed Sep  7 18:11:09 2011
@@ -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">
 
@@ -135,6 +135,12 @@
             <scope>provided</scope>
             <optional>true</optional>
         </dependency>
+        <!-- need for testcase logging -->
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-simple</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
     <build>

Propchange: incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/
            ('svn:mergeinfo' removed)

Modified: incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/ApacheFactoryContext.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/ApacheFactoryContext.java?rev=1166289&r1=1166288&r2=1166289&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/ApacheFactoryContext.java (original)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/ApacheFactoryContext.java Wed Sep  7 18:11:09 2011
@@ -71,6 +71,9 @@ public class ApacheFactoryContext implem
      * 
      * @param factory
      * @param metaBeanFinder
+     * @deprecated does anyone need this?  If the default {@link ApacheFactoryContext}
+     * uses a {@link Jsr303MetaBeanFactory}, which circularly refers to its owning {@link ApacheFactoryContext},
+     * it follows that this constructor can't be conveniently used with a {@link Jsr303MetaBeanFactory}.
      */
     protected ApacheFactoryContext(ApacheValidatorFactory factory, MetaBeanFinder metaBeanFinder) {
         this.factory = factory;
@@ -179,7 +182,6 @@ public class ApacheFactoryContext implem
      * 
      * @return a new instance of MetaBeanManager with adequate MetaBeanFactories
      */
-    @SuppressWarnings("deprecation")
     protected MetaBeanFinder buildMetaBeanFinder() {
         List<MetaBeanFactory> builders = new ArrayList<MetaBeanFactory>();
         if (Boolean.parseBoolean(factory.getProperties().get(
@@ -225,6 +227,11 @@ public class ApacheFactoryContext implem
             ApacheValidatorConfiguration.Properties.ENABLE_METABEANS_XML))) {
             return XMLMetaBeanManagerCreator.createXMLMetaBeanManager(builders);
         }
+        // as long as we support both: jsr303 (in the builders list) and xstream-xml metabeans:
+        if (Boolean.parseBoolean(factory.getProperties().get(
+            ApacheValidatorConfiguration.Properties.ENABLE_METABEANS_XML))) {
+            return XMLMetaBeanManagerCreator.createXMLMetaBeanManager(builders);
+        }
         return new MetaBeanManager(new MetaBeanBuilder(builders.toArray(new MetaBeanFactory[builders.size()])));
     }
 

Modified: incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/ApacheValidatorFactory.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/ApacheValidatorFactory.java?rev=1166289&r1=1166288&r2=1166289&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/ApacheValidatorFactory.java (original)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/ApacheValidatorFactory.java Wed Sep  7 18:11:09 2011
@@ -313,7 +313,8 @@ public class ApacheValidatorFactory impl
      * Mark a property of <code>beanClass</code> for nested validation.
      *
      * @param beanClass
-     * @param accessStrategy defining the property to validate
+     * @param accessStrategy
+     *            defining the property to validate
      */
     public void addValid(Class<?> beanClass, AccessStrategy accessStrategy) {
         List<AccessStrategy> slot = validAccesses.get(beanClass);

Propchange: incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/AppendValidationToBuilder.java
            ('svn:mergeinfo' removed)

Propchange: incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/BaseAppendValidation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/BeanDescriptorImpl.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/BeanDescriptorImpl.java?rev=1166289&r1=1166288&r2=1166289&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/BeanDescriptorImpl.java (original)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/BeanDescriptorImpl.java Wed Sep  7 18:11:09 2011
@@ -87,6 +87,15 @@ public class BeanDescriptorImpl extends 
      * 
      * @param propertyName
      *            property evaluated
+=======
+     * Return the property level constraints for a given propertyName or null if
+     * either the property does not exist or has no constraint The returned
+     * object (and associated objects including ConstraintDescriptors) are
+     * immutable.
+     * 
+     * @param propertyName
+     *            property evaluated
+>>>>>>> .merge-right.r997084
      */
     public PropertyDescriptor getConstraintsForProperty(String propertyName) {
         if (propertyName == null || propertyName.trim().length() == 0) {

Modified: incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/ClassValidator.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/ClassValidator.java?rev=1166289&r1=1166288&r2=1166289&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/ClassValidator.java (original)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/ClassValidator.java Wed Sep  7 18:11:09 2011
@@ -428,6 +428,8 @@ public class ClassValidator implements C
             // save old values from context
             final Object bean = context.getBean();
             final MetaBean mbean = context.getMetaBean();
+            // TODO implement Validation.groups support on related bean
+//            Class[] groups = prop.getFeature(Jsr303Features.Property.REF_GROUPS);
             for (AccessStrategy each : access) {
                 if (isCascadable(context, prop, each)) {
                     // modify context state for relationship-target bean

Propchange: incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintDescriptorImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintValidation.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintValidation.java?rev=1166289&r1=1166288&r2=1166289&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintValidation.java (original)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintValidation.java Wed Sep  7 18:11:09 2011
@@ -171,12 +171,11 @@ public class ConstraintValidation<T exte
             ConstraintValidationListener<?> listener = context.getListener();
             listener.beginReportAsSingle();
 
-            boolean failed = false;
+            boolean failed = listener.hasViolations();
             try {
                 // stop validating when already failed and
                 // ReportAsSingleInvalidConstraint = true ?
-                for (Iterator<ConstraintValidation<?>> composed = getComposingValidations().iterator(); !failed
-                    && composed.hasNext();) {
+                for (Iterator<ConstraintValidation<?>> composed = getComposingValidations().iterator(); !failed && composed.hasNext();) {
                     composed.next().validate(context);
                     failed = listener.hasViolations();
                 }

Propchange: incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintValidation.java
            ('svn:mergeinfo' removed)

Propchange: incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintValidationListener.java
            ('svn:mergeinfo' removed)

Propchange: incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintValidatorIdentity.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/ElementDescriptorImpl.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/ElementDescriptorImpl.java?rev=1166289&r1=1166288&r2=1166289&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/ElementDescriptorImpl.java (original)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/ElementDescriptorImpl.java Wed Sep  7 18:11:09 2011
@@ -22,6 +22,7 @@ import org.apache.bval.model.Validation;
 import javax.validation.metadata.ConstraintDescriptor;
 import javax.validation.metadata.ElementDescriptor;
 import java.util.Collections;
+import java.util.Collections;
 import java.util.HashSet;
 import java.util.Set;
 

Propchange: incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/GraphBeanIdentity.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/Jsr303Features.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/Jsr303Features.java?rev=1166289&r1=1166288&r2=1166289&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/Jsr303Features.java (original)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/Jsr303Features.java Wed Sep  7 18:11:09 2011
@@ -34,6 +34,10 @@ public interface Jsr303Features {
     interface Property extends Features.Property {
         /** INFO: cached PropertyDescriptorImpl of the property */
         String PropertyDescriptor = "PropertyDescriptor";
+        /**
+         * INFO: Class[] with the groups to validate a REF_CASCADE
+         */
+        String REF_GROUPS = "refGroups";
     }
 
     /**
@@ -46,8 +50,8 @@ public interface Jsr303Features {
          **/
         String GROUP_SEQUENCE = "GroupSequence";
 
-        /** INFO: cached sortied Array with ValidationEntries */
-        String VALIDATION_SEQUENCE = "ValidationSequence";
+//        INFO: cached sorted Array with ValidationEntries 
+//        String VALIDATION_SEQUENCE = "ValidationSequence";
 
         /**
          * INFO: cached BeanDescriptorImpl of the bean

Modified: incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/Jsr303MetaBeanFactory.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/Jsr303MetaBeanFactory.java?rev=1166289&r1=1166288&r2=1166289&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/Jsr303MetaBeanFactory.java (original)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/Jsr303MetaBeanFactory.java Wed Sep  7 18:11:09 2011
@@ -34,6 +34,7 @@ import javax.validation.ValidationExcept
 import javax.validation.groups.Default;
 
 import org.apache.bval.MetaBeanFactory;
+import org.apache.bval.Validate;
 import org.apache.bval.jsr303.groups.Group;
 import org.apache.bval.jsr303.util.ClassHelper;
 import org.apache.bval.jsr303.util.SecureActions;
@@ -55,6 +56,10 @@ public class Jsr303MetaBeanFactory imple
     // of dubious utility as it's static :/
     protected static final Logger log = LoggerFactory.getLogger(Jsr303MetaBeanFactory.class);
 
+    public static final String ANNOTATION_PAYLOAD = "payload";
+    public static final String ANNOTATION_GROUPS = "groups";
+    public static final String ANNOTATION_MESSAGE = "message";
+
     /** {@link ApacheFactoryContext} used */
     protected final ApacheFactoryContext factoryContext;
 

Propchange: incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/UnknownPropertyException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/extensions/MethodValidatorMetaBeanFactory.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/extensions/MethodValidatorMetaBeanFactory.java?rev=1166289&r1=1166288&r2=1166289&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/extensions/MethodValidatorMetaBeanFactory.java (original)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/extensions/MethodValidatorMetaBeanFactory.java Wed Sep  7 18:11:09 2011
@@ -16,6 +16,7 @@
  */
 package org.apache.bval.jsr303.extensions;
 
+import org.apache.bval.Validate;
 import org.apache.bval.jsr303.ApacheFactoryContext;
 import org.apache.bval.jsr303.AppendValidation;
 import org.apache.bval.jsr303.ConstraintAnnotationAttributes;
@@ -106,7 +107,7 @@ public class MethodValidatorMetaBeanFact
                 AppendValidationToList validations = new AppendValidationToList();
                 ReturnAccess returnAccess = new ReturnAccess(method.getReturnType());
                 for (Annotation anno : method.getAnnotations()) {
-                    if (anno instanceof Valid) {
+                    if (anno instanceof Valid || anno instanceof Validate) {
                         methodDesc.setCascaded(true);
                     } else {
                         processAnnotation(anno, methodDesc, returnAccess, validations);
@@ -131,7 +132,7 @@ public class MethodValidatorMetaBeanFact
         AppendValidationToList validations = new AppendValidationToList();
         boolean cascaded = false;
         for (Annotation anno : paramAnnos) {
-            if (anno instanceof Valid) {
+            if (anno instanceof Valid || anno instanceof Validate) {
                 cascaded = true;
             } else {
                 processAnnotation(anno, methodDesc, access, validations);
@@ -148,7 +149,7 @@ public class MethodValidatorMetaBeanFact
     private <A extends Annotation> void processAnnotation(A annotation, ProcedureDescriptor desc,
         AccessStrategy access, AppendValidation validations) throws InvocationTargetException, IllegalAccessException {
 
-        if (annotation instanceof Valid) {
+        if (annotation instanceof Valid || annotation instanceof Validate) {
             desc.setCascaded(true);
         } else {
             Constraint vcAnno = annotation.annotationType().getAnnotation(Constraint.class);

Propchange: incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/extensions/ParameterAccess.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/extensions/ReturnAccess.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/ClassHelper.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/ClassHelper.java?rev=1166289&r1=1166288&r2=1166289&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/ClassHelper.java (original)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/ClassHelper.java Wed Sep  7 18:11:09 2011
@@ -18,6 +18,8 @@
  */
 package org.apache.bval.jsr303.util;
 
+import org.apache.commons.lang3.ClassUtils;
+
 import java.security.AccessController;
 import java.util.List;
 
@@ -55,4 +57,26 @@ public class ClassHelper {
         }
     }
 
+    /**
+     * @deprecated Will be removed for security reasons.
+     *
+     * Perform ClassUtils.getClass functions with Java 2 Security enabled.
+     */
+    @Deprecated
+    public static Class<?> getClass(String className) throws ClassNotFoundException {
+        return getClass(className, true);
+    }
+
+    /**
+     * @deprecated Will be removed for security reasons.
+     *
+     * Perform ClassUtils.getClass functions with Java 2 Security enabled.
+     */
+    @Deprecated
+    public static Class<?> getClass(String className, boolean initialize) throws ClassNotFoundException {
+        ClassLoader loader = Thread.currentThread().getContextClassLoader();
+        if (loader == null)
+          loader = ClassHelper.class.getClassLoader();
+        return ClassUtils.getClass(loader, className, initialize);
+    }
 }

Propchange: incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/ClassHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/ConstraintDefinitionValidator.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/ConstraintDefinitionValidator.java?rev=1166289&r1=1166288&r2=1166289&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/ConstraintDefinitionValidator.java (original)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/ConstraintDefinitionValidator.java Wed Sep  7 18:11:09 2011
@@ -18,6 +18,8 @@
  */
 package org.apache.bval.jsr303.util;
 
+import org.apache.bval.jsr303.Jsr303MetaBeanFactory;
+
 import javax.validation.Constraint;
 import javax.validation.ConstraintDefinitionException;
 

Propchange: incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/ConstraintDefinitionValidator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/xml/AnnotationProxyBuilder.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/xml/AnnotationProxyBuilder.java?rev=1166289&r1=1166288&r2=1166289&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/xml/AnnotationProxyBuilder.java (original)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/xml/AnnotationProxyBuilder.java Wed Sep  7 18:11:09 2011
@@ -176,7 +176,7 @@ final public class AnnotationProxyBuilde
      * @return {@link Annotation}
      */
     public A createAnnotation() {
-        ClassLoader classLoader = SecureActions.getClassLoader(getClass());
+        ClassLoader classLoader = SecureActions.getClassLoader(getType());
         @SuppressWarnings("unchecked")
         final Class<A> proxyClass = (Class<A>) Proxy.getProxyClass(classLoader, getType());
         final InvocationHandler handler = new AnnotationProxy(this);

Propchange: incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/xml/ValidationMappingParser.java
            ('svn:mergeinfo' removed)

Propchange: incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/resources/org/apache/bval/jsr303/ValidationMessages_en.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/bval/sandbox/lang3-work/bval-jsr303/src/test/java/org/apache/bval/constraints/DecimalMinMaxValidatorsTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/bval/sandbox/lang3-work/bval-jsr303/src/test/java/org/apache/bval/constraints/MinMaxValidatorsForNumberTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message