You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bo...@apache.org on 2009/06/19 15:45:59 UTC

svn commit: r786506 - in /ant/core/trunk: WHATSNEW src/main/org/apache/tools/ant/taskdefs/LoadProperties.java src/tests/antunit/taskdefs/loadproperties-test.xml

Author: bodewig
Date: Fri Jun 19 13:45:58 2009
New Revision: 786506

URL: http://svn.apache.org/viewvc?rev=786506&view=rev
Log:
loadproperties' encoding attribute is broken.  PR 47382

Modified:
    ant/core/trunk/WHATSNEW
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java
    ant/core/trunk/src/tests/antunit/taskdefs/loadproperties-test.xml

Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=786506&r1=786505&r2=786506&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Fri Jun 19 13:45:58 2009
@@ -385,6 +385,9 @@
    the setbeans attribute.
    Bugzilla Report 47336.
 
+ * <loadproperties>' encoding attribute didn't work.
+   Bugzilla Report 47382.
+
 Other changes:
 --------------
  * A HostInfo task was added performing information on hosts, including info on 

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java?rev=786506&r1=786505&r2=786506&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java Fri Jun 19 13:45:58 2009
@@ -168,11 +168,7 @@
                 if (!text.endsWith("\n")) {
                     text = text + "\n";
                 }
-                if (encoding == null) {
-                    tis = new ByteArrayInputStream(text.getBytes());
-                } else {
-                    tis = new ByteArrayInputStream(text.getBytes(encoding));
-                }
+                tis = new ByteArrayInputStream(text.getBytes());
                 final Properties props = new Properties();
                 props.load(tis);
 

Modified: ant/core/trunk/src/tests/antunit/taskdefs/loadproperties-test.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/taskdefs/loadproperties-test.xml?rev=786506&r1=786505&r2=786506&view=diff
==============================================================================
--- ant/core/trunk/src/tests/antunit/taskdefs/loadproperties-test.xml (original)
+++ ant/core/trunk/src/tests/antunit/taskdefs/loadproperties-test.xml Fri Jun 19 13:45:58 2009
@@ -58,4 +58,14 @@
     <au:assertPropertyEquals name="xref-complex.f" value="$${xref-complex.d}" />
   </target>
 
+  <target name="testEncoding"
+          description="https://issues.apache.org/bugzilla/show_bug.cgi?id=47382">
+    <mkdir dir="${input}"/>
+    <echo file="${input}/ebcdic.properties" encoding="Cp1047">
+a=Hello world in EBCDIC
+    </echo>
+    <loadproperties srcfile="${input}/ebcdic.properties" encoding="Cp1047"/>
+    <au:assertPropertyEquals name="a" value="Hello world in EBCDIC"/>
+  </target>
+
 </project>