From cd7715be30a3aef1e155e512b50035ee34876110 Mon Sep 17 00:00:00 2001
From: felmer <felmer>
Date: Thu, 20 Sep 2012 05:50:31 +0000
Subject: [PATCH] SP-182, Bis-109: method loadAndAppendProperties added

SVN: 26687
---
 .../cisd/common/utilities/PropertyUtils.java      | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/common/source/java/ch/systemsx/cisd/common/utilities/PropertyUtils.java b/common/source/java/ch/systemsx/cisd/common/utilities/PropertyUtils.java
index 4ffbdfa0b53..345533598d4 100644
--- a/common/source/java/ch/systemsx/cisd/common/utilities/PropertyUtils.java
+++ b/common/source/java/ch/systemsx/cisd/common/utilities/PropertyUtils.java
@@ -586,6 +586,20 @@ public final class PropertyUtils
     public static Properties loadProperties(File propertiesFile)
     {
         Properties properties = new Properties();
+        loadAndAppendProperties(properties, propertiesFile);
+        return properties;
+    }
+
+    /**
+     * Loads properties from the specified file and adds them to the specified properties.
+     * <ul>
+     * <li>Empty lines and lines starting with a hash symbol '#' are ignored.
+     * <li>All other lines should have a equals symbol '='. The trimmed part before/after '='
+     * specify property key and value , respectively.
+     * </ul>
+     */
+    public static void loadAndAppendProperties(Properties properties, File propertiesFile)
+    {
         List<String> lines = FileUtilities.loadToStringList(propertiesFile);
         for (int i = 0; i < lines.size(); i++)
         {
@@ -604,7 +618,6 @@ public final class PropertyUtils
             String value = line.substring(indexOfEqualSymbol + 1).trim();
             properties.setProperty(key, value);
         }
-        return properties;
     }
 
     /**
-- 
GitLab