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 873341099A for ; Thu, 29 Aug 2013 22:17:23 +0000 (UTC) Received: (qmail 29496 invoked by uid 500); 29 Aug 2013 22:17:23 -0000 Delivered-To: apmail-ode-commits-archive@ode.apache.org Received: (qmail 29395 invoked by uid 500); 29 Aug 2013 22:17:23 -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 29221 invoked by uid 99); 29 Aug 2013 22:17:22 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Aug 2013 22:17:22 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 5EB7D8C6F06; Thu, 29 Aug 2013 22:17:22 +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 Date: Thu, 29 Aug 2013 22:17:27 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [6/8] git commit: ODE-1002: orEach: When counters are negative or too large an InvalidExpressionValue fault must be thrown 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/f901c37e Tree: http://git-wip-us.apache.org/repos/asf/ode/tree/f901c37e Diff: http://git-wip-us.apache.org/repos/asf/ode/diff/f901c37e Branch: refs/heads/master Commit: f901c37ecdce2a5578e29cc9413e1e65bc5539e3 Parents: 6ac86ca Author: Tammo van Lessen Authored: Thu Aug 29 00:58:39 2013 +0200 Committer: Tammo van Lessen Committed: Thu Aug 29 23:52:30 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/f901c37e/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 2d99054..2627a1c 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 @@ -183,13 +183,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); } }