Browse Source

loadproperties' encoding attribute is broken. PR 47382

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@786506 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 16 years ago
parent
commit
ab8c8e14e9
3 changed files with 14 additions and 5 deletions
  1. +3
    -0
      WHATSNEW
  2. +1
    -5
      src/main/org/apache/tools/ant/taskdefs/LoadProperties.java
  3. +10
    -0
      src/tests/antunit/taskdefs/loadproperties-test.xml

+ 3
- 0
WHATSNEW View File

@@ -385,6 +385,9 @@ Fixed bugs:
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


+ 1
- 5
src/main/org/apache/tools/ant/taskdefs/LoadProperties.java View File

@@ -168,11 +168,7 @@ public class LoadProperties extends Task {
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);



+ 10
- 0
src/tests/antunit/taskdefs/loadproperties-test.xml View File

@@ -58,4 +58,14 @@ xref-complex.f=$${xref-complex.e}</string>
<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>

Loading…
Cancel
Save