commits@javamail.java.net

[mercurial:104] getReplyTo returns zero length array when ReplyTo hdr has no value - bug

From: <shannon_at_kenai.com>
Date: Mon, 9 Feb 2009 19:40:58 +0000 (GMT)

Repository: mercurial
Revision: 104
Author: Bill Shannon <bill.shannon_at_sun.com>
Date: 2009-01-31 02:04:30 UTC

Log Message:
-----------
getReplyTo returns zero length array when ReplyTo hdr has no value -
bug 6799810

Modified Paths:
--------------
    demo/src/main/java/msgshow.java
    doc/release/CHANGES.txt
    mail/src/main/java/javax/mail/internet/MimeMessage.java

Diffs:
-----
diff -r 68ab7e1541df -r f6d187e0a169 demo/src/main/java/msgshow.java
--- a/demo/src/main/java/msgshow.java Fri Jan 30 13:20:12 2009 -0800
+++ b/demo/src/main/java/msgshow.java Fri Jan 30 18:04:30 2009 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -357,6 +357,12 @@
                pr("FROM: " + a[j].toString());
        }
 
+ // REPLY TO
+ if ((a = m.getReplyTo()) != null) {
+ for (int j = 0; j < a.length; j++)
+ pr("REPLY TO: " + a[j].toString());
+ }
+
        // TO
        if ((a = m.getRecipients(Message.RecipientType.TO)) != null) {
            for (int j = 0; j < a.length; j++) {
diff -r 68ab7e1541df -r f6d187e0a169 doc/release/CHANGES.txt
--- a/doc/release/CHANGES.txt Fri Jan 30 13:20:12 2009 -0800
+++ b/doc/release/CHANGES.txt Fri Jan 30 18:04:30 2009 -0800
@@ -29,6 +29,7 @@
 6738454 deadlock when connection is broken
 6738468 javadocs use fully qualified names
 6797756 StringIndexOutOfBoundsError in
InternetAddress.parseHeader()
+6799810 getReplyTo() returns zero length array when ReplyTo hdr
has no value
 GF 3929 Inconsistent synchronization in
com.sun.mail.iap.Protocol
 GF 4997 BASE64DecoderStream.skip (etc) skips the wrong number
of octets
 GF 5189 Can't specify SSLSocketFactory for STARTTLS in Javamail
1.4
diff -r 68ab7e1541df -r f6d187e0a169
mail/src/main/java/javax/mail/internet/MimeMessage.java
--- a/mail/src/main/java/javax/mail/internet/MimeMessage.java Fri Jan
30 13:20:12 2009 -0800
+++ b/mail/src/main/java/javax/mail/internet/MimeMessage.java Fri Jan
30 18:04:30 2009 -0800
@@ -1,7 +1,7 @@
 /*
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
  *
- * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved.
  *
  * The contents of this file are subject to the terms of either the
GNU
  * General Public License Version 2 only ("GPL") or the Common
Development
@@ -663,7 +663,7 @@
      */
     public Address[] getReplyTo() throws MessagingException {
        Address[] a = getAddressHeader("Reply-To");
- if (a == null)
+ if (a == null || a.length == 0)
            a = getFrom();
        return a;
     }