You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by RobinFernandes <ro...@soal.org> on 2009/04/01 20:34:14 UTC

Re: Ant on z/OS

Sorry to revive an old thread. I'm seeing the same problem as described
below: <property environment="env" /> is failing on z/OS when specifying a
non-EBCDIC encoding in -Dfile.encoding. Verbose output is:
...
 [property] Loading Environment env.
 [property] Ignoring:
 [property] <lots of garbage characters here...>
...

I'm using Ant 1.7.1 on IBM JDK 6 (IBM z/OS build pmz3160sr3-20081108_01
(SR3)).


I think I've tracked the issue down to this code in
org/apache/tools/ant/taskdefs/Execute.java, which forces the raw output of
the env var command to be treated as Cp1047 bytes, regardless of
-Dfile.encoding (this code is present in 1.7.1 and trunk):
[...]
    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
            }
        }
[...]

If I remove this behaviour and simply return bos.toString(), <property
environment="env" /> loads correctly irrespective of whether -Dfile.encoding
is set to a non-ebcdic encoding.

Just a guess: perhaps that code was a work-around for older JDKs where
file.encoding didn't affect env, and should now be removed? 

Regards,
Robin


Anuradha Weeraman wrote:
> 
> Hi All,
> 
> I'm having what appears to be some character set related issues when
> running Ant on z/OS under USS. I have tracked down the issue to the
> <property environment> tag which doesn't seem to be able to pick up
> environment variables and spews ASCII text when the following
> IBM_JAVA_OPTIONS variable is defined:
> 
> -Dfile.encoding=ISO8859-1 -Dconsole.encoding=IBM-1047 -Xnoargsconversion
> 
> The ASCII text, when converted to EBCDIC appears to be environment
> variables, so I'm guessing that Ant internally expects the environment
> variables in EBCDIC (possibly from the output of /bin/env) which
> somehow gets converted to ISO8859-1 due to the file.encoding
> parameter, leading to its confusion.
> 
> Ant 1.5.3-1 is bundled with the version of Maven that I use, and it
> requires the IBM_JAVA_OPTIONS to be set.
> 
> Has anyone experienced this before? Does anyone know if Ant is capable
> of handling custom file.encoding as in this case?
> 
> Regards,
> Anuradha
> 
> 

-- 
View this message in context: http://www.nabble.com/Ant-on-z-OS-tp5429644p22832757.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org