This is an automated email from the ASF dual-hosted git repository.
smckinney pushed a commit to branch FC-265
in repository https://gitbox.apache.org/repos/asf/directory-fortress-core.git
The following commit(s) were added to refs/heads/FC-265 by this push:
new 73da461 get boolean property defaults to false even on error.
73da461 is described below
commit 73da461f0ea64f900378e3e7bc588a3880c5ee81
Author: Shawn McKinney <smckinney@apache.org>
AuthorDate: Fri Mar 15 19:36:54 2019 -0500
get boolean property defaults to false even on error.
---
.../directory/fortress/core/util/Config.java | 34 +++++++++++++++-------
1 file changed, 24 insertions(+), 10 deletions(-)
diff --git a/src/main/java/org/apache/directory/fortress/core/util/Config.java b/src/main/java/org/apache/directory/fortress/core/util/Config.java
index ce2d1ed..f459f57 100755
--- a/src/main/java/org/apache/directory/fortress/core/util/Config.java
+++ b/src/main/java/org/apache/directory/fortress/core/util/Config.java
@@ -311,14 +311,21 @@ public final class Config
public boolean getBoolean( String key )
{
boolean value = false;
- if ( config != null )
+ try
{
- value = config.getBoolean( key );
+ if (config != null)
+ {
+ value = config.getBoolean(key);
+ }
+ else
+ {
+ String warn = "getBoolean - invalid config, can't read prop [" + key + "]";
+ LOG.warn(warn);
+ }
}
- else
+ catch (java.util.NoSuchElementException e )
{
- String warn = "getBoolean - invalid config, can't read prop [" + key + "]";
- LOG.warn( warn );
+ // prop not found, ignore.
}
return value;
}
@@ -333,14 +340,21 @@ public final class Config
public boolean getBoolean( String key, boolean defaultValue )
{
boolean value = defaultValue;
- if ( config != null )
+ try
{
- value = config.getBoolean( key, defaultValue );
+ if ( config != null )
+ {
+ value = config.getBoolean( key, defaultValue );
+ }
+ else
+ {
+ String warn = "getBoolean - invalid config, can't read prop [" + key + "]";
+ LOG.warn( warn );
+ }
}
- else
+ catch (java.util.NoSuchElementException e )
{
- String warn = "getBoolean - invalid config, can't read prop [" + key + "]";
- LOG.warn( warn );
+ // prop not found, ignore.
}
return value;
}
|