Browse Source

Misplaced null check.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271611 13f79535-47bb-0310-9956-ffa450edef68
master
Magesh Umasankar 23 years ago
parent
commit
22e36e493c
1 changed files with 9 additions and 8 deletions
  1. +9
    -8
      proposal/sandbox/filterreaders/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java

+ 9
- 8
proposal/sandbox/filterreaders/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java View File

@@ -130,18 +130,19 @@ public final class LoadProperties extends Task {
crh.setFilterChains(filterChains);

String text = crh.processStream();
if (!text.endsWith("\n")) {
text = text + "\n";
}

if (text != null) {
StringInputStream sis = new StringInputStream(text);
Properties props = new Properties();
if (!text.endsWith("\n")) {
text = text + "\n";
}

final StringInputStream sis = new StringInputStream(text);
final Properties props = new Properties();
props.load(sis);
Enumeration e = props.keys();
final Enumeration e = props.keys();
while (e.hasMoreElements()) {
String key = (String) e.nextElement();
String value = props.getProperty(key);
final String key = (String) e.nextElement();
final String value = props.getProperty(key);
if (key != null && value != null
&& value.trim().length() > 0) {
project.setNewProperty(key, value);


Loading…
Cancel
Save