Skip to content

Commit

Permalink
add some error information to config
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkusH committed Aug 1, 2012
1 parent 3ebde8d commit 42c4cc8
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions config/src/de/dhbw_mannheim/cloudraid/config/impl/Config.java
Expand Up @@ -220,7 +220,7 @@ public synchronized boolean delete() {
private synchronized String get(String key) throws NoSuchElementException,
InvalidConfigValueException {
if (!this.containsKey(key)) {
throw new NoSuchElementException();
throw new NoSuchElementException(key);
}
try {
if (this.salts.containsKey(key)) {
Expand Down Expand Up @@ -322,7 +322,7 @@ public synchronized double getDouble(String key, Double defaultVal)
} catch (NoSuchElementException e) {
if (defaultVal == null) {
if (!Config.defaultData.containsKey(key)) {
throw new NoSuchElementException();
throw new NoSuchElementException(key);
}
return Double.parseDouble(Config.defaultData.get(key));
}
Expand Down Expand Up @@ -350,7 +350,7 @@ public synchronized float getFloat(String key, Float defaultVal)
} catch (NoSuchElementException e) {
if (defaultVal == null) {
if (!Config.defaultData.containsKey(key)) {
throw new NoSuchElementException();
throw new NoSuchElementException(key);
}
return Float.parseFloat(Config.defaultData.get(key));
}
Expand Down Expand Up @@ -378,7 +378,7 @@ public synchronized int getInt(String key, Integer defaultVal)
} catch (NoSuchElementException e) {
if (defaultVal == null) {
if (!Config.defaultData.containsKey(key)) {
throw new NoSuchElementException();
throw new NoSuchElementException(key);
}
return Integer.parseInt(Config.defaultData.get(key));
}
Expand Down Expand Up @@ -406,7 +406,7 @@ public synchronized long getLong(String key, Long defaultVal)
} catch (NoSuchElementException e) {
if (defaultVal == null) {
if (!Config.defaultData.containsKey(key)) {
throw new NoSuchElementException();
throw new NoSuchElementException(key);
}
return Long.parseLong(Config.defaultData.get(key));

Expand Down Expand Up @@ -435,7 +435,7 @@ public synchronized String getString(String key, String defaultVal)
} catch (NoSuchElementException e) {
if (defaultVal == null) {
if (!Config.defaultData.containsKey(key)) {
throw new NoSuchElementException();
throw new NoSuchElementException(key);
}
return Config.defaultData.get(key);

Expand Down Expand Up @@ -811,6 +811,8 @@ protected void shutdown() {
*/
protected void startup(BundleContext context) throws InvalidKeyException {
System.out.println("Config: startup: begin");
System.out.println("Config file: " + Config.CONFIG_PATH);
System.out.println("CloudRAID home: " + Config.CLOUDRAID_HOME);
this.doSaveOnShutdown = true;
if (this.init(this.passwordmgr.getCredentials()) == null) {
this.doSaveOnShutdown = false;
Expand Down

0 comments on commit 42c4cc8

Please sign in to comment.