Skip to content
Snippets Groups Projects
Commit 8bd3e0dd authored by Andreas Schärtl's avatar Andreas Schärtl
Browse files

fine tune configuration errors

parent f44a6e90
No related branches found
No related tags found
No related merge requests found
...@@ -3,6 +3,7 @@ package info.mathhub.uloapi.config; ...@@ -3,6 +3,7 @@ package info.mathhub.uloapi.config;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.MissingResourceException;
import java.util.ResourceBundle; import java.util.ResourceBundle;
public class Config { public class Config {
...@@ -40,7 +41,7 @@ public class Config { ...@@ -40,7 +41,7 @@ public class Config {
return environmentValue; 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; // try to read the configuration from the configuration file;
// this is useful when debugging and running this application as // this is useful when debugging and running this application as
...@@ -49,12 +50,12 @@ public class Config { ...@@ -49,12 +50,12 @@ public class Config {
try { try {
final ResourceBundle bundle = ResourceBundle.getBundle("uloapi"); final ResourceBundle bundle = ResourceBundle.getBundle("uloapi");
return bundle.getString(configFileKey); return bundle.getString(configFileKey);
} catch (NullPointerException e) { } catch (NullPointerException | MissingResourceException | ClassCastException e) {
log.warn(e.getMessage()); log.warn(e.getMessage());
log.error("could not look up configuration option {}/{}; aborting", environmentKey, configFileKey); log.error("could not look up configuration option {}/{}; aborting", environmentKey, configFileKey);
System.exit(1); System.exit(1);
} }
throw new IllegalStateException("should not be reachable"); throw new IllegalStateException("could not load configuration");
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment