Skip to content

Commit

Permalink
Fix exception in bean json parser
Browse files Browse the repository at this point in the history
  • Loading branch information
BoykoAlex committed Sep 11, 2024
1 parent dc577ef commit 30abaec
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ private void parseBeans(LiveBeansContext context, JSONArray beansArray) throws J
// 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);
Expand All @@ -94,13 +94,13 @@ private void parseBeans(LiveBeansContext context, JSONArray beansArray) throws J

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) {
Expand Down Expand Up @@ -149,7 +149,7 @@ private void populateBeanDependencies(JSONArray beansArray) throws JSONException
// 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) {
Expand Down

0 comments on commit 30abaec

Please sign in to comment.