cleanup + misc. fixes
[mir.git] / source / mir / config / MirPropertiesConfiguration.java
index 198ff3a..2b3089e 100755 (executable)
@@ -165,22 +165,25 @@ public class MirPropertiesConfiguration extends ExtendedProperties {
 
   /**
    * @return the value of this property as String
-   * @param key the key of the property
-   * @param defaultValue the default value of this property if it is null
+   * @param aKey the key of the property
+   * @param aDefaultValue the default value of this property if it is null
    * @see org.apache.commons.collections.ExtendedProperties#getString(java.lang.String, java.lang.String)
    */
-  public String getString(String key, String defaultValue) {
-    Object object = getProperty(key);
-    if(object == null){
-      if (defaultValue == null) {
-        return new String();
-      }
-      return defaultValue;
+  public String getString(String aKey, String aDefaultValue) {
+    if (aDefaultValue == null) {
+      aDefaultValue = "";
     }
-    if (object instanceof String) {
-      return (String)object;
+    Object result = getProperty(aKey);
+
+    if (result == null){
+      return aDefaultValue;
     }
-    return object.toString();
+
+    if (result instanceof String) {
+      return (String) result;
+    }
+
+    return result.toString();
   }
 
   public boolean getBoolean(String aKey, boolean aDefaultValue) {
@@ -196,7 +199,7 @@ public class MirPropertiesConfiguration extends ExtendedProperties {
     String value = getString(aKey).trim();
 
     return "1".equals(value) || "y".equalsIgnoreCase(value) ||
-        "yes".equalsIgnoreCase(value) || "true".equalsIgnoreCase(value);
+           "yes".equalsIgnoreCase(value) || "true".equalsIgnoreCase(value);
   }
 
   /**