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

AnnotationWorkflowInterceptor should supports non-public annotated methods

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.5.12
    • Core Interceptors
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: