Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id E0B87200CDA for ; Thu, 20 Jul 2017 13:25:09 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id DD43B16B19A; Thu, 20 Jul 2017 11:25:09 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 0FBC716B198 for ; Thu, 20 Jul 2017 13:25:08 +0200 (CEST) Received: (qmail 82253 invoked by uid 500); 20 Jul 2017 11:25:03 -0000 Mailing-List: contact java-dev-help@axis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-dev@axis.apache.org Delivered-To: mailing list java-dev@axis.apache.org Received: (qmail 82243 invoked by uid 99); 20 Jul 2017 11:25:03 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Jul 2017 11:25:03 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 9C3BDC348B for ; Thu, 20 Jul 2017 11:25:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.002 X-Spam-Level: X-Spam-Status: No, score=-100.002 tagged_above=-999 required=6.31 tests=[RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id 9jbqsxwYPdBx for ; Thu, 20 Jul 2017 11:25:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 299E05FD49 for ; Thu, 20 Jul 2017 11:25:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id A4988E0984 for ; Thu, 20 Jul 2017 11:25:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 59C7221E92 for ; Thu, 20 Jul 2017 11:25:00 +0000 (UTC) Date: Thu, 20 Jul 2017 11:25:00 +0000 (UTC) From: "Jeff Thomas (JIRA)" To: java-dev@axis.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (AXIS2-5862) Handler / Phase Indexes incorrect? MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Thu, 20 Jul 2017 11:25:10 -0000 [ https://issues.apache.org/jira/browse/AXIS2-5862?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jeff Thomas updated AXIS2-5862: ------------------------------- Description: 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. was: 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 = {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.*/ {color:red}*msgContext.setCurrentPhaseIndex(0)*{color}; } 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. > 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 > 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. > {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: java-dev-unsubscribe@axis.apache.org For additional commands, e-mail: java-dev-help@axis.apache.org