Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openbis
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sispub
openbis
Commits
cd7715be
Commit
cd7715be
authored
12 years ago
by
felmer
Browse files
Options
Downloads
Patches
Plain Diff
SP-182, Bis-109: method loadAndAppendProperties added
SVN: 26687
parent
2712e492
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
common/source/java/ch/systemsx/cisd/common/utilities/PropertyUtils.java
+14
-1
14 additions, 1 deletion
...java/ch/systemsx/cisd/common/utilities/PropertyUtils.java
with
14 additions
and
1 deletion
common/source/java/ch/systemsx/cisd/common/utilities/PropertyUtils.java
+
14
−
1
View file @
cd7715be
...
@@ -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
;
}
}
/**
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment