fix two issues for ListUIBean

fix listkey and listvalue when list is not string
fix if statement location for when list is string but not found
This commit is contained in:
Yasser Zamani
2018-03-15 21:26:15 +03:30
committed by GitHub
parent 42cc8bd0fd
commit a6516a24cb
@@ -70,25 +70,23 @@ public abstract class ListUIBean extends UIBean {
if (list instanceof String) {
value = findValue((String) list);
} else if (list instanceof Collection || list instanceof Map) {
value = list;
} else if (MakeIterator.isIterable(list)) {
value = MakeIterator.convert(list);
}
if (value == null) {
if (throwExceptionOnNullValueAttribute) {
// will throw an exception if not found
value = findValue((list == null) ? (String) list : list.toString(), "list",
"The requested list key '" + list + "' could not be resolved as a collection/array/map/enumeration/iterator type. " +
"Example: people or people.{name}");
} else {
// ww-1010, allows value with null value to be compatible with ww
// 2.1.7 behaviour
value = findValue((list == null) ? (String) list : list.toString());
if (value == null) {
if (throwExceptionOnNullValueAttribute) {
// will throw an exception if not found
value = findValue((list == null) ? (String) list : list.toString(), "list",
"The requested list key '" + list + "' could not be resolved as a collection/array/map/enumeration/iterator type. " +
"Example: people or people.{name}");
} else {
// ww-1010, allows value with null value to be compatible with ww
// 2.1.7 behaviour
value = findValue((list == null) ? (String) list : list.toString());
}
}
} else {
value = list;
}
if (value instanceof Collection) {
if (value instanceof Iterable || !MakeIterator.isIterable(value)) {
addParameter("list", value);
} else {
addParameter("list", MakeIterator.convert(value));