You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jb...@apache.org on 2003/09/13 07:41:19 UTC

cvs commit: incubator-geronimo/specs/javamail/src/test/javax/mail/internet AllInternetTests.java InternetAddressTest.java MimeMessageTest.java

jboynes     2003/09/12 22:41:19

  Modified:    specs/javamail Tag: javamail_030912 project.xml
               specs/javamail/src/java/javax/mail Tag: javamail_030912
                        FetchProfile.java Flags.java Header.java
                        MultipartDataSource.java Provider.java Session.java
                        URLName.java
               specs/javamail/src/java/javax/mail/event Tag:
                        javamail_030912 ConnectionEvent.java
                        FolderEvent.java MessageChangedEvent.java
                        MessageCountEvent.java TransportEvent.java
               specs/javamail/src/java/javax/mail/internet Tag:
                        javamail_030912 InternetAddress.java
                        MimeBodyPart.java MimeMessage.java
                        MimeMultipart.java ParameterList.java
               specs/javamail/src/java/javax/mail/search Tag:
                        javamail_030912 DateTerm.java
               specs/javamail/src/test/javax/mail Tag: javamail_030912
                        MessageContextTest.java TestData.java
                        URLNameTest.java
               specs/javamail/src/test/javax/mail/internet Tag:
                        javamail_030912 AllInternetTests.java
                        InternetAddressTest.java MimeMessageTest.java
  Added:       specs/javamail/src/java/javax/mail/internet Tag:
                        javamail_030912 Constants.java
  Log:
  Applied patch from Alex Blewitt to branch javamail_030912
  This has been fixed so it compiles but it does not yet pass the unit tests
  Good luck....
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.4.2.1   +10 -2     incubator-geronimo/specs/javamail/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/specs/javamail/project.xml,v
  retrieving revision 1.4
  retrieving revision 1.4.2.1
  diff -u -r1.4 -r1.4.2.1
  --- project.xml	18 Aug 2003 17:29:24 -0000	1.4
  +++ project.xml	13 Sep 2003 05:41:18 -0000	1.4.2.1
  @@ -43,7 +43,15 @@
           <module>true</module>
         </properties>
       </dependency>
  -    
  +
  +      <dependency>
  +          <groupId>geronimo</groupId>
  +          <artifactId>geronimo-common</artifactId>
  +          <version>DEV</version>
  +          <properties>
  +              <module>true</module>
  +          </properties>
  +      </dependency>
     </dependencies>
     
   </project>
  
  
  
  No                   revision
  No                   revision
  1.2.2.1   +4 -4      incubator-geronimo/specs/javamail/src/java/javax/mail/FetchProfile.java
  
  Index: FetchProfile.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/specs/javamail/src/java/javax/mail/FetchProfile.java,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- FetchProfile.java	16 Aug 2003 04:29:52 -0000	1.2
  +++ FetchProfile.java	13 Sep 2003 05:41:18 -0000	1.2.2.1
  @@ -61,6 +61,8 @@
   package javax.mail;
   import java.util.HashMap;
   import java.util.Map;
  +
  +import org.apache.geronimo.common.NullArgumentException;
   /**
    * @version $Revision$ $Date$
    */
  @@ -74,9 +76,7 @@
           public static final Item FLAGS = new Item("X-Flags");
           private String _header;
           protected Item(String header) {
  -            if (header == null) {
  -                throw new IllegalArgumentException("Header cannot be null");
  -            }
  +            NullArgumentException.checkForNull("header",header);
               _header = header;
           }
           public boolean equals(Object other) {
  
  
  
  1.2.2.1   +4 -4      incubator-geronimo/specs/javamail/src/java/javax/mail/Flags.java
  
  Index: Flags.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/specs/javamail/src/java/javax/mail/Flags.java,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- Flags.java	16 Aug 2003 04:29:52 -0000	1.2
  +++ Flags.java	13 Sep 2003 05:41:18 -0000	1.2.2.1
  @@ -65,6 +65,8 @@
   import java.util.LinkedList;
   import java.util.List;
   import java.util.Map;
  +
  +import org.apache.geronimo.common.NullArgumentException;
   /**
    * @version $Revision$ $Date$
    */
  @@ -83,9 +85,7 @@
               this(name, false);
           }
           private Flag(String name, boolean system) {
  -            if (name == null) {
  -                throw new IllegalArgumentException("Flag name cannot be null");
  -            }
  +            NullArgumentException.checkForNull("name", name);
               _name = name;
               _system = system;
           }
  
  
  
  1.2.2.1   +4 -1      incubator-geronimo/specs/javamail/src/java/javax/mail/Header.java
  
  Index: Header.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/specs/javamail/src/java/javax/mail/Header.java,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- Header.java	16 Aug 2003 04:29:52 -0000	1.2
  +++ Header.java	13 Sep 2003 05:41:18 -0000	1.2.2.1
  @@ -75,4 +75,7 @@
       public String getValue() {
           return _value;
       }
  +    public String toString() {
  +        return _name+"="+_value;
  +    }
   }
  
  
  
  1.2.2.1   +2 -2      incubator-geronimo/specs/javamail/src/java/javax/mail/MultipartDataSource.java
  
  Index: MultipartDataSource.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/specs/javamail/src/java/javax/mail/MultipartDataSource.java,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- MultipartDataSource.java	16 Aug 2003 04:29:52 -0000	1.2
  +++ MultipartDataSource.java	13 Sep 2003 05:41:18 -0000	1.2.2.1
  @@ -64,6 +64,6 @@
    * @version $Revision$ $Date$
    */
   public interface MultipartDataSource extends DataSource {
  -    public abstract BodyPart getBodyPart(int index);
  +    public abstract BodyPart getBodyPart(int index) throws MessagingException;
       public abstract int getCount();
   }
  
  
  
  1.4.2.1   +2 -2      incubator-geronimo/specs/javamail/src/java/javax/mail/Provider.java
  
  Index: Provider.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/specs/javamail/src/java/javax/mail/Provider.java,v
  retrieving revision 1.4
  retrieving revision 1.4.2.1
  diff -u -r1.4 -r1.4.2.1
  --- Provider.java	4 Sep 2003 01:05:40 -0000	1.4
  +++ Provider.java	13 Sep 2003 05:41:18 -0000	1.4.2.1
  @@ -63,7 +63,7 @@
    * @version $Revision$ $Date$
    */
   public class Provider {
  -    protected Provider(
  +    Provider(
           String protocol,
           String className,
           Type type,
  
  
  
  1.3.2.1   +6 -13     incubator-geronimo/specs/javamail/src/java/javax/mail/Session.java
  
  Index: Session.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/specs/javamail/src/java/javax/mail/Session.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- Session.java	4 Sep 2003 00:55:38 -0000	1.3
  +++ Session.java	13 Sep 2003 05:41:18 -0000	1.3.2.1
  @@ -86,9 +86,6 @@
           loadProviders();
           loadAddressMap();
       }
  -
  -    private Session(){}
  -
       public synchronized static Session getDefaultInstance(Properties properties) {
           if (DEFAULT_SESSION == null) {
               DEFAULT_SESSION = getInstance(properties);
  @@ -185,7 +182,6 @@
           } catch (IOException e) {
               // continue; we are trying to load a non-existent file; doesn't matter if we get security/IO exceptions
           } catch (ParseException e) {
  -            // TODO Auto-generated catch block
               e.printStackTrace();
           }
           try {
  @@ -196,7 +192,6 @@
           } catch (IOException e) {
               // continue; we are trying to load a non-existent file; doesn't matter if we get security/IO exceptions
           } catch (ParseException e) {
  -            // TODO Auto-generated catch block
               e.printStackTrace();
           }
           try {
  @@ -206,7 +201,6 @@
           } catch (IOException e) {
               // continue; we are trying to load a non-existent file; doesn't matter if we get security/IO exceptions
           } catch (ParseException e) {
  -            // TODO Auto-generated catch block
               e.printStackTrace();
           }
       }
  @@ -220,7 +214,6 @@
               }
               ParameterList pl = new ParameterList(line);
               pl.get(line);
  -            // TODO Continue implementing
               String protocol = pl.get("protocol");
               String className = pl.get("class");
               String typeString = pl.get("type");
  @@ -242,6 +235,9 @@
       private PrintStream _debugOut;
       private Map _passwordAuthentications = new HashMap();
       private Properties _properties = new Properties();
  +    private Session() {
  +        // disallow external creation
  +    }
       public boolean getDebug() {
           return _debug;
       }
  @@ -249,8 +245,8 @@
           return System.err;
       }
       public Folder getFolder(URLName name) throws MessagingException {
  -        // TODO Implement
  -        return null;
  +        String protocol = name.getProtocol();
  +        return getStore(protocol).getFolder(name);
       }
       public PasswordAuthentication getPasswordAuthentication(URLName name) {
           return (PasswordAuthentication) _passwordAuthentications.get(name);
  @@ -262,8 +258,6 @@
           return getProperties().getProperty(property);
       }
       public Provider getProvider(String name) throws NoSuchProviderException {
  -        // TODO Implement
  -        // Lookup from 
           return (Provider) _providers.get(name);
       }
       public Provider[] getProviders() {
  @@ -321,8 +315,7 @@
       }
       public Transport getTransport(String protocol)
           throws NoSuchProviderException {
  -        // TODO Implement
  -        Provider provider = null; // lookup
  +        Provider provider = getProvider(protocol);
           return getTransport(provider);
       }
       public Transport getTransport(URLName name)
  
  
  
  1.4.2.1   +2 -2      incubator-geronimo/specs/javamail/src/java/javax/mail/URLName.java
  
  Index: URLName.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/specs/javamail/src/java/javax/mail/URLName.java,v
  retrieving revision 1.4
  retrieving revision 1.4.2.1
  diff -u -r1.4 -r1.4.2.1
  --- URLName.java	19 Aug 2003 02:39:02 -0000	1.4
  +++ URLName.java	13 Sep 2003 05:41:18 -0000	1.4.2.1
  @@ -215,7 +215,7 @@
       }
   
       public boolean equals(Object o) {
  -        if (o instanceof URLName == false) {
  +        if (o == null || o.getClass() != this.getClass()) {
               return false;
           }
           URLName other = (URLName) o;
  
  
  
  No                   revision
  No                   revision
  1.1.2.1   +6 -3      incubator-geronimo/specs/javamail/src/java/javax/mail/event/ConnectionEvent.java
  
  Index: ConnectionEvent.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/specs/javamail/src/java/javax/mail/event/ConnectionEvent.java,v
  retrieving revision 1.1
  retrieving revision 1.1.2.1
  diff -u -r1.1 -r1.1.2.1
  --- ConnectionEvent.java	16 Aug 2003 01:55:48 -0000	1.1
  +++ ConnectionEvent.java	13 Sep 2003 05:41:18 -0000	1.1.2.1
  @@ -59,6 +59,9 @@
   // DO NOT add / change / or delete method signatures!
   //
   package javax.mail.event;
  +
  +import org.apache.geronimo.common.InvalidArgumentException;
  +
   /**
    * @version $Revision$ $Date$
    */
  @@ -71,7 +74,7 @@
           super(source);
           this.type = type;
           if (type != DISCONNECTED && type != OPENED && type != CLOSED) {
  -            throw new IllegalArgumentException("Unknown type " + type);
  +            throw new InvalidArgumentException("type",new Integer(type));
           }
       }
       public void dispatch(Object listener) {
  @@ -84,7 +87,7 @@
           } else if (type == CLOSED) {
               l.closed(this);
           } else {
  -            throw new RuntimeException("Unknown type " + type);
  +            throw new InvalidArgumentException("type",new Integer(type));
           }
       }
       public int getType() {
  
  
  
  1.1.2.1   +6 -4      incubator-geronimo/specs/javamail/src/java/javax/mail/event/FolderEvent.java
  
  Index: FolderEvent.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/specs/javamail/src/java/javax/mail/event/FolderEvent.java,v
  retrieving revision 1.1
  retrieving revision 1.1.2.1
  diff -u -r1.1 -r1.1.2.1
  --- FolderEvent.java	16 Aug 2003 01:55:48 -0000	1.1
  +++ FolderEvent.java	13 Sep 2003 05:41:18 -0000	1.1.2.1
  @@ -59,7 +59,9 @@
   // DO NOT add / change / or delete method signatures!
   //
   package javax.mail.event;
  -import javax.mail.*;
  +import javax.mail.Folder;
  +
  +import org.apache.geronimo.common.InvalidArgumentException;
   /**
    * @version $Revision$ $Date$
    */
  @@ -80,7 +82,7 @@
           this.newFolder = newFolder;
           this.type = type;
           if (type != CREATED && type != DELETED && type != RENAMED) {
  -            throw new IllegalArgumentException("Unknown type " + type);
  +            throw new InvalidArgumentException("type",new Integer(type));
           }
       }
       public FolderEvent(Object source, Folder folder, int type) {
  @@ -96,7 +98,7 @@
           } else if (type == RENAMED) {
               l.folderRenamed(this);
           } else {
  -            throw new RuntimeException("Unknown type " + type);
  +            throw new InvalidArgumentException("type",new Integer(type));
           }
       }
       public Folder getFolder() {
  
  
  
  1.1.2.1   +5 -3      incubator-geronimo/specs/javamail/src/java/javax/mail/event/MessageChangedEvent.java
  
  Index: MessageChangedEvent.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/specs/javamail/src/java/javax/mail/event/MessageChangedEvent.java,v
  retrieving revision 1.1
  retrieving revision 1.1.2.1
  diff -u -r1.1 -r1.1.2.1
  --- MessageChangedEvent.java	16 Aug 2003 01:55:48 -0000	1.1
  +++ MessageChangedEvent.java	13 Sep 2003 05:41:18 -0000	1.1.2.1
  @@ -59,7 +59,9 @@
   // DO NOT add / change / or delete method signatures!
   //
   package javax.mail.event;
  -import javax.mail.*;
  +import javax.mail.Message;
  +
  +import org.apache.geronimo.common.InvalidArgumentException;
   /**
    * @version $Revision$ $Date$
    */
  @@ -73,7 +75,7 @@
           msg = message;
           this.type = type;
           if (type != ENVELOPE_CHANGED && type != FLAGS_CHANGED) {
  -            throw new IllegalArgumentException("Unknown type " + type);
  +            throw new InvalidArgumentException("type",new Integer(type));
           }
       }
       public void dispatch(Object listener) {
  
  
  
  1.1.2.1   +4 -2      incubator-geronimo/specs/javamail/src/java/javax/mail/event/MessageCountEvent.java
  
  Index: MessageCountEvent.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/specs/javamail/src/java/javax/mail/event/MessageCountEvent.java,v
  retrieving revision 1.1
  retrieving revision 1.1.2.1
  diff -u -r1.1 -r1.1.2.1
  --- MessageCountEvent.java	16 Aug 2003 01:55:48 -0000	1.1
  +++ MessageCountEvent.java	13 Sep 2003 05:41:18 -0000	1.1.2.1
  @@ -61,6 +61,8 @@
   package javax.mail.event;
   import javax.mail.Folder;
   import javax.mail.Message;
  +
  +import org.apache.geronimo.common.InvalidArgumentException;
   /**
    * @version $Revision$ $Date$
    */
  @@ -88,7 +90,7 @@
           } else if (type == REMOVED) {
               l.messagesRemoved(this);
           } else {
  -            throw new IllegalArgumentException("Unknown type " + type);
  +            throw new InvalidArgumentException("type", new Integer(type));
           }
       }
       public Message[] getMessages() {
  
  
  
  1.1.2.1   +5 -3      incubator-geronimo/specs/javamail/src/java/javax/mail/event/TransportEvent.java
  
  Index: TransportEvent.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/specs/javamail/src/java/javax/mail/event/TransportEvent.java,v
  retrieving revision 1.1
  retrieving revision 1.1.2.1
  diff -u -r1.1 -r1.1.2.1
  --- TransportEvent.java	16 Aug 2003 01:55:48 -0000	1.1
  +++ TransportEvent.java	13 Sep 2003 05:41:18 -0000	1.1.2.1
  @@ -62,6 +62,8 @@
   import javax.mail.Address;
   import javax.mail.Message;
   import javax.mail.Transport;
  +
  +import org.apache.geronimo.common.InvalidArgumentException;
   /**
    * @version $Revision$ $Date$
    */
  @@ -89,7 +91,7 @@
           if (type != MESSAGE_DELIVERED
               && type != MESSAGE_NOT_DELIVERED
               && type != MESSAGE_PARTIALLY_DELIVERED) {
  -            throw new IllegalArgumentException("Unknown type " + type);
  +            throw new InvalidArgumentException("type",new Integer(type));
           }
       }
       public Address[] getValidSentAddresses() {
  @@ -117,7 +119,7 @@
           } else if (type == MESSAGE_PARTIALLY_DELIVERED) {
               l.messagePartiallyDelivered(this);
           } else {
  -            throw new RuntimeException("Unknown type " + type);
  +            throw new InvalidArgumentException("type",new Integer(type));
           }
       }
   }
  
  
  
  No                   revision
  No                   revision
  1.1.2.1   +25 -26    incubator-geronimo/specs/javamail/src/java/javax/mail/internet/InternetAddress.java
  
  Index: InternetAddress.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/specs/javamail/src/java/javax/mail/internet/InternetAddress.java,v
  retrieving revision 1.1
  retrieving revision 1.1.2.1
  diff -u -r1.1 -r1.1.2.1
  --- InternetAddress.java	16 Aug 2003 01:55:48 -0000	1.1
  +++ InternetAddress.java	13 Sep 2003 05:41:18 -0000	1.1.2.1
  @@ -107,10 +107,12 @@
           // addresses are name <addr> or addr (name), sometimes with name in quotes
           // comma separated
           List result = new LinkedList();
  -        StringTokenizer tokenizer = new StringTokenizer(addresses, ",");
  -        while (tokenizer.hasMoreTokens()) {
  -            String address = tokenizer.nextToken();
  -            result.add(new InternetAddress(address));
  +        if (addresses != null) {
  +            StringTokenizer tokenizer = new StringTokenizer(addresses, ",");
  +            while (tokenizer.hasMoreTokens()) {
  +                String address = tokenizer.nextToken();
  +                result.add(new InternetAddress(address));
  +            }
           }
           return (InternetAddress[]) result.toArray(IA_ARRAY);
       }
  @@ -148,19 +150,22 @@
       }
       public InternetAddress(String address) throws AddressException {
           int lt = address.indexOf("<");
  +        if (lt == -1) {
  +            lt = 0;
  +        }
           int gt = address.indexOf(">");
  -        if (lt != -1 && gt != -1) {
  -            setAddress(address.substring(lt + 1, gt));
  -            // everyting else is the name
  -            try {
  -                setPersonal(
  -                    (address.substring(0, lt) + address.substring(gt + 1))
  -                        .trim());
  -            } catch (UnsupportedEncodingException e) {
  -                throw new AddressException(e.getMessage());
  -            }
  -        } else {
  -            setAddress(address);
  +        if (gt == -1) {
  +            gt = address.length();
  +        }
  +        setAddress(address.substring(lt + 1, gt));
  +        // everyting else is the name
  +        try {
  +            String name =
  +                (lt > 0 ? address.substring(0, lt) : "")
  +                    + (gt < address.length() ? address.substring(gt + 1) : "");
  +            setPersonal(name.trim());
  +        } catch (UnsupportedEncodingException e) {
  +            throw new AddressException(e.getMessage());
           }
       }
       public InternetAddress(String address, boolean strict)
  @@ -173,9 +178,8 @@
       }
       public InternetAddress(String address, String personal, String charset)
           throws UnsupportedEncodingException {
  -        this.address = address;
  -        this.personal = personal;
  -        // TODO Encode personal with given charset
  +        setAddress(address);
  +        setPersonal(personal, charset);
       }
       public Object clone() {
           InternetAddress ia = new InternetAddress();
  @@ -203,7 +207,6 @@
           return "rfc822";
       }
       public int hashCode() {
  -        // hash of the name and address
           return personal.hashCode() + address.hashCode();
       }
       public boolean isGroup() {
  @@ -218,11 +221,7 @@
       }
       public void setPersonal(String name, String encoding)
           throws UnsupportedEncodingException {
  -        encodedPersonal =
  -            MimeUtility.encodeText(
  -                name,
  -                MimeUtility.getDefaultJavaCharset(),
  -                encoding);
  +        encodedPersonal = MimeUtility.encodeText(name, null, encoding);
           personal = name;
       }
       public String toString() {
  
  
  
  1.1.2.1   +112 -34   incubator-geronimo/specs/javamail/src/java/javax/mail/internet/MimeBodyPart.java
  
  Index: MimeBodyPart.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/specs/javamail/src/java/javax/mail/internet/MimeBodyPart.java,v
  retrieving revision 1.1
  retrieving revision 1.1.2.1
  diff -u -r1.1 -r1.1.2.1
  --- MimeBodyPart.java	16 Aug 2003 01:55:48 -0000	1.1
  +++ MimeBodyPart.java	13 Sep 2003 05:41:18 -0000	1.1.2.1
  @@ -59,12 +59,18 @@
   // DO NOT add / change / or delete method signatures!
   //
   package javax.mail.internet;
  +import java.io.BufferedWriter;
  +import java.io.ByteArrayInputStream;
   import java.io.IOException;
   import java.io.InputStream;
   import java.io.OutputStream;
  +import java.io.OutputStreamWriter;
  +import java.io.UnsupportedEncodingException;
   import java.util.Enumeration;
  +
   import javax.activation.DataHandler;
   import javax.mail.BodyPart;
  +import javax.mail.Header;
   import javax.mail.MessagingException;
   import javax.mail.Multipart;
   /**
  @@ -99,37 +105,43 @@
           return headers.getAllHeaders();
       }
       public Object getContent() throws IOException, MessagingException {
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        return getDataHandler().getContent();
       }
       public String getContentID() throws MessagingException {
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        return getHeader(Constants.CONTENT_ID, null);
       }
       public String[] getContentLanguage() throws MessagingException {
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        return getHeader(Constants.CONTENT_LANGUAGE);
       }
       public String getContentMD5() throws MessagingException {
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        return getHeader(Constants.CONTENT_MD5, null);
       }
       protected InputStream getContentStream() throws MessagingException {
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        return contentStream = new ByteArrayInputStream(content);
       }
       public String getContentType() throws MessagingException {
  -        return dh.getContentType();
  +        return getHeader(Constants.CONTENT_TYPE, null);
       }
  -    public DataHandler getDataHandler() throws MessagingException {
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +    public synchronized DataHandler getDataHandler()
  +        throws MessagingException {
  +        if (dh == null) {
  +            dh = new DataHandler(new MimePartDataSource(this));
  +        }
  +        return dh;
       }
       public String getDescription() throws MessagingException {
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        return getHeader(Constants.CONTENT_DESCRIPTION, null);
       }
       public String getDisposition() throws MessagingException {
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        String old = getHeader(Constants.CONTENT_DISPOSITION, null);
  +        return new ContentDisposition(old).getDisposition();
       }
       public String getEncoding() throws MessagingException {
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        return getHeader(Constants.CONTENT_TRANSFER_ENCODING, null);
       }
       public String getFileName() throws MessagingException {
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        String old = getHeader(Constants.CONTENT_DISPOSITION, null);
  +        return new ContentDisposition(old).getParameter(Constants.FILENAME);
       }
       public String[] getHeader(String name) throws MessagingException {
           return headers.getHeader(name);
  @@ -140,10 +152,14 @@
       }
       public InputStream getInputStream()
           throws IOException, MessagingException {
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        return getDataHandler().getInputStream();
       }
  +    /**
  +     * Returns the number of lines in this message.
  +     * This implementation returns -1, as does the JavaMail RI.
  +     */
       public int getLineCount() throws MessagingException {
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        return -1;
       }
       public Enumeration getMatchingHeaderLines(String[] names)
           throws MessagingException {
  @@ -157,15 +173,27 @@
           throws MessagingException {
           return headers.getNonMatchingHeaderLines(names);
       }
  -    public Enumeration getNonMatchingHeaders(String[] name)
  +    public Enumeration getNonMatchingHeaders(String[] names)
           throws MessagingException {
  -        return headers.getNonMatchingHeaders(name);
  +        return headers.getNonMatchingHeaders(names);
       }
       public InputStream getRawInputStream() throws MessagingException {
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        return getContentStream();
       }
       public int getSize() throws MessagingException {
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        if (content == null) {
  +            if (contentStream == null) {
  +                return -1;
  +            } else {
  +                try {
  +                    return contentStream.available();
  +                } catch (IOException e) {
  +                    throw new MessagingException(null, e);
  +                }
  +            }
  +        } else {
  +            return content.length;
  +        }
       }
       public boolean isMimeType(String type) throws MessagingException {
           ContentType c1 = new ContentType(type);
  @@ -175,54 +203,104 @@
       public void removeHeader(String name) throws MessagingException {
           headers.removeHeader(name);
       }
  -    public void setContent(Multipart content) throws MessagingException {
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +    public void setContent(Multipart part) throws MessagingException {
  +        setContent(part, part.getContentType());
       }
       public void setContent(Object content, String type)
           throws MessagingException {
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        setDataHandler(new DataHandler(content, type));
       }
       public void setContentID(String cid) throws MessagingException {
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        setHeader(Constants.CONTENT_ID, cid);
       }
  -    public void setContentLanguage(String[] languages)
  +    public void setContentLanguage(String[] language)
           throws MessagingException {
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        if (language == null || language.length == 0) {
  +            removeHeader(Constants.CONTENT_LANGUAGE);
  +        } else {
  +            StringBuffer buffer = new StringBuffer(language[0]);
  +            for (int i = 1; i < language.length; i++) {
  +                buffer.append(", ");
  +                buffer.append(language[i]);
  +            }
  +            setHeader(Constants.CONTENT_LANGUAGE, buffer.toString());
  +        }
       }
       public void setContentMD5(String md5) throws MessagingException {
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        setHeader(Constants.CONTENT_MD5, md5);
       }
       public void setDataHandler(DataHandler handler) throws MessagingException {
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        dh = handler;
       }
       public void setDescription(String description) throws MessagingException {
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        setHeader(Constants.CONTENT_DESCRIPTION, description);
       }
       public void setDescription(String description, String charset)
           throws MessagingException {
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        try {
  +            setHeader(
  +                Constants.CONTENT_DESCRIPTION,
  +                MimeUtility.encodeText(description, charset, "binary"));
  +        } catch (UnsupportedEncodingException e) {
  +            throw new MessagingException(null, e);
  +        }
       }
       public void setDisposition(String disposition) throws MessagingException {
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        String old = getHeader(Constants.CONTENT_DISPOSITION, null);
  +        ContentDisposition cd = new ContentDisposition(old);
  +        cd.setDisposition(disposition);
  +        setHeader(Constants.CONTENT_DISPOSITION, cd.toString());
       }
       public void setFileName(String name) throws MessagingException {
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        String old = getHeader(Constants.CONTENT_DISPOSITION, null);
  +        ContentDisposition disposition = new ContentDisposition(old);
  +        disposition.setParameter(Constants.FILENAME, name);
  +        setHeader(Constants.CONTENT_DISPOSITION, disposition.toString());
       }
       public void setHeader(String name, String value)
           throws MessagingException {
  +        if (headers == null) {
  +            headers = new InternetHeaders();
  +        }
           headers.setHeader(name, value);
       }
       public void setText(String text) throws MessagingException {
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        setContent(text, Constants.TEXT_PLAIN);
       }
       public void setText(String text, String charset)
           throws MessagingException {
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        // TODO What happens with charset?
  +        setContent(text, Constants.TEXT_PLAIN);
       }
  +    /**
  +     * This implementation does nothing, as does the JavaMail RI; it is left to subclasses to decide how this occurs
  +     * @throws MessagingException
  +     */
       protected void updateHeaders() throws MessagingException {
       }
       public void writeTo(OutputStream out)
           throws IOException, MessagingException {
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        Enumeration outheaders;
  +        outheaders = headers.getAllHeaders();
  +        // TODO Characterset mangling
  +        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(out));
  +        while (outheaders.hasMoreElements()) {
  +            Header header = (Header) outheaders.nextElement();
  +            bw.write(header.getName());
  +            bw.write(": ");
  +            bw.write(header.getValue());
  +            bw.write(Constants.EOL);
  +        }
  +        bw.write(Constants.EOL); // blank line between headers and content
  +        bw.flush();
  +        // copy from dh to out
  +        byte buffer[] = new byte[1024];
  +        int amount = 0;
  +        InputStream data = getInputStream();
  +        // TODO Ensure encoding works
  +        while ((amount = data.read(buffer)) != -1) {
  +            out.write(buffer, 0, amount);
  +
  +        }
       }
   }
  
  
  
  1.1.2.1   +247 -114  incubator-geronimo/specs/javamail/src/java/javax/mail/internet/MimeMessage.java
  
  Index: MimeMessage.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/specs/javamail/src/java/javax/mail/internet/MimeMessage.java,v
  retrieving revision 1.1
  retrieving revision 1.1.2.1
  diff -u -r1.1 -r1.1.2.1
  --- MimeMessage.java	16 Aug 2003 01:55:48 -0000	1.1
  +++ MimeMessage.java	13 Sep 2003 05:41:18 -0000	1.1.2.1
  @@ -59,31 +59,36 @@
   // DO NOT add / change / or delete method signatures!
   //
   package javax.mail.internet;
  +import java.io.BufferedWriter;
  +import java.io.ByteArrayInputStream;
  +import java.io.DataInputStream;
   import java.io.IOException;
   import java.io.InputStream;
   import java.io.ObjectStreamException;
   import java.io.OutputStream;
  +import java.io.OutputStreamWriter;
  +import java.io.UnsupportedEncodingException;
  +import java.text.ParseException;
   import java.util.Date;
   import java.util.Enumeration;
  +
   import javax.activation.DataHandler;
   import javax.mail.Address;
   import javax.mail.Flags;
   import javax.mail.Folder;
  +import javax.mail.Header;
   import javax.mail.Message;
   import javax.mail.MessagingException;
   import javax.mail.Multipart;
   import javax.mail.Session;
  -// TODO there's a bunch of methods that overlap between MimeMessaeg and MimeBodyPart.
  -// If we can implement one in terms of the other it would be more efficient, and
  -// it's fairly likely that we can ...
   /**
    * @version $Revision$ $Date$
    */
   public class MimeMessage extends Message implements MimePart {
  -    public static class RecipientType extends Message.RecipientType {
  +     public static class RecipientType extends Message.RecipientType {
           public static final RecipientType NEWSGROUPS =
               new RecipientType("Newsgroups");
  -        private RecipientType(String type) {
  +        protected RecipientType(String type) {
               super(type);
           }
           protected Object readResolve() throws ObjectStreamException {
  @@ -94,6 +99,29 @@
               }
           }
       }
  +    private static Address[] toAddressArray(InternetAddress[] address) {
  +        Address result[] = new Address[address.length];
  +        System.arraycopy(address, 0, result, 0, address.length);
  +        return result;
  +    }
  +    /**
  +     * Convert the date into a Date object, or <code>null</code> if there is no string.
  +     * @param date the date in RFC822 format
  +     * @return the new date
  +     * @throws MessagingException if a ParseException occurs
  +     * @see MailDateFormat
  +     */
  +    private static Date toDate(String date) throws MessagingException {
  +        if (date == null) {
  +            return null;
  +        } else {
  +            try {
  +                return MailDateFormat.INSTANCE.parse(date);
  +            } catch (ParseException e) {
  +                throw new MessagingException(null, e);
  +            }
  +        }
  +    }
       protected byte content[];
       protected InputStream contentStream;
       protected DataHandler dh;
  @@ -103,8 +131,13 @@
       protected boolean saved;
       protected MimeMessage(Folder folder, InputStream in, int number)
           throws MessagingException {
  +        this.folder = folder;
  +        this.msgnum = number;
  +        parse(in);
       }
       protected MimeMessage(Folder folder, int number) {
  +        this.folder = folder;
  +        this.msgnum = number;
       }
       protected MimeMessage(
           Folder folder,
  @@ -112,23 +145,29 @@
           byte[] content,
           int number)
           throws MessagingException {
  +        this.folder = folder;
  +        this.headers = headers;
  +        this.content = content;
  +        this.msgnum = number;
       }
       public MimeMessage(MimeMessage message) throws MessagingException {
  -        // TODO Implement method
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        // copy the mime message
  +        folder = message.folder;
  +        session = message.session;
  +        // don't copy other features (flags, content etc -- they are added later)
       }
       public MimeMessage(Session session) {
  -        // TODO Implement method
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        this.session = session;
       }
       public MimeMessage(Session session, InputStream in)
           throws MessagingException {
           this.session = session;
  -        contentStream = in;
  +        parse(in);
       }
       public void addFrom(Address[] address) throws MessagingException {
  -        // TODO Implement method
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        for (int i = 0; i < address.length; i++) {
  +            addHeader(Constants.FROM, address[i].toString());
  +        }
       }
       public void addHeader(String name, String value)
           throws MessagingException {
  @@ -139,8 +178,9 @@
       }
       public void addRecipients(Message.RecipientType type, Address[] address)
           throws MessagingException {
  -        // TODO Implement method
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        for (int i = 0; i < address.length; i++) {
  +            addHeader(type.toString(), address[i].toString());
  +        }
       }
       public void addRecipients(Message.RecipientType type, String address)
           throws MessagingException {
  @@ -148,8 +188,10 @@
       }
       protected InternetHeaders createInternetHeaders(InputStream in)
           throws MessagingException {
  -        // TODO Implement method
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        if (headers == null) {
  +            headers = new InternetHeaders(in);
  +        }
  +        return headers;
       }
       public Enumeration getAllHeaderLines() throws MessagingException {
           return headers.getAllHeaderLines();
  @@ -158,89 +200,92 @@
           return headers.getAllHeaders();
       }
       public Address[] getAllRecipients() throws MessagingException {
  -        // TODO Implement method
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        Address[] to = getRecipients(Message.RecipientType.TO);
  +        Address[] cc = getRecipients(Message.RecipientType.CC);
  +        Address[] bcc = getRecipients(Message.RecipientType.BCC);
  +        Address[] as = new Address[to.length + cc.length + bcc.length];
  +        System.arraycopy(to, 0, as, 0, to.length);
  +        System.arraycopy(cc, 0, as, to.length, cc.length);
  +        System.arraycopy(bcc, 0, as, to.length + cc.length, bcc.length);
  +        return as;
       }
  -    public Object getContent() throws IOException {
  -        // TODO Implement method
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +    public Object getContent() throws IOException, MessagingException {
  +        return getDataHandler().getContent();
       }
       public String getContentID() throws MessagingException {
  -        // TODO Implement method
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        return getHeader(Constants.CONTENT_ID, null);
       }
       public String[] getContentLanguage() throws MessagingException {
  -        // TODO Implement method
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        return getHeader(Constants.CONTENT_LANGUAGE);
       }
       public String getContentMD5() throws MessagingException {
  -        // TODO Implement method
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        return getHeader(Constants.CONTENT_MD5, null);
       }
       protected InputStream getContentStream() throws MessagingException {
  -        // TODO Implement method
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        return contentStream = new ByteArrayInputStream(content);
       }
       public String getContentType() throws MessagingException {
  -        // TODO Implement method
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        return getHeader(Constants.CONTENT_TYPE, null);
       }
       public synchronized DataHandler getDataHandler()
           throws MessagingException {
  -        // TODO Implement method
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        if (dh == null) {
  +            dh = new DataHandler(new MimePartDataSource(this));
  +        }
  +        return dh;
       }
       public String getDescription() throws MessagingException {
  -        // TODO Implement method
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        return getHeader(Constants.CONTENT_DESCRIPTION, null);
       }
       public String getDisposition() throws MessagingException {
  -        // TODO Implement method
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        String old = getHeader(Constants.CONTENT_DISPOSITION, null);
  +        return new ContentDisposition(old).getDisposition();
       }
       public String getEncoding() throws MessagingException {
  -        // TODO Implement method
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        return getHeader(Constants.CONTENT_TRANSFER_ENCODING, null);
       }
       public String getFileName() throws MessagingException {
  -        // TODO Implement method
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        String old = getHeader(Constants.CONTENT_DISPOSITION, null);
  +        return new ContentDisposition(old).getParameter(Constants.FILENAME);
       }
       public synchronized Flags getFlags() throws MessagingException {
  -        // TODO Implement method
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        if (flags == null) {
  +            flags = new Flags();
  +        }
  +        return flags;
       }
       public Address[] getFrom() throws MessagingException {
  -        // TODO Implement method
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        String addresses = getHeader(Constants.FROM, ",");
  +        return toAddressArray(InternetAddress.parse(addresses));
       }
       public String[] getHeader(String name) throws MessagingException {
  -        // TODO Implement method
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        return headers.getHeader(name);
       }
       public String getHeader(String name, String delimiter)
           throws MessagingException {
  -        // TODO Implement method
  -        throw new UnsupportedOperationException("Method not yet implemented");
  -    }
  -    public InputStream getInputStream() throws IOException {
  -        // TODO Implement method
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        return headers.getHeader(name, delimiter);
       }
  +    public InputStream getInputStream()
  +        throws IOException, MessagingException {
  +        return getDataHandler().getInputStream();
  +    }
  +    /**
  +     * Returns the number of lines in this message.
  +     * This implementation returns -1, as does the JavaMail RI.
  +     */
       public int getLineCount() throws MessagingException {
  -        // TODO Implement method
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        return -1;
       }
       public Enumeration getMatchingHeaderLines(String[] names)
           throws MessagingException {
           return headers.getMatchingHeaderLines(names);
       }
  -    public Enumeration getMatchingHeaders(String[] names)
  +    public Enumeration getMatchingHeaders(String[] name)
           throws MessagingException {
  -        return getMatchingHeaders(names);
  +        return headers.getMatchingHeaders(name);
       }
       public String getMessageID() throws MessagingException {
  -        return headers.getHeader("Message-ID", null);
  +        return headers.getHeader(Constants.MESSAGE_ID, null);
       }
       public Enumeration getNonMatchingHeaderLines(String[] names)
           throws MessagingException {
  @@ -251,152 +296,240 @@
           return headers.getNonMatchingHeaders(names);
       }
       public InputStream getRawInputStream() throws MessagingException {
  -        // TODO Implement method
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        return getContentStream();
       }
       public Date getReceivedDate() throws MessagingException {
  -        // TODO Implement method
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        return toDate(getHeader(Constants.RECEIVED_DATE, null));
       }
       public Address[] getRecipients(Message.RecipientType type)
           throws MessagingException {
  -        // TODO Implement method
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        String recipients = getHeader(type.toString(), ",");
  +        return toAddressArray(InternetAddress.parse(recipients));
       }
       public Address[] getReplyTo() throws MessagingException {
  -        // TODO Implement method
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        String reply = getHeader(Constants.REPLY_TO, ",");
  +        if (reply == null) {
  +            return getFrom();
  +        } else {
  +            return toAddressArray(InternetAddress.parse(reply));
  +        }
       }
       public Address getSender() throws MessagingException {
  -        // TODO Implement method
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        String sender = getHeader(Constants.SENDER, ",");
  +        if (sender == null) {
  +            return null;
  +        } else {
  +            return new InternetAddress(sender);
  +        }
       }
       public Date getSentDate() throws MessagingException {
  -        // TODO Implement method
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        return toDate(getHeader(Constants.SENT_DATE, null));
       }
       public int getSize() throws MessagingException {
  -        // TODO Implement method
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        if (content == null) {
  +            if (contentStream == null) {
  +                return -1;
  +            } else {
  +                try {
  +                    return contentStream.available();
  +                } catch (IOException e) {
  +                    throw new MessagingException(null, e);
  +                }
  +            }
  +        } else {
  +            return content.length;
  +        }
       }
       public String getSubject() throws MessagingException {
  -        // TODO Implement method
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        return getHeader(Constants.SUBJECT, null);
       }
       public boolean isMimeType(String type) throws MessagingException {
           ContentType c1 = new ContentType(type);
           ContentType c2 = new ContentType(dh.getContentType());
           return c1.match(c2);
       }
  -    public synchronized boolean isSet(Flags.Flag flag)
  -        throws MessagingException {
  -        // TODO Implement method
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +    public boolean isSet(Flags.Flag flag) throws MessagingException {
  +        return getFlags().contains(flag);
       }
       protected void parse(InputStream in) throws MessagingException {
  -        // TODO Implement method
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        createInternetHeaders(in);
  +        try {
  +            content = new byte[in.available()];
  +            new DataInputStream(in).readFully(content);
  +        } catch (IOException e) {
  +            throw new MessagingException(null, e);
  +        }
       }
       public void removeHeader(String name) throws MessagingException {
           headers.removeHeader(name);
       }
       public Message reply(boolean replyToAll) throws MessagingException {
  -        // TODO Implement method
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        Message reply = new MimeMessage(this);
  +        // set up fields etc.
  +        reply.setFrom();
  +        reply.setRecipients(Message.RecipientType.TO, getReplyTo());
  +        if (replyToAll) {
  +            reply.setRecipients(Message.RecipientType.CC, getAllRecipients());
  +        }
  +        String subject = getSubject();
  +        if (subject.startsWith(Constants.REGARDING + ":")) {
  +            reply.setSubject(subject);
  +        } else {
  +            reply.setSubject(Constants.REGARDING + ": " + subject);
  +        }
  +        String id = getMessageID();
  +        if (id != null) {
  +            setHeader(Constants.IN_REPLY_TO, id);
  +        }
  +        setFlag(Flags.Flag.ANSWERED, true);
  +        return reply;
       }
       public void saveChanges() throws MessagingException {
           updateHeaders();
  +        saved = true;
       }
       public void setContent(Multipart part) throws MessagingException {
  -        // TODO Implement method
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        setContent(part, part.getContentType());
       }
       public void setContent(Object content, String type)
           throws MessagingException {
  -        // TODO Implement method
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        setDataHandler(new DataHandler(content, type));
       }
       public void setContentID(String cid) throws MessagingException {
  -        // TODO Implement method
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        setHeader(Constants.CONTENT_ID, cid);
       }
  -    public void setContentLanguage(String[] languages)
  +    public void setContentLanguage(String[] language)
           throws MessagingException {
  -        // TODO Implement method
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        if (language == null || language.length == 0) {
  +            removeHeader(Constants.CONTENT_LANGUAGE);
  +        } else {
  +            for (int i = 0; i < language.length; i++) {
  +                addHeader(Constants.CONTENT_LANGUAGE, language[i]);
  +            }
  +        }
       }
       public void setContentMD5(String md5) throws MessagingException {
  -        // TODO Implement method
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        setHeader(Constants.CONTENT_MD5, md5);
       }
       public void setDataHandler(DataHandler handler) throws MessagingException {
           dh = handler;
       }
       public void setDescription(String description) throws MessagingException {
  -        // TODO Implement method
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        setHeader(Constants.CONTENT_DESCRIPTION, description);
       }
       public void setDescription(String description, String charset)
           throws MessagingException {
  -        // TODO Implement method
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        try {
  +            setHeader(
  +                Constants.CONTENT_DESCRIPTION,
  +                MimeUtility.encodeText(description, charset, "binary"));
  +        } catch (UnsupportedEncodingException e) {
  +            throw new MessagingException(null, e);
  +        }
       }
       public void setDisposition(String disposition) throws MessagingException {
  -        // TODO Implement method
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        String old = getHeader(Constants.CONTENT_DISPOSITION, null);
  +        ContentDisposition cd = new ContentDisposition(old);
  +        cd.setDisposition(disposition);
  +        setHeader(Constants.CONTENT_DISPOSITION, cd.toString());
       }
       public void setFileName(String name) throws MessagingException {
  -        // TODO Implement method
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        String old = getHeader(Constants.CONTENT_DISPOSITION, null);
  +        ContentDisposition disposition = new ContentDisposition(old);
  +        disposition.setParameter(Constants.FILENAME, name);
  +        setHeader(Constants.CONTENT_DISPOSITION, disposition.toString());
       }
       public synchronized void setFlags(Flags flags, boolean set)
           throws MessagingException {
  -        // TODO Implement method
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        if (set) {
  +            getFlags().add(flags);
  +        } else {
  +            getFlags().remove(flags);
  +        }
       }
       public void setFrom() throws MessagingException {
           setFrom(InternetAddress.getLocalAddress(session));
       }
       public void setFrom(Address address) throws MessagingException {
  -        // TODO Implement method
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        setHeader(Constants.FROM, address.toString());
       }
       public void setHeader(String name, String value)
           throws MessagingException {
  +        if (headers == null) {
  +            headers = new InternetHeaders();
  +        }
           headers.setHeader(name, value);
       }
       public void setRecipients(Message.RecipientType type, Address[] address)
           throws MessagingException {
  -        // TODO Implement method
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        setHeader(type.toString(), InternetAddress.toString(address));
       }
       public void setRecipients(Message.RecipientType type, String address)
           throws MessagingException {
           setRecipients(type, InternetAddress.parse(address));
       }
       public void setReplyTo(Address[] address) throws MessagingException {
  -        // TODO Implement method
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        setHeader(Constants.REPLY_TO, InternetAddress.toString(address));
  +    }
  +    public void setSender(Address address) throws MessagingException {
  +        setHeader(Constants.SENDER, address.toString());
       }
       public void setSentDate(Date sent) throws MessagingException {
  +        setHeader(Constants.SENT_DATE, MailDateFormat.INSTANCE.format(sent));
       }
       public void setSubject(String subject) throws MessagingException {
  +        setHeader(Constants.SUBJECT, subject);
       }
       public void setSubject(String subject, String charset)
           throws MessagingException {
  +        // TODO What happens with charset?
  +        setHeader(Constants.SUBJECT, subject);
       }
       public void setText(String text) throws MessagingException {
  +        setContent(text, Constants.TEXT_PLAIN);
       }
       public void setText(String text, String charset)
           throws MessagingException {
  +        // TODO What happens with charset?
  +        setContent(text, Constants.TEXT_PLAIN);
       }
  +    /**
  +     * This implementation does nothing, as does the JavaMail RI; it is left to subclasses to decide how this occurs
  +     * @throws MessagingException
  +     */
       protected void updateHeaders() throws MessagingException {
       }
  -    public void writeTo(OutputStream out) throws IOException {
  +    public void writeTo(OutputStream out)
  +        throws IOException, MessagingException {
  +        writeTo(out, null);
       }
       public void writeTo(OutputStream out, String[] ignoreHeaders)
  -        throws IOException {
  -    }
  -    public void setSender(Address address) {
  +        throws IOException, MessagingException {
  +        Enumeration outheaders;
  +        if (ignoreHeaders == null || ignoreHeaders.length == 0) {
  +            outheaders = headers.getAllHeaders();
  +        } else {
  +            outheaders = headers.getNonMatchingHeaders(ignoreHeaders);
  +        }
  +        // TODO Characterset mangling
  +        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(out));
  +        while (outheaders.hasMoreElements()) {
  +            Header header = (Header) outheaders.nextElement();
  +            bw.write(header.getName());
  +            bw.write(": ");
  +            bw.write(header.getValue());
  +            bw.write(Constants.EOL);
  +        }
  +        bw.write(Constants.EOL); // blank line between headers and content
  +        bw.flush();
  +        // copy from dh to out
  +        byte buffer[] = new byte[1024];
  +        int amount = 0;
  +        InputStream data = getInputStream();
  +        // TODO Ensure encoding works
  +        while((amount = data.read(buffer)) != -1) {
  +            out.write(buffer,0,amount);
  +            
  +        }
       }
   }
  
  
  
  1.1.2.1   +5 -6      incubator-geronimo/specs/javamail/src/java/javax/mail/internet/MimeMultipart.java
  
  Index: MimeMultipart.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/specs/javamail/src/java/javax/mail/internet/MimeMultipart.java,v
  retrieving revision 1.1
  retrieving revision 1.1.2.1
  diff -u -r1.1 -r1.1.2.1
  --- MimeMultipart.java	16 Aug 2003 01:55:48 -0000	1.1
  +++ MimeMultipart.java	13 Sep 2003 05:41:18 -0000	1.1.2.1
  @@ -71,14 +71,14 @@
    */
   public class MimeMultipart extends Multipart {
       protected DataSource ds;
  -    protected boolean parsed;
  +    protected boolean parsed = true;
       public MimeMultipart() {
           // TODO Implement method
           throw new UnsupportedOperationException("Method not yet implemented");
       }
       public MimeMultipart(DataSource dataSource) throws MessagingException {
  -        // TODO Implement method
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +        this.ds = dataSource;
  +        parsed = false;
       }
       public MimeMultipart(String subtype) {
           // TODO Implement method
  @@ -86,8 +86,7 @@
       }
       protected InternetHeaders createInternetHeaders(InputStream in)
           throws MessagingException {
  -        // TODO Implement method
  -        throw new UnsupportedOperationException("Method not yet implemented");
  +            return new InternetHeaders(in);
       }
       protected MimeBodyPart createMimeBodyPart(InputStream in)
           throws MessagingException {
  
  
  
  1.2.2.1   +5 -5      incubator-geronimo/specs/javamail/src/java/javax/mail/internet/ParameterList.java
  
  Index: ParameterList.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/specs/javamail/src/java/javax/mail/internet/ParameterList.java,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- ParameterList.java	4 Sep 2003 02:14:40 -0000	1.2
  +++ ParameterList.java	13 Sep 2003 05:41:18 -0000	1.2.2.1
  @@ -65,11 +65,11 @@
   import java.util.Iterator;
   import java.util.Map;
   import java.util.StringTokenizer;
  -// Represents lists in things like
  -// Content-Type: text/plain;charset=klingon
  -//
  -// The ;charset=klingon is the parameter list, may have more of them with ';'
   /**
  + * Represents lists in things like
  + * Content-Type: text/plain;charset=klingon
  + *
  + * The ;charset=klingon is the parameter list, may have more of them with ';'
    * @version $Revision$ $Date$
    */
   public class ParameterList {
  
  
  
  No                   revision
  
  Index: ParameterList.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/specs/javamail/src/java/javax/mail/internet/ParameterList.java,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- ParameterList.java	4 Sep 2003 02:14:40 -0000	1.2
  +++ ParameterList.java	13 Sep 2003 05:41:18 -0000	1.2.2.1
  @@ -65,11 +65,11 @@
   import java.util.Iterator;
   import java.util.Map;
   import java.util.StringTokenizer;
  -// Represents lists in things like
  -// Content-Type: text/plain;charset=klingon
  -//
  -// The ;charset=klingon is the parameter list, may have more of them with ';'
   /**
  + * Represents lists in things like
  + * Content-Type: text/plain;charset=klingon
  + *
  + * The ;charset=klingon is the parameter list, may have more of them with ';'
    * @version $Revision$ $Date$
    */
   public class ParameterList {
  
  
  
  No                   revision
  
  Index: ParameterList.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/specs/javamail/src/java/javax/mail/internet/ParameterList.java,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- ParameterList.java	4 Sep 2003 02:14:40 -0000	1.2
  +++ ParameterList.java	13 Sep 2003 05:41:18 -0000	1.2.2.1
  @@ -65,11 +65,11 @@
   import java.util.Iterator;
   import java.util.Map;
   import java.util.StringTokenizer;
  -// Represents lists in things like
  -// Content-Type: text/plain;charset=klingon
  -//
  -// The ;charset=klingon is the parameter list, may have more of them with ';'
   /**
  + * Represents lists in things like
  + * Content-Type: text/plain;charset=klingon
  + *
  + * The ;charset=klingon is the parameter list, may have more of them with ';'
    * @version $Revision$ $Date$
    */
   public class ParameterList {
  
  
  
  1.1.2.1   +92 -0     incubator-geronimo/specs/javamail/src/java/javax/mail/internet/Attic/Constants.java
  
  
  
  
  No                   revision
  No                   revision
  1.1.2.1   +4 -4      incubator-geronimo/specs/javamail/src/java/javax/mail/search/DateTerm.java
  
  Index: DateTerm.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/specs/javamail/src/java/javax/mail/search/DateTerm.java,v
  retrieving revision 1.1
  retrieving revision 1.1.2.1
  diff -u -r1.1 -r1.1.2.1
  --- DateTerm.java	16 Aug 2003 01:55:48 -0000	1.1
  +++ DateTerm.java	13 Sep 2003 05:41:19 -0000	1.1.2.1
  @@ -60,6 +60,8 @@
   //
   package javax.mail.search;
   import java.util.Date;
  +
  +import org.apache.geronimo.common.NullArgumentException;
   /**
    * @version $Revision$ $Date$
    */
  @@ -67,9 +69,7 @@
       protected Date date;
       protected DateTerm(int comparison, Date date) {
           super(comparison);
  -        if (date == null) {
  -            throw new IllegalArgumentException("Date cannot be null");
  -        }
  +        NullArgumentException.checkForNull("date",date);
           this.date = date;
       }
       public boolean equals(Object other) {
  
  
  
  No                   revision
  No                   revision
  1.2.2.1   +0 -4      incubator-geronimo/specs/javamail/src/test/javax/mail/MessageContextTest.java
  
  Index: MessageContextTest.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/specs/javamail/src/test/javax/mail/MessageContextTest.java,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- MessageContextTest.java	4 Sep 2003 14:45:29 -0000	1.2
  +++ MessageContextTest.java	13 Sep 2003 05:41:19 -0000	1.2.2.1
  @@ -66,9 +66,6 @@
    * @version $Revision$ $Date$
    */
   public class MessageContextTest extends TestCase {
  -    public void testNothing() {
  -    }
  -    /*
       public void testMessageContext() {
           Part p;
           MessageContext mc;
  @@ -309,5 +306,4 @@
               throws IOException, MessagingException {
           }
       }
  -    */
   }
  
  
  
  1.2.2.1   +4 -4      incubator-geronimo/specs/javamail/src/test/javax/mail/TestData.java
  
  Index: TestData.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/specs/javamail/src/test/javax/mail/TestData.java,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- TestData.java	28 Aug 2003 13:32:09 -0000	1.2
  +++ TestData.java	13 Sep 2003 05:41:19 -0000	1.2.2.1
  @@ -64,7 +64,7 @@
       public static Store getTestStore() {
           return new Store(
               getTestSession(),
  -            new URLName("http://alex@test.com")) {
  +            new URLName("myimap://alex@test.com")) {
               public Folder getDefaultFolder() throws MessagingException {
                   return getTestFolder();
               }
  @@ -138,7 +138,7 @@
               public Folder[] list(String pattern) throws MessagingException {
                   return null;
               }
  -            public void open(int mode) throws MessagingException {
  +            public void open(int newMode) throws MessagingException {
               }
               public boolean renameTo(Folder newName) throws MessagingException {
                   return false;
  @@ -148,10 +148,10 @@
       public static Transport getTestTransport() {
           return new Transport(
               getTestSession(),
  -            new URLName("http://host.name")) {
  +            new URLName("mysmtp://host.name")) {
               public void sendMessage(Message message, Address[] addresses)
                   throws MessagingException {
  -                // TODO Auto-generated method stub
  +                // pretend to send message
               }
           };
       }
  
  
  
  1.3.2.1   +100 -19   incubator-geronimo/specs/javamail/src/test/javax/mail/URLNameTest.java
  
  Index: URLNameTest.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/specs/javamail/src/test/javax/mail/URLNameTest.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- URLNameTest.java	19 Aug 2003 02:39:02 -0000	1.3
  +++ URLNameTest.java	13 Sep 2003 05:41:19 -0000	1.3.2.1
  @@ -62,6 +62,8 @@
   
   import java.net.MalformedURLException;
   import java.net.URL;
  +import java.util.HashMap;
  +import java.util.Map;
   
   import junit.framework.TestCase;
   
  @@ -174,7 +176,7 @@
           }
   
           name = new URLName((String) null);
  -        assertNull( name.getProtocol());
  +        assertNull(name.getProtocol());
           assertNull(name.getHost());
           assertEquals(-1, name.getPort());
           assertNull(name.getFile());
  @@ -189,7 +191,7 @@
           }
   
           name = new URLName("");
  -        assertNull( name.getProtocol());
  +        assertNull(name.getProtocol());
           assertNull(name.getHost());
           assertEquals(-1, name.getPort());
           assertNull(name.getFile());
  @@ -276,12 +278,21 @@
           assertNull(name.getUsername());
           assertNull(name.getPassword());
           try {
  -            assertEquals(new URL("http://www.apache.org/file/file2"), name.getURL());
  +            assertEquals(
  +                new URL("http://www.apache.org/file/file2"),
  +                name.getURL());
           } catch (MalformedURLException e) {
               fail();
           }
   
  -        name = new URLName("http", "www.apache.org", -1, "/file/file2", "john", "");
  +        name =
  +            new URLName(
  +                "http",
  +                "www.apache.org",
  +                -1,
  +                "/file/file2",
  +                "john",
  +                "");
           assertEquals("http://john@www.apache.org/file/file2", name.toString());
           assertEquals("http", name.getProtocol());
           assertEquals("www.apache.org", name.getHost());
  @@ -291,13 +302,24 @@
           assertEquals("john", name.getUsername());
           assertNull(name.getPassword());
           try {
  -            assertEquals(new URL("http://john@www.apache.org/file/file2"), name.getURL());
  +            assertEquals(
  +                new URL("http://john@www.apache.org/file/file2"),
  +                name.getURL());
           } catch (MalformedURLException e) {
               fail();
           }
   
  -        name = new URLName("http", "www.apache.org", -1, "/file/file2", "john", "doe");
  -        assertEquals("http://john:doe@www.apache.org/file/file2", name.toString());
  +        name =
  +            new URLName(
  +                "http",
  +                "www.apache.org",
  +                -1,
  +                "/file/file2",
  +                "john",
  +                "doe");
  +        assertEquals(
  +            "http://john:doe@www.apache.org/file/file2",
  +            name.toString());
           assertEquals("http", name.getProtocol());
           assertEquals("www.apache.org", name.getHost());
           assertEquals(-1, name.getPort());
  @@ -306,12 +328,15 @@
           assertEquals("john", name.getUsername());
           assertEquals("doe", name.getPassword());
           try {
  -            assertEquals(new URL("http://john:doe@www.apache.org/file/file2"), name.getURL());
  +            assertEquals(
  +                new URL("http://john:doe@www.apache.org/file/file2"),
  +                name.getURL());
           } catch (MalformedURLException e) {
               fail();
           }
   
  -        name = new URLName("http", "www.apache.org", -1, "/file/file2", "", "doe");
  +        name =
  +            new URLName("http", "www.apache.org", -1, "/file/file2", "", "doe");
           assertEquals("http://www.apache.org/file/file2", name.toString());
           assertEquals("http", name.getProtocol());
           assertEquals("www.apache.org", name.getHost());
  @@ -321,7 +346,9 @@
           assertNull(name.getUsername());
           assertNull(name.getPassword());
           try {
  -            assertEquals(new URL("http://www.apache.org/file/file2"), name.getURL());
  +            assertEquals(
  +                new URL("http://www.apache.org/file/file2"),
  +                name.getURL());
           } catch (MalformedURLException e) {
               fail();
           }
  @@ -351,21 +378,33 @@
           URLName name1 = new URLName("http://www.apache.org");
           assertEquals(name1, new URLName("http://www.apache.org"));
           assertEquals(name1, new URLName(new URL("http://www.apache.org")));
  -        assertEquals(name1, new URLName("http", "www.apache.org", -1, null, null, null));
  -        assertEquals(name1, new URLName("http://www.apache.org#foo")); // wierd but ref is not part of the equals contract
  +        assertEquals(
  +            name1,
  +            new URLName("http", "www.apache.org", -1, null, null, null));
  +        assertEquals(name1, new URLName("http://www.apache.org#foo"));
  +        // wierd but ref is not part of the equals contract
           assertTrue(!name1.equals(new URLName("http://www.apache.org:8080")));
           assertTrue(!name1.equals(new URLName("http://cvs.apache.org")));
           assertTrue(!name1.equals(new URLName("https://www.apache.org")));
   
           name1 = new URLName("http://john:doe@www.apache.org");
  -        assertEquals(name1, new URLName(new URL("http://john:doe@www.apache.org")));
  -        assertEquals(name1, new URLName("http", "www.apache.org", -1, null, "john", "doe"));
  -        assertTrue(!name1.equals(new URLName("http://john:xxx@www.apache.org")));
  +        assertEquals(
  +            name1,
  +            new URLName(new URL("http://john:doe@www.apache.org")));
  +        assertEquals(
  +            name1,
  +            new URLName("http", "www.apache.org", -1, null, "john", "doe"));
  +        assertTrue(
  +            !name1.equals(new URLName("http://john:xxx@www.apache.org")));
           assertTrue(!name1.equals(new URLName("http://xxx:doe@www.apache.org")));
           assertTrue(!name1.equals(new URLName("http://www.apache.org")));
   
  -        assertEquals(new URLName("http://john@www.apache.org"), new URLName("http", "www.apache.org", -1, null, "john", null));
  -        assertEquals(new URLName("http://www.apache.org"), new URLName("http", "www.apache.org", -1, null, null, "doe"));
  +        assertEquals(
  +            new URLName("http://john@www.apache.org"),
  +            new URLName("http", "www.apache.org", -1, null, "john", null));
  +        assertEquals(
  +            new URLName("http://www.apache.org"),
  +            new URLName("http", "www.apache.org", -1, null, null, "doe"));
       }
   
       public void testHashCode() {
  @@ -376,7 +415,8 @@
       }
   
       public void testNullProtocol() {
  -        URLName name1 = new URLName(null, "www.apache.org", -1, null, null, null);
  +        URLName name1 =
  +            new URLName(null, "www.apache.org", -1, null, null, null);
           assertTrue(!name1.equals(name1));
       }
   
  @@ -398,4 +438,45 @@
   
           // TBD as I am not sure what other URL formats to use
       }
  +
  +    public void testEqualsBroken() {
  +        URLName original = new URLName("http://www.apache.org");
  +        ExtendedURLName extended =
  +            new ExtendedURLName("http://www.apache.org", "Data");
  +        assertEquals(
  +            "Equals contract broken",
  +            original.equals(extended),
  +            extended.equals(original));
  +    }
  +
  +    public void testEqualStillBroken() {
  +        URLName original = new URLName("http://www.apache.org");
  +        ExtendedURLName extended =
  +            new ExtendedURLName("http://www.apache.org", "Data");
  +        Map map = new HashMap();
  +        map.put(original, original);
  +        assertFalse(map.containsKey(extended));
  +        assertFalse(map.containsValue(extended));
  +    }
  +
  +    public static class ExtendedURLName extends URLName {
  +        public ExtendedURLName(String url, Object data) {
  +            super(url);
  +            this.data = data;
  +        }
  +        private Object data;
  +        public boolean equals(Object o) {
  +            if (o instanceof ExtendedURLName) {
  +                // compare as this
  +                return super.equals(o)
  +                    && ((ExtendedURLName) o).data.equals(this.data);
  +            } else if (o instanceof URLName) {
  +                // compare as superclass
  +                return super.equals(o);
  +            } else {
  +                return false;
  +            }
  +        }
  +    }
  +
   }
  
  
  
  No                   revision
  No                   revision
  1.1.2.1   +8 -2      incubator-geronimo/specs/javamail/src/test/javax/mail/internet/AllInternetTests.java
  
  Index: AllInternetTests.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/specs/javamail/src/test/javax/mail/internet/AllInternetTests.java,v
  retrieving revision 1.1
  retrieving revision 1.1.2.1
  diff -u -r1.1 -r1.1.2.1
  --- AllInternetTests.java	16 Aug 2003 01:55:49 -0000	1.1
  +++ AllInternetTests.java	13 Sep 2003 05:41:19 -0000	1.1.2.1
  @@ -68,9 +68,15 @@
       public static Test suite() {
           TestSuite suite = new TestSuite("Test for javax.mail.internet");
           //$JUnit-BEGIN$
  +        suite.addTest(new TestSuite(ContentDispositionTest.class));
           suite.addTest(new TestSuite(ContentTypeTest.class));
  -        suite.addTest(new TestSuite(ParameterListTest.class));
  +        suite.addTest(new TestSuite(HeaderTokenizerTest.class));
           suite.addTest(new TestSuite(InternetAddressTest.class));
  +        suite.addTest(new TestSuite(InternetHeadersTest.class));
  +        suite.addTest(new TestSuite(MailDateFormatTest.class));
  +        suite.addTest(new TestSuite(MimeMessageTest.class));
  +        suite.addTest(new TestSuite(NewsAddressTest.class));
  +        suite.addTest(new TestSuite(ParameterListTest.class));
           //$JUnit-END$
           return suite;
       }
  
  
  
  1.1.2.1   +12 -18    incubator-geronimo/specs/javamail/src/test/javax/mail/internet/InternetAddressTest.java
  
  Index: InternetAddressTest.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/specs/javamail/src/test/javax/mail/internet/InternetAddressTest.java,v
  retrieving revision 1.1
  retrieving revision 1.1.2.1
  diff -u -r1.1 -r1.1.2.1
  --- InternetAddressTest.java	16 Aug 2003 01:55:49 -0000	1.1
  +++ InternetAddressTest.java	13 Sep 2003 05:41:19 -0000	1.1.2.1
  @@ -64,25 +64,19 @@
    * @version $Revision$ $Date$
    */
   public class InternetAddressTest extends TestCase {
  -    public InternetAddressTest(String arg0) {
  -        super(arg0);
  -    }
       public void testInternetAddress() throws AddressException {
           InternetAddress ia =
  -            new InternetAddress("Alex Blewitt <Al...@bigboy.com>");
  -        assertEquals("Alex Blewitt", ia.getPersonal());
  -        assertEquals("Alex.Blewitt@bigboy.com", ia.getAddress());
  -    }
  -    public void testInternetAddresses() throws AddressException {
  -        InternetAddress[] ia =
  +            new InternetAddress("Geronimo Developers <ge...@apache.org>");
  +        assertEquals("Geronimo Developers", ia.getPersonal());
  +        assertEquals("geronimo-dev@apache.org", ia.getAddress());
  +        assertEquals("rfc822",ia.getType());
  +        InternetAddress[] ias =
               InternetAddress.parse(
  -                "Mr B <Mr...@bigboy.com>, Mrs B <Mr...@biggirl.com>, Milly <Mi...@thedog.com>");
  -        assertEquals(3, ia.length);
  -        assertEquals("Mr B", ia[0].getPersonal());
  -        assertEquals("Mr.B@bigboy.com", ia[0].getAddress());
  -        assertEquals("Mrs B", ia[1].getPersonal());
  -        assertEquals("Mrs.B@biggirl.com", ia[1].getAddress());
  -        assertEquals("Milly", ia[2].getPersonal());
  -        assertEquals("Milly@thedog.com", ia[2].getAddress());
  +                "Geronimo Developers <ge...@apache.org>, Geronimo Users <ge...@apache.org>");
  +        assertEquals(2, ias.length);
  +        assertEquals("Geronimo Developers", ias[0].getPersonal());
  +        assertEquals("geronimo-dev@apache.org", ias[0].getAddress());
  +        assertEquals("Geronimo Users", ias[1].getPersonal());
  +        assertEquals("geronimo-user@apache.org", ias[1].getAddress());
       }
   }
  
  
  
  1.2.2.1   +4 -6      incubator-geronimo/specs/javamail/src/test/javax/mail/internet/MimeMessageTest.java
  
  Index: MimeMessageTest.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/specs/javamail/src/test/javax/mail/internet/MimeMessageTest.java,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- MimeMessageTest.java	4 Sep 2003 14:45:29 -0000	1.2
  +++ MimeMessageTest.java	13 Sep 2003 05:41:19 -0000	1.2.2.1
  @@ -72,9 +72,6 @@
    * @version $Revision$ $Date$
    */
   public class MimeMessageTest extends TestCase {
  -    public void testNothing() {
  -    }
  -    /*
       private static final String EOL = "\r\n";
       private static final String users =
           "Geronimo Users <ge...@apache.org>";
  @@ -124,8 +121,8 @@
           MimeMessage message = new MimeMessage(null, 1);
           message.setContent("Hello world", "text/plain");
           message.setContentID("Test message @ test.com");
  -        //message.setContentLanguage(new String[] { "en" });
           message.setContentMD5("md5hash");
  +        message.setContentLanguage(new String[] { "en","fr" });
           message.setDescription("A test message");
           message.setDisposition(Part.INLINE);
           message.setFileName("file.txt");
  @@ -142,7 +139,9 @@
           assertEquals("A test message", message.getDescription());
           assertEquals("inline", message.getDisposition());
           assertEquals("file.txt", message.getFileName());
  -        //        assertEquals("en",message.getContentLanguage()[0]);
  +        assertEquals(2,message.getContentLanguage().length);
  +        assertEquals("en",message.getContentLanguage()[0]);
  +        assertEquals("fr",message.getContentLanguage()[1]);
           assertEquals(
               "inline;filename=file.txt",
               message.getHeader("Content-Disposition", null));
  @@ -154,5 +153,4 @@
               // whereas the one from the MessageContext has been encoded to a string and parsed
           assertEquals(sent.toString(),message.getSentDate().toString());
       }
  -    */
   }