Changed status code and error messages.

Change-Id: I2dfbd6894597c97eb7eb5498792204f96951e5f2
diff --git a/src/main/java/de/ids_mannheim/korap/query/parse/fcsql/ExpressionParser.java b/src/main/java/de/ids_mannheim/korap/query/parse/fcsql/ExpressionParser.java
index 3565db1..842cabc 100644
--- a/src/main/java/de/ids_mannheim/korap/query/parse/fcsql/ExpressionParser.java
+++ b/src/main/java/de/ids_mannheim/korap/query/parse/fcsql/ExpressionParser.java
@@ -115,7 +115,7 @@
         }
         else {
             throw new KoralException(StatusCodes.QUERY_TOO_COMPLEX,
-                    "FCS diagnostic 11: Query is too complex.");
+                    "Query is too complex.");
         }
     }
 
@@ -224,7 +224,7 @@
         }
         else {
             throw new KoralException(StatusCodes.UNKNOWN_QUERY_ELEMENT,
-                    "SRU diagnostic 48: Layer " + identifier
+                    "Layer " + identifier
                             + " is unsupported.");
         }
 
@@ -257,11 +257,11 @@
         }
         else if (qualifier.equals(FOUNDRY_OPENNLP) && layer.equals("l")) {
             throw new KoralException(StatusCodes.UNKNOWN_QUERY_ELEMENT,
-                    "SRU diagnostic 48: Layer lemma with qualifier opennlp is unsupported.");
+                    "Layer lemma with qualifier opennlp is unsupported.");
         }
         else if (!supportedFoundries.contains(qualifier)) {
             throw new KoralException(StatusCodes.UNKNOWN_QUERY_ELEMENT,
-                    "SRU diagnostic 48: Qualifier " + qualifier
+                    "Qualifier " + qualifier
                             + " is unsupported.");
         }
 
@@ -293,7 +293,7 @@
         }
         else {
             throw new KoralException(StatusCodes.UNKNOWN_QUERY_ELEMENT,
-                    "SRU diagnostic 37:" + operator.name() + " is unsupported.");
+                    operator.name() + " is unsupported.");
         }
         koralTerm.setOperator(matchOperator);
     }
@@ -330,12 +330,12 @@
 
         if (names.size() == 1) {
             throw new KoralException(StatusCodes.UNKNOWN_QUERY_ELEMENT,
-                    "SRU diagnostic 48: Regexflag: " + names.get(0)
+                    "Regexflag: " + names.get(0)
                             + " is unsupported.");
         }
         else if (names.size() > 1) {
             throw new KoralException(StatusCodes.UNKNOWN_QUERY_ELEMENT,
-                    "SRU diagnostic 48: Regexflags: " + names.toString()
+                    "Regexflags: " + names.toString()
                             + " are unsupported.");
         }
     }
diff --git a/src/main/java/de/ids_mannheim/korap/query/parse/fcsql/FCSSRUQueryParser.java b/src/main/java/de/ids_mannheim/korap/query/parse/fcsql/FCSSRUQueryParser.java
index fc0cfcf..98f6536 100644
--- a/src/main/java/de/ids_mannheim/korap/query/parse/fcsql/FCSSRUQueryParser.java
+++ b/src/main/java/de/ids_mannheim/korap/query/parse/fcsql/FCSSRUQueryParser.java
@@ -70,7 +70,7 @@
         }
         else {
             throw new KoralException(StatusCodes.QUERY_TOO_COMPLEX,
-                    "FCS diagnostic 11:" + queryNode.getNodeType().name()
+                    queryNode.getNodeType().name()
                             + " is currently unsupported.");
         }
     }
@@ -142,7 +142,7 @@
     private KoralSpan parseWithinScope(Scope scope) throws KoralException {
         if (scope == null) {
             throw new KoralException(StatusCodes.MALFORMED_QUERY,
-                    "FCS diagnostic 11: Within context is missing.");
+                    "Within context is missing.");
         }
 
         KoralContext contextSpan;
@@ -157,7 +157,7 @@
         }
         else {
             throw new KoralException(StatusCodes.QUERY_TOO_COMPLEX,
-                    "FCS diagnostic 11: Within scope " + scope.toString()
+                    "Within scope " + scope.toString()
                             + " is currently unsupported.");
         }
 
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/FCSQLQueryProcessor.java b/src/main/java/de/ids_mannheim/korap/query/serialize/FCSQLQueryProcessor.java
index 06036ad..3717cba 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/FCSQLQueryProcessor.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/FCSQLQueryProcessor.java
@@ -70,12 +70,12 @@
     private boolean isVersionValid() {
         if (version == null || version.isEmpty()) {
             addError(StatusCodes.MISSING_VERSION,
-                    "SRU diagnostic 7: Version number is missing.");
+                    "Version number is missing.");
             return false;
         }
         else if (!version.equals(VERSION_2_0)) {
-            addError(StatusCodes.MISSING_VERSION,
-                    "SRU diagnostic 5: Only supports SRU version 2.0.");
+            addError(StatusCodes.UNSUPPORTED_VERSION,
+                    "Only supports SRU version 2.0.");
             return false;
         }
         return true;
