Fix bug where a 'match all' VC is returned in case a bug in the input data is given

Change-Id: I8a64636fa00b86211fcb323143507aa5acaffac2
diff --git a/Changes b/Changes
index 88599ac..0768a6a 100644
--- a/Changes
+++ b/Changes
@@ -1,7 +1,9 @@
-0.55.8 2017-05-29
+0.55.8 2017-07-04
         - [feature] Retrieve and display pagebreaks (diewald)
         - [bugfix] Handle invalid dates in input (diewald)
         - [feature] Support availability meta data (diewald)
+        - [bugfix] Do not respond with a "match all" VC if the
+          VC data (e.g. JSON) is wrong (diewald)
 
 0.55.7 2017-01-24
         - [bugfix] Sorted results in unordered element distance query
diff --git a/src/main/java/de/ids_mannheim/korap/KrillCollection.java b/src/main/java/de/ids_mannheim/korap/KrillCollection.java
index e399264..b2d326e 100644
--- a/src/main/java/de/ids_mannheim/korap/KrillCollection.java
+++ b/src/main/java/de/ids_mannheim/korap/KrillCollection.java
@@ -98,18 +98,21 @@
             }
             else{
                 this.addError(StatusCodes.MISSING_COLLECTION, "Collection is not found.");
+				this.fromBuilder(this.build().nothing());
             }
         }
 
         // Query Exception
         catch (QueryException qe) {
             this.addError(qe.getErrorCode(), qe.getMessage());
+			this.fromBuilder(this.build().nothing());
         }
 
         // JSON exception
         catch (IOException e) {
             this.addError(621, "Unable to parse JSON", "KrillCollection",
                     e.getLocalizedMessage());
+			this.fromBuilder(this.build().nothing());
         };
     };
 
@@ -140,6 +143,7 @@
         }
         catch (Exception e) {
             this.addError(621, "Unable to parse JSON", "KrillCollection");
+			this.fromBuilder(this.build().nothing());
         };
 
         return this;
diff --git a/src/main/java/de/ids_mannheim/korap/collection/CollectionBuilder.java b/src/main/java/de/ids_mannheim/korap/collection/CollectionBuilder.java
index d3ade8b..4716804 100644
--- a/src/main/java/de/ids_mannheim/korap/collection/CollectionBuilder.java
+++ b/src/main/java/de/ids_mannheim/korap/collection/CollectionBuilder.java
@@ -51,6 +51,12 @@
         return new CollectionBuilder.Range(field, since, KrillDate.END);
     };
 
+	public CollectionBuilder.Interface nothing () {
+
+		// Requires that a field with name "0---" does not exist
+        return new CollectionBuilder.Term("0---", "0");
+    };
+
 
     public CollectionBuilder.Interface till (String field, String date) {
         try {
diff --git a/src/main/resources/log4j.properties b/src/main/resources/log4j.properties
index 074fbae..1678d9e 100644
--- a/src/main/resources/log4j.properties
+++ b/src/main/resources/log4j.properties
@@ -1,4 +1,4 @@
-# log4j.rootLogger = ERROR, stdout
+log4j.rootLogger = ERROR, stdout
 
 # Queries:
 # log4j.logger.de.ids_mannheim.korap.query.SpanNextQuery = TRACE, stdout
@@ -32,7 +32,7 @@
 # log4j.logger.de.ids_mannheim.korap.response.Match = TRACE, stdout
 
 # Index:
-log4j.logger.de.ids_mannheim.korap.index.Indexer = INFO, stdout
+# log4j.logger.de.ids_mannheim.korap.index.Indexer = INFO, stdout
 # log4j.logger.de.ids_mannheim.korap.KrillIndex = TRACE, stdout
 # log4j.logger.de.ids_mannheim.korap.index.PositionsToOffset = TRACE, stdout
 # log4j.logger.de.ids_mannheim.korap.index.MultiTermTokenStream = TRACE, stdout
diff --git a/src/test/java/de/ids_mannheim/korap/collection/TestKrillCollectionIndex.java b/src/test/java/de/ids_mannheim/korap/collection/TestKrillCollectionIndex.java
index 1361e61..0446ee0 100644
--- a/src/test/java/de/ids_mannheim/korap/collection/TestKrillCollectionIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/collection/TestKrillCollectionIndex.java
@@ -39,7 +39,9 @@
         ki.commit();
 
         KrillCollection kc = new KrillCollection("{lalala}");
+		assertEquals("Unable to parse JSON", kc.getError(0).getMessage());
         kc.setIndex(ki);
+
         long docs = 0, tokens = 0, sentences = 0, paragraphs = 0;
         try {
             docs = kc.numberOf("documents");