Browse Source

change return null to empty list

pull/2/head
baoliang 6 years ago
parent
commit
950deba4c7
  1. 9
      escheduler-common/src/main/java/cn/escheduler/common/utils/JSONUtils.java

9
escheduler-common/src/main/java/cn/escheduler/common/utils/JSONUtils.java

@ -27,10 +27,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TimeZone;
import java.util.*;
/**
* json utils
@ -109,7 +106,7 @@ public class JSONUtils {
*/
public static <T> List<T> toList(String json, Class<T> clazz) {
if (StringUtils.isEmpty(json)) {
return null;
return new ArrayList<>();
}
try {
return JSONArray.parseArray(json, clazz);
@ -117,7 +114,7 @@ public class JSONUtils {
logger.error("JSONArray.parseArray exception!",e);
}
return null;
return new ArrayList<>();
}

Loading…
Cancel
Save