nullpointers in queryserializer

Change-Id: I2c42dad990cfb35f3d233f20a361b5e7ee2fae50
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/PoliqarpPlusQueryProcessor.java b/src/main/java/de/ids_mannheim/korap/query/serialize/PoliqarpPlusQueryProcessor.java
index 03117dd..4571efb 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/PoliqarpPlusQueryProcessor.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/PoliqarpPlusQueryProcessor.java
@@ -46,7 +46,6 @@
      * 
      * @param query
      *            The syntax tree as returned by ANTLR
-     * @throws QueryException
      */
     public PoliqarpPlusQueryProcessor (String query) {
         KoralObjectGenerator.setQueryProcessor(this);
@@ -59,6 +58,7 @@
     public void process (String query) {
         ParseTree tree;
         tree = parsePoliqarpQuery(query);
+        // fixme: not required!?
         super.parser = this.parser;
         log.info("Processing PoliqarpPlus query: " + query);
         if (tree != null) {
@@ -86,7 +86,6 @@
      * @param node
      *            The currently processed node. The process(String
      *            query) method calls this method with the root.
-     * @throws QueryException
      */
     private void processNode (ParseTree node) {
         // Top-down processing
@@ -329,12 +328,14 @@
                     .makeTerm();
 
             String key = node.getChild(0).getText();
-            TokenStream stream = parser.getTokenStream();
-            String kval = stream.getText(node.getChild(0).getSourceInterval());
 
             if (getNodeCat(node.getChild(0).getChild(0)).equals("regex")) {
                 isRegex = true;
                 term.put("type", "type:regex");
+
+                // fixme: use stream with offset to get text!
+                // TokenStream stream = parser.getTokenStream();
+                // key = stream.getText(node.getChild(0).getSourceInterval());
                 key = key.substring(1, key.length() - 1);
             }
             term.put("layer", "orth");
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 c89bf59..fa4c029 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,7 +180,7 @@
             List messages = (List) requestMap.get("messages");
             collection = mergeCollection(collection, this.collection);
             requestMap.put("collection", collection);
-            
+
             if (meta == null)
                 meta = new HashMap();
             if (errors == null)
diff --git a/src/test/java/de/ids_mannheim/korap/query/serialize/PoliqarpPlusQueryProcessorTest.java b/src/test/java/de/ids_mannheim/korap/query/serialize/PoliqarpPlusQueryProcessorTest.java
index ca5507f..fb82f28 100644
--- a/src/test/java/de/ids_mannheim/korap/query/serialize/PoliqarpPlusQueryProcessorTest.java
+++ b/src/test/java/de/ids_mannheim/korap/query/serialize/PoliqarpPlusQueryProcessorTest.java
@@ -149,7 +149,6 @@
         query = "z.B./x";
         qs.setQuery(query, "poliqarpplus");
         res = mapper.readTree(qs.toJSON());
-        //System.out.println("QUERY IS  "+ res);
         assertEquals("koral:token", res.at("/query/@type").asText());
         assertEquals("koral:term", res.at("/query/wrap/@type").asText());
         assertEquals(".*?z\\.B\\..*?", res.at("/query/wrap/key").asText());
@@ -161,7 +160,7 @@
         query = "\"a\\.\"";
         qs.setQuery(query, "poliqarpplus");
         res = mapper.readTree(qs.toJSON());
-        //System.out.println("QUERY IS  "+ res);
+        System.out.println("QUERY IS  "+ res);
         assertEquals("koral:token", res.at("/query/@type").asText());
         assertEquals("koral:term", res.at("/query/wrap/@type").asText());
         assertEquals("type:regex", res.at("/query/wrap/type").asText());