X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=source%2Fmir%2Fconfig%2FMirPropertiesConfiguration.java;h=125dff05c04ef72a3d1ff581206458cb7e92fdc6;hb=88455349028d7ecd46fe04ff8662b584c54c6143;hp=80ece21690339b49c775075f01c4de8bfdfc4f76;hpb=63e0ee1fb8038eb6d8f0190cf38c3b3ab2727216;p=mir.git diff --git a/source/mir/config/MirPropertiesConfiguration.java b/source/mir/config/MirPropertiesConfiguration.java index 80ece216..125dff05 100755 --- a/source/mir/config/MirPropertiesConfiguration.java +++ b/source/mir/config/MirPropertiesConfiguration.java @@ -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. * @@ -18,27 +18,24 @@ * 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); } /**