james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject svn commit: r895016 - in /james/mime4j/branches/cycleclean: core/src/main/java/org/apache/james/mime4j/field/address/ core/src/main/java/org/apache/james/mime4j/field/address/parser/ core/src/main/java/org/apache/james/mime4j/field/impl/ core/src/test/...
Date Fri, 01 Jan 2010 14:29:54 GMT
Author: bago
Date: Fri Jan  1 14:29:54 2010
New Revision: 895016

URL: http://svn.apache.org/viewvc?rev=895016&view=rev
Log:
Remove static parse methods from Address beans. Created an AddressBuilder in the address.parser package for that methods. Moved "Builder" to that package too. (MIME4J-156)

Added:
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/parser/AddressBuilder.java   (with props)
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/parser/Builder.java   (contents, props changed)
      - copied, changed from r894746, james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/Builder.java
Removed:
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/Builder.java
Modified:
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/Address.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/AddressList.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/Group.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/Mailbox.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/AddressListFieldImpl.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/MailboxFieldImpl.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/MailboxListFieldImpl.java
    james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/field/FieldsTest.java
    james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/field/address/AddressTest.java
    james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/MessageTest.java
    james/mime4j/branches/cycleclean/examples/src/main/java/org/apache/james/mime4j/samples/dom/MultipartMessage.java
    james/mime4j/branches/cycleclean/examples/src/main/java/org/apache/james/mime4j/samples/dom/TextPlainMessage.java
    james/mime4j/branches/cycleclean/examples/src/main/java/org/apache/james/mime4j/samples/transform/TransformMessage.java

Modified: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/Address.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/Address.java?rev=895016&r1=895015&r2=895016&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/Address.java (original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/Address.java Fri Jan  1 14:29:54 2010
@@ -20,12 +20,8 @@
 package org.apache.james.mime4j.field.address;
 
 import java.io.Serializable;
-import java.io.StringReader;
 import java.util.List;
 
-import org.apache.james.mime4j.field.address.parser.AddressListParser;
-import org.apache.james.mime4j.field.address.parser.ParseException;
-
 /**
  * The abstract base for classes that represent RFC2822 addresses. This includes
  * groups and mailboxes.
@@ -95,25 +91,6 @@
      */
     public abstract String getEncodedString();
 
-    /**
-     * Parses the specified raw string into an address.
-     * 
-     * @param rawAddressString
-     *            string to parse.
-     * @return an <code>Address</code> object for the specified string.
-     * @throws IllegalArgumentException
-     *             if the raw string does not represent a single address.
-     */
-    public static Address parse(String rawAddressString) {
-        AddressListParser parser = new AddressListParser(new StringReader(
-                rawAddressString));
-        try {
-            return Builder.getInstance().buildAddress(parser.parseAddress());
-        } catch (ParseException e) {
-            throw new IllegalArgumentException(e);
-        }
-    }
-
     @Override
     public String toString() {
         return getDisplayString(false);

Modified: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/AddressList.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/AddressList.java?rev=895016&r1=895015&r2=895016&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/AddressList.java (original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/AddressList.java Fri Jan  1 14:29:54 2010
@@ -19,11 +19,7 @@
 
 package org.apache.james.mime4j.field.address;
 
-import org.apache.james.mime4j.field.address.parser.AddressListParser;
-import org.apache.james.mime4j.field.address.parser.ParseException;
-
 import java.io.Serializable;
-import java.io.StringReader;
 import java.util.AbstractList;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -109,40 +105,4 @@
         }
     }
 
-    /**
-     * Parse the address list string, such as the value of a From, To, Cc, Bcc,
-     * Sender, or Reply-To header.
-     * 
-     * The string MUST be unfolded already.
-     */
-    public static AddressList parse(String rawAddressList)
-            throws ParseException {
-        AddressListParser parser = new AddressListParser(new StringReader(
-                rawAddressList));
-        return Builder.getInstance().buildAddressList(parser.parseAddressList());
-    }
-
-    /**
-     * Test console.
-     */
-    public static void main(String[] args) throws Exception {
-        java.io.BufferedReader reader = new java.io.BufferedReader(
-                new java.io.InputStreamReader(System.in));
-        while (true) {
-            try {
-                System.out.print("> ");
-                String line = reader.readLine();
-                if (line.length() == 0 || line.toLowerCase().equals("exit")
-                        || line.toLowerCase().equals("quit")) {
-                    System.out.println("Goodbye.");
-                    return;
-                }
-                AddressList list = parse(line);
-                list.print();
-            } catch (Exception e) {
-                e.printStackTrace();
-                Thread.sleep(300);
-            }
-        }
-    }
 }

