Skip to content

Commit

Permalink
convert supplied value to list when isn't iterable
Browse files Browse the repository at this point in the history
when user supply a not iterable value for list in ListUIBean, then convert it to a single member list (instead of a null value as before versions do)
  • Loading branch information
yasserzamani authored Mar 16, 2018
1 parent a6516a2 commit 770e4ed
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.Array;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;

/**
Expand Down Expand Up @@ -86,10 +87,12 @@ public void evaluateExtraParams() {
value = list;
}

if (value instanceof Iterable || !MakeIterator.isIterable(value)) {
if (value instanceof Iterable) {
addParameter("list", value);
} else {
} else if (MakeIterator.isIterable(value)) {
addParameter("list", MakeIterator.convert(value));
} else {
addParameter("list", Collections.singletonList(value));
}

if (value instanceof Collection) {
Expand Down

0 comments on commit 770e4ed

Please sign in to comment.