From 30abaec4d6e2bf6d2fe09c500e388edca3e1ee25 Mon Sep 17 00:00:00 2001 From: aboyko Date: Wed, 11 Sep 2024 10:46:31 -0400 Subject: [PATCH] Fix exception in bean json parser --- .../beans/ui/live/model/LiveBeansJsonParser.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/eclipse-extensions/org.springframework.ide.eclipse.beans.ui.live/src/org/springframework/ide/eclipse/beans/ui/live/model/LiveBeansJsonParser.java b/eclipse-extensions/org.springframework.ide.eclipse.beans.ui.live/src/org/springframework/ide/eclipse/beans/ui/live/model/LiveBeansJsonParser.java index 9e85179cf..04c630ea7 100644 --- a/eclipse-extensions/org.springframework.ide.eclipse.beans.ui.live/src/org/springframework/ide/eclipse/beans/ui/live/model/LiveBeansJsonParser.java +++ b/eclipse-extensions/org.springframework.ide.eclipse.beans.ui.live/src/org/springframework/ide/eclipse/beans/ui/live/model/LiveBeansJsonParser.java @@ -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) {