Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
The empty array values should be treated as null value when parsing j…
Browse files Browse the repository at this point in the history
…son data (#1044)
  • Loading branch information
penghuo authored Feb 10, 2021
1 parent a775aee commit 358c1c0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public Iterator<? extends Content> array() {

@Override
public boolean isNull() {
return value == null || value.isNull();
return value == null || value.isNull() || (value.isArray() && value.isEmpty());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ public void constructNullValue() {
assertTrue(new ElasticsearchJsonContent(null).isNull());
}

@Test
public void constructNullArrayValue() {
assertEquals(nullValue(), tupleValue("{\"intV\":[]}").get("intV"));
}

@Test
public void constructByte() {
assertEquals(byteValue((byte) 1), tupleValue("{\"byteV\":1}").get("byteV"));
Expand Down

0 comments on commit 358c1c0

Please sign in to comment.