bodewig 2003/10/14 05:49:40 Modified: . Tag: ANT_16_BRANCH WHATSNEW src/main/org/apache/tools/ant/taskdefs Tag: ANT_16_BRANCH LoadProperties.java Log: Merge from HEAD Revision Changes Path No revision No revision 1.503.2.4 +5 -0 ant/WHATSNEW Index: WHATSNEW =================================================================== RCS file: /home/cvs/ant/WHATSNEW,v retrieving revision 1.503.2.3 retrieving revision 1.503.2.4 diff -u -r1.503.2.3 -r1.503.2.4 --- WHATSNEW 28 Sep 2003 04:00:05 -0000 1.503.2.3 +++ WHATSNEW 14 Oct 2003 12:49:39 -0000 1.503.2.4 @@ -63,6 +63,11 @@ is now Hashtable<String, String[]>). This will affect third party code that extend Copy and override Copy#doFileOperations. +* <loadproperties> didn't expand properties while <property file="..."/> + does, so they were not equivalent. This has been fixed, which means + that propetries may get expanded twice if you use an + <expandproperties> filterreader. Bugzilla Report 17782. + Fixed bugs: ----------- * Filter readers were not handling line endings properly. Bugzilla No revision No revision 1.16.2.4 +13 -11 ant/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java Index: LoadProperties.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java,v retrieving revision 1.16.2.3 retrieving revision 1.16.2.4 diff -u -r1.16.2.3 -r1.16.2.4 --- LoadProperties.java 25 Sep 2003 07:44:27 -0000 1.16.2.3 +++ LoadProperties.java 14 Oct 2003 12:49:39 -0000 1.16.2.4 @@ -140,6 +140,7 @@ FileInputStream fis = null; BufferedInputStream bis = null; Reader instream = null; + ByteArrayInputStream tis = null; try { final long len = srcFile.length(); @@ -166,7 +167,6 @@ text = text + "\n"; } - ByteArrayInputStream tis = null; if (encoding == null) { tis = new ByteArrayInputStream(text.getBytes()); } else { @@ -174,16 +174,11 @@ } 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) { @@ -195,6 +190,13 @@ try { if (fis != null) { fis.close(); + } + } catch (IOException ioex) { + //ignore + } + try { + if (tis != null) { + tis.close(); } } catch (IOException ioex) { //ignore
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]