Fixed empty named VC path in configuration (solves #754)

Change-Id: I0eb93b056f095c0fb75746842ee636586711a44a
diff --git a/Changes b/Changes
index 111885d..691a5d7 100644
--- a/Changes
+++ b/Changes
@@ -5,6 +5,7 @@
 - Cleaned up named-vc.  
 - Updated tests using the old match info web-services (#757)
 - Added deprecation warning for the old matchInfo service (#757)
+- Fixed empty named VC path in configuration (solves #754)
 
 # version 0.73.1
 
diff --git a/pom.xml b/pom.xml
index 0fce0e9..9cc6f48 100644
--- a/pom.xml
+++ b/pom.xml
@@ -18,7 +18,7 @@
 		<jetty.version>11.0.19</jetty.version>
 		<flyway.version>10.6.0</flyway.version>
 		<log4j.version>2.22.1</log4j.version>
-		<krill.version>[0.62.4,)</krill.version>
+		<krill.version>[0.62.5,)</krill.version>
 		<koral.version>[0.42,)</koral.version>
 	</properties>
 	<profiles>
diff --git a/src/main/java/de/ids_mannheim/korap/config/KustvaktConfiguration.java b/src/main/java/de/ids_mannheim/korap/config/KustvaktConfiguration.java
index 0e16623..d69f3c6 100644
--- a/src/main/java/de/ids_mannheim/korap/config/KustvaktConfiguration.java
+++ b/src/main/java/de/ids_mannheim/korap/config/KustvaktConfiguration.java
@@ -123,6 +123,7 @@
         load(properties);
         //        readPipesFile("pipes");
         KrillProperties.setProp(properties);
+        KrillProperties.updateConfigurations(properties);
     }
 
     public KustvaktConfiguration () {}
@@ -145,7 +146,6 @@
      */
     protected void load (Properties properties) throws Exception {
         loadBasicProperties(properties);
-        loadKrillProperties(properties);
 
         apiWelcomeMessage = properties.getProperty("api.welcome.message",
                 "Welcome to KorAP API!");
@@ -222,26 +222,6 @@
         networkEndpointURL = properties.getProperty("network.endpoint.url", "");
     }
 
-    private void loadKrillProperties (Properties properties) {
-        try {
-            String maxTokenMatch = properties.getProperty("krill.match.max.token");
-            if (maxTokenMatch != null) {
-                KrillProperties.maxTokenMatchSize = Integer.parseInt(maxTokenMatch);
-            }
-    
-            String maxTokenContext = properties
-                    .getProperty("krill.context.max.token");
-            if (maxTokenContext != null) {
-                KrillProperties.maxTokenContextSize = Integer
-                        .parseInt(maxTokenContext);
-            }
-        }
-        catch (NumberFormatException e) {
-            log.error("A Krill property expects numerical values: "
-                    + e.getMessage());
-        };
-    }
-
     @Deprecated
     public void readPipesFile (String filename) throws IOException {
         File file = new File(filename);
diff --git a/src/test/java/de/ids_mannheim/korap/web/controller/StatisticsControllerTest.java b/src/test/java/de/ids_mannheim/korap/web/controller/StatisticsControllerTest.java
index ecdad64..ea5008f 100644
--- a/src/test/java/de/ids_mannheim/korap/web/controller/StatisticsControllerTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/controller/StatisticsControllerTest.java
@@ -213,4 +213,18 @@
         assertEquals(25074, node.at("/sentences").asInt());
         assertEquals(772, node.at("/paragraphs").asInt());
     }
+    
+    @Test
+    public void testStatisticsWithNamedVC () throws KustvaktException {
+        Response response = target().path(API_VERSION).path("statistics")
+                .queryParam("cq", "referTo unknownVC")
+                .request().method("GET");
+        String ent = response.readEntity(String.class);
+        assertEquals(Status.OK.getStatusCode(), response.getStatus());
+        JsonNode node = JsonUtils.readTree(ent);
+        assertEquals(0, node.at("/documents").asInt());
+        assertEquals(0, node.at("/tokens").asInt());
+        assertEquals(0, node.at("/sentences").asInt());
+        assertEquals(0, node.at("/paragraphs").asInt());
+    }
 }
diff --git a/src/test/java/de/ids_mannheim/korap/web/controller/VCReferenceTest.java b/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusReferenceTest.java
similarity index 92%
rename from src/test/java/de/ids_mannheim/korap/web/controller/VCReferenceTest.java
rename to src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusReferenceTest.java
index 2afb2f7..5c53e17 100644
--- a/src/test/java/de/ids_mannheim/korap/web/controller/VCReferenceTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusReferenceTest.java
@@ -30,7 +30,7 @@
 import jakarta.ws.rs.core.Response;
 import jakarta.ws.rs.core.Response.Status;
 
-public class VCReferenceTest extends SpringJerseyTest {
+public class VirtualCorpusReferenceTest extends SpringJerseyTest {
 
     @Autowired
     private NamedVCLoader vcLoader;
@@ -130,7 +130,7 @@
     public void testStatisticsWithRef () throws KustvaktException {
         String corpusQuery = "availability = /CC-BY.*/ & referTo named-vc1";
         Response response = target().path(API_VERSION).path("statistics")
-                .queryParam("corpusQuery", corpusQuery).request().get();
+                .queryParam("cq", corpusQuery).request().get();
         String ent = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(ent);
         assertEquals(2, node.at("/documents").asInt());
@@ -139,6 +139,19 @@
     }
 
     @Test
+    public void testStatisticsWithUnknownVC () throws KustvaktException {
+        String corpusQuery = "referTo unknown-vc";
+        Response response = target().path(API_VERSION).path("statistics")
+                .queryParam("cq", corpusQuery).request().get();
+        String ent = response.readEntity(String.class);
+        assertEquals(Status.OK.getStatusCode(), response.getStatus());
+        JsonNode node = JsonUtils.readTree(ent);
+        assertEquals(0, node.at("/documents").asInt());
+        assertEquals(0, node.at("/tokens").asInt());
+        assertEquals(0, node.at("/sentences").asInt());
+    }
+    
+    @Test
     public void testRefVcNotExist () throws KustvaktException {
         Response response = target().path(API_VERSION).path("search")
                 .queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
diff --git a/src/test/java/de/ids_mannheim/korap/web/lite/LiteStatisticControllerTest.java b/src/test/java/de/ids_mannheim/korap/web/lite/LiteStatisticControllerTest.java
index 4314ef0..5fe5b1a 100644
--- a/src/test/java/de/ids_mannheim/korap/web/lite/LiteStatisticControllerTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/lite/LiteStatisticControllerTest.java
@@ -160,4 +160,18 @@
         assertEquals(25074, node.at("/sentences").asInt());
         assertEquals(772, node.at("/paragraphs").asInt());
     }
+    
+    @Test
+    public void testStatisticsWithNamedVC () throws KustvaktException {
+        Response response = target().path(API_VERSION).path("statistics")
+                .queryParam("cq", "referTo unknownVC")
+                .request().method("GET");
+        String ent = response.readEntity(String.class);
+        assertEquals(Status.OK.getStatusCode(), response.getStatus());
+        JsonNode node = JsonUtils.readTree(ent);
+        assertEquals(0, node.at("/documents").asInt());
+        assertEquals(0, node.at("/tokens").asInt());
+        assertEquals(0, node.at("/sentences").asInt());
+        assertEquals(0, node.at("/paragraphs").asInt());
+    }
 }