From 230828048012b33a0c68f40f281571ef4516e2d0 Mon Sep 17 00:00:00 2001 From: Jonathan Bernard Date: Mon, 5 Dec 2011 22:18:26 -0600 Subject: [PATCH] Bugfix. Default behavior in SmartConfig was wrong. What it should be (and now is) is when a value is requested but not present, the value is set and returned with the default if given, or null is returned if no default is given. --- project.properties | 4 ++-- src/main/com/jdbernard/util/SmartConfig.groovy | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/project.properties b/project.properties index 8192ecd..8869e54 100644 --- a/project.properties +++ b/project.properties @@ -1,6 +1,6 @@ -#Mon, 05 Dec 2011 22:11:12 -0600 +#Mon, 05 Dec 2011 22:17:22 -0600 name=jdb-util version=1.4 lib.local=true -build.number=8 +build.number=9 diff --git a/src/main/com/jdbernard/util/SmartConfig.groovy b/src/main/com/jdbernard/util/SmartConfig.groovy index 3f80289..9e8e61e 100644 --- a/src/main/com/jdbernard/util/SmartConfig.groovy +++ b/src/main/com/jdbernard/util/SmartConfig.groovy @@ -45,11 +45,11 @@ public class SmartConfig { def val = props[name] - if (val == null && defVal != null) { + if (val == null) { log.trace("Doesn't exists, setting with given default") val = defVal - this.setProperty(name, defVal) + if (defVal != null) { this.setProperty(name, defVal) } } else {