@@ -88,25 +88,24 @@
     private FCSSRUQuery parseQueryStringtoFCSQuery(String query) {
         if ((query == null) || query.isEmpty())
             addError(StatusCodes.NO_QUERY,
-                    "SRU diagnostic 1: No query has been passed.");
+                    "No query has been passed.");
         FCSSRUQuery fcsQuery = null;
         try {
             QueryNode parsedQuery = fcsParser.parse(query);
             fcsQuery = new FCSSRUQuery(query, parsedQuery);
             if (fcsQuery == null) {
                 addError(StatusCodes.UNKNOWN_QUERY_ERROR,
-                        "FCS diagnostic 10: Unexpected error while parsing query.");
+                        "Unexpected error while parsing query.");
             }
         }
         catch (QueryParserException e) {
             addError(
                     StatusCodes.UNKNOWN_QUERY_ERROR,
-                    "FCS diagnostic 10: Query cannot be parsed, "
+                    "Query cannot be parsed, "
                             + e.getMessage());
         }
         catch (Exception e) {
-            addError(StatusCodes.UNKNOWN_QUERY_ERROR, "FCS diagnostic 10: "
-                    + "Unexpected error while parsing query.");
+            addError(StatusCodes.UNKNOWN_QUERY_ERROR, "Unexpected error while parsing query.");
         }
         return fcsQuery;
     }
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/util/StatusCodes.java b/src/main/java/de/ids_mannheim/korap/query/serialize/util/StatusCodes.java
index 1f896b3..8a7f6e0 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/util/StatusCodes.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/util/StatusCodes.java
@@ -10,6 +10,7 @@
 	public final static int UNKNOWN_QUERY_LANGUAGE = 307;
     public final static int UNBOUND_ANNIS_RELATION = 308;
 	public final static int MISSING_VERSION = 309;
-	public final static int QUERY_TOO_COMPLEX = 310;
+	public final static int UNSUPPORTED_VERSION = 310;
+	public final static int QUERY_TOO_COMPLEX = 311;
 	public final static int UNKNOWN_QUERY_ERROR = 399;
 }
\ No newline at end of file
diff --git a/src/test/java/de/ids_mannheim/korap/query/serialize/FCSQLComplexTest.java b/src/test/java/de/ids_mannheim/korap/query/serialize/FCSQLComplexTest.java
index 973c838..990f611 100644
--- a/src/test/java/de/ids_mannheim/korap/query/serialize/FCSQLComplexTest.java
+++ b/src/test/java/de/ids_mannheim/korap/query/serialize/FCSQLComplexTest.java
@@ -382,9 +382,9 @@
         query = "[cnx:pos=\"VVFIN\"] within u";
         error = FCSQLQueryProcessorTest.getError(new FCSQLQueryProcessor(query,
                 "2.0"));
-        assertEquals(310, error.get(0));
+        assertEquals(311, error.get(0));
         assertEquals(
-                "FCS diagnostic 11: Within scope UTTERANCE is currently unsupported.",
+                "Within scope UTTERANCE is currently unsupported.",
                 (String) error.get(1));
     }
 
@@ -428,31 +428,30 @@
 
     @Test
     public void testWrongQuery() throws IOException {
+        
+        String errorMessage = "Query cannot be parsed, an unexpcected occured exception while parsing";
+        
         // expression should always be within a segment
         query = "!(mate:lemma=\"sein\" | mate:pos=\"PPOSS\")";
         error = FCSQLQueryProcessorTest.getError(new FCSQLQueryProcessor(query,
                 "2.0"));
         assertEquals(399, error.get(0));
-        assertEquals(true,
-                error.get(1).toString().startsWith("FCS diagnostic 10"));
+        assertEquals(errorMessage, error.get(1).toString());
 
         query = "![mate:lemma=\"sein\" | mate:pos=\"PPOSS\"]";
         error = FCSQLQueryProcessorTest.getError(new FCSQLQueryProcessor(query,
                 "2.0"));
-        assertEquals(true,
-                error.get(1).toString().startsWith("FCS diagnostic 10"));
+        assertEquals(errorMessage, error.get(1).toString());
 
         query = "(\"blaue\"&\"grüne\")";
         error = FCSQLQueryProcessorTest.getError(new FCSQLQueryProcessor(query,
                 "2.0"));
-        assertEquals(true,
-                error.get(1).toString().startsWith("FCS diagnostic 10"));
+        assertEquals(errorMessage, error.get(1).toString());
 
         query = "[pos=\"NN\"]&[text=\"Mann\"]";
         error = FCSQLQueryProcessorTest.getError(new FCSQLQueryProcessor(query,
                 "2.0"));
         assertEquals(399, error.get(0));
-        String msg = (String) error.get(1);
-        assertEquals(true, msg.startsWith("FCS diagnostic 10"));
+        assertEquals(errorMessage, error.get(1).toString());
     }
 }
