Bug 505929 - Array parsing bug Change-Id: I60d3c6d65dd88a8da4580723909f960ddf428bc0 Signed-off-by: Snjezana Peco <snjezana.peco@redhat.com>
diff --git a/bundles/org.eclipse.wst.json.core/src/org/eclipse/wst/json/core/internal/document/JSONModelParser.java b/bundles/org.eclipse.wst.json.core/src/org/eclipse/wst/json/core/internal/document/JSONModelParser.java index 902cb6d..08948a4 100644 --- a/bundles/org.eclipse.wst.json.core/src/org/eclipse/wst/json/core/internal/document/JSONModelParser.java +++ b/bundles/org.eclipse.wst.json.core/src/org/eclipse/wst/json/core/internal/document/JSONModelParser.java
@@ -71,7 +71,9 @@ JSONObjectImpl parentObj = (JSONObjectImpl) node.getParentNode(); if (parentObj != null && parentObj.getParentOrPairNode() instanceof JSONPairImpl) { JSONPairImpl parentPair = (JSONPairImpl) parentObj.getParentOrPairNode(); - parentPair.setValue(parentObj); + if (parentPair.getValue() != parentObj.getParentNode()) { + parentPair.setValue(parentObj); + } } } @@ -893,7 +895,9 @@ } if(structure.getParentOrPairNode() instanceof JSONPairImpl) { JSONPairImpl parentPair = (JSONPairImpl) structure.getParentOrPairNode(); - parentPair.setValue(structure); + if (structure.getParentNode() != parentPair.getValue()) { + parentPair.setValue(structure); + } } } else if (structure.getNodeType() == IJSONNode.ARRAY_NODE) { // If the parent is a JSONArray insert the new JSONValue at @@ -1012,7 +1016,9 @@ this.context.setCurrentNode(pair); if(object.getParentOrPairNode() instanceof JSONPairImpl) { JSONPairImpl parentPair = (JSONPairImpl) object.getParentOrPairNode(); - parentPair.setValue(object); + if (object.getParentNode() != parentPair.getValue()) { + parentPair.setValue(object); + } } } else if (region.getType() == JSONRegionContexts.JSON_COLON) { pair.setEqualRegion(region);