[
https://issues.apache.org/jira/browse/AXIS2-5862?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Andreas Veithen updated AXIS2-5862:
-----------------------------------
Fix Version/s: (was: 1.7.6)
> Handler / Phase Indexes incorrect?
> ----------------------------------
>
> Key: AXIS2-5862
> URL: https://issues.apache.org/jira/browse/AXIS2-5862
> Project: Axis2
> Issue Type: Bug
> Components: kernel
> Affects Versions: 1.7.4
> Reporter: Jeff Thomas
>
> 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.
> {code:java}
> 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
> msgctx.setCurrentPhaseIndex(i+1);
> }
> {code}
> 2. During the phase 'flowComplete':
> I would expect here 'msgContext.getCurrenHandlerIndex()' and
> 'msgContext.setCurrentHandlerIndex(0)' instead.
> {code:java}
> // This will be non-zero if we failed during execution of one of the
> // handlers in this phase
> int currentHandlerIndex = msgContext.getCurrentPhaseIndex();
> 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.*/
> msgContext.setCurrentPhaseIndex(0);
> }
> 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 + "'");
> }
> handler.flowComplete(msgContext);
> }
> {code}
> 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).
> {noformat}
> java.lang.ArrayIndexOutOfBoundsException: 0
> at
> java.util.concurrent.CopyOnWriteArrayList.get(CopyOnWriteArrayList.java:368)
> at
> java.util.concurrent.CopyOnWriteArrayList.get(CopyOnWriteArrayList.java:377)
> at org.apache.axis2.engine.Phase.flowComplete(Phase.java:361)
> {noformat}
> 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
(v6.4.14#64029)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]