Fixed invalid dates in input

Change-Id: I95e28499de2afca536e9d02e9d75e2d63abede1b
diff --git a/src/main/java/de/ids_mannheim/korap/index/FieldDocument.java b/src/main/java/de/ids_mannheim/korap/index/FieldDocument.java
index 89e839a..e8730ed 100644
--- a/src/main/java/de/ids_mannheim/korap/index/FieldDocument.java
+++ b/src/main/java/de/ids_mannheim/korap/index/FieldDocument.java
@@ -79,7 +79,8 @@
 
 
     public void addInt (String key, String value) {
-        this.addInt(key, Integer.parseInt(value));
+		if (value != null)
+			this.addInt(key, Integer.parseInt(value));
     };
 
 
@@ -284,7 +285,9 @@
     @Override
     public KrillDate setPubDate (String pubDate) {
         KrillDate date = super.setPubDate(pubDate);
-        this.addInt("pubDate", date.toString());
+		if (date != null) {
+			this.addInt("pubDate", date.toString());
+		};
         return date;
     };
 
@@ -293,7 +296,9 @@
     @Override
     public KrillDate setCreationDate (String creationDate) {
         KrillDate date = super.setCreationDate(creationDate);
-        this.addInt("creationDate", date.toString());
+		if (date != null) {
+			this.addInt("creationDate", date.toString());
+		};
         return date;
     };
 
diff --git a/src/main/resources/log4j.properties b/src/main/resources/log4j.properties
index 2805e78..074fbae 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,6 +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.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/index/TestFieldDocument.java b/src/test/java/de/ids_mannheim/korap/index/TestFieldDocument.java
index 512535d..8f418ac 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestFieldDocument.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestFieldDocument.java
@@ -206,6 +206,40 @@
     };
 
 
+    @Test
+    public void indexNoValidDate () throws Exception {
+
+        String json = new String("{" + "  \"fields\" : [" + "    { "
+                + "      \"primaryData\" : \"abc\"" + "    }," + "    {"
+                + "      \"name\" : \"tokens\"," + "      \"data\" : ["
+                + "         [ \"s:a\", \"i:a\", \"_0$<i>0<i>1\", \"-:t$<i>3\"],"
+                + "         [ \"s:b\", \"i:b\", \"_1$<i>1<i>2\" ],"
+                + "         [ \"s:c\", \"i:c\", \"_2$<i>2<i>3\" ]" + "      ]"
+                + "    }" + "  ]," + "  \"corpusID\"  : \"WPD\","
+                + "  \"ID\"        : \"WPD-AAA-00001\","
+                + "  \"textClass\" : \"music entertainment\","
+                + "  \"author\"    : \"Peter Frankenfeld\","
+                + "  \"pubDate\"   : \"00000000\","
+                + "  \"title\"     : \"Wikipedia\","
+                + "  \"subTitle\"  : \"Die freie Enzyklopädie\","
+                + "  \"pubPlace\"  : \"Bochum\"" + "}");
+
+        KrillIndex ki = new KrillIndex();
+        FieldDocument fd = ki.addDoc(json);
+
+        ki.commit();
+
+        assertEquals(fd.getPrimaryData(), "abc");
+        assertEquals(fd.getCorpusID(), "WPD");
+        assertEquals(fd.getID(), "WPD-AAA-00001");
+        assertEquals(fd.getTextClass(), "music entertainment");
+        assertEquals(fd.getAuthor(), "Peter Frankenfeld");
+        assertEquals(fd.getTitle(), "Wikipedia");
+        assertEquals(fd.getSubTitle(), "Die freie Enzyklopädie");
+        assertEquals(fd.getPubPlace(), "Bochum");
+        assertEquals(fd.getPubDate().toDisplay(), "");
+	};
+	
     public static String getString (String path) {
         StringBuilder contentBuilder = new StringBuilder();
         try {