Commit ae4305d6 by Le Ma Committed by Sarath Subramanian

ATLAS-2933-2 Fix for changed behavior of empty arr attributes

parent 9afe4622
...@@ -218,12 +218,11 @@ public class AtlasGraphUtilsV2 { ...@@ -218,12 +218,11 @@ public class AtlasGraphUtilsV2 {
Object existingValue = element.getProperty(propertyName, Object.class); Object existingValue = element.getProperty(propertyName, Object.class);
if (value == null || (value instanceof Collection && ((Collection)value).isEmpty())) { if (value == null) {
if (existingValue != null) { if (existingValue != null) {
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("Removing property {} from {}", propertyName, toString(element)); LOG.debug("Removing property {} from {}", propertyName, toString(element));
} }
element.removeProperty(propertyName); element.removeProperty(propertyName);
} }
} else { } else {
......
...@@ -218,7 +218,7 @@ public class AtlasComplexAttributesTest extends AtlasEntityTestBase { ...@@ -218,7 +218,7 @@ public class AtlasComplexAttributesTest extends AtlasEntityTestBase {
assertNull(updatedSimpleEntity.getAttribute("stringAtrr")); assertNull(updatedSimpleEntity.getAttribute("stringAtrr"));
assertEquals(updatedSimpleEntity.getAttribute("mapOfStrings"), Collections.emptyMap()); assertEquals(updatedSimpleEntity.getAttribute("mapOfStrings"), Collections.emptyMap());
assertNull(updatedSimpleEntity.getAttribute("arrayOfStrings")); assertEquals(updatedSimpleEntity.getAttribute("arrayOfStrings"), Collections.emptyList());
updatedSimpleEntity.setAttribute("stringAtrr", ""); updatedSimpleEntity.setAttribute("stringAtrr", "");
updatedSimpleEntity.setAttribute("mapOfStrings", null); updatedSimpleEntity.setAttribute("mapOfStrings", null);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment