Fix parameter serialization in messages
Change-Id: I9d404582f25b76841bf0e9522adf439be4279321
diff --git a/Changes b/Changes
index c503c38..c0dd87a 100644
--- a/Changes
+++ b/Changes
@@ -1,4 +1,4 @@
-0.55.6 2016-08-05
+0.55.6 2016-08-06
- [bugfix] distance with key "t" uses default foundry (diewald)
- [cleanup] Renamed fromJson() to fromKoral() (diewald)
- [cleanup] Removed deprecated methods in Krill:
@@ -17,6 +17,7 @@
- [feature] Differ between matching scope and match highlighting,
in case the match was extended to the sentence scope (diewald)
- [bugfix] KoralQuery bugs are now correctly moved to responses (diewald)
+ - [security] Do not mirror arbitrary JSON objects (diewald)
0.55.5 2016-05-02
- [performance] Changed to a dynamic window for sorting in FocusSpans (margaretha)
diff --git a/src/main/java/de/ids_mannheim/korap/response/Message.java b/src/main/java/de/ids_mannheim/korap/response/Message.java
index 975f9f6..8da0ad3 100644
--- a/src/main/java/de/ids_mannheim/korap/response/Message.java
+++ b/src/main/java/de/ids_mannheim/korap/response/Message.java
@@ -116,8 +116,12 @@
* @return Message object for chaining
*/
public Message addParameter (String param) {
+ if (param == null || param.length() == 0)
+ return this;
+
if (this.parameters == null)
this.parameters = new LinkedList<String>();
+
this.parameters.add(param);
return this;
};
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestSegmentNegationIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestSegmentNegationIndex.java
index 85161ab..81a5ed6 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestSegmentNegationIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestSegmentNegationIndex.java
@@ -103,7 +103,7 @@
assertEquals("Warning text", kr.getWarning(0).getMessage(),
"Exclusivity of query is ignored");
- // Flag parameter injection
+ // Flag parameter injection
kr = ki.search(new Krill(
"{\"query\" : { \"@type\" : \"koral:token\", \"wrap\" : { \"@type\" : \"koral:term\", \"key\" : \"a\", \"flags\" : [{ \"injection\" : true }], \"layer\" : \"orth\", \"match\" : \"match:ne\" }}}"));