Handle null in map - protobuf doesn't like it.
@@ -400,12 +400,12 @@ public class StreamsTopologyProvider implements Supplier<Topology> {
Str.ArtifactValue previous = builder.getArtifacts(count - 1); // last one
Map<String, String> prevContents = previous.getMetadataMap();
if (prevContents != null) {
- contents.put(MetaDataKeys.CREATED_ON, prevContents.get(MetaDataKeys.CREATED_ON));
+ checkNull(artifactId, version, contents, MetaDataKeys.CREATED_ON, prevContents.get(MetaDataKeys.CREATED_ON));
if (prevContents.containsKey(MetaDataKeys.NAME)) {
- contents.put(MetaDataKeys.NAME, prevContents.get(MetaDataKeys.NAME));
+ checkNull(artifactId, version, contents, MetaDataKeys.NAME, prevContents.get(MetaDataKeys.NAME));
}
if (prevContents.containsKey(MetaDataKeys.DESCRIPTION)) {
- contents.put(MetaDataKeys.DESCRIPTION, prevContents.get(MetaDataKeys.DESCRIPTION));
+ checkNull(artifactId, version, contents, MetaDataKeys.DESCRIPTION, prevContents.get(MetaDataKeys.DESCRIPTION));
}
}
}
@@ -415,5 +415,13 @@ public class StreamsTopologyProvider implements Supplier<Topology> {
builder.addArtifacts(avb);
}
+ private static void checkNull(String artifactId, int version, Map<String, String> contents, String key, String value) {
+ if (key != null && value != null) {
+ contents.put(key, value);
+ } else {
+ log.warn("Metadata - null key {} or value {} - [{} ({})]", key, value, artifactId, version);
+ }
+ }
+
}
}
