From 22e36e493cfa20ba754a35363401781f7a4cd588 Mon Sep 17 00:00:00 2001 From: Magesh Umasankar Date: Thu, 28 Feb 2002 19:16:36 +0000 Subject: [PATCH] Misplaced null check. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271611 13f79535-47bb-0310-9956-ffa450edef68 --- .../tools/ant/taskdefs/LoadProperties.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/proposal/sandbox/filterreaders/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java b/proposal/sandbox/filterreaders/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java index e3cd0ae7f..5e0c4a4ec 100644 --- a/proposal/sandbox/filterreaders/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java +++ b/proposal/sandbox/filterreaders/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java @@ -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);