From a2d6c849b9e17398f9641fa41c0b381f5d80d58c Mon Sep 17 00:00:00 2001 From: mdb Date: Tue, 26 Nov 2002 01:57:22 +0000 Subject: [PATCH] Minor fiddling. git-svn-id: https://samskivert.googlecode.com/svn/trunk@950 6335cc39-0255-0410-8fd6-9bcaacd3b74c --- .../src/java/com/samskivert/util/Config.java | 11 ++++------- .../java/com/samskivert/util/ConfigUtil.java | 17 ++++++++++++----- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/projects/samskivert/src/java/com/samskivert/util/Config.java b/projects/samskivert/src/java/com/samskivert/util/Config.java index 265db642..3d9d5bed 100644 --- a/projects/samskivert/src/java/com/samskivert/util/Config.java +++ b/projects/samskivert/src/java/com/samskivert/util/Config.java @@ -1,5 +1,5 @@ // -// $Id: Config.java,v 1.17 2002/11/24 04:51:02 mdb Exp $ +// $Id: Config.java,v 1.18 2002/11/26 01:57:22 mdb Exp $ // // samskivert library - useful routines for java programs // Copyright (C) 2001 Michael Bayne @@ -104,17 +104,14 @@ public class Config public Config (String path) { // first load up our default prefs + _props = new Properties(); + try { // append the file suffix onto the path String ppath = path + PROPS_SUFFIX; // load the properties file - _props = ConfigUtil.loadInheritedProperties(ppath); - if (_props == null) { - Log.warning("Unable to locate configuration definitions " + - "[path=" + path + "]."); - _props = new Properties(); - } + ConfigUtil.loadInheritedProperties(ppath, _props); } catch (IOException ioe) { Log.warning("Unable to load configuration [path=" + path + diff --git a/projects/samskivert/src/java/com/samskivert/util/ConfigUtil.java b/projects/samskivert/src/java/com/samskivert/util/ConfigUtil.java index 8249cad7..3f3f9909 100644 --- a/projects/samskivert/src/java/com/samskivert/util/ConfigUtil.java +++ b/projects/samskivert/src/java/com/samskivert/util/ConfigUtil.java @@ -1,5 +1,5 @@ // -// $Id: ConfigUtil.java,v 1.8 2002/11/25 22:25:20 mdb Exp $ +// $Id: ConfigUtil.java,v 1.9 2002/11/26 01:57:22 mdb Exp $ // // samskivert library - useful routines for java programs // Copyright (C) 2001 Michael Bayne @@ -58,8 +58,6 @@ public class ConfigUtil * Like {@link #loadProperties(String)} but this method uses the * supplied class loader rather than the class loader used to load the * ConfigUtil class. - * - * @see #loadProperties(String) */ public static Properties loadProperties (String path, ClassLoader loader) throws IOException @@ -223,12 +221,21 @@ public class ConfigUtil path, ConfigUtil.class.getClassLoader()); } + /** + * Like {@link #loadInheritedProperties(String)} but loads the + * properties into the supplied target object. + */ + public static void loadInheritedProperties (String path, Properties target) + throws IOException + { + loadInheritedProperties( + path, ConfigUtil.class.getClassLoader(), target); + } + /** * Like {@link #loadInheritedProperties(String)} but this method uses * the supplied class loader rather than the class loader used to load * the ConfigUtil class. - * - * @see #loadInheritedProperties(String) */ public static Properties loadInheritedProperties ( String path, ClassLoader loader)