Minor changes to the UI and fixes to empty corpus queries

Change-Id: If9dce8fd2cdfe441a6637d6caaaa334e6921d420
diff --git a/plugin/src/main/java/de/ids_mannheim/korap/plkexport/IdsExportService.java b/plugin/src/main/java/de/ids_mannheim/korap/plkexport/IdsExportService.java
index 51bfb7a..eab7f3d 100644
--- a/plugin/src/main/java/de/ids_mannheim/korap/plkexport/IdsExportService.java
+++ b/plugin/src/main/java/de/ids_mannheim/korap/plkexport/IdsExportService.java
@@ -55,6 +55,7 @@
  * - Add hitc to form.
  * - Add infos to JsonExporter.
  * - Add date info.
+ * - Adjust count, if hitc < count.
  */
 
 @Path("/")
@@ -173,7 +174,7 @@
             .queryParam("ql", ql)
             ;
 
-        if (cq != null)
+        if (cq != null && cq.length() > 0)
             uri = uri.queryParam("cq", cq);
         
         if (path != "") {
@@ -204,6 +205,7 @@
             resp = authBuilder(reqBuilder, xff, auth).get(String.class);
             
         } catch (Exception e) {
+            System.err.println("Unable to reach: " + uri.build());
             throw new WebApplicationException(
                 responseForm(Status.BAD_GATEWAY, "Unable to reach Backend")
                 );
diff --git a/plugin/src/main/java/de/ids_mannheim/korap/plkexport/PluginServer.java b/plugin/src/main/java/de/ids_mannheim/korap/plkexport/PluginServer.java
index 8bbd366..d51c2e7 100644
--- a/plugin/src/main/java/de/ids_mannheim/korap/plkexport/PluginServer.java
+++ b/plugin/src/main/java/de/ids_mannheim/korap/plkexport/PluginServer.java
@@ -60,7 +60,7 @@
                 properties.getProperty("api.scheme") +
                 "://" +
                 properties.getProperty("api.host") +
-                properties.getProperty("api.path") + ":" +
+                properties.getProperty("api.path","") + ":" +
                 properties.getProperty("api.port")
                 );
             jettyServer.join();
diff --git a/plugin/src/main/java/de/ids_mannheim/korap/plkexport/RtfExporter.java b/plugin/src/main/java/de/ids_mannheim/korap/plkexport/RtfExporter.java
index b3aa445..7c0f7bc 100644
--- a/plugin/src/main/java/de/ids_mannheim/korap/plkexport/RtfExporter.java
+++ b/plugin/src/main/java/de/ids_mannheim/korap/plkexport/RtfExporter.java
@@ -148,13 +148,16 @@
 
     private void addInfoTable (Writer w) throws IOException {
 
+        String q = this.getQueryString();
+
         // Add Information table
-        if (this.getQueryString() != null) {
+        if (q != null && q.length() > 0) {
             this.addInfoRow(w, "Query", this.getQueryString());
         };
 
-        if (this.getCorpusQueryString() != null) {
-            this.addInfoRow(w, "Corpus", this.getCorpusQueryString());
+        q = this.getCorpusQueryString();
+        if (q != null && q.length() > 0) {
+            this.addInfoRow(w, "Corpus", q);
         };
 
         if (this.getTotalResults() != -1) {
@@ -175,8 +178,9 @@
             this.addInfoRow(w, "Fetched", this.getMaxResults());
         };
 
-        if (this.getSource() != null) {
-            this.addInfoRow(w, "Source", this.getSource());
+        q = this.getSource();
+        if (q != null && q.length() > 0) {
+            this.addInfoRow(w, "Source", q);
         };
 
         if (this.getMeta() != null && this.getMeta().has("version")) {