Diff of /cocoon/blocks/unsupported/template/trunk/java/org/apache/cocoon/template/jxtg/instruction/StartForEach.java
Parent Directory
| Revision Log
| Patch
--- cocoon/blocks/unsupported/template/trunk/java/org/apache/cocoon/template/jxtg/instruction/StartForEach.java 2005/05/06 21:48:39 168666
+++ cocoon/blocks/unsupported/template/trunk/java/org/apache/cocoon/template/jxtg/instruction/StartForEach.java 2005/05/06 21:52:29 168667
@@ -72,6 +72,7 @@ public class StartForEach extends StartI
throw new SAXParseException("forEach: only one of \"select\" or \"items\" may be specified",
locator, null);
}
+
this.items = JXTExpression.compileExpr(items == null ? select : items, null, locator);
}
@@ -81,9 +82,11 @@ public class StartForEach extends StartI
throws SAXException {
Iterator iter = null;
int begin, end, step;
- String var, varStatus;
+ String var = null, varStatus = null;
try {
- iter = this.items.getIterator(expressionContext);
+ iter = (this.items != null )
+ ? this.items.getIterator(expressionContext)
+ : JXTExpression.NULL_ITER;
begin = this.begin == null
? 0
: this.begin.getIntValue(expressionContext);
@@ -93,13 +96,12 @@ public class StartForEach extends StartI
step = this.step == null
? 1
: this.step.getIntValue(expressionContext);
+
+ if ( this.var != null )
+ var = this.var.getStringValue(expressionContext);
- // FIXME: why is this needed?
- if ( step == 0 )
- step = 1;
-
- var = this.var.getStringValue(expressionContext);
- varStatus = this.varStatus.getStringValue(expressionContext);
+ if ( this.varStatus != null )
+ varStatus = this.varStatus.getStringValue(expressionContext);
} catch (Exception exc) {
throw new SAXParseException(exc.getMessage(),
getLocation(), exc);