Return-Path: X-Original-To: apmail-ode-commits-archive@www.apache.org Delivered-To: apmail-ode-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E02C710F45 for ; Wed, 28 Aug 2013 22:59:12 +0000 (UTC) Received: (qmail 36150 invoked by uid 500); 28 Aug 2013 22:59:12 -0000 Delivered-To: apmail-ode-commits-archive@ode.apache.org Received: (qmail 36107 invoked by uid 500); 28 Aug 2013 22:59:12 -0000 Mailing-List: contact commits-help@ode.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ode.apache.org Delivered-To: mailing list commits@ode.apache.org Received: (qmail 36100 invoked by uid 99); 28 Aug 2013 22:59:12 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Aug 2013 22:59:12 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id EC3F03208B9; Wed, 28 Aug 2013 22:59:11 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: vanto@apache.org To: commits@ode.apache.org Message-Id: <158c4d30f0f9438b8548a677c377190b@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: ODE-1002: orEach: When counters are negative or too large an InvalidExpressionValue fault must be thrown Date: Wed, 28 Aug 2013 22:59:11 +0000 (UTC) Updated Branches: refs/heads/ode-1.3.6.x 500dac1da -> ebb82ccba ODE-1002: orEach: When counters are negative or too large an InvalidExpressionValue fault must be thrown Project: http://git-wip-us.apache.org/repos/asf/ode/repo Commit: http://git-wip-us.apache.org/repos/asf/ode/commit/ebb82ccb Tree: http://git-wip-us.apache.org/repos/asf/ode/tree/ebb82ccb Diff: http://git-wip-us.apache.org/repos/asf/ode/diff/ebb82ccb Branch: refs/heads/ode-1.3.6.x Commit: ebb82ccba0b012a2608454e894c61f80fafdc40c Parents: 500dac1 Author: Tammo van Lessen Authored: Thu Aug 29 00:58:39 2013 +0200 Committer: Tammo van Lessen Committed: Thu Aug 29 00:58:39 2013 +0200 ---------------------------------------------------------------------- .../org/apache/ode/bpel/runtime/FOREACH.java | 26 +++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ode/blob/ebb82ccb/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/FOREACH.java ---------------------------------------------------------------------- diff --git a/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/FOREACH.java b/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/FOREACH.java index 5704f9e..28a6675 100644 --- a/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/FOREACH.java +++ b/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/FOREACH.java @@ -185,13 +185,31 @@ public class FOREACH extends ACTIVITY { private int evaluateCondition(OExpression condition) throws FaultException { try { - return getBpelRuntimeContext().getExpLangRuntime(). + int cond = getBpelRuntimeContext().getExpLangRuntime(). evaluateAsNumber(condition, getEvaluationContext()).intValue(); + + if (cond < 0) { + String msg = "ForEach counter was negative."; + __log.error(msg); + throw new FaultException(_oforEach.getOwner().constants.qnInvalidExpressionValue,msg); + } + + if (cond > Integer.MAX_VALUE) { + // FIXME: this is not entirely correct. ODE uses an signed integer but the + // value range for the counters are xs:unsignedInt, which do not fit in + // an integer. To keep byte code compatibility, we can't easily change the type + // of the fields. But we can probably live with the limitation to only + // support Integer.MAX_VALUE as a maximum instead of Integer.MAX_VALUE * 2 - 1. + String msg = "ForEach counter was too large."; + __log.error(msg); + throw new FaultException(_oforEach.getOwner().constants.qnInvalidExpressionValue,msg); + } + + return cond; } catch (EvaluationException e) { - String msg; - msg = "ForEach counter value couldn't be evaluated as xs:unsignedInt."; + String msg = "ForEach counter value couldn't be evaluated as xs:unsignedInt."; __log.error(msg, e); - throw new FaultException(_oforEach.getOwner().constants.qnForEachCounterError,msg); + throw new FaultException(_oforEach.getOwner().constants.qnInvalidExpressionValue,msg); } }