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

ArrayIndexOutOfBoundsException during Struts action call

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.3.20
    • Fix Version/s: 2.5
    • Component/s: None
    • Labels:
      None

      Description

      I've just changed struts to version 2.3.18 and I'm getting ArrayIndexOutOfBoundsException.

      ERROR 14:53:49,382 pl.netpr.struts.results.ErrorResult - wystapil blad java.lang.ArrayIndexOutOfBoundsException: 1
      ERROR 14:53:49,382 pl.netpr.struts.results.ErrorResult - java.lang.ArrayIndexOutOfBoundsException: 1
              at ognl.OgnlRuntime.resolveType(OgnlRuntime.java:710)
              at ognl.OgnlRuntime.findParameterTypes(OgnlRuntime.java:679)
              at ognl.OgnlRuntime.getAppropriateMethod(OgnlRuntime.java:1185)
              at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1223)
              at ognl.ObjectMethodAccessor.callMethod(ObjectMethodAccessor.java:68)
              at com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethodWithDebugInfo(XWorkMethodAccessor.java:117)
              at com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethod(XWorkMethodAccessor.java:108)
              at ognl.OgnlRuntime.callMethod(OgnlRuntime.java:1369)
              at ognl.ASTMethod.getValueBody(ASTMethod.java:90)
              at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:212)
              at ognl.SimpleNode.getValue(SimpleNode.java:258)
              at ognl.Ognl.getValue(Ognl.java:494)
              at ognl.Ognl.getValue(Ognl.java:458)
              at com.opensymphony.xwork2.ognl.OgnlUtil$2.execute(OgnlUtil.java:309)
              at com.opensymphony.xwork2.ognl.OgnlUtil.compileAndExecute(OgnlUtil.java:340)
              at com.opensymphony.xwork2.ognl.OgnlUtil.getValue(OgnlUtil.java:307)
              at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:421)
              at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:285)
              at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
              at pl.netpr.login.struts2.AuthorizationInterceptor.intercept(AuthorizationInterceptor.java:50)
      

      AuthorizationInterceptor.java:50 contains

       invocation.invoke()
      
      1. strutstest.zip
        22 kB
        Mirek Hankus

        Activity

        Hide
        lukaszlenart Lukasz Lenart added a comment -

        Already there

        Show
        lukaszlenart Lukasz Lenart added a comment - Already there
        Hide
        mhankus Mirek Hankus added a comment -

        Looks good. Link to this page from version notes, would also be useful.

        Show
        mhankus Mirek Hankus added a comment - Looks good. Link to this page from version notes, would also be useful.
        Show
        lukaszlenart Lukasz Lenart added a comment - What do you think? https://cwiki.apache.org/confluence/display/WW/Security#Security-OGNLisusedtocallaction'smethods
        Hide
        lukaszlenart Lukasz Lenart added a comment -

        It isn't possible to solve it with current version of OGNL - it doesn't support specifying what method must be called to narrow possible options. I will add note to Version Notes about that and postpone this issue till version 2.5.

        Show
        lukaszlenart Lukasz Lenart added a comment - It isn't possible to solve it with current version of OGNL - it doesn't support specifying what method must be called to narrow possible options. I will add note to Version Notes about that and postpone this issue till version 2.5.
        Hide
        lukaszlenart Lukasz Lenart added a comment -

        Yes I know, but the change is related to this which was introduced to use OGNL and SecurityMemberAccess to increase security.

        I will try to fix that case, will see

        Show
        lukaszlenart Lukasz Lenart added a comment - Yes I know, but the change is related to this which was introduced to use OGNL and SecurityMemberAccess to increase security. I will try to fix that case, will see
        Hide
        mhankus Mirek Hankus added a comment -

        Problem is, that it works fine with 2.3.16.3 (it will complain about missing result definition, but action executes fine). Something has changed on the way to 2.3.18.
        Problem is that people may find out that their app is not compatible with new version of struts in a hard way (for example on production system
        We can change our app, because we already know that it is a problem, but what about others ?

        Show
        mhankus Mirek Hankus added a comment - Problem is, that it works fine with 2.3.16.3 (it will complain about missing result definition, but action executes fine). Something has changed on the way to 2.3.18. Problem is that people may find out that their app is not compatible with new version of struts in a hard way (for example on production system We can change our app, because we already know that it is a problem, but what about others ?
        Hide
        lukaszlenart Lukasz Lenart added a comment -

        It's somehow an OGNL's limitation - as I noticed there are three the same methods:

        SaveCon#save
        ExampleSupport1#save
        ExampleSupport#save(Object)
        

        and the last one is the problem - OGNL cannot match it with the expected list of arguments (empty) - right now I don't see other option than redesign your application to avoid such situation.

        Show
        lukaszlenart Lukasz Lenart added a comment - It's somehow an OGNL's limitation - as I noticed there are three the same methods: SaveCon#save ExampleSupport1#save ExampleSupport#save( Object ) and the last one is the problem - OGNL cannot match it with the expected list of arguments (empty) - right now I don't see other option than redesign your application to avoid such situation.
        Hide
        mhankus Mirek Hankus added a comment -

        yes. You are right. It should open, when you start project.

        Show
        mhankus Mirek Hankus added a comment - yes. You are right. It should open, when you start project.
        Hide
        lukaszlenart Lukasz Lenart added a comment -

        I assume it's the /save action?

        Show
        lukaszlenart Lukasz Lenart added a comment - I assume it's the /save action?
        Hide
        mhankus Mirek Hankus added a comment -

        Lukasz Lenart sorry for delay - I had some urgent issues.
        I've attached sample project which demonstrates this problem.

        Show
        mhankus Mirek Hankus added a comment - Lukasz Lenart sorry for delay - I had some urgent issues. I've attached sample project which demonstrates this problem.
        Hide
        mhankus Mirek Hankus added a comment -

        Project file with exception

        Show
        mhankus Mirek Hankus added a comment - Project file with exception
        Hide
        lukaszlenart Lukasz Lenart added a comment -

        Mirek Hankus any progress with this issue?

        Show
        lukaszlenart Lukasz Lenart added a comment - Mirek Hankus any progress with this issue?
        Hide
        lukaszlenart Lukasz Lenart added a comment -

        Can you show the action class and method? It looks like your method has parameters defined. Right now Ognl is used to call execute method and any other action's methods.

        Show
        lukaszlenart Lukasz Lenart added a comment - Can you show the action class and method? It looks like your method has parameters defined. Right now Ognl is used to call execute method and any other action's methods.
        Hide
        lukaszlenart Lukasz Lenart added a comment -

        Great, thanks!

        Show
        lukaszlenart Lukasz Lenart added a comment - Great, thanks!
        Hide
        mhankus Mirek Hankus added a comment -

        I know, that it is not released yet. It was deployed to my development server. I'll try to investigate problem, and add some more info.

        Show
        mhankus Mirek Hankus added a comment - I know, that it is not released yet. It was deployed to my development server. I'll try to investigate problem, and add some more info.
        Hide
        lukaszlenart Lukasz Lenart added a comment -

        This version wasn't officially released yet, please report any error in this thread
        http://markmail.org/thread/azmkod2pg34wrnhf

        Show
        lukaszlenart Lukasz Lenart added a comment - This version wasn't officially released yet, please report any error in this thread http://markmail.org/thread/azmkod2pg34wrnhf

          People

          • Assignee:
            lukaszlenart Lukasz Lenart
            Reporter:
            mhankus Mirek Hankus
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development