Skip to content
Snippets Groups Projects
Commit cd7715be authored by felmer's avatar felmer
Browse files

SP-182, Bis-109: method loadAndAppendProperties added

SVN: 26687
parent 2712e492
No related branches found
No related tags found
No related merge requests found
...@@ -586,6 +586,20 @@ public final class PropertyUtils ...@@ -586,6 +586,20 @@ public final class PropertyUtils
public static Properties loadProperties(File propertiesFile) public static Properties loadProperties(File propertiesFile)
{ {
Properties properties = new Properties(); 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); List<String> lines = FileUtilities.loadToStringList(propertiesFile);
for (int i = 0; i < lines.size(); i++) for (int i = 0; i < lines.size(); i++)
{ {
...@@ -604,7 +618,6 @@ public final class PropertyUtils ...@@ -604,7 +618,6 @@ public final class PropertyUtils
String value = line.substring(indexOfEqualSymbol + 1).trim(); String value = line.substring(indexOfEqualSymbol + 1).trim();
properties.setProperty(key, value); properties.setProperty(key, value);
} }
return properties;
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment