axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Thomas (JIRA)" <>
Subject [jira] [Created] (AXIS2-5862) Handler / Phase Indexes incorrect?
Date Thu, 20 Jul 2017 10:53:00 GMT
Jeff Thomas created AXIS2-5862:

             Summary: Handler / Phase Indexes incorrect?
                 Key: AXIS2-5862
             Project: Axis2
          Issue Type: Bug
          Components: kernel
    Affects Versions: 1.7.4
            Reporter: Jeff Thomas
             Fix For: 1.7.6

I believe there is a problem or rather multiple problems in the Phase/Handler flow indexing..but
I am not 100% sure.

In 'org.apache.axis2.engine.Phase':

1.  During the Phase invocation:

While cycling through the handlers, I would expect 'msgctx.setHandlerIndex(i+1)' but instead
the phase index is incremented.

int handlersSize = handlers.size();
        for (int i= currentIndex; i < handlersSize; i++) {
            Handler handler = (Handler) handlers.get(i);

            InvocationResponse pi = invokeHandler(handler, msgctx);
            if (!pi.equals(InvocationResponse.CONTINUE)) {
                return pi;
            // Set phase index to the next handler

2. During the phase 'flowComplete':

I would expect here 'msgContext.getCurrenHandlerIndex()' and 'msgContext.setCurrentHandlerIndex(0)'

        // This will be non-zero if we failed during execution of one of the
        // handlers in this phase
        int currentHandlerIndex = {color:red}*msgContext.getCurrentPhaseIndex()*{color};
        if (currentHandlerIndex == 0) {
            currentHandlerIndex = handlers.size();
        } else {
            /*We need to set it to 0 so that any previous phases will execute all
         * of their handlers.*/

       for (; currentHandlerIndex > 0; currentHandlerIndex--) {
            Handler handler = (Handler) handlers.get(currentHandlerIndex - 1);

            if (isDebugEnabled) {
                log.debug(msgContext.getLogIDString() + " Invoking flowComplete() for Handler
'" +
                        handler.getName() + "' in Phase '" + phaseName + "'");


   This is currrently causing errors in our installation because we are seeing a currentPhaseIndex
== 1, which forces the "currentHandlerIndex == 1"; however the phase we are in has no handlers.
 This causes an OutOfBoundsException when it attempts to get the handler with index[0] (1-1).

    java.lang.ArrayIndexOutOfBoundsException: 0
                at java.util.concurrent.CopyOnWriteArrayList.get(
                at java.util.concurrent.CopyOnWriteArrayList.get(
                at org.apache.axis2.engine.Phase.flowComplete(

Unfortunately I am not sure if there even more locations where HandlerIndex instead of PhaseIndex
probably should have been used.

This message was sent by Atlassian JIRA

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message