diff --git a/WHATSNEW b/WHATSNEW index 6d63e2c1e..b37e91d68 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -14,8 +14,8 @@ Other changes: * Translate task logs a debug message specifying the number of files that it processed. Bugzilla Report 13938. -Changes from Ant 1.5.4 to Ant 1.6Beta1 -====================================== +Changes from Ant 1.5.4 to Ant 1.6 +================================= Changes that could break older environments: -------------------------------------------- @@ -79,6 +79,11 @@ Changes that could break older environments: is now Hashtable). This will affect third party code that extend Copy and override Copy#doFileOperations. +* didn't expand properties while + does, so they were not equivalent. This has been fixed, which means + that propetries may get expanded twice if you use an + filterreader. Bugzilla Report 17782. + Fixed bugs: ----------- * Filter readers were not handling line endings properly. Bugzilla diff --git a/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java b/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java index eb127879f..ef20d273e 100644 --- a/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java +++ b/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java @@ -140,6 +140,7 @@ public final class LoadProperties extends Task { FileInputStream fis = null; BufferedInputStream bis = null; Reader instream = null; + ByteArrayInputStream tis = null; try { final long len = srcFile.length(); @@ -166,7 +167,6 @@ public final class LoadProperties extends Task { text = text + "\n"; } - ByteArrayInputStream tis = null; if (encoding == null) { tis = new ByteArrayInputStream(text.getBytes()); } else { @@ -174,16 +174,11 @@ public final class LoadProperties extends Task { } final Properties props = new Properties(); props.load(tis); - final Enumeration e = props.keys(); - while (e.hasMoreElements()) { - final String key = (String) e.nextElement(); - final String value = props.getProperty(key); - if (key != null && value != null - && value.trim().length() > 0) { - getProject().setNewProperty(key, value); - } - } - tis.close(); + + Property propertyTask = + (Property) getProject().createTask("property"); + propertyTask.setTaskName(getTaskName()); + propertyTask.addProperties(props); } } catch (final IOException ioe) { @@ -199,6 +194,13 @@ public final class LoadProperties extends Task { } catch (IOException ioex) { //ignore } + try { + if (tis != null) { + tis.close(); + } + } catch (IOException ioex) { + //ignore + } } }