summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaros Marsalek <mmarsale@cisco.com>2016-10-19 15:01:41 +0200
committerMarek Gradzki <mgradzki@cisco.com>2016-10-20 14:07:15 +0000
commitdb9ce3d32c794b0cfa78fc5b3c8d5efcd0bd4532 (patch)
treee2a6409620dca54cb25f14a170d4b98bbc8dcbb0
parentc1b946d979a9796d3a15a9e4fb5acb9adf5d4edd (diff)
HONEYCOMB-261 Dont return empty containers from read
Change-Id: I0b17b958f55a5bf83e2644dc9843fe5e631baa55 Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
-rw-r--r--infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/registry/CompositeReader.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/registry/CompositeReader.java b/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/registry/CompositeReader.java
index 91a195f44..e392228aa 100644
--- a/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/registry/CompositeReader.java
+++ b/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/registry/CompositeReader.java
@@ -111,7 +111,10 @@ class CompositeReader<D extends DataObject, B extends Builder<D>> extends Abstra
LOG.debug("{}: Reading child from: {}", this, child);
if (child instanceof ListReader) {
final List<? extends DataObject> list = ((ListReader) child).readList(childId, ctx);
- ((ListReader) child).merge(builder, list);
+ // Dont set empty lists
+ if (!list.isEmpty()) {
+ ((ListReader) child).merge(builder, list);
+ }
} else {
final Optional<? extends DataObject> read = child.read(childId, ctx);
if (read.isPresent()) {