From e2161ece234e196ad7f9c4f84f906eb1776a20a1 Mon Sep 17 00:00:00 2001
From: Daniel <daniel@harvey>
Date: Wed, 27 Nov 2019 11:19:37 +0100
Subject: [PATCH] FIX: Calling Info on freshly started CaosDB works again.

Also now syncs the database info if that has not been done before.

Fixes #54.
---
 src/main/java/caosdb/server/utils/Info.java | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/main/java/caosdb/server/utils/Info.java b/src/main/java/caosdb/server/utils/Info.java
index e35b77bf..bf85546d 100644
--- a/src/main/java/caosdb/server/utils/Info.java
+++ b/src/main/java/caosdb/server/utils/Info.java
@@ -77,7 +77,7 @@ public class Info extends AbstractObservable implements Observer, TransactionInt
   private static int recordsCount = -1;
   private static int recordTypesCount = -1;
   private static int tmpFilesCount;
-  private static String fssize;
+  private static String fssize = "";
 
   public static Integer getRecordsCount() throws Exception {
     return recordsCount;
@@ -197,6 +197,9 @@ public class Info extends AbstractObservable implements Observer, TransactionInt
    *     TODO: The error format for missing or not readable drop off box has to be specified.
    */
   public static Element toElement(final boolean tree) throws Exception, SQLException {
+    if (filesCount == -1 && recordsCount == -1) {
+      getInstance().syncDatabase();
+    }
     dropOffBox = new File(FileSystem.getDropOffBox());
     final Element info = new Element("Stats");
     final Element counts = new Element("counts");
-- 
GitLab