commit | 81907afa0249fd872450989eb35e2dd7923cd991 | [log] [tgz] |
---|---|---|
author | zheilbron <zheilbron@gmail.com> | Thu May 09 15:29:20 2013 -0700 |
committer | zheilbron <zheilbron@gmail.com> | Thu May 09 15:29:20 2013 -0700 |
tree | 43cc8e365fc72db3cbe615b4ae0b8d5b1efe07fe | |
parent | e2eb6eff5eae3fe55cafab278546bb62a5632138 [diff] |
handled undefined property to avoid NPE
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/AsterixPropertiesAccessor.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/AsterixPropertiesAccessor.java index d4f44f6..7b2f2a6 100644 --- a/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/AsterixPropertiesAccessor.java +++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/AsterixPropertiesAccessor.java
@@ -84,9 +84,12 @@ public <T> T getProperty(String property, T defaultValue, IPropertyInterpreter<T> interpreter) { Property p = asterixConfigurationParams.get(property); + if (p == null) { + return defaultValue; + } + try { - T interpretedValue = interpreter.interpret(p); - return interpretedValue == null ? defaultValue : interpretedValue; + return interpreter.interpret(p); } catch (IllegalArgumentException e) { logConfigurationError(p, defaultValue); throw e;