james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1061265 - in /james/mime4j/branches/dom-api-refactoring: dom/src/main/java/org/apache/james/mime4j/field/ dom/src/main/java/org/apache/james/mime4j/field/address/ dom/src/main/java/org/apache/james/mime4j/message/ dom/src/test/java/org/apa...
Date Thu, 20 Jan 2011 12:21:38 GMT
Author: olegk
Date: Thu Jan 20 12:21:37 2011
New Revision: 1061265

URL: http://svn.apache.org/viewvc?rev=1061265&view=rev
Log:
Made methods of AddressFormatter, AddressBuilder and MimeBuilder non-static; renamed MessageWriter to MimeWriter

Added:
    james/mime4j/branches/dom-api-refactoring/dom/src/main/java/org/apache/james/mime4j/message/MimeWriter.java
      - copied, changed from r1061161, james/mime4j/branches/dom-api-refactoring/dom/src/main/java/org/apache/james/mime4j/message/MessageWriter.java
Removed:
    james/mime4j/branches/dom-api-refactoring/dom/src/main/java/org/apache/james/mime4j/message/MessageWriter.java
Modified:
    james/mime4j/branches/dom-api-refactoring/dom/src/main/java/org/apache/james/mime4j/field/AddressListFieldImpl.java
    james/mime4j/branches/dom-api-refactoring/dom/src/main/java/org/apache/james/mime4j/field/Fields.java
    james/mime4j/branches/dom-api-refactoring/dom/src/main/java/org/apache/james/mime4j/field/MailboxFieldImpl.java
    james/mime4j/branches/dom-api-refactoring/dom/src/main/java/org/apache/james/mime4j/field/MailboxListFieldImpl.java
    james/mime4j/branches/dom-api-refactoring/dom/src/main/java/org/apache/james/mime4j/field/address/AddressBuilder.java
    james/mime4j/branches/dom-api-refactoring/dom/src/main/java/org/apache/james/mime4j/field/address/AddressFormatter.java
    james/mime4j/branches/dom-api-refactoring/dom/src/main/java/org/apache/james/mime4j/message/MessageImpl.java
    james/mime4j/branches/dom-api-refactoring/dom/src/test/java/org/apache/james/mime4j/dom/HeaderTest.java
    james/mime4j/branches/dom-api-refactoring/dom/src/test/java/org/apache/james/mime4j/dom/MessageTest.java
    james/mime4j/branches/dom-api-refactoring/dom/src/test/java/org/apache/james/mime4j/dom/MultipartFormTest.java
    james/mime4j/branches/dom-api-refactoring/dom/src/test/java/org/apache/james/mime4j/field/FieldsTest.java
    james/mime4j/branches/dom-api-refactoring/dom/src/test/java/org/apache/james/mime4j/field/address/AddressTest.java
    james/mime4j/branches/dom-api-refactoring/examples/src/main/java/org/apache/james/mime4j/samples/dom/MultipartMessage.java
    james/mime4j/branches/dom-api-refactoring/examples/src/main/java/org/apache/james/mime4j/samples/dom/TextPlainMessage.java
    james/mime4j/branches/dom-api-refactoring/examples/src/main/java/org/apache/james/mime4j/samples/transform/TransformMessage.java
    james/mime4j/branches/dom-api-refactoring/examples/src/main/java/org/apache/james/mime4j/samples/tree/MessageTree.java

Modified: james/mime4j/branches/dom-api-refactoring/dom/src/main/java/org/apache/james/mime4j/field/AddressListFieldImpl.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/dom-api-refactoring/dom/src/main/java/org/apache/james/mime4j/field/AddressListFieldImpl.java?rev=1061265&r1=1061264&r2=1061265&view=diff
==============================================================================
--- james/mime4j/branches/dom-api-refactoring/dom/src/main/java/org/apache/james/mime4j/field/AddressListFieldImpl.java (original)
+++ james/mime4j/branches/dom-api-refactoring/dom/src/main/java/org/apache/james/mime4j/field/AddressListFieldImpl.java Thu Jan 20 12:21:37 2011
@@ -64,7 +64,7 @@ public class AddressListFieldImpl extend
         String body = getBody();
 
         try {
-            addressList = AddressBuilder.parseAddressList(body, monitor);
+            addressList = AddressBuilder.DEFAULT.parseAddressList(body, monitor);
         } catch (ParseException e) {
             parseException = e;
         }

Modified: james/mime4j/branches/dom-api-refactoring/dom/src/main/java/org/apache/james/mime4j/field/Fields.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/dom-api-refactoring/dom/src/main/java/org/apache/james/mime4j/field/Fields.java?rev=1061265&r1=1061264&r2=1061265&view=diff
==============================================================================
--- james/mime4j/branches/dom-api-refactoring/dom/src/main/java/org/apache/james/mime4j/field/Fields.java (original)
+++ james/mime4j/branches/dom-api-refactoring/dom/src/main/java/org/apache/james/mime4j/field/Fields.java Thu Jan 20 12:21:37 2011
@@ -635,7 +635,7 @@ public class Fields {
             if (sb.length() > 0) {
                 sb.append(", ");
             }
-            AddressFormatter.encode(sb, address);
+            AddressFormatter.DEFAULT.encode(sb, address);
         }
         return sb.toString();
     }

