This is an automated email from the ASF dual-hosted git repository.
sarath pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/atlas.git
The following commit(s) were added to refs/heads/master by this push:
new ae4305d ATLAS-2933-2 Fix for changed behavior of empty arr attributes
ae4305d is described below
commit ae4305d624ba82d7cd2af607c1c229177ededfc2
Author: Le Ma <[email protected]>
AuthorDate: Mon Aug 12 13:49:21 2019 -0700
ATLAS-2933-2 Fix for changed behavior of empty arr attributes
Signed-off-by: Sarath Subramanian <[email protected]>
---
.../org/apache/atlas/repository/store/graph/v2/AtlasGraphUtilsV2.java | 3 +--
.../atlas/repository/store/graph/v2/AtlasComplexAttributesTest.java | 2 +-
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git
a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasGraphUtilsV2.java
b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasGraphUtilsV2.java
index 70b01a5..b90d67f 100644
---
a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasGraphUtilsV2.java
+++
b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasGraphUtilsV2.java
@@ -218,12 +218,11 @@ public class AtlasGraphUtilsV2 {
Object existingValue = element.getProperty(propertyName, Object.class);
- if (value == null || (value instanceof Collection &&
((Collection)value).isEmpty())) {
+ if (value == null) {
if (existingValue != null) {
if (LOG.isDebugEnabled()) {
LOG.debug("Removing property {} from {}", propertyName,
toString(element));
}
-
element.removeProperty(propertyName);
}
} else {
diff --git
a/repository/src/test/java/org/apache/atlas/repository/store/graph/v2/AtlasComplexAttributesTest.java
b/repository/src/test/java/org/apache/atlas/repository/store/graph/v2/AtlasComplexAttributesTest.java
index 4c8440d..b682e86 100644
---
a/repository/src/test/java/org/apache/atlas/repository/store/graph/v2/AtlasComplexAttributesTest.java
+++
b/repository/src/test/java/org/apache/atlas/repository/store/graph/v2/AtlasComplexAttributesTest.java
@@ -218,7 +218,7 @@ public class AtlasComplexAttributesTest extends
AtlasEntityTestBase {
assertNull(updatedSimpleEntity.getAttribute("stringAtrr"));
assertEquals(updatedSimpleEntity.getAttribute("mapOfStrings"),
Collections.emptyMap());
- assertNull(updatedSimpleEntity.getAttribute("arrayOfStrings"));
+ assertEquals(updatedSimpleEntity.getAttribute("arrayOfStrings"),
Collections.emptyList());
updatedSimpleEntity.setAttribute("stringAtrr", "");
updatedSimpleEntity.setAttribute("mapOfStrings", null);