tiny fixes here and there
[mir.git] / source / mir / config / MirPropertiesConfiguration.java
index 80ece21..125dff0 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2005 The Mir-coders group
  *
  * This file is part of Mir.
  *
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  * In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with  any library licensed under the Apache Software License,
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
- * (or with modified versions of the above that use the same license as the above),
- * and distribute linked combinations including the two.  You must obey the
- * GNU General Public License in all respects for all of the code used other than
- * the above mentioned libraries.  If you modify this file, you may extend this
+ * the code of this program with  any library licensed under the Apache Software License.
+ * You must obey the GNU General Public License in all respects for all of the code used
+ * other than the above mentioned libraries.  If you modify this file, you may extend this
  * exception to your version of the file, but you are not obligated to do so.
  * If you do not wish to do so, delete this exception statement from your version.
  */
 package mir.config;
 
+import multex.Exc;
+import multex.Failure;
+import org.apache.commons.collections.ExtendedProperties;
+
+import javax.servlet.ServletContext;
 import java.io.File;
 import java.io.IOException;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
-import javax.servlet.ServletContext;
-
-import multex.Exc;
-import multex.Failure;
-import org.apache.commons.collections.ExtendedProperties;
 
 /**
  * @author idefix
@@ -149,9 +146,7 @@ public class MirPropertiesConfiguration extends ExtendedProperties {
     if (result.isAbsolute()) {
       return result;
     }
-    else {
-      return new File(home, path);
-    }
+               return new File(home, path);
   }
 
   /**
@@ -165,22 +160,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;
+    }
+
+    if (result instanceof String) {
+      return (String) result;
     }
-    return object.toString();
+
+    return result.toString();
   }
 
   public boolean getBoolean(String aKey, boolean aDefaultValue) {
@@ -196,7 +194,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);
   }
 
   /**