You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by lu...@apache.org on 2017/06/22 06:40:54 UTC

[1/2] struts git commit: WW-4744 WW-4694 Removes annotation search to commons lang 3.6

Repository: struts
Updated Branches:
  refs/heads/master fa20b71fc -> 8f53b6f59


WW-4744 WW-4694 Removes annotation search to commons lang 3.6


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

Branch: refs/heads/master
Commit: 33e1eeb386c98beeaeff51504a2ff156098f2c01
Parents: 4c386c6
Author: Yasser Zamani <ya...@live.com>
Authored: Wed Jun 21 13:28:45 2017 +0430
Committer: Yasser Zamani <ya...@live.com>
Committed: Wed Jun 21 13:28:45 2017 +0430

----------------------------------------------------------------------
 .../interceptor/DefaultWorkflowInterceptor.java |   5 +-
 .../AnnotationWorkflowInterceptor.java          |  25 ++--
 .../xwork2/util/AnnotationUtils.java            | 113 -------------------
 .../apache/struts2/components/Component.java    |   5 +-
 .../AnnotationValidationInterceptor.java        |   4 +-
 .../xwork2/util/AnnotationUtilsTest.java        |  53 ---------
 .../xwork2/util/annotation/DummyClass.java      |  10 +-
 .../xwork2/util/annotation/DummyClassExt.java   |   4 -
 .../xwork2/util/annotation/DummyInterface.java  |   6 -
 .../xwork2/util/annotation/MyAnnotationI.java   |   8 --
 .../interceptor/BeanValidationInterceptor.java  |   5 +-
 pom.xml                                         |   2 +-
 12 files changed, 27 insertions(+), 213 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/33e1eeb3/core/src/main/java/com/opensymphony/xwork2/interceptor/DefaultWorkflowInterceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/DefaultWorkflowInterceptor.java b/core/src/main/java/com/opensymphony/xwork2/interceptor/DefaultWorkflowInterceptor.java