Modified: james/mime4j/branches/dom-api-refactoring/dom/src/main/java/org/apache/james/mime4j/field/MailboxFieldImpl.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/dom-api-refactoring/dom/src/main/java/org/apache/james/mime4j/field/MailboxFieldImpl.java?rev=1061265&r1=1061264&r2=1061265&view=diff
==============================================================================
--- james/mime4j/branches/dom-api-refactoring/dom/src/main/java/org/apache/james/mime4j/field/MailboxFieldImpl.java (original)
+++ james/mime4j/branches/dom-api-refactoring/dom/src/main/java/org/apache/james/mime4j/field/MailboxFieldImpl.java Thu Jan 20 12:21:37 2011
@@ -64,7 +64,7 @@ public class MailboxFieldImpl extends Ab
         String body = getBody();
 
         try {
-            MailboxList mailboxList = AddressBuilder.parseAddressList(body, monitor).flatten();
+            MailboxList mailboxList = AddressBuilder.DEFAULT.parseAddressList(body, monitor).flatten();
             if (mailboxList.size() > 0) {
                 mailbox = mailboxList.get(0);
             }

Modified: james/mime4j/branches/dom-api-refactoring/dom/src/main/java/org/apache/james/mime4j/field/MailboxListFieldImpl.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/dom-api-refactoring/dom/src/main/java/org/apache/james/mime4j/field/MailboxListFieldImpl.java?rev=1061265&r1=1061264&r2=1061265&view=diff
==============================================================================
--- james/mime4j/branches/dom-api-refactoring/dom/src/main/java/org/apache/james/mime4j/field/MailboxListFieldImpl.java (original)
+++ james/mime4j/branches/dom-api-refactoring/dom/src/main/java/org/apache/james/mime4j/field/MailboxListFieldImpl.java Thu Jan 20 12:21:37 2011
@@ -63,7 +63,7 @@ public class MailboxListFieldImpl extend
         String body = getBody();
 
         try {
-            mailboxList = AddressBuilder.parseAddressList(body, monitor).flatten();
+            mailboxList = AddressBuilder.DEFAULT.parseAddressList(body, monitor).flatten();
         } catch (ParseException e) {
             parseException = e;
         }

Modified: james/mime4j/branches/dom-api-refactoring/dom/src/main/java/org/apache/james/mime4j/field/address/AddressBuilder.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/dom-api-refactoring/dom/src/main/java/org/apache/james/mime4j/field/address/AddressBuilder.java?rev=1061265&r1=1061264&r2=1061265&view=diff
==============================================================================
--- james/mime4j/branches/dom-api-refactoring/dom/src/main/java/org/apache/james/mime4j/field/address/AddressBuilder.java (original)
+++ james/mime4j/branches/dom-api-refactoring/dom/src/main/java/org/apache/james/mime4j/field/address/AddressBuilder.java Thu Jan 20 12:21:37 2011
@@ -31,6 +31,12 @@ import org.apache.james.mime4j.field.add
 
 public class AddressBuilder {
 
+    public static final AddressBuilder DEFAULT = new AddressBuilder();
+    
+    protected AddressBuilder() {
+        super();
+    }
+    
     /**
      * Parses the specified raw string into an address.
      * 
@@ -40,13 +46,13 @@ public class AddressBuilder {
      * @return an <code>Address</code> object for the specified string.
      * @throws ParseException if the raw string does not represent a single address.
      */
-    public static Address parseAddress(String rawAddressString, DecodeMonitor monitor) throws ParseException {
+    public Address parseAddress(String rawAddressString, DecodeMonitor monitor) throws ParseException {
         AddressListParser parser = new AddressListParser(new StringReader(
                 rawAddressString));
         return Builder.getInstance().buildAddress(parser.parseAddress(), monitor);
     }
 
-    public static Address parseAddress(String rawAddressString) throws ParseException {
+    public Address parseAddress(String rawAddressString) throws ParseException {
         return parseAddress(rawAddressString, DecodeMonitor.STRICT);
     }
 
@@ -57,14 +63,14 @@ public class AddressBuilder {
      * The string MUST be unfolded already.
      * @param monitor the DecodeMonitor to be used while parsing/decoding
      */
-    public static AddressList parseAddressList(String rawAddressList, DecodeMonitor monitor)
+    public AddressList parseAddressList(String rawAddressList, DecodeMonitor monitor)
             throws ParseException {
         AddressListParser parser = new AddressListParser(new StringReader(
                 rawAddressList));
         return Builder.getInstance().buildAddressList(parser.parseAddressList(), monitor);
     }
 
-    public static AddressList parseAddressList(String rawAddressList) throws ParseException {
+    public AddressList parseAddressList(String rawAddressList) throws ParseException {
         return parseAddressList(rawAddressList, DecodeMonitor.STRICT);
     }
 
@@ -79,13 +85,13 @@ public class AddressBuilder {
      *             if the raw string does not represent a single mailbox
      *             address.
      */
-    public static Mailbox parseMailbox(String rawMailboxString, DecodeMonitor monitor) throws ParseException {
+    public Mailbox parseMailbox(String rawMailboxString, DecodeMonitor monitor) throws ParseException {
         AddressListParser parser = new AddressListParser(new StringReader(
                 rawMailboxString));
         return Builder.getInstance().buildMailbox(parser.parseMailbox(), monitor);
     }
 
-    public static Mailbox parseMailbox(String rawMailboxString) throws ParseException {
+    public Mailbox parseMailbox(String rawMailboxString) throws ParseException {
         return parseMailbox(rawMailboxString, DecodeMonitor.STRICT);
     }
 
@@ -98,7 +104,7 @@ public class AddressBuilder {
      * @throws ParseException
      *             if the raw string does not represent a single group address.
      */
-    public static Group parseGroup(String rawGroupString, DecodeMonitor monitor) throws ParseException {
+    public Group parseGroup(String rawGroupString, DecodeMonitor monitor) throws ParseException {
         Address address = parseAddress(rawGroupString, monitor);
         if (!(address instanceof Group))
             throw new ParseException("Not a group address");
@@ -106,7 +112,7 @@ public class AddressBuilder {
         return (Group) address;
     }
 
-    public static Group parseGroup(String rawGroupString) throws ParseException {
+    public Group parseGroup(String rawGroupString) throws ParseException {
         return parseGroup(rawGroupString, DecodeMonitor.STRICT);
     }
 

Modified: james/mime4j/branches/dom-api-refactoring/dom/src/main/java/org/apache/james/mime4j/field/address/AddressFormatter.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/dom-api-refactoring/dom/src/main/java/org/apache/james/mime4j/field/address/AddressFormatter.java?rev=1061265&r1=1061264&r2=1061265&view=diff
==============================================================================
--- james/mime4j/branches/dom-api-refactoring/dom/src/main/java/org/apache/james/mime4j/field/address/AddressFormatter.java (original)
+++ james/mime4j/branches/dom-api-refactoring/dom/src/main/java/org/apache/james/mime4j/field/address/AddressFormatter.java Thu Jan 20 12:21:37 2011
@@ -26,6 +26,12 @@ import org.apache.james.mime4j.dom.addre
 
 public class AddressFormatter {
 
+    public static final AddressFormatter DEFAULT = new AddressFormatter();
+    
+    protected AddressFormatter() {
+        super();
+    }
+    
     /**
      * Formats the address as a human readable string, not including the route.
      * The resulting string is intended for display purposes only and cannot be
@@ -47,7 +53,7 @@ public class AddressFormatter {
      *            exists, <code>false</code> otherwise.
      * @return a string representation of this address intended to be displayed.
      */
-    public static void format(final StringBuilder sb, final Address address, boolean includeRoute) {
+    public void format(final StringBuilder sb, final Address address, boolean includeRoute) {
         if (address == null) {
             return;
         }
@@ -69,7 +75,7 @@ public class AddressFormatter {
      * @return a string representation of this address intended for transport
      *         purposes.
      */
-    public static void encode(final StringBuilder sb, final Address address) {
+    public void encode(final StringBuilder sb, final Address address) {
         if (address == null) {
             return;
         }
@@ -82,7 +88,7 @@ public class AddressFormatter {
         }
     }
     
-    public static void format(final StringBuilder sb, final Mailbox mailbox, boolean includeRoute) {
+    public void format(final StringBuilder sb, final Mailbox mailbox, boolean includeRoute) {
         if (sb == null) {
             throw new IllegalArgumentException("StringBuilder may not be null");
         }
@@ -112,13 +118,13 @@ public class AddressFormatter {
         }
     }
     
-    public static String format(final Mailbox mailbox, boolean includeRoute) {
+    public String format(final Mailbox mailbox, boolean includeRoute) {
         StringBuilder sb = new StringBuilder();
         format(sb, mailbox, includeRoute);
         return sb.toString();
     }
     
-    public static void encode(final StringBuilder sb, final Mailbox mailbox) {
+    public void encode(final StringBuilder sb, final Mailbox mailbox) {
         if (sb == null) {
             throw new IllegalArgumentException("StringBuilder may not be null");
         }
@@ -142,13 +148,13 @@ public class AddressFormatter {
         }
     }
     
-    public static String encode(final Mailbox mailbox) {
+    public String encode(final Mailbox mailbox) {
         StringBuilder sb = new StringBuilder();
         encode(sb, mailbox);
         return sb.toString();
     }
 
-    public static void format(final StringBuilder sb, final Group group, boolean includeRoute) {
+    public void format(final StringBuilder sb, final Group group, boolean includeRoute) {
         if (sb == null) {
             throw new IllegalArgumentException("StringBuilder may not be null");
         }
@@ -171,13 +177,13 @@ public class AddressFormatter {
         sb.append(";");
     }
     
-    public static String format(final Group group, boolean includeRoute) {
+    public String format(final Group group, boolean includeRoute) {
         StringBuilder sb = new StringBuilder();
         format(sb, group, includeRoute);
         return sb.toString();
     }
     
-    public static void encode(final StringBuilder sb, final Group group) {
+    public void encode(final StringBuilder sb, final Group group) {
         if (sb == null) {
             throw new IllegalArgumentException("StringBuilder may not be null");
         }
@@ -200,7 +206,7 @@ public class AddressFormatter {
         sb.append(';');
     }
 
-    public static String encode(final Group group) {
+    public String encode(final Group group) {
         StringBuilder sb = new StringBuilder();
         encode(sb, group);
         return sb.toString();

Modified: james/mime4j/branches/dom-api-refactoring/dom/src/main/java/org/apache/james/mime4j/message/MessageImpl.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/dom-api-refactoring/dom/src/main/java/org/apache/james/mime4j/message/MessageImpl.java?rev=1061265&r1=1061264&r2=1061265&view=diff
==============================================================================
--- james/mime4j/branches/dom-api-refactoring/dom/src/main/java/org/apache/james/mime4j/message/MessageImpl.java (original)
+++ james/mime4j/branches/dom-api-refactoring/dom/src/main/java/org/apache/james/mime4j/message/MessageImpl.java Thu Jan 20 12:21:37 2011
@@ -57,7 +57,7 @@ public class MessageImpl extends Abstrac
      * @see org.apache.james.mime4j.dom.Message#writeTo(java.io.OutputStream)
      */
     public void writeTo(OutputStream out) throws IOException {
-        MessageWriter.DEFAULT.writeEntity(this, out);
+        MimeWriter.DEFAULT.writeEntity(this, out);
     }
 
     @Override

Copied: james/mime4j/branches/dom-api-refactoring/dom/src/main/java/org/apache/james/mime4j/message/MimeWriter.java (from r1061161, james/mime4j/branches/dom-api-refactoring/dom/src/main/java/org/apache/james/mime4j/message/MessageWriter.java)
URL: http://svn.apache.org/viewvc/james/mime4j/branches/dom-api-refactoring/dom/src/main/java/org/apache/james/mime4j/message/MimeWriter.java?p2=james/mime4j/branches/dom-api-refactoring/dom/src/main/java/org/apache/james/mime4j/message/MimeWriter.java&p1=james/mime4j/branches/dom-api-refactoring/dom/src/main/java/org/apache/james/mime4j/message/MessageWriter.java&r1=1061161&r2=1061265&rev=1061265&view=diff
==============================================================================
--- james/mime4j/branches/dom-api-refactoring/dom/src/main/java/org/apache/james/mime4j/message/MessageWriter.java (original)
+++ james/mime4j/branches/dom-api-refactoring/dom/src/main/java/org/apache/james/mime4j/message/MimeWriter.java Thu Jan 20 12:21:37 2011
@@ -47,7 +47,7 @@ import org.apache.james.mime4j.util.Mime
  * This class may be subclassed to implement custom strategies for writing
  * messages.
  */
-public class MessageWriter {
+public class MimeWriter {
 
     private static final byte[] CRLF = { '\r', '\n' };
     private static final byte[] DASHES = { '-', '-' };
@@ -55,12 +55,12 @@ public class MessageWriter {
     /**
      * The default message writer.
      */
-    public static final MessageWriter DEFAULT = new MessageWriter();
+    public static final MimeWriter DEFAULT = new MimeWriter();
 
     /**
      * Protected constructor prevents direct instantiation.
      */
-    protected MessageWriter() {
+    protected MimeWriter() {
     }
 
     /**

Modified: james/mime4j/branches/dom-api-refactoring/dom/src/test/java/org/apache/james/mime4j/dom/HeaderTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/dom-api-refactoring/dom/src/test/java/org/apache/james/mime4j/dom/HeaderTest.java?rev=1061265&r1=1061264&r2=1061265&view=diff
==============================================================================
--- james/mime4j/branches/dom-api-refactoring/dom/src/test/java/org/apache/james/mime4j/dom/HeaderTest.java (original)
+++ james/mime4j/branches/dom-api-refactoring/dom/src/test/java/org/apache/james/mime4j/dom/HeaderTest.java Thu Jan 20 12:21:37 2011
@@ -26,7 +26,7 @@ import org.apache.james.mime4j.dom.Heade
 import org.apache.james.mime4j.dom.field.Field;
 import org.apache.james.mime4j.field.DefaultFieldParser;
 import org.apache.james.mime4j.message.HeaderImpl;
-import org.apache.james.mime4j.message.MessageWriter;
+import org.apache.james.mime4j.message.MimeWriter;
 import org.apache.james.mime4j.util.CharsetUtil;
 
 public class HeaderTest extends TestCase {
@@ -62,7 +62,7 @@ public class HeaderTest extends TestCase
         
         ByteArrayOutputStream buffer = new ByteArrayOutputStream();
         
-        MessageWriter.DEFAULT.writeHeader(header, buffer);
+        MimeWriter.DEFAULT.writeHeader(header, buffer);
         String s = buffer.toString(CharsetUtil.US_ASCII.name());
         
         assertEquals("Hello: Gr?ezi_z?m?\r\n\r\n", s);

Modified: james/mime4j/branches/dom-api-refactoring/dom/src/test/java/org/apache/james/mime4j/dom/MessageTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/dom-api-refactoring/dom/src/test/java/org/apache/james/mime4j/dom/MessageTest.java?rev=1061265&r1=1061264&r2=1061265&view=diff
==============================================================================
--- james/mime4j/branches/dom-api-refactoring/dom/src/test/java/org/apache/james/mime4j/dom/MessageTest.java (original)
+++ james/mime4j/branches/dom-api-refactoring/dom/src/test/java/org/apache/james/mime4j/dom/MessageTest.java Thu Jan 20 12:21:37 2011
@@ -254,7 +254,7 @@ public class MessageTest extends TestCas
     public void testSetSender() throws Exception {
         MessageImpl m = new MessageImpl();
 
-        m.setSender(AddressBuilder.parseMailbox("john.doe@example.net"));
+        m.setSender(AddressBuilder.DEFAULT.parseMailbox("john.doe@example.net"));
         assertEquals("john.doe@example.net", m.getHeader().getField("Sender")
                 .getBody());
 
@@ -276,8 +276,8 @@ public class MessageTest extends TestCas
     public void testSetFrom() throws Exception {
         MessageImpl m = new MessageImpl();
 
-        Mailbox mailbox1 = AddressBuilder.parseMailbox("john.doe@example.net");
-        Mailbox mailbox2 = AddressBuilder.parseMailbox("jane.doe@example.net");
+        Mailbox mailbox1 = AddressBuilder.DEFAULT.parseMailbox("john.doe@example.net");
+        Mailbox mailbox2 = AddressBuilder.DEFAULT.parseMailbox("jane.doe@example.net");
 
         m.setFrom(mailbox1);
         assertEquals("john.doe@example.net", m.getHeader().getField("From")
@@ -310,10 +310,10 @@ public class MessageTest extends TestCas
     public void testSetTo() throws Exception {
         MessageImpl m = new MessageImpl();
 
-        Mailbox mailbox1 = AddressBuilder.parseMailbox("john.doe@example.net");
-        Mailbox mailbox2 = AddressBuilder.parseMailbox("jane.doe@example.net");
+        Mailbox mailbox1 = AddressBuilder.DEFAULT.parseMailbox("john.doe@example.net");
+        Mailbox mailbox2 = AddressBuilder.DEFAULT.parseMailbox("jane.doe@example.net");
         Group group = new Group("Does", mailbox1, mailbox2);
-        Mailbox mailbox3 = AddressBuilder.parseMailbox("Mary Smith <mary@example.net>");
+        Mailbox mailbox3 = AddressBuilder.DEFAULT.parseMailbox("Mary Smith <mary@example.net>");
 
         m.setTo(group);
         assertEquals("Does: john.doe@example.net, jane.doe@example.net;", m
@@ -348,10 +348,10 @@ public class MessageTest extends TestCas
     public void testSetCc() throws Exception {
         MessageImpl m = new MessageImpl();
 
-        Mailbox mailbox1 = AddressBuilder.parseMailbox("john.doe@example.net");
-        Mailbox mailbox2 = AddressBuilder.parseMailbox("jane.doe@example.net");
+        Mailbox mailbox1 = AddressBuilder.DEFAULT.parseMailbox("john.doe@example.net");
+        Mailbox mailbox2 = AddressBuilder.DEFAULT.parseMailbox("jane.doe@example.net");
         Group group = new Group("Does", mailbox1, mailbox2);
-        Mailbox mailbox3 = AddressBuilder.parseMailbox("Mary Smith <mary@example.net>");
+        Mailbox mailbox3 = AddressBuilder.DEFAULT.parseMailbox("Mary Smith <mary@example.net>");
 
         m.setCc(group);
         assertEquals("Does: john.doe@example.net, jane.doe@example.net;", m
@@ -386,10 +386,10 @@ public class MessageTest extends TestCas
     public void testSetBcc() throws Exception {
         MessageImpl m = new MessageImpl();
 
-        Mailbox mailbox1 = AddressBuilder.parseMailbox("john.doe@example.net");
-        Mailbox mailbox2 = AddressBuilder.parseMailbox("jane.doe@example.net");
+        Mailbox mailbox1 = AddressBuilder.DEFAULT.parseMailbox("john.doe@example.net");
+        Mailbox mailbox2 = AddressBuilder.DEFAULT.parseMailbox("jane.doe@example.net");
         Group group = new Group("Does", mailbox1, mailbox2);
-        Mailbox mailbox3 = AddressBuilder.parseMailbox("Mary Smith <mary@example.net>");
+        Mailbox mailbox3 = AddressBuilder.DEFAULT.parseMailbox("Mary Smith <mary@example.net>");
 
         m.setBcc(group);
         assertEquals("Does: john.doe@example.net, jane.doe@example.net;", m
@@ -424,10 +424,10 @@ public class MessageTest extends TestCas
     public void testSetReplyTo() throws Exception {
         MessageImpl m = new MessageImpl();
 
-        Mailbox mailbox1 = AddressBuilder.parseMailbox("john.doe@example.net");
-        Mailbox mailbox2 = AddressBuilder.parseMailbox("jane.doe@example.net");
+        Mailbox mailbox1 = AddressBuilder.DEFAULT.parseMailbox("john.doe@example.net");
+        Mailbox mailbox2 = AddressBuilder.DEFAULT.parseMailbox("jane.doe@example.net");
         Group group = new Group("Does", mailbox1, mailbox2);
-        Mailbox mailbox3 = AddressBuilder.parseMailbox("Mary Smith <mary@example.net>");
+        Mailbox mailbox3 = AddressBuilder.DEFAULT.parseMailbox("Mary Smith <mary@example.net>");
 
         m.setReplyTo(group);
         assertEquals("Does: john.doe@example.net, jane.doe@example.net;", m

Modified: james/mime4j/branches/dom-api-refactoring/dom/src/test/java/org/apache/james/mime4j/dom/MultipartFormTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/dom-api-refactoring/dom/src/test/java/org/apache/james/mime4j/dom/MultipartFormTest.java?rev=1061265&r1=1061264&r2=1061265&view=diff
==============================================================================
--- james/mime4j/branches/dom-api-refactoring/dom/src/test/java/org/apache/james/mime4j/dom/MultipartFormTest.java (original)
+++ james/mime4j/branches/dom-api-refactoring/dom/src/test/java/org/apache/james/mime4j/dom/MultipartFormTest.java Thu Jan 20 12:21:37 2011
@@ -30,7 +30,7 @@ import org.apache.james.mime4j.message.B
 import org.apache.james.mime4j.message.BodyPart;
 import org.apache.james.mime4j.message.HeaderImpl;
 import org.apache.james.mime4j.message.MessageImpl;
-import org.apache.james.mime4j.message.MessageWriter;
+import org.apache.james.mime4j.message.MimeWriter;
 import org.apache.james.mime4j.message.MultipartImpl;
 
 public class MultipartFormTest extends TestCase {
@@ -67,7 +67,7 @@ public class MultipartFormTest extends T
         multipart.addBodyPart(p3);
         
         ByteArrayOutputStream out = new ByteArrayOutputStream();
-        MessageWriter.DEFAULT.writeMultipart(multipart, out);
+        MimeWriter.DEFAULT.writeMultipart(multipart, out);
         out.close();
         
         String expected = "--foo\r\n" +

Modified: james/mime4j/branches/dom-api-refactoring/dom/src/test/java/org/apache/james/mime4j/field/FieldsTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/dom-api-refactoring/dom/src/test/java/org/apache/james/mime4j/field/FieldsTest.java?rev=1061265&r1=1061264&r2=1061265&view=diff
==============================================================================
--- james/mime4j/branches/dom-api-refactoring/dom/src/test/java/org/apache/james/mime4j/field/FieldsTest.java (original)
+++ james/mime4j/branches/dom-api-refactoring/dom/src/test/java/org/apache/james/mime4j/field/FieldsTest.java Thu Jan 20 12:21:37 2011
@@ -242,14 +242,14 @@ public class FieldsTest extends TestCase
     }
 
     public void testSender() throws Exception {
-        MailboxField field = Fields.sender(AddressBuilder
+        MailboxField field = Fields.sender(AddressBuilder.DEFAULT
                 .parseMailbox("JD <john.doe@acme.org>"));
         assertEquals("Sender: JD <john.doe@acme.org>", decode(field));
     }
 
     public void testFrom() throws Exception {
-        Mailbox mailbox1 = AddressBuilder.parseMailbox("JD <john.doe@acme.org>");
-        Mailbox mailbox2 = AddressBuilder.parseMailbox("Mary Smith <mary@example.net>");
+        Mailbox mailbox1 = AddressBuilder.DEFAULT.parseMailbox("JD <john.doe@acme.org>");
+        Mailbox mailbox2 = AddressBuilder.DEFAULT.parseMailbox("Mary Smith <mary@example.net>");
 
         MailboxListField field = Fields.from(mailbox1);
         assertEquals("From: JD <john.doe@acme.org>", decode(field));
@@ -264,9 +264,9 @@ public class FieldsTest extends TestCase
     }
 
     public void testTo() throws Exception {
-        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>");
+        Mailbox mailbox1 = AddressBuilder.DEFAULT.parseMailbox("JD <john.doe@acme.org>");
+        Mailbox mailbox2 = AddressBuilder.DEFAULT.parseMailbox("jane.doe@example.org");
+        Mailbox mailbox3 = AddressBuilder.DEFAULT.parseMailbox("Mary Smith <mary@example.net>");
         Group group = new Group("The Does", mailbox1, mailbox2);
 
         AddressListField field = Fields.to(group);
@@ -285,9 +285,9 @@ public class FieldsTest extends TestCase
     }
 
     public void testCc() throws Exception {
-        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>");
+        Mailbox mailbox1 = AddressBuilder.DEFAULT.parseMailbox("JD <john.doe@acme.org>");
+        Mailbox mailbox2 = AddressBuilder.DEFAULT.parseMailbox("jane.doe@example.org");
+        Mailbox mailbox3 = AddressBuilder.DEFAULT.parseMailbox("Mary Smith <mary@example.net>");
         Group group = new Group("The Does", mailbox1, mailbox2);
 
         AddressListField field = Fields.cc(group);
@@ -306,9 +306,9 @@ public class FieldsTest extends TestCase
     }
 
     public void testBcc() throws Exception {
-        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>");
+        Mailbox mailbox1 = AddressBuilder.DEFAULT.parseMailbox("JD <john.doe@acme.org>");
+        Mailbox mailbox2 = AddressBuilder.DEFAULT.parseMailbox("jane.doe@example.org");
+        Mailbox mailbox3 = AddressBuilder.DEFAULT.parseMailbox("Mary Smith <mary@example.net>");
         Group group = new Group("The Does", mailbox1, mailbox2);
 
         AddressListField field = Fields.bcc(group);
@@ -327,9 +327,9 @@ public class FieldsTest extends TestCase
     }
 
     public void testReplyTo() throws Exception {
-        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>");
+        Mailbox mailbox1 = AddressBuilder.DEFAULT.parseMailbox("JD <john.doe@acme.org>");
+        Mailbox mailbox2 = AddressBuilder.DEFAULT.parseMailbox("jane.doe@example.org");
+        Mailbox mailbox3 = AddressBuilder.DEFAULT.parseMailbox("Mary Smith <mary@example.net>");
         Group group = new Group("The Does", mailbox1, mailbox2);
 
         AddressListField field = Fields.replyTo(group);
@@ -348,15 +348,14 @@ public class FieldsTest extends TestCase
     }
 
     public void testMailbox() throws Exception {
-        MailboxField field = Fields.mailbox("Resent-Sender", AddressBuilder
+        MailboxField field = Fields.mailbox("Resent-Sender", AddressBuilder.DEFAULT
                 .parseMailbox("JD <john.doe@acme.org>"));
-        assertEquals("Resent-Sender: JD <john.doe@acme.org>", decode(field
-                ));
+        assertEquals("Resent-Sender: JD <john.doe@acme.org>", decode(field));
     }
 
     public void testMailboxList() throws Exception {
-        Mailbox mailbox1 = AddressBuilder.parseMailbox("JD <john.doe@acme.org>");
-        Mailbox mailbox2 = AddressBuilder.parseMailbox("Mary Smith <mary@example.net>");
+        Mailbox mailbox1 = AddressBuilder.DEFAULT.parseMailbox("JD <john.doe@acme.org>");
+        Mailbox mailbox2 = AddressBuilder.DEFAULT.parseMailbox("Mary Smith <mary@example.net>");
 
         MailboxListField field = Fields.mailboxList("Resent-From", Arrays
                 .asList(mailbox1, mailbox2));
@@ -365,9 +364,9 @@ public class FieldsTest extends TestCase
     }
 
     public void testAddressList() throws Exception {
-        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>");
+        Mailbox mailbox1 = AddressBuilder.DEFAULT.parseMailbox("JD <john.doe@acme.org>");
+        Mailbox mailbox2 = AddressBuilder.DEFAULT.parseMailbox("jane.doe@example.org");
+        Mailbox mailbox3 = AddressBuilder.DEFAULT.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/dom-api-refactoring/dom/src/test/java/org/apache/james/mime4j/field/address/AddressTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/dom-api-refactoring/dom/src/test/java/org/apache/james/mime4j/field/address/AddressTest.java?rev=1061265&r1=1061264&r2=1061265&view=diff
==============================================================================
--- james/mime4j/branches/dom-api-refactoring/dom/src/test/java/org/apache/james/mime4j/field/address/AddressTest.java (original)
+++ james/mime4j/branches/dom-api-refactoring/dom/src/test/java/org/apache/james/mime4j/field/address/AddressTest.java Thu Jan 20 12:21:37 2011
@@ -42,7 +42,8 @@ public class AddressTest extends TestCas
     }
 
     public void testParse1() throws ParseException {
-        AddressList addrList = AddressBuilder.parseAddressList("John Doe <jdoe@machine(comment).  example>");
+        AddressList addrList = AddressBuilder.DEFAULT.parseAddressList(
+                "John Doe <jdoe@machine(comment).  example>");
         assertEquals(1, addrList.size());
         Mailbox mailbox = (Mailbox)addrList.get(0);
         assertEquals("John Doe", mailbox.getName());
@@ -51,7 +52,8 @@ public class AddressTest extends TestCas
     }
 
     public void testParse2() throws ParseException {
-        AddressList addrList = AddressBuilder.parseAddressList("Mary Smith \t    \t\t  <mary@example.net>");
+        AddressList addrList = AddressBuilder.DEFAULT.parseAddressList(
+                "Mary Smith \t    \t\t  <mary@example.net>");
         assertEquals(1, addrList.size());
         Mailbox mailbox = (Mailbox)addrList.get(0);
         assertEquals("Mary Smith", mailbox.getName());
@@ -60,7 +62,7 @@ public class AddressTest extends TestCas
     }
 
     public void testEmptyGroup() throws ParseException {
-        AddressList addrList = AddressBuilder.parseAddressList("undisclosed-recipients:;");
+        AddressList addrList = AddressBuilder.DEFAULT.parseAddressList("undisclosed-recipients:;");
         assertEquals(1, addrList.size());
         Group group = (Group)addrList.get(0);
         assertEquals(0, group.getMailboxes().size());
@@ -68,7 +70,10 @@ public class AddressTest extends TestCas
     }
 
     public void testMessyGroupAndMailbox() throws ParseException {
-        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>");
+        AddressList addrList = AddressBuilder.DEFAULT.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);
@@ -95,12 +100,12 @@ public class AddressTest extends TestCas
     }
 
     public void testEmptyAddressList() throws ParseException {
-        assertEquals(0, AddressBuilder.parseAddressList("  \t   \t ").size());
-        assertEquals(0, AddressBuilder.parseAddressList("  \t  ,  , , ,,, , \t ").size());
+        assertEquals(0, AddressBuilder.DEFAULT.parseAddressList("  \t   \t ").size());
+        assertEquals(0, AddressBuilder.DEFAULT.parseAddressList("  \t  ,  , , ,,, , \t ").size());
     }
 
     public void testSimpleForm() throws ParseException {
-        AddressList addrList = AddressBuilder.parseAddressList("\"a b c d e f g\" (comment) @example.net");
+        AddressList addrList = AddressBuilder.DEFAULT.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());
@@ -108,7 +113,7 @@ public class AddressTest extends TestCas
     }
 
     public void testFlatten() throws ParseException {
-        AddressList addrList = AddressBuilder.parseAddressList("dev : one@example.com, two@example.com; , ,,, marketing:three@example.com ,four@example.com;, five@example.com");
+        AddressList addrList = AddressBuilder.DEFAULT.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());
     }
@@ -125,15 +130,15 @@ public class AddressTest extends TestCas
         // there shouldn't be any aspect of the RFC that is tested here
         // but not in the other unit tests.
 
-        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");
+        AddressBuilder.DEFAULT.parseAddressList("Alfred Neuman <Neuman@BBN-TENEXA>");
+        AddressBuilder.DEFAULT.parseAddressList("Neuman@BBN-TENEXA");
+        AddressBuilder.DEFAULT.parseAddressList("\"George, Ted\" <Shared@Group.Arpanet>");
+        AddressBuilder.DEFAULT.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.
-        AddressBuilder.parseAddressList("     Gourmets:  Pompous Person <WhoZiWhatZit@Cordon-Bleu>," +
+        AddressBuilder.DEFAULT.parseAddressList("     Gourmets:  Pompous Person <WhoZiWhatZit@Cordon-Bleu>," +
                 "                Childs@WGBH.Boston, \"Galloping Gourmet\"@" +
                 "                ANT.Down-Under (Australian National Television)," +
                 "                Cheapie@Discount-Liquors;," +
@@ -143,7 +148,7 @@ public class AddressTest extends TestCas
         // 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 "<".
-        AddressBuilder.parseAddressList("Important folk:" +
+        AddressBuilder.DEFAULT.parseAddressList("Important folk:" +
                 "                   Tom Softwood <Balsa@Tree.Root>," +
                 "                   \"Sam Irving\"@Other-Host;," +
                 "                 Standard Distribution:" +
@@ -152,16 +157,16 @@ public class AddressTest extends TestCas
 
         // 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
-        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 ;");
+        AddressBuilder.DEFAULT.parseAddressList("\":sysmail\"@  Some-Group.\t         Some-Org, Muhammed.(I am  the greatest) Ali @(the)Vegas.WBA");
+        AddressBuilder.DEFAULT.parseAddressList("me@home.com (comment (nested (deeply\\))))");
+        AddressBuilder.DEFAULT.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 {
-            AddressBuilder.parseAddressList(")");
+            AddressBuilder.DEFAULT.parseAddressList(")");
             fail("Expected parsing error");
         }
         catch (ParseException e) {
@@ -188,7 +193,7 @@ public class AddressTest extends TestCas
 
     
     public void testAddressList() throws ParseException {
-        AddressList addlist = AddressBuilder.parseAddressList("foo@example.com, bar@example.com, third@example.com");
+        AddressList addlist = AddressBuilder.DEFAULT.parseAddressList("foo@example.com, bar@example.com, third@example.com");
         List<Address> al = new ArrayList<Address>();
         al.add(addlist.get(0));
 
@@ -284,12 +289,13 @@ public class AddressTest extends TestCas
         List<Mailbox> al = new ArrayList<Mailbox>();
         al.add(new Mailbox("test", "example.com"));
         al.add(new Mailbox("Foo!", "foo", "example.com"));
-        DomainList dl = new DomainList(new ArrayList<String>(Arrays.asList(new String[] {"foo.example.com"})), true);
+        DomainList dl = new DomainList(new ArrayList<String>(
+                Arrays.asList(new String[] {"foo.example.com"})), true);
         Mailbox mailbox = new Mailbox("Foo Bar", dl, "foo2", "example.com");
         assertSame(dl, mailbox.getRoute());
         al.add(mailbox);
         Group g = new Group("group", new MailboxList(al, false));
-        String s = AddressFormatter.format(g, false);
+        String s = AddressFormatter.DEFAULT.format(g, false);
         assertEquals("group: test@example.com, Foo! <foo@example.com>, Foo Bar <foo2@example.com>;", s);
     }
     
@@ -299,7 +305,7 @@ public class AddressTest extends TestCas
          * ParseException
          */
         try {
-            AddressBuilder.parseAddressList("\"\"bar@bar.com");
+            AddressBuilder.DEFAULT.parseAddressList("\"\"bar@bar.com");
             fail("ParseException expected");
         } catch (ParseException pe) {
         }
@@ -307,16 +313,16 @@ public class AddressTest extends TestCas
     
     public void testMailboxGetEncodedString() throws Exception {
         Mailbox m1 = new Mailbox("john.doe", "acme.org");
-        assertEquals("john.doe@acme.org", AddressFormatter.encode(m1));
+        assertEquals("john.doe@acme.org", AddressFormatter.DEFAULT.encode(m1));
         Mailbox m2 = new Mailbox("john doe", "acme.org");
-        assertEquals("\"john doe\"@acme.org", AddressFormatter.encode(m2));
+        assertEquals("\"john doe\"@acme.org", AddressFormatter.DEFAULT.encode(m2));
         Mailbox m3 = new Mailbox("John Doe", "john.doe", "acme.org");
-        assertEquals("John Doe <john.doe@acme.org>", AddressFormatter.encode(m3));
+        assertEquals("John Doe <john.doe@acme.org>", AddressFormatter.DEFAULT.encode(m3));
         Mailbox m4 = new Mailbox("John Doe @Home", "john.doe", "acme.org");
-        assertEquals("\"John Doe @Home\" <john.doe@acme.org>", AddressFormatter.encode(m4));
+        assertEquals("\"John Doe @Home\" <john.doe@acme.org>", AddressFormatter.DEFAULT.encode(m4));
         Mailbox m5 = new Mailbox("Hans M\374ller", "hans.mueller", "acme.org");
         assertEquals("=?ISO-8859-1?Q?Hans_M=FCller?= <hans.mueller@acme.org>",
-                AddressFormatter.encode(m5));
+                AddressFormatter.DEFAULT.encode(m5));
     }
 
     public void testGroupGetEncodedString() throws Exception {
@@ -327,22 +333,22 @@ public class AddressTest extends TestCas
         Group g = new Group("group @work", new MailboxList(al, false));
         assertEquals("\"group @work\": test@example.com, "
                 + "Foo! <foo@example.com>, =?ISO-8859-1?Q?Hans_M=FCller?="
-                + " <hans.mueller@acme.org>;", AddressFormatter.encode(g));
+                + " <hans.mueller@acme.org>;", AddressFormatter.DEFAULT.encode(g));
     }
 
     public void testEmptyGroupGetEncodedString() throws Exception {
         MailboxList emptyMailboxes = new MailboxList(null, true);
         Group g = new Group("Undisclosed recipients", emptyMailboxes);
-        assertEquals("Undisclosed recipients:;", AddressFormatter.encode(g));
+        assertEquals("Undisclosed recipients:;", AddressFormatter.DEFAULT.encode(g));
     }
 
     public void testParseAddress() throws Exception {
-        Address address = AddressBuilder.parseAddress("Mary Smith <mary@example.net>");
+        Address address = AddressBuilder.DEFAULT.parseAddress("Mary Smith <mary@example.net>");
         assertTrue(address instanceof Mailbox);
         assertEquals("Mary Smith", ((Mailbox) address).getName());
         assertEquals("mary@example.net", ((Mailbox) address).getAddress());
 
-        address = AddressBuilder.parseAddress("group: Mary Smith <mary@example.net>;");
+        address = AddressBuilder.DEFAULT.parseAddress("group: Mary Smith <mary@example.net>;");
         assertTrue(address instanceof Group);
         assertEquals("group", ((Group) address).getName());
         assertEquals("Mary Smith", ((Group) address).getMailboxes().get(0)
@@ -351,15 +357,15 @@ public class AddressTest extends TestCas
                 .get(0).getAddress());
 
         try {
-            AddressBuilder.parseGroup("john.doe@acme.org, jane.doe@acme.org");
+            AddressBuilder.DEFAULT.parseGroup("john.doe@acme.org, jane.doe@acme.org");
             fail();
         } catch (ParseException expected) {
         }
     }
     
     public void testParseGroup() throws Exception {
-        Group group = AddressBuilder
-                .parseGroup("group: john.doe@acme.org, Mary Smith <mary@example.net>;");
+        Group group = AddressBuilder.DEFAULT.parseGroup(
+                "group: john.doe@acme.org, Mary Smith <mary@example.net>;");
         assertEquals("group", group.getName());
 
         MailboxList mailboxes = group.getMailboxes();
@@ -374,41 +380,42 @@ public class AddressTest extends TestCas
         assertEquals("mary@example.net", mailbox2.getAddress());
 
         try {
-            AddressBuilder.parseGroup("john.doe@acme.org");
+            AddressBuilder.DEFAULT.parseGroup("john.doe@acme.org");
             fail();
         } catch (ParseException expected) {
         }
 
         try {
-            AddressBuilder.parseGroup("g1: john.doe@acme.org;, g2: mary@example.net;");
+            AddressBuilder.DEFAULT.parseGroup("g1: john.doe@acme.org;, g2: mary@example.net;");
             fail();
         } catch (ParseException expected) {
         }
     }
 
     public void testParseMailbox() throws Exception {
-        Mailbox mailbox1 = AddressBuilder.parseMailbox("john.doe@acme.org");
+        Mailbox mailbox1 = AddressBuilder.DEFAULT.parseMailbox("john.doe@acme.org");
         assertNull(mailbox1.getName());
         assertEquals("john.doe@acme.org", mailbox1.getAddress());
 
-        Mailbox mailbox2 = AddressBuilder.parseMailbox("Mary Smith <mary@example.net>");
+        Mailbox mailbox2 = AddressBuilder.DEFAULT.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 = AddressBuilder
-                .parseMailbox("\"Hans M\374ller\" <hans.mueller@acme.org>");
+        Mailbox mailbox3 = AddressBuilder.DEFAULT.parseMailbox(
+                "\"Hans M\374ller\" <hans.mueller@acme.org>");
         assertEquals("Hans M\374ller", mailbox3.getName());
         assertEquals("hans.mueller@acme.org", mailbox3.getAddress());
 
         try {
-            AddressBuilder.parseMailbox("g: Mary Smith <mary@example.net>;");
+            AddressBuilder.DEFAULT.parseMailbox("g: Mary Smith <mary@example.net>;");
             fail();
         } catch (ParseException expected) {
         }
 
         try {
-            AddressBuilder.parseMailbox("Mary Smith <mary@example.net>, hans.mueller@acme.org");
+            AddressBuilder.DEFAULT.parseMailbox(
+                    "Mary Smith <mary@example.net>, hans.mueller@acme.org");
             fail();
         } catch (ParseException expected) {
         }

Modified: james/mime4j/branches/dom-api-refactoring/examples/src/main/java/org/apache/james/mime4j/samples/dom/MultipartMessage.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/dom-api-refactoring/examples/src/main/java/org/apache/james/mime4j/samples/dom/MultipartMessage.java?rev=1061265&r1=1061264&r2=1061265&view=diff
==============================================================================
--- james/mime4j/branches/dom-api-refactoring/examples/src/main/java/org/apache/james/mime4j/samples/dom/MultipartMessage.java (original)
+++ james/mime4j/branches/dom-api-refactoring/examples/src/main/java/org/apache/james/mime4j/samples/dom/MultipartMessage.java Thu Jan 20 12:21:37 2011
@@ -57,13 +57,13 @@ public class MultipartMessage {
 
         // Date and From are required fields
         message.setDate(new Date());
-        message.setFrom(AddressBuilder.parseMailbox("John Doe <jdoe@machine.example>"));
+        message.setFrom(AddressBuilder.DEFAULT.parseMailbox("John Doe <jdoe@machine.example>"));
 
         // Message-ID should be present
         message.createMessageId("machine.example");
 
         // set some optional fields
-        message.setTo(AddressBuilder.parseMailbox("Mary Smith <mary@example.net>"));
+        message.setTo(AddressBuilder.DEFAULT.parseMailbox("Mary Smith <mary@example.net>"));
         message.setSubject("An image for you");
 
         // 3) set a multipart body

Modified: james/mime4j/branches/dom-api-refactoring/examples/src/main/java/org/apache/james/mime4j/samples/dom/TextPlainMessage.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/dom-api-refactoring/examples/src/main/java/org/apache/james/mime4j/samples/dom/TextPlainMessage.java?rev=1061265&r1=1061264&r2=1061265&view=diff
==============================================================================
--- james/mime4j/branches/dom-api-refactoring/examples/src/main/java/org/apache/james/mime4j/samples/dom/TextPlainMessage.java (original)
+++ james/mime4j/branches/dom-api-refactoring/examples/src/main/java/org/apache/james/mime4j/samples/dom/TextPlainMessage.java Thu Jan 20 12:21:37 2011
@@ -42,13 +42,13 @@ public class TextPlainMessage {
 
         // Date and From are required fields
         message.setDate(new Date());
-        message.setFrom(AddressBuilder.parseMailbox("John Doe <jdoe@machine.example>"));
+        message.setFrom(AddressBuilder.DEFAULT.parseMailbox("John Doe <jdoe@machine.example>"));
 
         // Message-ID should be present
         message.createMessageId("machine.example");
 
         // set some optional fields
-        message.setTo(AddressBuilder.parseMailbox("Mary Smith <mary@example.net>"));
+        message.setTo(AddressBuilder.DEFAULT.parseMailbox("Mary Smith <mary@example.net>"));
         message.setSubject("Saying Hello");
 
         // 3) set a text body

Modified: james/mime4j/branches/dom-api-refactoring/examples/src/main/java/org/apache/james/mime4j/samples/transform/TransformMessage.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/dom-api-refactoring/examples/src/main/java/org/apache/james/mime4j/samples/transform/TransformMessage.java?rev=1061265&r1=1061264&r2=1061265&view=diff
==============================================================================
--- james/mime4j/branches/dom-api-refactoring/examples/src/main/java/org/apache/james/mime4j/samples/transform/TransformMessage.java (original)
+++ james/mime4j/branches/dom-api-refactoring/examples/src/main/java/org/apache/james/mime4j/samples/transform/TransformMessage.java Thu Jan 20 12:21:37 2011
@@ -118,7 +118,7 @@ public class TransformMessage {
         message.createMessageId(HOSTNAME);
         message.setSubject("Transformed message");
         message.setDate(new Date());
-        message.setFrom(AddressBuilder.parseMailbox("John Doe <jdoe@machine.example>"));
+        message.setFrom(AddressBuilder.DEFAULT.parseMailbox("John Doe <jdoe@machine.example>"));
 
         return message;
     }

Modified: james/mime4j/branches/dom-api-refactoring/examples/src/main/java/org/apache/james/mime4j/samples/tree/MessageTree.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/dom-api-refactoring/examples/src/main/java/org/apache/james/mime4j/samples/tree/MessageTree.java?rev=1061265&r1=1061264&r2=1061265&view=diff
==============================================================================
--- james/mime4j/branches/dom-api-refactoring/examples/src/main/java/org/apache/james/mime4j/samples/tree/MessageTree.java (original)
+++ james/mime4j/branches/dom-api-refactoring/examples/src/main/java/org/apache/james/mime4j/samples/tree/MessageTree.java Thu Jan 20 12:21:37 2011
@@ -315,7 +315,7 @@ public class MessageTree extends JPanel 
                 StringBuilder sb = new StringBuilder();
                 for (int i = 0; i < list.size(); i++) {
                     Mailbox mb = list.get(i);
-                    sb.append(AddressFormatter.format(mb, false) + "\n");
+                    sb.append(AddressFormatter.DEFAULT.format(mb, false) + "\n");
                 }
                 textView.setText(sb.toString());
 



Mime
View raw message