From 42c4cc87908e981e7247356c82cb66bcd26dadaf Mon Sep 17 00:00:00 2001 From: Markus Holtermann Date: Wed, 1 Aug 2012 16:49:33 +0200 Subject: [PATCH] add some error information to config --- .../cloudraid/config/impl/Config.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/config/src/de/dhbw_mannheim/cloudraid/config/impl/Config.java b/config/src/de/dhbw_mannheim/cloudraid/config/impl/Config.java index ee2a9d5..e840231 100644 --- a/config/src/de/dhbw_mannheim/cloudraid/config/impl/Config.java +++ b/config/src/de/dhbw_mannheim/cloudraid/config/impl/Config.java @@ -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)) { @@ -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)); } @@ -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)); } @@ -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)); } @@ -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)); @@ -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); @@ -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;