summaryrefslogtreecommitdiffstats
path: root/infra/translate-impl
diff options
context:
space:
mode:
authorJakub Morvay <jmorvay@frinx.io>2018-01-04 12:14:13 +0100
committerJakub Morvay <jmorvay@frinx.io>2018-01-04 12:43:24 +0100
commit6421f0dddf1ad963537f57c364198b19fcdea7c2 (patch)
treea89a2d22053a94af5fa52fc0d947b7a372e67dfb /infra/translate-impl
parent2f6ae7bb8bf04067191bb91995e605e02c19fbcb (diff)
Check for missing readers when building CompositeReaderRegistry
Change-Id: Ic5e16e7a53836600236701caa51599bc0b957955 Signed-off-by: Jakub Morvay <jmorvay@frinx.io>
Diffstat (limited to 'infra/translate-impl')
-rw-r--r--infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/registry/CompositeReaderRegistryBuilder.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/registry/CompositeReaderRegistryBuilder.java b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/registry/CompositeReaderRegistryBuilder.java
index 4f7e1e140..8ee84b40f 100644
--- a/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/registry/CompositeReaderRegistryBuilder.java
+++ b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/registry/CompositeReaderRegistryBuilder.java
@@ -16,6 +16,7 @@
package io.fd.honeycomb.translate.impl.read.registry;
+import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableMap;
import io.fd.honeycomb.translate.impl.read.GenericListReader;
import io.fd.honeycomb.translate.impl.read.GenericReader;
@@ -131,8 +132,13 @@ public final class CompositeReaderRegistryBuilder
}
final ImmutableMap<Class<?>, Reader<?, ? extends Builder<?>>> childReadersMap = childReadersMapB.build();
- return childReadersMap.isEmpty()
- ? mappedReaders.get(instanceIdentifier)
- : CompositeReader.createForReader(mappedReaders.get(instanceIdentifier), childReadersMap);
+
+ if (childReadersMap.isEmpty()) {
+ return mappedReaders.get(instanceIdentifier);
+ } else {
+ final Reader<?, ?> reader = Preconditions.checkNotNull(mappedReaders.get(instanceIdentifier),
+ "Missing reader for %s", instanceIdentifier);
+ return CompositeReader.createForReader(reader, childReadersMap);
+ }
}
}