index f9bcbd8..d88d6f8 100644
--- a/core/src/main/java/com/opensymphony/xwork2/interceptor/DefaultWorkflowInterceptor.java
+++ b/core/src/main/java/com/opensymphony/xwork2/interceptor/DefaultWorkflowInterceptor.java
@@ -22,8 +22,6 @@ import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.reflect.MethodUtils;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
-import com.opensymphony.xwork2.util.AnnotationUtils;
-import java.lang.reflect.Method;
 
 /**
  * <!-- START SNIPPET: description -->
@@ -208,7 +206,8 @@ public class DefaultWorkflowInterceptor extends MethodFilterInterceptor {
      */
     protected String processInputConfig(final Object action, final String method, final String currentResultName) throws Exception {
         String resultName = currentResultName;
-        InputConfig annotation = AnnotationUtils.findAnnotation(action.getClass().getMethod(method, EMPTY_CLASS_ARRAY), InputConfig.class);
+        InputConfig annotation = MethodUtils.getAnnotation(action.getClass().getMethod(method, EMPTY_CLASS_ARRAY),
+                InputConfig.class ,true,true);
         if (annotation != null) {
             if (StringUtils.isNotEmpty(annotation.methodName())) {
                 resultName = (String) MethodUtils.invokeMethod(action, true, annotation.methodName());

http://git-wip-us.apache.org/repos/asf/struts/blob/33e1eeb3/core/src/main/java/com/opensymphony/xwork2/interceptor/annotations/AnnotationWorkflowInterceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/annotations/AnnotationWorkflowInterceptor.java b/core/src/main/java/com/opensymphony/xwork2/interceptor/annotations/AnnotationWorkflowInterceptor.java
index 38e3503..36faa09 100644
--- a/core/src/main/java/com/opensymphony/xwork2/interceptor/annotations/AnnotationWorkflowInterceptor.java
+++ b/core/src/main/java/com/opensymphony/xwork2/interceptor/annotations/AnnotationWorkflowInterceptor.java
@@ -19,7 +19,6 @@ import com.opensymphony.xwork2.ActionInvocation;
 import com.opensymphony.xwork2.XWorkException;
 import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
 import com.opensymphony.xwork2.interceptor.PreResultListener;
-import com.opensymphony.xwork2.util.AnnotationUtils;
 import org.apache.commons.lang3.reflect.MethodUtils;
 
 import java.lang.reflect.Method;
@@ -113,13 +112,15 @@ public class AnnotationWorkflowInterceptor extends AbstractInterceptor implement
     public String intercept(ActionInvocation invocation) throws Exception {
         final Object action = invocation.getAction();
         invocation.addPreResultListener(this);
-        List<Method> methods = new ArrayList<>(AnnotationUtils.getAnnotatedMethods(action.getClass(), Before.class));
+        List<Method> methods = new ArrayList<>(MethodUtils.getMethodsListWithAnnotation(action.getClass(), Before.class,
+                true, true));
         if (methods.size() > 0) {
             // methods are only sorted by priority
             Collections.sort(methods, new Comparator<Method>() {
                 public int compare(Method method1, Method method2) {
-                    return comparePriorities(AnnotationUtils.findAnnotation(method1, Before.class).priority(),
-                            AnnotationUtils.findAnnotation(method2, Before.class).priority());
+                    return comparePriorities(MethodUtils.getAnnotation(method1, Before.class, true,
+                            true).priority(), MethodUtils.getAnnotation(method2, Before.class, true,
+                            true).priority());
                 }
             });
             for (Method m : methods) {
@@ -134,14 +135,16 @@ public class AnnotationWorkflowInterceptor extends AbstractInterceptor implement
         String invocationResult = invocation.invoke();
 
         // invoke any @After methods
-        methods = new ArrayList<Method>(AnnotationUtils.getAnnotatedMethods(action.getClass(), After.class));
+        methods = new ArrayList<Method>(MethodUtils.getMethodsListWithAnnotation(action.getClass(), After.class,
+                true, true));
 
         if (methods.size() > 0) {
             // methods are only sorted by priority
             Collections.sort(methods, new Comparator<Method>() {
                 public int compare(Method method1, Method method2) {
-                    return comparePriorities(AnnotationUtils.findAnnotation(method1, After.class).priority(),
-                            AnnotationUtils.findAnnotation(method2, After.class).priority());
+                    return comparePriorities(MethodUtils.getAnnotation(method1, After.class, true,
+                            true).priority(), MethodUtils.getAnnotation(method2, After.class, true,
+                            true).priority());
                 }
             });
             for (Method m : methods) {
@@ -169,14 +172,16 @@ public class AnnotationWorkflowInterceptor extends AbstractInterceptor implement
      */
     public void beforeResult(ActionInvocation invocation, String resultCode) {
         Object action = invocation.getAction();
-        List<Method> methods = new ArrayList<Method>(AnnotationUtils.getAnnotatedMethods(action.getClass(), BeforeResult.class));
+        List<Method> methods = new ArrayList<Method>(MethodUtils.getMethodsListWithAnnotation(action.getClass(),
+                BeforeResult.class, true, true));
 
         if (methods.size() > 0) {
             // methods are only sorted by priority
             Collections.sort(methods, new Comparator<Method>() {
                 public int compare(Method method1, Method method2) {
-                    return comparePriorities(AnnotationUtils.findAnnotation(method1, BeforeResult.class).priority(),
-                            AnnotationUtils.findAnnotation(method2, BeforeResult.class).priority());
+                    return comparePriorities(MethodUtils.getAnnotation(method1, BeforeResult.class, true,
+                            true).priority(), MethodUtils.getAnnotation(method2, BeforeResult.class,
+                            true, true).priority());
                 }
             });
             for (Method m : methods) {

http://git-wip-us.apache.org/repos/asf/struts/blob/33e1eeb3/core/src/main/java/com/opensymphony/xwork2/util/AnnotationUtils.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/util/AnnotationUtils.java b/core/src/main/java/com/opensymphony/xwork2/util/AnnotationUtils.java
index e0af7a5..eb8570f 100644
--- a/core/src/main/java/com/opensymphony/xwork2/util/AnnotationUtils.java
+++ b/core/src/main/java/com/opensymphony/xwork2/util/AnnotationUtils.java
@@ -15,16 +15,10 @@
  */
 package com.opensymphony.xwork2.util;
 
-import org.apache.commons.lang3.ArrayUtils;
-import org.apache.commons.lang3.ClassUtils;
-
 import java.lang.annotation.Annotation;
-import java.lang.reflect.AnnotatedElement;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
-import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collection;
 import java.util.List;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -108,113 +102,6 @@ public class AnnotationUtils {
     }
 
     /**
-     * For the given <code>Class</code> get a collection of the the {@link AnnotatedElement}s
-     * that match the given <code>annotation</code>s or if no <code>annotation</code>s are
-     * specified then return all of the annotated elements of the given <code>Class</code>.
-     * Includes only the method level annotations.
-     *
-     * @param clazz      The {@link Class} to inspect
-     * @param annotation the {@link Annotation}s to find
-     * @return A {@link Collection}&lt;{@link AnnotatedElement}&gt; containing all of the
-     * method {@link AnnotatedElement}s matching the specified {@link Annotation}s
-     * @deprecated Will be removed after release of <a href="https://github.com/apache/commons-lang/pull/261">LANG-1317</a>
-     */
-    @Deprecated
-    public static Collection<Method> getAnnotatedMethods(Class clazz, Class<? extends Annotation>... annotation) {
-        List<Class<?>> allSuperclasses = ClassUtils.getAllSuperclasses(clazz);
-        allSuperclasses.add(0, clazz);
-        int sci = 0;
-        List<Class<?>> allInterfaces = ClassUtils.getAllInterfaces(clazz);
-        int ifi = 0;
-        final List<Method> annotatedMethods = new ArrayList<>();
-        while (ifi < allInterfaces.size() ||
-                sci < allSuperclasses.size()) {
-            Class<?> acls;
-            if (ifi >= allInterfaces.size()) {
-                acls = allSuperclasses.get(sci++);
-            }
-            else if (sci >= allSuperclasses.size()) {
-                acls = allInterfaces.get(ifi++);
-            }
-            else if (sci <= ifi) {
-                acls = allSuperclasses.get(sci++);
-            }
-            else {
-                acls = allInterfaces.get(ifi++);
-            }
-            final Method[] allMethods = acls.getDeclaredMethods();
-            for (final Method method : allMethods) {
-                if (ArrayUtils.isEmpty(annotation) && ArrayUtils.isNotEmpty(method.getAnnotations())) {
-                    annotatedMethods.add(method);
-                    continue;
-                }
-                for (Class<? extends Annotation> c : annotation) {
-                    if (method.getAnnotation(c) != null) {
-                        annotatedMethods.add(method);
-                    }
-                }
-            }
-        }
-
-        return annotatedMethods;
-    }
-
-    /**
-     * <p>BFS to find the annotation object that is present on the given method or any equivalent method in
-     * super classes and interfaces, with the given annotation type. Returns null if the annotation type was not present
-     * on any of them.</p>
-     * @param <A>
-     *            the annotation type
-     * @param method
-     *            the {@link Method} to query
-     * @param annotationCls
-     *            the {@link Annotation} to check if is present on the method
-     * @return an Annotation (possibly null).
-     * @deprecated Will be removed after release of <a href="https://github.com/apache/commons-lang/pull/261">LANG-1317</a>
-     */
-    @Deprecated
-    public static <A extends Annotation> A findAnnotation(final Method method, final Class<A> annotationCls) {
-        A annotation = method.getAnnotation(annotationCls);
-
-        if(annotation == null) {
-            Class<?> mcls = method.getDeclaringClass();
-            List<Class<?>> allSuperclasses = ClassUtils.getAllSuperclasses(mcls);
-            int sci = 0;
-            List<Class<?>> allInterfaces = ClassUtils.getAllInterfaces(mcls);
-            int ifi = 0;
-            while (ifi < allInterfaces.size() ||
-                    sci < allSuperclasses.size()) {
-                Class<?> acls;
-                if(ifi >= allInterfaces.size()) {
-                    acls = allSuperclasses.get(sci++);
-                }
-                else if(sci >= allSuperclasses.size()) {
-                    acls = allInterfaces.get(ifi++);
-                }
-                else if(ifi <= sci) {
-                    acls = allInterfaces.get(ifi++);
-                }
-                else {
-                    acls = allSuperclasses.get(sci++);
-                }
-                Method equivalentMethod = null;
-                try {
-                    equivalentMethod = acls.getDeclaredMethod(method.getName(), method.getParameterTypes());
-                } catch (NoSuchMethodException e) {
-                    // If not found, just keep on breadth first search
-                }
-                if(equivalentMethod != null) {
-                    annotation = equivalentMethod.getAnnotation(annotationCls);
-                    if(annotation != null) {
-                        break;
-                    }
-                }
-            }
-        }
-        return annotation;
-    }
-
-    /**
      * Returns the property name for a method.
      * This method is independent from property fields.
      *

http://git-wip-us.apache.org/repos/asf/struts/blob/33e1eeb3/core/src/main/java/org/apache/struts2/components/Component.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/components/Component.java b/core/src/main/java/org/apache/struts2/components/Component.java
index 2505fd2..971cd53 100644
--- a/core/src/main/java/org/apache/struts2/components/Component.java
+++ b/core/src/main/java/org/apache/struts2/components/Component.java
@@ -22,10 +22,10 @@
 package org.apache.struts2.components;
 
 import com.opensymphony.xwork2.inject.Inject;
-import com.opensymphony.xwork2.util.AnnotationUtils;
 import com.opensymphony.xwork2.util.TextParseUtil;
 import com.opensymphony.xwork2.util.ValueStack;
 import org.apache.commons.lang3.BooleanUtils;
+import org.apache.commons.lang3.reflect.MethodUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
@@ -543,7 +543,8 @@ public class Component {
         Class clz = getClass();
         Collection<String> standardAttributes = standardAttributesMap.get(clz);
         if (standardAttributes == null) {
-            Collection<Method> methods = AnnotationUtils.getAnnotatedMethods(clz, StrutsTagAttribute.class);
+            Collection<Method> methods = MethodUtils.getMethodsListWithAnnotation(clz, StrutsTagAttribute.class,
+                    true, true);
             standardAttributes = new HashSet<>(methods.size());
             for(Method m : methods) {
                 standardAttributes.add(StringUtils.uncapitalize(m.getName().substring(3)));

http://git-wip-us.apache.org/repos/asf/struts/blob/33e1eeb3/core/src/main/java/org/apache/struts2/interceptor/validation/AnnotationValidationInterceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/interceptor/validation/AnnotationValidationInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/validation/AnnotationValidationInterceptor.java
index b9ba26c..d0b56aa 100644
--- a/core/src/main/java/org/apache/struts2/interceptor/validation/AnnotationValidationInterceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/validation/AnnotationValidationInterceptor.java
@@ -23,8 +23,8 @@ package org.apache.struts2.interceptor.validation;
 
 import com.opensymphony.xwork2.ActionInvocation;
 import com.opensymphony.xwork2.config.ConfigurationException;
-import com.opensymphony.xwork2.util.AnnotationUtils;
 import com.opensymphony.xwork2.validator.ValidationInterceptor;
+import org.apache.commons.lang3.reflect.MethodUtils;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 
@@ -44,7 +44,7 @@ public class AnnotationValidationInterceptor extends ValidationInterceptor {
         if (action != null) {
             Method method = getActionMethod(action.getClass(), invocation.getProxy().getMethod());
 
-            if (null != AnnotationUtils.findAnnotation(method, SkipValidation.class)) {
+            if (null != MethodUtils.getAnnotation(method, SkipValidation.class, true, true)) {
                 return invocation.invoke();
             }
         }

http://git-wip-us.apache.org/repos/asf/struts/blob/33e1eeb3/core/src/test/java/com/opensymphony/xwork2/util/AnnotationUtilsTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/util/AnnotationUtilsTest.java b/core/src/test/java/com/opensymphony/xwork2/util/AnnotationUtilsTest.java
index 1b6e0d5..872f670 100644
--- a/core/src/test/java/com/opensymphony/xwork2/util/AnnotationUtilsTest.java
+++ b/core/src/test/java/com/opensymphony/xwork2/util/AnnotationUtilsTest.java
@@ -2,68 +2,15 @@ package com.opensymphony.xwork2.util;
 
 import com.opensymphony.xwork2.util.annotation.Dummy2Class;
 import com.opensymphony.xwork2.util.annotation.DummyClass;
-import com.opensymphony.xwork2.util.annotation.DummyClassExt;
-import com.opensymphony.xwork2.util.annotation.DummyInterface;
 import com.opensymphony.xwork2.util.annotation.MyAnnotation;
-import com.opensymphony.xwork2.util.annotation.MyAnnotation2;
-import com.opensymphony.xwork2.util.annotation.MyAnnotationI;
 
 import junit.framework.TestCase;
 
-import java.lang.reflect.AnnotatedElement;
-import java.util.Collection;
-
 /**
  * @author Dan Oxlade, dan d0t oxlade at gmail d0t c0m
  */
 public class AnnotationUtilsTest extends TestCase {
 
-    public void testFindAnnotationFromSuperclass() throws Exception {
-        assertNotNull(AnnotationUtils.findAnnotation(DummyClassExt.class.getMethod("methodWithAnnotation"), MyAnnotation.class));
-    }
-
-    public void testFindAnnotationFromInterface() throws Exception {
-        assertNotNull(AnnotationUtils.findAnnotation(DummyClass.class.getMethod("interfaceMethodWithAnnotation"), MyAnnotationI.class));
-    }
-
-    public void testFindAnnotation() throws Exception {
-        assertNotNull(AnnotationUtils.findAnnotation(DummyClassExt.class.getMethod("anotherAnnotatedMethod"), MyAnnotation2.class));
-    }
-
-    @SuppressWarnings("unchecked")
-    public void testGetAnnotatedMethodsIncludingSuperclassAndInterface() throws Exception {
-
-        Collection<? extends AnnotatedElement> ans = AnnotationUtils.getAnnotatedMethods(DummyClassExt.class, Deprecated.class, MyAnnotation.class, MyAnnotation2.class, MyAnnotationI.class);
-        assertEquals(4, ans.size());
-    }
-
-    @SuppressWarnings("unchecked")
-    public void testGetAnnotatedMethodsWithoutAnnotationArgs() throws Exception {
-        Collection<? extends AnnotatedElement> ans = AnnotationUtils.getAnnotatedMethods(DummyClass.class);
-        assertEquals(3, ans.size());
-        assertTrue(ans.contains(DummyClass.class.getMethod("methodWithAnnotation")));
-        assertTrue(ans.contains(DummyClass.class.getDeclaredMethod("privateMethodWithAnnotation")));
-        assertTrue(ans.contains(DummyInterface.class.getDeclaredMethod("interfaceMethodWithAnnotation")));
-    }
-
-    @SuppressWarnings("unchecked")
-    public void testGetAnnotatedMethodsWithAnnotationArgs() throws Exception {
-        Collection<? extends AnnotatedElement> ans = AnnotationUtils.getAnnotatedMethods(DummyClass.class, Deprecated.class);
-        assertTrue(ans.isEmpty());
-
-        ans = AnnotationUtils.getAnnotatedMethods(DummyClass.class, Deprecated.class, MyAnnotation.class);
-        assertEquals(1, ans.size());
-
-        ans = AnnotationUtils.getAnnotatedMethods(DummyClass.class, MyAnnotation.class);
-        assertEquals(1, ans.size());
-
-        ans = AnnotationUtils.getAnnotatedMethods(DummyClass.class, MyAnnotation.class, MyAnnotation2.class);
-        assertEquals(2, ans.size());
-
-        ans = AnnotationUtils.getAnnotatedMethods(DummyClassExt.class, MyAnnotation.class, MyAnnotation2.class);
-        assertEquals(3, ans.size());
-    }
-
     public void testFindAnnotationOnClass() {
         MyAnnotation a1 = AnnotationUtils.findAnnotation(DummyClass.class, MyAnnotation.class);
         assertNotNull(a1);

http://git-wip-us.apache.org/repos/asf/struts/blob/33e1eeb3/core/src/test/java/com/opensymphony/xwork2/util/annotation/DummyClass.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/util/annotation/DummyClass.java b/core/src/test/java/com/opensymphony/xwork2/util/annotation/DummyClass.java
index f6a4be1..8332a88 100644
--- a/core/src/test/java/com/opensymphony/xwork2/util/annotation/DummyClass.java
+++ b/core/src/test/java/com/opensymphony/xwork2/util/annotation/DummyClass.java
@@ -1,7 +1,7 @@
 package com.opensymphony.xwork2.util.annotation;
 
 @MyAnnotation("class-test")
-public class DummyClass implements DummyInterface {
+public class DummyClass {
 
     public DummyClass() {
     }
@@ -9,12 +9,4 @@ public class DummyClass implements DummyInterface {
     @MyAnnotation("method-test")
     public void methodWithAnnotation() {
     }
-
-	@Override
-	public void interfaceMethodWithAnnotation() {
-	}
-
-	@MyAnnotation2
-    private void privateMethodWithAnnotation() {
-    }
 }

http://git-wip-us.apache.org/repos/asf/struts/blob/33e1eeb3/core/src/test/java/com/opensymphony/xwork2/util/annotation/DummyClassExt.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/util/annotation/DummyClassExt.java b/core/src/test/java/com/opensymphony/xwork2/util/annotation/DummyClassExt.java
index 7c024f6..ec8ca44 100644
--- a/core/src/test/java/com/opensymphony/xwork2/util/annotation/DummyClassExt.java
+++ b/core/src/test/java/com/opensymphony/xwork2/util/annotation/DummyClassExt.java
@@ -5,8 +5,4 @@ public final class DummyClassExt extends DummyClass {
     @MyAnnotation2
     public void anotherAnnotatedMethod() {
     }
-    
-	@Override
-	public void methodWithAnnotation() {
-	}
 }

http://git-wip-us.apache.org/repos/asf/struts/blob/33e1eeb3/core/src/test/java/com/opensymphony/xwork2/util/annotation/DummyInterface.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/util/annotation/DummyInterface.java b/core/src/test/java/com/opensymphony/xwork2/util/annotation/DummyInterface.java
deleted file mode 100644
index 4d5f908..0000000
--- a/core/src/test/java/com/opensymphony/xwork2/util/annotation/DummyInterface.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package com.opensymphony.xwork2.util.annotation;
-
-public interface DummyInterface {
-    @MyAnnotationI
-    void interfaceMethodWithAnnotation();
-}

http://git-wip-us.apache.org/repos/asf/struts/blob/33e1eeb3/core/src/test/java/com/opensymphony/xwork2/util/annotation/MyAnnotationI.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/util/annotation/MyAnnotationI.java b/core/src/test/java/com/opensymphony/xwork2/util/annotation/MyAnnotationI.java
deleted file mode 100644
index ea866b9..0000000
--- a/core/src/test/java/com/opensymphony/xwork2/util/annotation/MyAnnotationI.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package com.opensymphony.xwork2.util.annotation;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-@Retention(RetentionPolicy.RUNTIME)
-public @interface MyAnnotationI {
-}

http://git-wip-us.apache.org/repos/asf/struts/blob/33e1eeb3/plugins/bean-validation/src/main/java/org/apache/struts/beanvalidation/validation/interceptor/BeanValidationInterceptor.java
----------------------------------------------------------------------
diff --git a/plugins/bean-validation/src/main/java/org/apache/struts/beanvalidation/validation/interceptor/BeanValidationInterceptor.java b/plugins/bean-validation/src/main/java/org/apache/struts/beanvalidation/validation/interceptor/BeanValidationInterceptor.java
index a20d134..be7a0c9 100644
--- a/plugins/bean-validation/src/main/java/org/apache/struts/beanvalidation/validation/interceptor/BeanValidationInterceptor.java
+++ b/plugins/bean-validation/src/main/java/org/apache/struts/beanvalidation/validation/interceptor/BeanValidationInterceptor.java
@@ -26,10 +26,10 @@ import com.opensymphony.xwork2.ModelDriven;
 import com.opensymphony.xwork2.TextProviderFactory;
 import com.opensymphony.xwork2.inject.Inject;
 import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;
-import com.opensymphony.xwork2.util.AnnotationUtils;
 import com.opensymphony.xwork2.validator.DelegatingValidatorContext;
 import com.opensymphony.xwork2.validator.ValidatorContext;
 import org.apache.commons.lang3.BooleanUtils;
+import org.apache.commons.lang3.reflect.MethodUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
@@ -98,7 +98,8 @@ public class BeanValidationInterceptor extends MethodFilterInterceptor {
             LOG.debug("Validating [{}/{}] with method [{}]", invocation.getProxy().getNamespace(), invocation.getProxy().getActionName(), methodName);
         }
 
-        if (null == AnnotationUtils.findAnnotation(getActionMethod(action.getClass(), methodName), SkipValidation.class)) {
+        if (null == MethodUtils.getAnnotation(getActionMethod(action.getClass(), methodName), SkipValidation.class,
+                true, true)) {
             // performing bean validation on action
             performBeanValidation(action, validator);
         }

http://git-wip-us.apache.org/repos/asf/struts/blob/33e1eeb3/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 720b9c2..ce29478 100644
--- a/pom.xml
+++ b/pom.xml
@@ -718,7 +718,7 @@
             <dependency>
                 <groupId>org.apache.commons</groupId>
                 <artifactId>commons-lang3</artifactId>
-                <version>3.5</version>
+                <version>3.6</version>
             </dependency>
             <dependency>
                 <groupId>commons-digester</groupId>


[2/2] struts git commit: WW-4744 WW-4694 Removes annotation search to commons lang 3.6

Posted by lu...@apache.org.
WW-4744 WW-4694 Removes annotation search to commons lang 3.6


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

Branch: refs/heads/master
Commit: 8f53b6f59efe0f713e4689ef10fe6bae5e4c0cb7
Parents: fa20b71 33e1eeb
Author: Lukasz Lenart <lu...@apache.org>
Authored: Thu Jun 22 08:40:46 2017 +0200
Committer: Lukasz Lenart <lu...@apache.org>
Committed: Thu Jun 22 08:40:46 2017 +0200

----------------------------------------------------------------------
 .../interceptor/DefaultWorkflowInterceptor.java |   5 +-
 .../AnnotationWorkflowInterceptor.java          |  25 ++--
 .../xwork2/util/AnnotationUtils.java            | 113 -------------------
 .../apache/struts2/components/Component.java    |   5 +-
 .../AnnotationValidationInterceptor.java        |   4 +-
 .../xwork2/util/AnnotationUtilsTest.java        |  53 ---------
 .../xwork2/util/annotation/DummyClass.java      |  10 +-
 .../xwork2/util/annotation/DummyClassExt.java   |   4 -
 .../xwork2/util/annotation/DummyInterface.java  |   6 -
 .../xwork2/util/annotation/MyAnnotationI.java   |   8 --
 .../interceptor/BeanValidationInterceptor.java  |   5 +-
 pom.xml                                         |   2 +-
 12 files changed, 27 insertions(+), 213 deletions(-)
----------------------------------------------------------------------