Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 78AC61178B for ; Sun, 7 Sep 2014 21:17:06 +0000 (UTC) Received: (qmail 29619 invoked by uid 500); 7 Sep 2014 21:17:06 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 29552 invoked by uid 500); 7 Sep 2014 21:17:06 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 29540 invoked by uid 99); 7 Sep 2014 21:17:06 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 07 Sep 2014 21:17:06 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 07 Sep 2014 21:16:44 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id DC7E72388993; Sun, 7 Sep 2014 21:16:42 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1623231 - /commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Foreach.java Date: Sun, 07 Sep 2014 21:16:42 -0000 To: commits@commons.apache.org From: ate@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140907211642.DC7E72388993@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: ate Date: Sun Sep 7 21:16:42 2014 New Revision: 1623231 URL: http://svn.apache.org/r1623231 Log: Only (try to) keep track of loop index when requested Modified: commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Foreach.java Modified: commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Foreach.java URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Foreach.java?rev=1623231&r1=1623230&r2=1623231&view=diff ============================================================================== --- commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Foreach.java (original) +++ commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Foreach.java Sun Sep 7 21:16:42 2014 @@ -107,7 +107,9 @@ public class Foreach extends Action impl if (arrayObject.getClass().isArray()) { for (int currentIndex = 0, size = Array.getLength(arrayObject); currentIndex < size; currentIndex++) { ctx.setLocal(item, Array.get(arrayObject, currentIndex)); - ctx.setLocal(index, currentIndex); + if (index != null) { + ctx.setLocal(index, currentIndex); + } // The "foreach" statement is a "container" for (Action aa : actions) { aa.execute(exctx);