nullpointer during missing json fields hot fix
Change-Id: I186df1d8cbd3beec05a93d5ad5d88c7ce06d6d0e
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/QuerySerializer.java b/src/main/java/de/ids_mannheim/korap/query/serialize/QuerySerializer.java
index 27c16e7..c89bf59 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/QuerySerializer.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/QuerySerializer.java
@@ -180,6 +180,16 @@
List messages = (List) requestMap.get("messages");
collection = mergeCollection(collection, this.collection);
requestMap.put("collection", collection);
+
+ if (meta == null)
+ meta = new HashMap();
+ if (errors == null)
+ errors = new LinkedList();
+ if (warnings == null)
+ warnings = new LinkedList();
+ if (messages == null)
+ messages = new LinkedList();
+
if (this.meta != null) {
meta.putAll(this.meta);
requestMap.put("meta", meta);
@@ -196,7 +206,6 @@
messages.addAll(this.messages);
requestMap.put("messages", messages);
}
-
return cleanup(requestMap);
}
return new HashMap<>();