Author: adrianc
Date: Sat May 5 17:36:13 2012
New Revision: 1334459
URL:
http://svn.apache.org/viewvc?rev=1334459&view=revLog:
Bug fix in Mini-language <iterate> element - the <break> and <continue> elements were ignored for collections and iterators.
Modified:
ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Iterate.java
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Iterate.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Iterate.java?rev=1334459&r1=1334458&r2=1334459&view=diff==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Iterate.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Iterate.java Sat May 5 17:36:13 2012
@@ -111,9 +111,20 @@ public class Iterate extends MethodOpera
}
for (Object theEntry : theCollection) {
entryAcsr.put(methodContext, theEntry);
- if (!SimpleMethod.runSubOps(subOps, methodContext)) {
- // only return here if it returns false, otherwise just carry on
- return false;
+ try {
+ for (MethodOperation methodOperation : subOps) {
+ if (!methodOperation.exec(methodContext)) {
+ return false;
+ }
+ }
+ } catch (MiniLangException e) {
+ if (e instanceof BreakElementException) {
+ break;
+ }
+ if (e instanceof ContinueElementException) {
+ continue;
+ }
+ throw e;
}
}
} else if (objList instanceof Iterator<?>) {
@@ -126,9 +137,20 @@ public class Iterate extends MethodOpera
while (theIterator.hasNext()) {
Object theEntry = theIterator.next();
entryAcsr.put(methodContext, theEntry);
- if (!SimpleMethod.runSubOps(subOps, methodContext)) {
- // only return here if it returns false, otherwise just carry on
- return false;
+ try {
+ for (MethodOperation methodOperation : subOps) {
+ if (!methodOperation.exec(methodContext)) {
+ return false;
+ }
+ }
+ } catch (MiniLangException e) {
+ if (e instanceof BreakElementException) {
+ break;
+ }
+ if (e instanceof ContinueElementException) {
+ continue;
+ }
+ throw e;
}
}
} else {