From 8bd3e0dddacba4fc8b8e668b9ce16b1844f51366 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Sch=C3=A4rtl?= <andreas@schaertl.me> Date: Tue, 15 Sep 2020 11:58:48 +0200 Subject: [PATCH] fine tune configuration errors --- .../src/main/java/info/mathhub/uloapi/config/Config.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ulo-storage-applications/src/main/java/info/mathhub/uloapi/config/Config.java b/src/ulo-storage-applications/src/main/java/info/mathhub/uloapi/config/Config.java index fb77a88..32d585e 100644 --- a/src/ulo-storage-applications/src/main/java/info/mathhub/uloapi/config/Config.java +++ b/src/ulo-storage-applications/src/main/java/info/mathhub/uloapi/config/Config.java @@ -3,6 +3,7 @@ package info.mathhub.uloapi.config; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.util.MissingResourceException; import java.util.ResourceBundle; public class Config { @@ -40,7 +41,7 @@ public class Config { return environmentValue; } - log.debug("could not read environment variable {}, falling back to configuration file", environmentKey); + log.info("could not read environment variable {}, falling back to configuration file", environmentKey); // try to read the configuration from the configuration file; // this is useful when debugging and running this application as @@ -49,12 +50,12 @@ public class Config { try { final ResourceBundle bundle = ResourceBundle.getBundle("uloapi"); return bundle.getString(configFileKey); - } catch (NullPointerException e) { + } catch (NullPointerException | MissingResourceException | ClassCastException e) { log.warn(e.getMessage()); log.error("could not look up configuration option {}/{}; aborting", environmentKey, configFileKey); System.exit(1); } - throw new IllegalStateException("should not be reachable"); + throw new IllegalStateException("could not load configuration"); } } -- GitLab