better exception message on key not found

This commit is contained in:
Adrian Cole 2012-04-24 12:27:16 -07:00
parent ba7ba36d20
commit c624c88274
1 changed files with 2 additions and 0 deletions

View File

@ -231,6 +231,8 @@ public class ContextBuilder {
try {
return find(newArrayList(mutable.getProperty(prov + "." + key), mutable.getProperty("jclouds." + key)),
notNull());
} catch (NoSuchElementException e) {
throw new NoSuchElementException(String.format("property %s.%s not present in properties: %s", prov, key, mutable.keySet()));
} finally {
mutable.remove(prov + "." + key);
mutable.remove("jclouds." + key);