You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2009/04/09 14:45:29 UTC

DO NOT REPLY [Bug 47007] New: On z/OS, environment variables mishandled when specifying a non-EBCDIC encoding in -Dfile.encoding

https://issues.apache.org/bugzilla/show_bug.cgi?id=47007

           Summary: On z/OS, environment variables mishandled when
                    specifying a non-EBCDIC encoding in -Dfile.encoding
           Product: Ant
           Version: 1.7.1
          Platform: PC
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core
        AssignedTo: notifications@ant.apache.org
        ReportedBy: robin@soal.org


On z/OS, <property environment="..." /> fails when specifying a non-EBCDIC
encoding in -Dfile.encoding.

Given the following test.xml:
<project basedir="." default="" name="common">
        <property environment="env" />
</project>

Output for 'export ANT_OPTS="-Dfile.encoding=UTF-8 -Dconsole.encoding=IBM-1047
-Xnoargsconversion" && ant -v -f test.xml':
...
 [property] Loading Environment env.
 [property] Ignoring:
 [property] <...garbage characters here...>
... 

This occurs on Java 1.4.2, 5.0 and 6.0 and is present in Ant 1.7.1 and trunk.

A solution is to remove the special casing in
org/apache/tools/ant/taskdefs/Execute.java in
Execute.toString(ByteArrayOutputStream bos) and just return bos.toString() (see
below).

The issue may be related to the change made under bug 13047. Perhaps
-Dfile.encoding was not respected for env vars on earlier JDKs?


---
C:\code\ant\apache-ant-1.7.1-orig\src\main\org\apache\tools\ant\taskdefs\Execute.java
   2008-06-27 05:05:22.000000000 +-0100
+++
C:\code\ant\apache-ant-1.7.1-patched\src\main\org\apache\tools\ant\taskdefs\Execute.java
   2009-04-09 13:39:24.000000000 +-0100
@@ -259,25 +259,12 @@
      * @return the output stream as a string, read with
      * special encodings in the case of z/os and os/400.
      *
      * @since Ant 1.5
      */
     public static String toString(ByteArrayOutputStream bos) {
-        if (Os.isFamily("z/os")) {
-            try {
-                return bos.toString("Cp1047");
-            } catch (java.io.UnsupportedEncodingException e) {
-                //noop default encoding used
-            }
-        } else if (Os.isFamily("os/400")) {
-            try {
-                return bos.toString("Cp500");
-            } catch (java.io.UnsupportedEncodingException e) {
-                //noop default encoding used
-            }
-        }
         return bos.toString();
     }

     /**
      * Creates a new execute object using <code>PumpStreamHandler</code> for
      * stream handling.



This issue has been raised on the user mailing list:
http://www.nabble.com/Ant-on-z-OS-tt5429644.html#a22832757

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.