Allow arrays containing null in Filter & ForEach - fixes #741
This commit is contained in:
parent
c8f0e88bd4
commit
dc4d04c132
@ -81,7 +81,11 @@ public class Filter implements Control {
|
||||
|
||||
results = new ArrayList<Object>(values.length);
|
||||
for (Object v : values) {
|
||||
bindings.put(name, v);
|
||||
if (v != null) {
|
||||
bindings.put(name, v);
|
||||
} else {
|
||||
bindings.remove(name);
|
||||
}
|
||||
|
||||
Object r = args[2].evaluate(bindings);
|
||||
if (r instanceof Boolean && ((Boolean) r).booleanValue()) {
|
||||
@ -97,7 +101,11 @@ public class Filter implements Control {
|
||||
try {
|
||||
Object v = a.get(i);
|
||||
|
||||
bindings.put(name, v);
|
||||
if (v != null) {
|
||||
bindings.put(name, v);
|
||||
} else {
|
||||
bindings.remove(name);
|
||||
}
|
||||
|
||||
Object r = args[2].evaluate(bindings);
|
||||
if (r instanceof Boolean && ((Boolean) r).booleanValue()) {
|
||||
@ -113,7 +121,11 @@ public class Filter implements Control {
|
||||
results = new ArrayList<Object>(collection.size());
|
||||
|
||||
for (Object v : collection) {
|
||||
bindings.put(name, v);
|
||||
if (v != null) {
|
||||
bindings.put(name, v);
|
||||
} else {
|
||||
bindings.remove(name);
|
||||
}
|
||||
|
||||
Object r = args[2].evaluate(bindings);
|
||||
if (r instanceof Boolean && ((Boolean) r).booleanValue()) {
|
||||
|
@ -81,7 +81,11 @@ public class ForEach implements Control {
|
||||
|
||||
results = new ArrayList<Object>(values.length);
|
||||
for (Object v : values) {
|
||||
bindings.put(name, v);
|
||||
if (v != null) {
|
||||
bindings.put(name, v);
|
||||
} else {
|
||||
bindings.remove(name);
|
||||
}
|
||||
|
||||
Object r = args[2].evaluate(bindings);
|
||||
|
||||
@ -96,7 +100,11 @@ public class ForEach implements Control {
|
||||
try {
|
||||
Object v = a.get(i);
|
||||
|
||||
bindings.put(name, v);
|
||||
if (v != null) {
|
||||
bindings.put(name, v);
|
||||
} else {
|
||||
bindings.remove(name);
|
||||
}
|
||||
|
||||
Object r = args[2].evaluate(bindings);
|
||||
|
||||
@ -111,7 +119,11 @@ public class ForEach implements Control {
|
||||
results = new ArrayList<Object>(collection.size());
|
||||
|
||||
for (Object v : collection) {
|
||||
bindings.put(name, v);
|
||||
if (v != null) {
|
||||
bindings.put(name, v);
|
||||
} else {
|
||||
bindings.remove(name);
|
||||
}
|
||||
|
||||
Object r = args[2].evaluate(bindings);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user