diff --git a/src/test/java/de/ids_mannheim/korap/query/serialize/FCSQLQueryProcessorTest.java b/src/test/java/de/ids_mannheim/korap/query/serialize/FCSQLQueryProcessorTest.java
index 407e6bd..8fa70df 100644
--- a/src/test/java/de/ids_mannheim/korap/query/serialize/FCSQLQueryProcessorTest.java
+++ b/src/test/java/de/ids_mannheim/korap/query/serialize/FCSQLQueryProcessorTest.java
@@ -48,13 +48,13 @@
     @Test
     public void testVersion() throws JsonProcessingException {
         error = getError(new FCSQLQueryProcessor("\"Sonne\"", "1.0"));
-        assertEquals(309, error.get(0));
-        assertEquals("SRU diagnostic 5: Only supports SRU version 2.0.",
+        assertEquals(310, error.get(0));
+        assertEquals("Only supports SRU version 2.0.",
                 error.get(1));
 
         error = getError(new FCSQLQueryProcessor("\"Sonne\"", null));
         assertEquals(309, error.get(0));
-        assertEquals("SRU diagnostic 7: Version number is missing.",
+        assertEquals("Version number is missing.",
                 error.get(1));
     }
 
@@ -117,14 +117,14 @@
                 "2.0"));
         assertEquals(306, error.get(0));
         String msg = (String) error.get(1);
-        assertEquals(true, msg.startsWith("SRU diagnostic 48: Regexflags"));
+        assertEquals(true, msg.startsWith("Regexflags"));
 
         query = "\"Fliegen\" /d";
         error = FCSQLQueryProcessorTest.getError(new FCSQLQueryProcessor(query,
                 "2.0"));
         assertEquals(306, error.get(0));
         assertEquals(
-                "SRU diagnostic 48: Regexflag: IGNORE_DIACRITICS is unsupported.",
+                "Regexflag: IGNORE_DIACRITICS is unsupported.",
                 (String) error.get(1));
     }
 
@@ -300,7 +300,7 @@
         error = getError(new FCSQLQueryProcessor(query, "2.0"));
         assertEquals(399, error.get(0));
         assertEquals(
-                "FCS diagnostic 10: Query cannot be parsed, an unexpcected occured exception while parsing",
+                "Query cannot be parsed, an unexpcected occured exception while parsing",
                 error.get(1));
     }
 
@@ -311,34 +311,34 @@
         error = getError(new FCSQLQueryProcessor(query, "2.0"));
         assertEquals(306, error.get(0));
         assertEquals(
-                "SRU diagnostic 48: Layer lemma with qualifier opennlp is unsupported.",
+                "Layer lemma with qualifier opennlp is unsupported.",
                 error.get(1));
 
         query = "[tt:morph = \"sein\"]";
         error = getError(new FCSQLQueryProcessor(query, "2.0"));
         assertEquals(306, error.get(0));
-        assertEquals("SRU diagnostic 48: Layer morph is unsupported.",
+        assertEquals("Layer morph is unsupported.",
                 error.get(1));
 
         // unsupported qualifier
         query = "[malt:lemma = \"sein\"]";
         error = getError(new FCSQLQueryProcessor(query, "2.0"));
         assertEquals(306, error.get(0));
-        assertEquals("SRU diagnostic 48: Qualifier malt is unsupported.",
+        assertEquals("Qualifier malt is unsupported.",
                 error.get(1));
 
         // unsupported layer
         query = "[cnx:morph = \"heit\"]";
         error = getError(new FCSQLQueryProcessor(query, "2.0"));
         assertEquals(306, error.get(0));
-        assertEquals("SRU diagnostic 48: Layer morph is unsupported.",
+        assertEquals("Layer morph is unsupported.",
                 error.get(1));
 
         // missing layer
         query = "[cnx=\"V\"]";
         error = getError(new FCSQLQueryProcessor(query, "2.0"));
         assertEquals(306, error.get(0));
-        assertEquals("SRU diagnostic 48: Layer cnx is unsupported.",
+        assertEquals("Layer cnx is unsupported.",
                 error.get(1));
     }
 }