Fix exception in bean json parser
This commit is contained in:
@@ -83,7 +83,7 @@ public class LiveBeansJsonParser {
|
||||
// construct LiveBeans
|
||||
for (int i = 0; i < beansArray.length(); i++) {
|
||||
JSONObject beanJson = beansArray.getJSONObject(i);
|
||||
if (beanJson != null && beanJson.has(LiveBean.ATTR_BEAN)) {
|
||||
if (beanJson != null && beanJson.has(LiveBean.ATTR_BEAN) && !beanJson.isNull(LiveBean.ATTR_BEAN)) {
|
||||
LiveBean bean = parseBean(beanJson, context);
|
||||
bean.addAttribute(LiveBeansContext.ATTR_CONTEXT, context.getLabel());
|
||||
context.addElement(bean);
|
||||
@@ -94,13 +94,13 @@ public class LiveBeansJsonParser {
|
||||
|
||||
protected LiveBean parseBean(JSONObject beanJson, LiveBeansContext context) throws JSONException {
|
||||
LiveBean bean = new LiveBean(typeLookup, beanJson.getString(LiveBean.ATTR_BEAN));
|
||||
if (beanJson.has(LiveBean.ATTR_SCOPE)) {
|
||||
if (beanJson.has(LiveBean.ATTR_SCOPE) && !beanJson.isNull(LiveBean.ATTR_SCOPE)) {
|
||||
bean.addAttribute(LiveBean.ATTR_SCOPE, beanJson.getString(LiveBean.ATTR_SCOPE));
|
||||
}
|
||||
if (beanJson.has(LiveBean.ATTR_TYPE)) {
|
||||
if (beanJson.has(LiveBean.ATTR_TYPE) && !beanJson.isNull(LiveBean.ATTR_TYPE)) {
|
||||
bean.addAttribute(LiveBean.ATTR_TYPE, beanJson.getString(LiveBean.ATTR_TYPE));
|
||||
}
|
||||
if (beanJson.has(LiveBean.ATTR_RESOURCE)) {
|
||||
if (beanJson.has(LiveBean.ATTR_RESOURCE) && !beanJson.isNull(LiveBean.ATTR_RESOURCE)) {
|
||||
bean.addAttribute(LiveBean.ATTR_RESOURCE, beanJson.getString(LiveBean.ATTR_RESOURCE));
|
||||
}
|
||||
if (typeLookup != null && typeLookup.getApplicationName() != null) {
|
||||
@@ -149,7 +149,7 @@ public class LiveBeansJsonParser {
|
||||
// populate LiveBean dependencies
|
||||
for (int i = 0; i < beansArray.length(); i++) {
|
||||
JSONObject beanJson = beansArray.optJSONObject(i);
|
||||
if (beanJson != null && beanJson.has(LiveBean.ATTR_BEAN)) {
|
||||
if (beanJson != null && beanJson.has(LiveBean.ATTR_BEAN) && !beanJson.isNull(LiveBean.ATTR_BEAN)) {
|
||||
LiveBean bean = beansMap.get(beanJson.getString(LiveBean.ATTR_BEAN));
|
||||
JSONArray dependencies = beanJson.optJSONArray(LiveBean.ATTR_DEPENDENCIES);
|
||||
if (dependencies != null) {
|
||||
|
||||
Reference in New Issue
Block a user