Modified: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/Group.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/Group.java?rev=895016&r1=895015&r2=895016&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/Group.java (original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/Group.java Fri Jan  1 14:29:54 2010
@@ -73,23 +73,6 @@
     }
 
     /**
-     * Parses the specified raw string into a group address.
-     * 
-     * @param rawGroupString
-     *            string to parse.
-     * @return a <code>Group</code> object for the specified string.
-     * @throws IllegalArgumentException
-     *             if the raw string does not represent a single group address.
-     */
-    public static Group parse(String rawGroupString) {
-        Address address = Address.parse(rawGroupString);
-        if (!(address instanceof Group))
-            throw new IllegalArgumentException("Not a group address");
-
-        return (Group) address;
-    }
-
-    /**
      * Returns the group name.
      */
     public String getName() {

Modified: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/Mailbox.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/Mailbox.java?rev=895016&r1=895015&r2=895016&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/Mailbox.java (original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/Mailbox.java Fri Jan  1 14:29:54 2010
@@ -19,14 +19,11 @@
 
 package org.apache.james.mime4j.field.address;
 
-import java.io.StringReader;
 import java.util.Collections;
 import java.util.List;
 import java.util.Locale;
 
 import org.apache.james.mime4j.codec.EncoderUtil;
-import org.apache.james.mime4j.field.address.parser.AddressListParser;
-import org.apache.james.mime4j.field.address.parser.ParseException;
 
 /**
  * Represents a single e-mail address.
@@ -118,26 +115,6 @@
     }
 
     /**
-     * Parses the specified raw string into a mailbox address.
-     * 
-     * @param rawMailboxString
-     *            string to parse.
-     * @return a <code>Mailbox</code> object for the specified string.
-     * @throws IllegalArgumentException
-     *             if the raw string does not represent a single mailbox
-     *             address.
-     */
-    public static Mailbox parse(String rawMailboxString) {
-        AddressListParser parser = new AddressListParser(new StringReader(
-                rawMailboxString));
-        try {
-            return Builder.getInstance().buildMailbox(parser.parseMailbox());
-        } catch (ParseException e) {
-            throw new IllegalArgumentException(e);
-        }
-    }
-
-    /**
      * Returns the name of the mailbox or <code>null</code> if it does not
      * have a name.
      */

Added: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/parser/AddressBuilder.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/parser/AddressBuilder.java?rev=895016&view=auto
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/parser/AddressBuilder.java (added)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/parser/AddressBuilder.java Fri Jan  1 14:29:54 2010
@@ -0,0 +1,125 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.james.mime4j.field.address.parser;
+
+import java.io.StringReader;
+
+import org.apache.james.mime4j.field.address.Address;
+import org.apache.james.mime4j.field.address.AddressList;
+import org.apache.james.mime4j.field.address.Group;
+import org.apache.james.mime4j.field.address.Mailbox;
+
+public class AddressBuilder {
+
+    /**
+     * Parses the specified raw string into an address.
+     * 
+     * @param rawAddressString
+     *            string to parse.
+     * @return an <code>Address</code> object for the specified string.
+     * @throws IllegalArgumentException
+     *             if the raw string does not represent a single address.
+     */
+    public static Address parseAddress(String rawAddressString) {
+        AddressListParser parser = new AddressListParser(new StringReader(
+                rawAddressString));
+        try {
+            return Builder.getInstance().buildAddress(parser.parseAddress());
+        } catch (ParseException e) {
+            throw new IllegalArgumentException(e);
+        }
+    }
+
+    /**
+     * Parse the address list string, such as the value of a From, To, Cc, Bcc,
+     * Sender, or Reply-To header.
+     * 
+     * The string MUST be unfolded already.
+     */
+    public static AddressList parseAddressList(String rawAddressList)
+            throws ParseException {
+        AddressListParser parser = new AddressListParser(new StringReader(
+                rawAddressList));
+        return Builder.getInstance().buildAddressList(parser.parseAddressList());
+    }
+
+
+    /**
+     * Test console for AddressList
+     */
+    public static void main(String[] args) throws Exception {
+        java.io.BufferedReader reader = new java.io.BufferedReader(
+                new java.io.InputStreamReader(System.in));
+        while (true) {
+            try {
+                System.out.print("> ");
+                String line = reader.readLine();
+                if (line.length() == 0 || line.toLowerCase().equals("exit")
+                        || line.toLowerCase().equals("quit")) {
+                    System.out.println("Goodbye.");
+                    return;
+                }
+                AddressList list = AddressBuilder.parseAddressList(line);
+                list.print();
+            } catch (Exception e) {
+                e.printStackTrace();
+                Thread.sleep(300);
+            }
+        }
+    }
+
+    /**
+     * Parses the specified raw string into a mailbox address.
+     * 
+     * @param rawMailboxString
+     *            string to parse.
+     * @return a <code>Mailbox</code> object for the specified string.
+     * @throws IllegalArgumentException
+     *             if the raw string does not represent a single mailbox
+     *             address.
+     */
+    public static Mailbox parseMailbox(String rawMailboxString) {
+        AddressListParser parser = new AddressListParser(new StringReader(
+                rawMailboxString));
+        try {
+            return Builder.getInstance().buildMailbox(parser.parseMailbox());
+        } catch (ParseException e) {
+            throw new IllegalArgumentException(e);
+        }
+    }
+
+    /**
+     * Parses the specified raw string into a group address.
+     * 
+     * @param rawGroupString
+     *            string to parse.
+     * @return a <code>Group</code> object for the specified string.
+     * @throws IllegalArgumentException
+     *             if the raw string does not represent a single group address.
+     */
+    public static Group parseGroup(String rawGroupString) {
+        Address address = parseAddress(rawGroupString);
+        if (!(address instanceof Group))
+            throw new IllegalArgumentException("Not a group address");
+    
+        return (Group) address;
+    }
+
+}

Propchange: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/parser/AddressBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/parser/AddressBuilder.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Copied: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/parser/Builder.java (from r894746, james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/Builder.java)
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/parser/Builder.java?p2=james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/parser/Builder.java&p1=james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/Builder.java&r1=894746&r2=895016&rev=895016&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/Builder.java (original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/parser/Builder.java Fri Jan  1 14:29:54 2010
@@ -17,9 +17,15 @@
  * under the License.                                           *
  ****************************************************************/
 
-package org.apache.james.mime4j.field.address;
+package org.apache.james.mime4j.field.address.parser;
 
 import org.apache.james.mime4j.codec.DecoderUtil;
+import org.apache.james.mime4j.field.address.Address;
+import org.apache.james.mime4j.field.address.AddressList;
+import org.apache.james.mime4j.field.address.DomainList;
+import org.apache.james.mime4j.field.address.Group;
+import org.apache.james.mime4j.field.address.Mailbox;
+import org.apache.james.mime4j.field.address.MailboxList;
 import org.apache.james.mime4j.field.address.parser.ASTaddr_spec;
 import org.apache.james.mime4j.field.address.parser.ASTaddress;
 import org.apache.james.mime4j.field.address.parser.ASTaddress_list;
@@ -75,7 +81,9 @@
                 return new Group(name, buildGroupBody((ASTgroup_body) n2));
             } else if (n2 instanceof ASTangle_addr) {
                 name = DecoderUtil.decodeEncodedWords(name);
-                return new Mailbox(name, buildAngleAddr((ASTangle_addr) n2));
+                Mailbox mb = buildAngleAddr((ASTangle_addr) n2);
+                return new Mailbox(name, mb.getRoute(), mb.getLocalPart(),
+                        mb.getDomain());
             } else {
                 throw new IllegalStateException();
             }
@@ -124,7 +132,9 @@
         n = it.next();
         if (n instanceof ASTangle_addr) {
             name = DecoderUtil.decodeEncodedWords(name);
-            return new Mailbox(name, buildAngleAddr((ASTangle_addr) n));
+            Mailbox mb = buildAngleAddr((ASTangle_addr) n);
+            return new Mailbox(name, mb.getRoute(), mb.getLocalPart(),
+                    mb.getDomain());
         } else {
             throw new IllegalStateException();
         }

Propchange: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/parser/Builder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/AddressListFieldImpl.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/AddressListFieldImpl.java?rev=895016&r1=895015&r2=895016&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/AddressListFieldImpl.java (original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/AddressListFieldImpl.java Fri Jan  1 14:29:54 2010
@@ -23,6 +23,7 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.james.mime4j.field.FieldParser;
 import org.apache.james.mime4j.field.address.AddressList;
+import org.apache.james.mime4j.field.address.parser.AddressBuilder;
 import org.apache.james.mime4j.field.address.parser.ParseException;
 import org.apache.james.mime4j.util.ByteSequence;
 
@@ -66,7 +67,7 @@
         String body = getBody();
 
         try {
-            addressList = AddressList.parse(body);
+            addressList = AddressBuilder.parseAddressList(body);
         } catch (ParseException e) {
             if (log.isDebugEnabled()) {
                 log.debug("Parsing value '" + body + "': " + e.getMessage());

Modified: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/MailboxFieldImpl.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/MailboxFieldImpl.java?rev=895016&r1=895015&r2=895016&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/MailboxFieldImpl.java (original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/MailboxFieldImpl.java Fri Jan  1 14:29:54 2010
@@ -22,9 +22,9 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.james.mime4j.field.FieldParser;
-import org.apache.james.mime4j.field.address.AddressList;
 import org.apache.james.mime4j.field.address.Mailbox;
 import org.apache.james.mime4j.field.address.MailboxList;
+import org.apache.james.mime4j.field.address.parser.AddressBuilder;
 import org.apache.james.mime4j.field.address.parser.ParseException;
 import org.apache.james.mime4j.util.ByteSequence;
 
@@ -68,7 +68,7 @@
         String body = getBody();
 
         try {
-            MailboxList mailboxList = AddressList.parse(body).flatten();
+            MailboxList mailboxList = AddressBuilder.parseAddressList(body).flatten();
             if (mailboxList.size() > 0) {
                 mailbox = mailboxList.get(0);
             }

Modified: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/MailboxListFieldImpl.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/MailboxListFieldImpl.java?rev=895016&r1=895015&r2=895016&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/MailboxListFieldImpl.java (original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/impl/MailboxListFieldImpl.java Fri Jan  1 14:29:54 2010
@@ -22,8 +22,8 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.james.mime4j.field.FieldParser;
-import org.apache.james.mime4j.field.address.AddressList;
 import org.apache.james.mime4j.field.address.MailboxList;
+import org.apache.james.mime4j.field.address.parser.AddressBuilder;
 import org.apache.james.mime4j.field.address.parser.ParseException;
 import org.apache.james.mime4j.util.ByteSequence;
 
@@ -67,7 +67,7 @@
         String body = getBody();
 
         try {
-            mailboxList = AddressList.parse(body).flatten();
+            mailboxList = AddressBuilder.parseAddressList(body).flatten();
         } catch (ParseException e) {
             if (log.isDebugEnabled()) {
                 log.debug("Parsing value '" + body + "': " + e.getMessage());

Modified: james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/field/FieldsTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/field/FieldsTest.java?rev=895016&r1=895015&r2=895016&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/field/FieldsTest.java (original)
+++ james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/field/FieldsTest.java Fri Jan  1 14:29:54 2010
@@ -29,6 +29,7 @@
 
 import org.apache.james.mime4j.field.address.Group;
 import org.apache.james.mime4j.field.address.Mailbox;
+import org.apache.james.mime4j.field.address.parser.AddressBuilder;
 import org.apache.james.mime4j.field.impl.Fields;
 import org.apache.james.mime4j.util.ByteSequence;
 import org.apache.james.mime4j.util.ContentUtil;
@@ -231,14 +232,14 @@
     }
 
     public void testSender() throws Exception {
-        MailboxField field = Fields.sender(Mailbox
-                .parse("JD <john.doe@acme.org>"));
+        MailboxField field = Fields.sender(AddressBuilder
+                .parseMailbox("JD <john.doe@acme.org>"));
         assertEquals("Sender: JD <john.doe@acme.org>", decode(field.getRaw()));
     }
 
     public void testFrom() throws Exception {
-        Mailbox mailbox1 = Mailbox.parse("JD <john.doe@acme.org>");
-        Mailbox mailbox2 = Mailbox.parse("Mary Smith <mary@example.net>");
+        Mailbox mailbox1 = AddressBuilder.parseMailbox("JD <john.doe@acme.org>");
+        Mailbox mailbox2 = AddressBuilder.parseMailbox("Mary Smith <mary@example.net>");
 
         MailboxListField field = Fields.from(mailbox1);
         assertEquals("From: JD <john.doe@acme.org>", decode(field.getRaw()));
@@ -253,9 +254,9 @@
     }
 
     public void testTo() throws Exception {
-        Mailbox mailbox1 = Mailbox.parse("JD <john.doe@acme.org>");
-        Mailbox mailbox2 = Mailbox.parse("jane.doe@example.org");
-        Mailbox mailbox3 = Mailbox.parse("Mary Smith <mary@example.net>");
+        Mailbox mailbox1 = AddressBuilder.parseMailbox("JD <john.doe@acme.org>");
+        Mailbox mailbox2 = AddressBuilder.parseMailbox("jane.doe@example.org");
+        Mailbox mailbox3 = AddressBuilder.parseMailbox("Mary Smith <mary@example.net>");
         Group group = new Group("The Does", mailbox1, mailbox2);
 
         AddressListField field = Fields.to(group);
@@ -274,9 +275,9 @@
     }
 
     public void testCc() throws Exception {
-        Mailbox mailbox1 = Mailbox.parse("JD <john.doe@acme.org>");
-        Mailbox mailbox2 = Mailbox.parse("jane.doe@example.org");
-        Mailbox mailbox3 = Mailbox.parse("Mary Smith <mary@example.net>");
+        Mailbox mailbox1 = AddressBuilder.parseMailbox("JD <john.doe@acme.org>");
+        Mailbox mailbox2 = AddressBuilder.parseMailbox("jane.doe@example.org");
+        Mailbox mailbox3 = AddressBuilder.parseMailbox("Mary Smith <mary@example.net>");
         Group group = new Group("The Does", mailbox1, mailbox2);
 
         AddressListField field = Fields.cc(group);
@@ -295,9 +296,9 @@
     }
 
     public void testBcc() throws Exception {
-        Mailbox mailbox1 = Mailbox.parse("JD <john.doe@acme.org>");
-        Mailbox mailbox2 = Mailbox.parse("jane.doe@example.org");
-        Mailbox mailbox3 = Mailbox.parse("Mary Smith <mary@example.net>");
+        Mailbox mailbox1 = AddressBuilder.parseMailbox("JD <john.doe@acme.org>");
+        Mailbox mailbox2 = AddressBuilder.parseMailbox("jane.doe@example.org");
+        Mailbox mailbox3 = AddressBuilder.parseMailbox("Mary Smith <mary@example.net>");
         Group group = new Group("The Does", mailbox1, mailbox2);
 
         AddressListField field = Fields.bcc(group);
@@ -316,9 +317,9 @@
     }
 
     public void testReplyTo() throws Exception {
-        Mailbox mailbox1 = Mailbox.parse("JD <john.doe@acme.org>");
-        Mailbox mailbox2 = Mailbox.parse("jane.doe@example.org");
-        Mailbox mailbox3 = Mailbox.parse("Mary Smith <mary@example.net>");
+        Mailbox mailbox1 = AddressBuilder.parseMailbox("JD <john.doe@acme.org>");
+        Mailbox mailbox2 = AddressBuilder.parseMailbox("jane.doe@example.org");
+        Mailbox mailbox3 = AddressBuilder.parseMailbox("Mary Smith <mary@example.net>");
         Group group = new Group("The Does", mailbox1, mailbox2);
 
         AddressListField field = Fields.replyTo(group);
@@ -337,15 +338,15 @@
     }
 
     public void testMailbox() throws Exception {
-        MailboxField field = Fields.mailbox("Resent-Sender", Mailbox
-                .parse("JD <john.doe@acme.org>"));
+        MailboxField field = Fields.mailbox("Resent-Sender", AddressBuilder
+                .parseMailbox("JD <john.doe@acme.org>"));
         assertEquals("Resent-Sender: JD <john.doe@acme.org>", decode(field
                 .getRaw()));
     }
 
     public void testMailboxList() throws Exception {
-        Mailbox mailbox1 = Mailbox.parse("JD <john.doe@acme.org>");
-        Mailbox mailbox2 = Mailbox.parse("Mary Smith <mary@example.net>");
+        Mailbox mailbox1 = AddressBuilder.parseMailbox("JD <john.doe@acme.org>");
+        Mailbox mailbox2 = AddressBuilder.parseMailbox("Mary Smith <mary@example.net>");
 
         MailboxListField field = Fields.mailboxList("Resent-From", Arrays
                 .asList(mailbox1, mailbox2));
@@ -354,9 +355,9 @@
     }
 
     public void testAddressList() throws Exception {
-        Mailbox mailbox1 = Mailbox.parse("JD <john.doe@acme.org>");
-        Mailbox mailbox2 = Mailbox.parse("jane.doe@example.org");
-        Mailbox mailbox3 = Mailbox.parse("Mary Smith <mary@example.net>");
+        Mailbox mailbox1 = AddressBuilder.parseMailbox("JD <john.doe@acme.org>");
+        Mailbox mailbox2 = AddressBuilder.parseMailbox("jane.doe@example.org");
+        Mailbox mailbox3 = AddressBuilder.parseMailbox("Mary Smith <mary@example.net>");
         Group group = new Group("The Does", mailbox1, mailbox2);
 
         AddressListField field = Fields.addressList("Resent-To", Arrays.asList(

Modified: james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/field/address/AddressTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/field/address/AddressTest.java?rev=895016&r1=895015&r2=895016&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/field/address/AddressTest.java (original)
+++ james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/field/address/AddressTest.java Fri Jan  1 14:29:54 2010
@@ -20,6 +20,7 @@
 package org.apache.james.mime4j.field.address;
 
 import org.apache.james.mime4j.MimeException;
+import org.apache.james.mime4j.field.address.parser.AddressBuilder;
 import org.apache.james.mime4j.field.address.parser.ParseException;
 
 import java.io.BufferedReader;
@@ -43,7 +44,7 @@
     }
 
     public void testParse1() throws ParseException {
-        AddressList addrList = AddressList.parse("John Doe <jdoe@machine(comment).  example>");
+        AddressList addrList = AddressBuilder.parseAddressList("John Doe <jdoe@machine(comment).  example>");
         assertEquals(1, addrList.size());
         Mailbox mailbox = (Mailbox)addrList.get(0);
         assertEquals("John Doe", mailbox.getName());
@@ -52,7 +53,7 @@
     }
 
     public void testParse2() throws ParseException {
-        AddressList addrList = AddressList.parse("Mary Smith \t    \t\t  <mary@example.net>");
+        AddressList addrList = AddressBuilder.parseAddressList("Mary Smith \t    \t\t  <mary@example.net>");
         assertEquals(1, addrList.size());
         Mailbox mailbox = (Mailbox)addrList.get(0);
         assertEquals("Mary Smith", mailbox.getName());
@@ -61,7 +62,7 @@
     }
 
     public void testEmptyGroup() throws ParseException {
-        AddressList addrList = AddressList.parse("undisclosed-recipients:;");
+        AddressList addrList = AddressBuilder.parseAddressList("undisclosed-recipients:;");
         assertEquals(1, addrList.size());
         Group group = (Group)addrList.get(0);
         assertEquals(0, group.getMailboxes().size());
@@ -69,7 +70,7 @@
     }
 
     public void testMessyGroupAndMailbox() throws ParseException {
-        AddressList addrList = AddressList.parse("Marketing  folks :  Jane Smith < jane @ example . net >, \" Jack \\\"Jackie\\\" Jones \" < jjones@example.com > (comment(comment)); ,, (comment)  , <@example . net,@example(ignore\\)).com:(ignore)john@(ignore)example.net>");
+        AddressList addrList = AddressBuilder.parseAddressList("Marketing  folks :  Jane Smith < jane @ example . net >, \" Jack \\\"Jackie\\\" Jones \" < jjones@example.com > (comment(comment)); ,, (comment)  , <@example . net,@example(ignore\\)).com:(ignore)john@(ignore)example.net>");
         assertEquals(2, addrList.size());
 
         Group group = (Group)addrList.get(0);
@@ -96,12 +97,12 @@
     }
 
     public void testEmptyAddressList() throws ParseException {
-        assertEquals(0, AddressList.parse("  \t   \t ").size());
-        assertEquals(0, AddressList.parse("  \t  ,  , , ,,, , \t ").size());
+        assertEquals(0, AddressBuilder.parseAddressList("  \t   \t ").size());
+        assertEquals(0, AddressBuilder.parseAddressList("  \t  ,  , , ,,, , \t ").size());
     }
 
     public void testSimpleForm() throws ParseException {
-        AddressList addrList = AddressList.parse("\"a b c d e f g\" (comment) @example.net");
+        AddressList addrList = AddressBuilder.parseAddressList("\"a b c d e f g\" (comment) @example.net");
         assertEquals(1, addrList.size());
         Mailbox mailbox = (Mailbox)addrList.get(0);
         assertEquals("a b c d e f g", mailbox.getLocalPart());
@@ -109,7 +110,7 @@
     }
 
     public void testFlatten() throws ParseException {
-        AddressList addrList = AddressList.parse("dev : one@example.com, two@example.com; , ,,, marketing:three@example.com ,four@example.com;, five@example.com");
+        AddressList addrList = AddressBuilder.parseAddressList("dev : one@example.com, two@example.com; , ,,, marketing:three@example.com ,four@example.com;, five@example.com");
         assertEquals(3, addrList.size());
         assertEquals(5, addrList.flatten().size());
     }
@@ -126,15 +127,15 @@
         // there shouldn't be any aspect of the RFC that is tested here
         // but not in the other unit tests.
 
-        AddressList.parse("Alfred Neuman <Neuman@BBN-TENEXA>");
-        AddressList.parse("Neuman@BBN-TENEXA");
-        AddressList.parse("\"George, Ted\" <Shared@Group.Arpanet>");
-        AddressList.parse("Wilt . (the Stilt) Chamberlain@NBA.US");
+        AddressBuilder.parseAddressList("Alfred Neuman <Neuman@BBN-TENEXA>");
+        AddressBuilder.parseAddressList("Neuman@BBN-TENEXA");
+        AddressBuilder.parseAddressList("\"George, Ted\" <Shared@Group.Arpanet>");
+        AddressBuilder.parseAddressList("Wilt . (the Stilt) Chamberlain@NBA.US");
 
         // NOTE: In RFC822 8.1.5, the following example did not have "Galloping Gourmet"
         // in double-quotes.  I can only assume this was a typo, since 6.2.4 specifically
         // disallows spaces in unquoted local-part.
-        AddressList.parse("     Gourmets:  Pompous Person <WhoZiWhatZit@Cordon-Bleu>," +
+        AddressBuilder.parseAddressList("     Gourmets:  Pompous Person <WhoZiWhatZit@Cordon-Bleu>," +
                 "                Childs@WGBH.Boston, \"Galloping Gourmet\"@" +
                 "                ANT.Down-Under (Australian National Television)," +
                 "                Cheapie@Discount-Liquors;," +
@@ -144,7 +145,7 @@
         // NOTE: In RFC822 8.3.3, the following example ended with a lone ">" after
         // Tops-20-Host.  I can only assume this was a typo, since 6.1 clearly shows
         // ">" requires a matching "<".
-        AddressList.parse("Important folk:" +
+        AddressBuilder.parseAddressList("Important folk:" +
                 "                   Tom Softwood <Balsa@Tree.Root>," +
                 "                   \"Sam Irving\"@Other-Host;," +
                 "                 Standard Distribution:" +
@@ -153,16 +154,16 @@
 
         // The following are from a Usenet post by Dan J. Bernstein:
         // http://groups.google.com/groups?selm=1996Aug1418.21.01.28081%40koobera.math.uic.edu
-        AddressList.parse("\":sysmail\"@  Some-Group.\t         Some-Org, Muhammed.(I am  the greatest) Ali @(the)Vegas.WBA");
-        AddressList.parse("me@home.com (comment (nested (deeply\\))))");
-        AddressList.parse("mailing list: me@home.com, route two <you@work.com>, them@play.com ;");
+        AddressBuilder.parseAddressList("\":sysmail\"@  Some-Group.\t         Some-Org, Muhammed.(I am  the greatest) Ali @(the)Vegas.WBA");
+        AddressBuilder.parseAddressList("me@home.com (comment (nested (deeply\\))))");
+        AddressBuilder.parseAddressList("mailing list: me@home.com, route two <you@work.com>, them@play.com ;");
 
     }
 
     public void testLexicalError() {
         // ensure that TokenMgrError doesn't get thrown
         try {
-            AddressList.parse(")");
+            AddressBuilder.parseAddressList(")");
             fail("Expected parsing error");
         }
         catch (ParseException e) {
@@ -189,7 +190,7 @@
 
     
     public void testAddressList() throws ParseException {
-        AddressList addlist = AddressList.parse("foo@example.com, bar@example.com, third@example.com");
+        AddressList addlist = AddressBuilder.parseAddressList("foo@example.com, bar@example.com, third@example.com");
         List<Address> al = new ArrayList<Address>();
         al.add(addlist.get(0));
 
@@ -232,7 +233,7 @@
                 @Override
                 public void run() {
                     try {
-                        AddressList.main(null);
+                        AddressBuilder.main(null);
                     } catch (Exception e) {
                         fail("Catched an exception in main: "+e);
                     }
@@ -367,7 +368,7 @@
          * ParseException
          */
         try {
-            AddressList.parse("\"\"bar@bar.com");
+            AddressBuilder.parseAddressList("\"\"bar@bar.com");
             fail("ParseException expected");
         } catch (ParseException pe) {
         }
@@ -405,12 +406,12 @@
     }
 
     public void testParseAddress() throws Exception {
-        Address address = Address.parse("Mary Smith <mary@example.net>");
+        Address address = AddressBuilder.parseAddress("Mary Smith <mary@example.net>");
         assertTrue(address instanceof Mailbox);
         assertEquals("Mary Smith", ((Mailbox) address).getName());
         assertEquals("mary@example.net", ((Mailbox) address).getAddress());
 
-        address = Address.parse("group: Mary Smith <mary@example.net>;");
+        address = AddressBuilder.parseAddress("group: Mary Smith <mary@example.net>;");
         assertTrue(address instanceof Group);
         assertEquals("group", ((Group) address).getName());
         assertEquals("Mary Smith", ((Group) address).getMailboxes().get(0)
@@ -419,15 +420,15 @@
                 .get(0).getAddress());
 
         try {
-            Group.parse("john.doe@acme.org, jane.doe@acme.org");
+            AddressBuilder.parseGroup("john.doe@acme.org, jane.doe@acme.org");
             fail();
         } catch (IllegalArgumentException expected) {
         }
     }
     
     public void testParseGroup() throws Exception {
-        Group group = Group
-                .parse("group: john.doe@acme.org, Mary Smith <mary@example.net>;");
+        Group group = AddressBuilder
+                .parseGroup("group: john.doe@acme.org, Mary Smith <mary@example.net>;");
         assertEquals("group", group.getName());
 
         MailboxList mailboxes = group.getMailboxes();
@@ -442,41 +443,41 @@
         assertEquals("mary@example.net", mailbox2.getAddress());
 
         try {
-            Group.parse("john.doe@acme.org");
+            AddressBuilder.parseGroup("john.doe@acme.org");
             fail();
         } catch (IllegalArgumentException expected) {
         }
 
         try {
-            Group.parse("g1: john.doe@acme.org;, g2: mary@example.net;");
+            AddressBuilder.parseGroup("g1: john.doe@acme.org;, g2: mary@example.net;");
             fail();
         } catch (IllegalArgumentException expected) {
         }
     }
 
     public void testParseMailbox() throws Exception {
-        Mailbox mailbox1 = Mailbox.parse("john.doe@acme.org");
+        Mailbox mailbox1 = AddressBuilder.parseMailbox("john.doe@acme.org");
         assertNull(mailbox1.getName());
         assertEquals("john.doe@acme.org", mailbox1.getAddress());
 
-        Mailbox mailbox2 = Mailbox.parse("Mary Smith <mary@example.net>");
+        Mailbox mailbox2 = AddressBuilder.parseMailbox("Mary Smith <mary@example.net>");
         assertEquals("Mary Smith", mailbox2.getName());
         assertEquals("mary@example.net", mailbox2.getAddress());
 
         // non-ascii should be allowed in quoted strings
-        Mailbox mailbox3 = Mailbox
-                .parse("\"Hans M\374ller\" <hans.mueller@acme.org>");
+        Mailbox mailbox3 = AddressBuilder
+                .parseMailbox("\"Hans M\374ller\" <hans.mueller@acme.org>");
         assertEquals("Hans M\374ller", mailbox3.getName());
         assertEquals("hans.mueller@acme.org", mailbox3.getAddress());
 
         try {
-            Mailbox.parse("g: Mary Smith <mary@example.net>;");
+            AddressBuilder.parseMailbox("g: Mary Smith <mary@example.net>;");
             fail();
         } catch (IllegalArgumentException expected) {
         }
 
         try {
-            Mailbox.parse("Mary Smith <mary@example.net>, hans.mueller@acme.org");
+            AddressBuilder.parseMailbox("Mary Smith <mary@example.net>, hans.mueller@acme.org");
             fail();
         } catch (IllegalArgumentException expected) {
         }

Modified: james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/MessageTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/MessageTest.java?rev=895016&r1=895015&r2=895016&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/MessageTest.java (original)
+++ james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/MessageTest.java Fri Jan  1 14:29:54 2010
@@ -35,6 +35,7 @@
 import org.apache.commons.io.IOUtils;
 import org.apache.james.mime4j.field.address.Group;
 import org.apache.james.mime4j.field.address.Mailbox;
+import org.apache.james.mime4j.field.address.parser.AddressBuilder;
 import org.apache.james.mime4j.field.impl.DefaultFieldParser;
 import org.apache.james.mime4j.message.impl.BodyPart;
 import org.apache.james.mime4j.message.impl.MessageImpl;
@@ -247,7 +248,7 @@
     public void testSetSender() throws Exception {
         MessageImpl m = new MessageImpl();
 
-        m.setSender(Mailbox.parse("john.doe@example.net"));
+        m.setSender(AddressBuilder.parseMailbox("john.doe@example.net"));
         assertEquals("john.doe@example.net", m.getHeader().getField("Sender")
                 .getBody());
 
@@ -269,8 +270,8 @@
     public void testSetFrom() throws Exception {
         MessageImpl m = new MessageImpl();
 
-        Mailbox mailbox1 = Mailbox.parse("john.doe@example.net");
-        Mailbox mailbox2 = Mailbox.parse("jane.doe@example.net");
+        Mailbox mailbox1 = AddressBuilder.parseMailbox("john.doe@example.net");
+        Mailbox mailbox2 = AddressBuilder.parseMailbox("jane.doe@example.net");
 
         m.setFrom(mailbox1);
         assertEquals("john.doe@example.net", m.getHeader().getField("From")
@@ -303,10 +304,10 @@
     public void testSetTo() throws Exception {
         MessageImpl m = new MessageImpl();
 
-        Mailbox mailbox1 = Mailbox.parse("john.doe@example.net");
-        Mailbox mailbox2 = Mailbox.parse("jane.doe@example.net");
+        Mailbox mailbox1 = AddressBuilder.parseMailbox("john.doe@example.net");
+        Mailbox mailbox2 = AddressBuilder.parseMailbox("jane.doe@example.net");
         Group group = new Group("Does", mailbox1, mailbox2);
-        Mailbox mailbox3 = Mailbox.parse("Mary Smith <mary@example.net>");
+        Mailbox mailbox3 = AddressBuilder.parseMailbox("Mary Smith <mary@example.net>");
 
         m.setTo(group);
         assertEquals("Does: john.doe@example.net, jane.doe@example.net;", m
@@ -341,10 +342,10 @@
     public void testSetCc() throws Exception {
         MessageImpl m = new MessageImpl();
 
-        Mailbox mailbox1 = Mailbox.parse("john.doe@example.net");
-        Mailbox mailbox2 = Mailbox.parse("jane.doe@example.net");
+        Mailbox mailbox1 = AddressBuilder.parseMailbox("john.doe@example.net");
+        Mailbox mailbox2 = AddressBuilder.parseMailbox("jane.doe@example.net");
         Group group = new Group("Does", mailbox1, mailbox2);
-        Mailbox mailbox3 = Mailbox.parse("Mary Smith <mary@example.net>");
+        Mailbox mailbox3 = AddressBuilder.parseMailbox("Mary Smith <mary@example.net>");
 
         m.setCc(group);
         assertEquals("Does: john.doe@example.net, jane.doe@example.net;", m
@@ -379,10 +380,10 @@
     public void testSetBcc() throws Exception {
         MessageImpl m = new MessageImpl();
 
-        Mailbox mailbox1 = Mailbox.parse("john.doe@example.net");
-        Mailbox mailbox2 = Mailbox.parse("jane.doe@example.net");
+        Mailbox mailbox1 = AddressBuilder.parseMailbox("john.doe@example.net");
+        Mailbox mailbox2 = AddressBuilder.parseMailbox("jane.doe@example.net");
         Group group = new Group("Does", mailbox1, mailbox2);
-        Mailbox mailbox3 = Mailbox.parse("Mary Smith <mary@example.net>");
+        Mailbox mailbox3 = AddressBuilder.parseMailbox("Mary Smith <mary@example.net>");
 
         m.setBcc(group);
         assertEquals("Does: john.doe@example.net, jane.doe@example.net;", m
@@ -417,10 +418,10 @@
     public void testSetReplyTo() throws Exception {
         MessageImpl m = new MessageImpl();
 
-        Mailbox mailbox1 = Mailbox.parse("john.doe@example.net");
-        Mailbox mailbox2 = Mailbox.parse("jane.doe@example.net");
+        Mailbox mailbox1 = AddressBuilder.parseMailbox("john.doe@example.net");
+        Mailbox mailbox2 = AddressBuilder.parseMailbox("jane.doe@example.net");
         Group group = new Group("Does", mailbox1, mailbox2);
-        Mailbox mailbox3 = Mailbox.parse("Mary Smith <mary@example.net>");
+        Mailbox mailbox3 = AddressBuilder.parseMailbox("Mary Smith <mary@example.net>");
 
         m.setReplyTo(group);
         assertEquals("Does: john.doe@example.net, jane.doe@example.net;", m

Modified: james/mime4j/branches/cycleclean/examples/src/main/java/org/apache/james/mime4j/samples/dom/MultipartMessage.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/examples/src/main/java/org/apache/james/mime4j/samples/dom/MultipartMessage.java?rev=895016&r1=895015&r2=895016&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/examples/src/main/java/org/apache/james/mime4j/samples/dom/MultipartMessage.java (original)
+++ james/mime4j/branches/cycleclean/examples/src/main/java/org/apache/james/mime4j/samples/dom/MultipartMessage.java Fri Jan  1 14:29:54 2010
@@ -29,7 +29,7 @@
 
 import javax.imageio.ImageIO;
 
-import org.apache.james.mime4j.field.address.Mailbox;
+import org.apache.james.mime4j.field.address.parser.AddressBuilder;
 import org.apache.james.mime4j.message.BinaryBody;
 import org.apache.james.mime4j.message.Multipart;
 import org.apache.james.mime4j.message.TextBody;
@@ -57,13 +57,13 @@
 
         // Date and From are required fields
         message.setDate(new Date());
-        message.setFrom(Mailbox.parse("John Doe <jdoe@machine.example>"));
+        message.setFrom(AddressBuilder.parseMailbox("John Doe <jdoe@machine.example>"));
 
         // Message-ID should be present
         message.createMessageId("machine.example");
 
         // set some optional fields
-        message.setTo(Mailbox.parse("Mary Smith <mary@example.net>"));
+        message.setTo(AddressBuilder.parseMailbox("Mary Smith <mary@example.net>"));
         message.setSubject("An image for you");
 
         // 3) set a multipart body

Modified: james/mime4j/branches/cycleclean/examples/src/main/java/org/apache/james/mime4j/samples/dom/TextPlainMessage.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/examples/src/main/java/org/apache/james/mime4j/samples/dom/TextPlainMessage.java?rev=895016&r1=895015&r2=895016&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/examples/src/main/java/org/apache/james/mime4j/samples/dom/TextPlainMessage.java (original)
+++ james/mime4j/branches/cycleclean/examples/src/main/java/org/apache/james/mime4j/samples/dom/TextPlainMessage.java Fri Jan  1 14:29:54 2010
@@ -22,7 +22,7 @@
 import java.io.IOException;
 import java.util.Date;
 
-import org.apache.james.mime4j.field.address.Mailbox;
+import org.apache.james.mime4j.field.address.parser.AddressBuilder;
 import org.apache.james.mime4j.message.TextBody;
 import org.apache.james.mime4j.message.impl.BodyFactory;
 import org.apache.james.mime4j.message.impl.MessageImpl;
@@ -41,13 +41,13 @@
 
         // Date and From are required fields
         message.setDate(new Date());
-        message.setFrom(Mailbox.parse("John Doe <jdoe@machine.example>"));
+        message.setFrom(AddressBuilder.parseMailbox("John Doe <jdoe@machine.example>"));
 
         // Message-ID should be present
         message.createMessageId("machine.example");
 
         // set some optional fields
-        message.setTo(Mailbox.parse("Mary Smith <mary@example.net>"));
+        message.setTo(AddressBuilder.parseMailbox("Mary Smith <mary@example.net>"));
         message.setSubject("Saying Hello");
 
         // 3) set a text body

Modified: james/mime4j/branches/cycleclean/examples/src/main/java/org/apache/james/mime4j/samples/transform/TransformMessage.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/examples/src/main/java/org/apache/james/mime4j/samples/transform/TransformMessage.java?rev=895016&r1=895015&r2=895016&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/examples/src/main/java/org/apache/james/mime4j/samples/transform/TransformMessage.java (original)
+++ james/mime4j/branches/cycleclean/examples/src/main/java/org/apache/james/mime4j/samples/transform/TransformMessage.java Fri Jan  1 14:29:54 2010
@@ -24,7 +24,7 @@
 import java.util.Date;
 import java.util.Random;
 
-import org.apache.james.mime4j.field.address.Mailbox;
+import org.apache.james.mime4j.field.address.parser.AddressBuilder;
 import org.apache.james.mime4j.message.Body;
 import org.apache.james.mime4j.message.Entity;
 import org.apache.james.mime4j.message.Multipart;
@@ -114,7 +114,7 @@
         message.createMessageId(HOSTNAME);
         message.setSubject("Transformed message");
         message.setDate(new Date());
-        message.setFrom(Mailbox.parse("John Doe <jdoe@machine.example>"));
+        message.setFrom(AddressBuilder.parseMailbox("John Doe <jdoe@machine.example>"));
 
         return message;
     }



Mime
View raw message