ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 51353] New: Mail task fails to send correctly on IBM z/OS EBCDIC operating system
Date Fri, 10 Jun 2011 14:30:44 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=51353

             Bug #: 51353
           Summary: Mail task fails to send correctly on IBM z/OS EBCDIC
                    operating system
           Product: Ant
           Version: 1.7.1
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core tasks
        AssignedTo: notifications@ant.apache.org
        ReportedBy: matthew1001@hotmail.com
    Classification: Unclassified


On attempting to use the Ant mail task on an IBM z/OS environment running in
the EBCDIC codepage, the mail fails to send completely.

The problem appears to be related to the JVM failing to flush the the output
stream correctly when it encounters a /n character in the PrintStream.write(int
byte) method on an EBCDIC environment. However, I don't believe this is a JVM
bug. 

When the JVM fails to flush the stream, the mail task hangs waiting for the
SMTP server to respond, which it never will as the stream hasn't been flushed.

The following build.xml can be used to recreate the problem on an EBCDIC
environment:

<?xml version="1.0" ?>
<project>
 <target name="SEND_EMAIL" >
  <mail mailhost="my.mailserver.com"
    mailport="25"
    subject="My email test"
    encoding="plain">
    <from address="matthew1001@hotmail.com"/>
    <to address="matthew1001@hotmail.com"/>
    <message>this is a test message</message>
  </mail>
 </target>
</project>

A similar issue exists in the writing of MIME headers to the SMTP server. 

I believe PrintStream.println(String x) is used to write MIME headers, but the
javadoc for PrintStream.println(String x) says that the string's characters are
converted into bytes according to the platform's default character encoding.
However, if your SMTP server doesn't support EBCDIC it won't understand the
MIME headers being sent from an EBCDIC environment. 

I believe the fix for this would be to use the PrintStream.write(byte[] buff,
int off, int len) method to write the headers to the output stream instead. The
String.getBytes(String charsetName) method should be used to provide the byte
buffer in the correct character set.

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

Mime
View raw message