Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-4744

AnnotationWorkflowInterceptor should supports non-public annotated methods

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.5.12
    • Component/s: Core Interceptors
    • Labels:
      None

      Description

      @Before
      protected String prepare(){
          //TODO
          return null;
      }
      

      https://github.com/apache/struts/blob/master/core/src/main/java/com/opensymphony/xwork2/interceptor/annotations/AnnotationWorkflowInterceptor.java#L115

      List<Method> methods = new ArrayList<>(AnnotationUtils.getAnnotatedMethods(action.getClass(), Before.class));
      

      https://github.com/apache/struts/blob/master/core/src/main/java/com/opensymphony/xwork2/util/AnnotationUtils.java#L123

      for (Method m : clazz.getMethods()) 
      

      clazz.getMethods() only return public methods, so method "prepare" will be excluded, and protected modifier is a good practice for intercept method.We should improve AnnotationUtils.getAnnotatedMethods() to return all methods. Perhaps use an ConcurrentHashMap as cache is much better.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              quaff Yanming Zhou
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: