commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject cvs commit: jakarta-commons/net/src/java/org/apache/commons/net/smtp SimpleSMTPHeader.java
Date Tue, 15 Jul 2003 01:52:40 GMT
dfs         2003/07/14 18:52:40

  Modified:    net/src/java/org/apache/commons/net/smtp
                        SimpleSMTPHeader.java
  Log:
  Applied patch from Paul Spencer <paul@mikon.com>:
  >Please apply the attached patch.  It corrects the following problems:
  >
  >1) toString() failed in JDK 1.3 because the method
  >StringBuffer.append(StringBuffer) does not exist.  The method was added
  >in JDK 1.4.
  >
  >2) Empty subjects are in the message.  Now the subject will only be
  >includes when it is non-null.
  
  What appears to have happened is that the code relied on an implicit
  toString() call by the compiler, but after J2SE 1.4 added
  StringBuffer.append(StringBuffer) and the code was compiled using
  J2SE 1.4 javac, a call to StringBuffer.append(StringBuffer) was
  resolved instead of StringBuffer.append(String).  Paul's patch
  fixes this problem.  Other parts of the code that depended on an
  implicit StringBuffer.toString() may be affected as well and should
  be checked.
  
  Revision  Changes    Path
  1.4       +9 -5      jakarta-commons/net/src/java/org/apache/commons/net/smtp/SimpleSMTPHeader.java
  
  Index: SimpleSMTPHeader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/smtp/SimpleSMTPHeader.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SimpleSMTPHeader.java	26 Jan 2003 00:21:45 -0000	1.3
  +++ SimpleSMTPHeader.java	15 Jul 2003 01:52:40 -0000	1.4
  @@ -149,7 +149,8 @@
       /***
        * Converts the SimpleSMTPHeader to a properly formatted header in
        * the form of a String, including the blank line used to separate
  -     * the header from the article body.
  +     * the header from the article body.  The header fields CC and Subject
  +     * are only included when they are non-null.
        * <p>
        * @return The message header in the form of a String.
        ***/
  @@ -168,13 +169,16 @@
           if (__cc != null)
           {
               header.append("\nCc: ");
  -            header.append(__cc);
  +            header.append(__cc.toString());
           }
   
  -        header.append("\nSubject: ");
  -        header.append(__subject);
  -        header.append('\n');
  +        if (__subject != null)
  +        {
  +            header.append("\nSubject: ");
  +            header.append(__subject);
  +        }
   
  +        header.append('\n');
           header.append('\n');
   
           return header.toString();
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message