james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject svn commit: r894103 - in /james/mime4j/trunk/core/src: main/java/org/apache/james/mime4j/field/ main/java/org/apache/james/mime4j/message/ test/java/org/apache/james/mime4j/field/ test/java/org/apache/james/mime4j/message/
Date Sun, 27 Dec 2009 19:41:35 GMT
Author: bago
Date: Sun Dec 27 19:41:34 2009
New Revision: 894103

URL: http://svn.apache.org/viewvc?rev=894103&view=rev
Log:
Moved default/generic field parsing from AbstractField to DefaultFieldParser (MIME4J-147)

Modified:
    james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/AbstractField.java
    james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/DefaultFieldParser.java
    james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/message/MessageBuilder.java
    james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/message/SimpleContentHandler.java
    james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/field/ContentDispositionFieldTest.java
    james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/field/ContentTransferEncodingFieldTest.java
    james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/field/ContentTypeFieldTest.java
    james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/field/FieldTest.java
    james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/field/UnstructuredFieldTest.java
    james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/message/CopyConstructorTest.java
    james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/message/EntityTest.java
    james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/message/HeaderTest.java
    james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/message/MessageTest.java
    james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/message/MultipartFormTest.java

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/AbstractField.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/AbstractField.java?rev=894103&r1=894102&r2=894103&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/AbstractField.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/AbstractField.java Sun Dec 27 19:41:34 2009
@@ -19,24 +19,13 @@
 
 package org.apache.james.mime4j.field;
 
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.james.mime4j.MimeException;
 import org.apache.james.mime4j.util.ByteSequence;
-import org.apache.james.mime4j.util.ContentUtil;
-import org.apache.james.mime4j.util.MimeUtil;
 
 /**
  * The base class of all field classes.
  */
 public abstract class AbstractField implements ParsedField {
 
-    private static final Pattern FIELD_NAME_PATTERN = Pattern
-            .compile("^([\\x21-\\x39\\x3b-\\x7e]+):");
-
-    private static final DefaultFieldParser PARSER = new DefaultFieldParser();
-    
     private final String name;
     private final String body;
     private final ByteSequence raw;
@@ -46,58 +35,6 @@
         this.body = body;
         this.raw = raw;
     }
-
-    /**
-     * Parses the given byte sequence and returns an instance of the
-     * <code>Field</code> class. The type of the class returned depends on the
-     * field name; see {@link #parse(String)} for a table of field names and
-     * their corresponding classes.
-     * 
-     * @param raw the bytes to parse.
-     * @return a <code>ParsedField</code> instance.
-     * @throws MimeException if the raw string cannot be split into field name and body.
-     * @see #isValidField()
-     */
-    public static ParsedField parse(final ByteSequence raw) throws MimeException {
-        String rawStr = ContentUtil.decode(raw);
-        return parse(raw, rawStr);
-    }
-
-    /**
-     * Parses the given string and returns an instance of the 
-     * <code>Field</code> class. The type of the class returned depends on
-     * the field name:
-     * <p>
-     * <table>
-     *   <tr><th>Class returned</th><th>Field names</th></tr>
-     *   <tr><td>{@link ContentTypeField}</td><td>Content-Type</td></tr>
-     *   <tr><td>{@link ContentTransferEncodingField}</td><td>Content-Transfer-Encoding</td></tr>
-     *   <tr><td>{@link ContentDispositionField}</td><td>Content-Disposition</td></tr>
-     *   <tr><td>{@link DateTimeField}</td><td>Date, Resent-Date</td></tr>
-     *   <tr><td>{@link MailboxField}</td><td>Sender, Resent-Sender</td></tr>
-     *   <tr><td>{@link MailboxListField}</td><td>From, Resent-From</td></tr>
-     *   <tr><td>{@link AddressListField}</td><td>To, Cc, Bcc, Reply-To, Resent-To, Resent-Cc, Resent-Bcc</td></tr>
-     *   <tr><td>{@link UnstructuredField}</td><td>Subject and others</td></tr>
-     * </table>
-     * 
-     * @param rawStr the string to parse.
-     * @return a <code>ParsedField</code> instance.
-     * @throws MimeException if the raw string cannot be split into field name and body.
-     * @see #isValidField()
-     */
-    public static ParsedField parse(final String rawStr) throws MimeException {
-        ByteSequence raw = ContentUtil.encode(rawStr);
-        return parse(raw, rawStr);
-    }
-
-    /**
-     * Gets the default parser used to parse fields.
-     * 
-     * @return the default field parser
-     */
-    public static DefaultFieldParser getParser() {
-        return PARSER;
-    }
     
     /**
      * Gets the name of the field (<code>Subject</code>, 
@@ -147,21 +84,4 @@
         return name + ": " + body;
     }
 
-    private static ParsedField parse(final ByteSequence raw, final String rawStr)
-            throws MimeException {
-        final Matcher fieldMatcher = FIELD_NAME_PATTERN.matcher(rawStr);
-        if (!fieldMatcher.find()) {
-            throw new MimeException("Invalid field in string");
-        }
-        final String name = fieldMatcher.group(1);
-
-        String body = rawStr.substring(fieldMatcher.end());
-        if (body.length() > 0 && body.charAt(0) == ' ') {
-            body = body.substring(1);
-        }
-
-        body = MimeUtil.unfold(body);
-        return PARSER.parse(name, body, raw);
-    }
-
 }

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/DefaultFieldParser.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/DefaultFieldParser.java?rev=894103&r1=894102&r2=894103&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/DefaultFieldParser.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/DefaultFieldParser.java Sun Dec 27 19:41:34 2009
@@ -19,8 +19,93 @@
 
 package org.apache.james.mime4j.field;
 
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.james.mime4j.MimeException;
+import org.apache.james.mime4j.util.ByteSequence;
+import org.apache.james.mime4j.util.ContentUtil;
+import org.apache.james.mime4j.util.MimeUtil;
+
 public class DefaultFieldParser extends DelegatingFieldParser {
 
+	private static final Pattern FIELD_NAME_PATTERN = Pattern
+    .compile("^([\\x21-\\x39\\x3b-\\x7e]+):");
+	
+    private static final DefaultFieldParser PARSER = new DefaultFieldParser();
+    
+
+    /**
+     * Gets the default parser used to parse fields.
+     * 
+     * @return the default field parser
+     */
+    public static DefaultFieldParser getParser() {
+        return PARSER;
+    }
+
+
+    /**
+     * Parses the given byte sequence and returns an instance of the
+     * <code>Field</code> class. The type of the class returned depends on the
+     * field name; see {@link #parse(String)} for a table of field names and
+     * their corresponding classes.
+     * 
+     * @param raw the bytes to parse.
+     * @return a <code>ParsedField</code> instance.
+     * @throws MimeException if the raw string cannot be split into field name and body.
+     * @see #isValidField()
+     */
+    public static ParsedField parse(final ByteSequence raw) throws MimeException {
+        String rawStr = ContentUtil.decode(raw);
+        return parse(raw, rawStr);
+    }
+
+
+    /**
+     * Parses the given string and returns an instance of the 
+     * <code>Field</code> class. The type of the class returned depends on
+     * the field name:
+     * <p>
+     * <table>
+     *   <tr><th>Class returned</th><th>Field names</th></tr>
+     *   <tr><td>{@link ContentTypeField}</td><td>Content-Type</td></tr>
+     *   <tr><td>{@link ContentTransferEncodingField}</td><td>Content-Transfer-Encoding</td></tr>
+     *   <tr><td>{@link ContentDispositionField}</td><td>Content-Disposition</td></tr>
+     *   <tr><td>{@link DateTimeField}</td><td>Date, Resent-Date</td></tr>
+     *   <tr><td>{@link MailboxField}</td><td>Sender, Resent-Sender</td></tr>
+     *   <tr><td>{@link MailboxListField}</td><td>From, Resent-From</td></tr>
+     *   <tr><td>{@link AddressListField}</td><td>To, Cc, Bcc, Reply-To, Resent-To, Resent-Cc, Resent-Bcc</td></tr>
+     *   <tr><td>{@link UnstructuredField}</td><td>Subject and others</td></tr>
+     * </table>
+     * 
+     * @param rawStr the string to parse.
+     * @return a <code>ParsedField</code> instance.
+     * @throws MimeException if the raw string cannot be split into field name and body.
+     * @see #isValidField()
+     */
+    public static ParsedField parse(final String rawStr) throws MimeException {
+        ByteSequence raw = ContentUtil.encode(rawStr);
+        return parse(raw, rawStr);
+    }
+
+    private static ParsedField parse(final ByteSequence raw, final String rawStr)
+            throws MimeException {
+        final Matcher fieldMatcher = FIELD_NAME_PATTERN.matcher(rawStr);
+        if (!fieldMatcher.find()) {
+            throw new MimeException("Invalid field in string");
+        }
+        final String name = fieldMatcher.group(1);
+
+        String body = rawStr.substring(fieldMatcher.end());
+        if (body.length() > 0 && body.charAt(0) == ' ') {
+            body = body.substring(1);
+        }
+        body = MimeUtil.unfold(body);
+        return PARSER.parse(name, body, raw);
+    }
+
+
     public DefaultFieldParser() {
         setFieldParser(FieldName.CONTENT_TRANSFER_ENCODING,
                 ContentTransferEncodingField.PARSER);

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/message/MessageBuilder.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/message/MessageBuilder.java?rev=894103&r1=894102&r2=894103&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/message/MessageBuilder.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/message/MessageBuilder.java Sun Dec 27 19:41:34 2009
@@ -27,7 +27,7 @@
 import org.apache.james.mime4j.codec.Base64InputStream;
 import org.apache.james.mime4j.codec.QuotedPrintableInputStream;
 import org.apache.james.mime4j.descriptor.BodyDescriptor;
-import org.apache.james.mime4j.field.AbstractField;
+import org.apache.james.mime4j.field.DefaultFieldParser;
 import org.apache.james.mime4j.parser.ContentHandler;
 import org.apache.james.mime4j.parser.Field;
 import org.apache.james.mime4j.parser.MimeStreamParser;
@@ -98,7 +98,7 @@
      */
     public void field(Field field) throws MimeException {
         expect(Header.class);
-        Field parsedField = AbstractField.parse(field.getRaw()); 
+        Field parsedField = DefaultFieldParser.parse(field.getRaw()); 
         ((Header) stack.peek()).addField(parsedField);
     }
     

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/message/SimpleContentHandler.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/message/SimpleContentHandler.java?rev=894103&r1=894102&r2=894103&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/message/SimpleContentHandler.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/message/SimpleContentHandler.java Sun Dec 27 19:41:34 2009
@@ -23,7 +23,7 @@
 import org.apache.james.mime4j.codec.Base64InputStream;
 import org.apache.james.mime4j.codec.QuotedPrintableInputStream;
 import org.apache.james.mime4j.descriptor.BodyDescriptor;
-import org.apache.james.mime4j.field.AbstractField;
+import org.apache.james.mime4j.field.DefaultFieldParser;
 import org.apache.james.mime4j.parser.AbstractContentHandler;
 import org.apache.james.mime4j.parser.Field;
 import org.apache.james.mime4j.util.MimeUtil;
@@ -77,7 +77,7 @@
      */
     @Override
     public final void field(Field field) throws MimeException {
-        Field parsedField = AbstractField.parse(field.getRaw()); 
+        Field parsedField = DefaultFieldParser.parse(field.getRaw()); 
         currHeader.addField(parsedField);
     }
 

Modified: james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/field/ContentDispositionFieldTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/field/ContentDispositionFieldTest.java?rev=894103&r1=894102&r2=894103&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/field/ContentDispositionFieldTest.java (original)
+++ james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/field/ContentDispositionFieldTest.java Sun Dec 27 19:41:34 2009
@@ -36,7 +36,7 @@
     public void testDispositionTypeWithSemiColonNoParams() throws Exception {
         ContentDispositionField f = null;
 
-        f = (ContentDispositionField) AbstractField
+        f = (ContentDispositionField) DefaultFieldParser
                 .parse("Content-Disposition: inline;");
         assertEquals("inline", f.getDispositionType());
     }
@@ -44,37 +44,37 @@
     public void testGetDispositionType() throws Exception {
         ContentDispositionField f = null;
 
-        f = (ContentDispositionField) AbstractField
+        f = (ContentDispositionField) DefaultFieldParser
                 .parse("Content-Disposition: attachment");
         assertEquals("attachment", f.getDispositionType());
 
-        f = (ContentDispositionField) AbstractField
+        f = (ContentDispositionField) DefaultFieldParser
                 .parse("content-disposition:   InLiNe   ");
         assertEquals("inline", f.getDispositionType());
 
-        f = (ContentDispositionField) AbstractField
+        f = (ContentDispositionField) DefaultFieldParser
                 .parse("CONTENT-DISPOSITION:   x-yada ;" + "  param = yada");
         assertEquals("x-yada", f.getDispositionType());
 
-        f = (ContentDispositionField) AbstractField.parse("CONTENT-DISPOSITION:   ");
+        f = (ContentDispositionField) DefaultFieldParser.parse("CONTENT-DISPOSITION:   ");
         assertEquals("", f.getDispositionType());
     }
 
     public void testGetParameter() throws Exception {
         ContentDispositionField f = null;
 
-        f = (ContentDispositionField) AbstractField
+        f = (ContentDispositionField) DefaultFieldParser
                 .parse("CONTENT-DISPOSITION:   inline ;"
                         + "  filename=yada yada");
         assertEquals("yada", f.getParameter("filename"));
 
-        f = (ContentDispositionField) AbstractField
+        f = (ContentDispositionField) DefaultFieldParser
                 .parse("Content-Disposition: x-yada;"
                         + "  fileNAme= \"ya:\\\"*da\"; " + "\tSIZE\t =  1234");
         assertEquals("ya:\"*da", f.getParameter("filename"));
         assertEquals("1234", f.getParameter("size"));
 
-        f = (ContentDispositionField) AbstractField
+        f = (ContentDispositionField) DefaultFieldParser
                 .parse("Content-Disposition: x-yada;  "
                         + "fileNAme= \"ya \\\"\\\"\tda \\\"\"; "
                         + "\tx-Yada\t =  \"\\\"hepp\\\"  =us\t-ascii\"");
@@ -85,19 +85,19 @@
     public void testIsDispositionType() throws Exception {
         ContentDispositionField f = null;
 
-        f = (ContentDispositionField) AbstractField.parse("Content-Disposition:INline");
+        f = (ContentDispositionField) DefaultFieldParser.parse("Content-Disposition:INline");
         assertTrue(f.isDispositionType("InLiNe"));
         assertFalse(f.isDispositionType("NiLiNe"));
         assertTrue(f.isInline());
         assertFalse(f.isAttachment());
 
-        f = (ContentDispositionField) AbstractField
+        f = (ContentDispositionField) DefaultFieldParser
                 .parse("Content-Disposition: attachment");
         assertTrue(f.isDispositionType("ATTACHMENT"));
         assertFalse(f.isInline());
         assertTrue(f.isAttachment());
 
-        f = (ContentDispositionField) AbstractField
+        f = (ContentDispositionField) DefaultFieldParser
                 .parse("Content-Disposition: x-something");
         assertTrue(f.isDispositionType("x-SomeThing"));
         assertFalse(f.isInline());
@@ -107,19 +107,19 @@
     public void testGetFilename() throws Exception {
         ContentDispositionField f = null;
 
-        f = (ContentDispositionField) AbstractField
+        f = (ContentDispositionField) DefaultFieldParser
                 .parse("Content-Disposition: inline; filename=yada.txt");
         assertEquals("yada.txt", f.getFilename());
 
-        f = (ContentDispositionField) AbstractField
+        f = (ContentDispositionField) DefaultFieldParser
                 .parse("Content-Disposition: inline; filename=yada yada.txt");
         assertEquals("yada", f.getFilename());
 
-        f = (ContentDispositionField) AbstractField
+        f = (ContentDispositionField) DefaultFieldParser
                 .parse("Content-Disposition: inline; filename=\"yada yada.txt\"");
         assertEquals("yada yada.txt", f.getFilename());
 
-        f = (ContentDispositionField) AbstractField
+        f = (ContentDispositionField) DefaultFieldParser
                 .parse("Content-Disposition: inline");
         assertNull(f.getFilename());
     }
@@ -127,17 +127,17 @@
     public void testGetCreationDate() throws Exception {
         ContentDispositionField f = null;
 
-        f = (ContentDispositionField) AbstractField
+        f = (ContentDispositionField) DefaultFieldParser
                 .parse("Content-Disposition: inline; "
                         + "creation-date=\"Tue, 01 Jan 1970 00:00:00 +0000\"");
         assertEquals(new Date(0), f.getCreationDate());
 
-        f = (ContentDispositionField) AbstractField
+        f = (ContentDispositionField) DefaultFieldParser
                 .parse("Content-Disposition: inline; "
                         + "creation-date=Tue, 01 Jan 1970 00:00:00 +0000");
         assertNull(f.getCreationDate());
 
-        f = (ContentDispositionField) AbstractField
+        f = (ContentDispositionField) DefaultFieldParser
                 .parse("Content-Disposition: attachment");
         assertNull(f.getCreationDate());
     }
@@ -145,22 +145,22 @@
     public void testGetModificationDate() throws Exception {
         ContentDispositionField f = null;
 
-        f = (ContentDispositionField) AbstractField
+        f = (ContentDispositionField) DefaultFieldParser
                 .parse("Content-Disposition: inline; "
                         + "modification-date=\"Tue, 01 Jan 1970 00:00:00 +0000\"");
         assertEquals(new Date(0), f.getModificationDate());
 
-        f = (ContentDispositionField) AbstractField
+        f = (ContentDispositionField) DefaultFieldParser
                 .parse("Content-Disposition: inline; "
                         + "modification-date=\"Wed, 12 Feb 1997 16:29:51 -0500\"");
         assertEquals(new Date(855782991000l), f.getModificationDate());
 
-        f = (ContentDispositionField) AbstractField
+        f = (ContentDispositionField) DefaultFieldParser
                 .parse("Content-Disposition: inline; "
                         + "modification-date=yesterday");
         assertNull(f.getModificationDate());
 
-        f = (ContentDispositionField) AbstractField
+        f = (ContentDispositionField) DefaultFieldParser
                 .parse("Content-Disposition: attachment");
         assertNull(f.getModificationDate());
     }
@@ -168,16 +168,16 @@
     public void testGetReadDate() throws Exception {
         ContentDispositionField f = null;
 
-        f = (ContentDispositionField) AbstractField
+        f = (ContentDispositionField) DefaultFieldParser
                 .parse("Content-Disposition: inline; "
                         + "read-date=\"Tue, 01 Jan 1970 00:00:00 +0000\"");
         assertEquals(new Date(0), f.getReadDate());
 
-        f = (ContentDispositionField) AbstractField
+        f = (ContentDispositionField) DefaultFieldParser
                 .parse("Content-Disposition: inline; read-date=");
         assertNull(f.getReadDate());
 
-        f = (ContentDispositionField) AbstractField
+        f = (ContentDispositionField) DefaultFieldParser
                 .parse("Content-Disposition: attachment");
         assertNull(f.getReadDate());
     }
@@ -185,23 +185,23 @@
     public void testGetSize() throws Exception {
         ContentDispositionField f = null;
 
-        f = (ContentDispositionField) AbstractField
+        f = (ContentDispositionField) DefaultFieldParser
                 .parse("Content-Disposition: attachment; size=0");
         assertEquals(0, f.getSize());
 
-        f = (ContentDispositionField) AbstractField
+        f = (ContentDispositionField) DefaultFieldParser
                 .parse("Content-Disposition: attachment; size=matters");
         assertEquals(-1, f.getSize());
 
-        f = (ContentDispositionField) AbstractField
+        f = (ContentDispositionField) DefaultFieldParser
                 .parse("Content-Disposition: attachment");
         assertEquals(-1, f.getSize());
 
-        f = (ContentDispositionField) AbstractField
+        f = (ContentDispositionField) DefaultFieldParser
                 .parse("Content-Disposition: attachment; size=-12");
         assertEquals(-1, f.getSize());
 
-        f = (ContentDispositionField) AbstractField
+        f = (ContentDispositionField) DefaultFieldParser
                 .parse("Content-Disposition: attachment; size=12");
         assertEquals(12, f.getSize());
     }

Modified: james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/field/ContentTransferEncodingFieldTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/field/ContentTransferEncodingFieldTest.java?rev=894103&r1=894102&r2=894103&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/field/ContentTransferEncodingFieldTest.java (original)
+++ james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/field/ContentTransferEncodingFieldTest.java Sun Dec 27 19:41:34 2009
@@ -20,7 +20,7 @@
 package org.apache.james.mime4j.field;
 
 import org.apache.james.mime4j.field.ContentTransferEncodingField;
-import org.apache.james.mime4j.field.AbstractField;
+import org.apache.james.mime4j.field.DefaultFieldParser;
 
 import junit.framework.TestCase;
 
@@ -30,19 +30,19 @@
         ContentTransferEncodingField f = null;
         
         f = (ContentTransferEncodingField) 
-                    AbstractField.parse("Content-Transfer-Encoding: 8bit");
+                    DefaultFieldParser.parse("Content-Transfer-Encoding: 8bit");
         assertEquals("8bit", f.getEncoding());
         
         f = (ContentTransferEncodingField) 
-                    AbstractField.parse("Content-Transfer-Encoding:    BaSE64   ");
+                    DefaultFieldParser.parse("Content-Transfer-Encoding:    BaSE64   ");
         assertEquals("base64", f.getEncoding());
         
         f = (ContentTransferEncodingField) 
-                    AbstractField.parse("Content-Transfer-Encoding:       ");
+                    DefaultFieldParser.parse("Content-Transfer-Encoding:       ");
         assertEquals("", f.getEncoding());
         
         f = (ContentTransferEncodingField) 
-                    AbstractField.parse("Content-Transfer-Encoding:");
+                    DefaultFieldParser.parse("Content-Transfer-Encoding:");
         assertEquals("", f.getEncoding());
     }
     
@@ -50,18 +50,18 @@
         ContentTransferEncodingField f = null;
         
         f = (ContentTransferEncodingField) 
-                    AbstractField.parse("Content-Transfer-Encoding: 8bit");
+                    DefaultFieldParser.parse("Content-Transfer-Encoding: 8bit");
         assertEquals("8bit", ContentTransferEncodingField.getEncoding(f));
         
         f = null;
         assertEquals("7bit", ContentTransferEncodingField.getEncoding(f));
         
         f = (ContentTransferEncodingField) 
-                    AbstractField.parse("Content-Transfer-Encoding:       ");
+                    DefaultFieldParser.parse("Content-Transfer-Encoding:       ");
         assertEquals("7bit", ContentTransferEncodingField.getEncoding(f));
         
         f = (ContentTransferEncodingField) 
-                    AbstractField.parse("Content-Transfer-Encoding:");
+                    DefaultFieldParser.parse("Content-Transfer-Encoding:");
         assertEquals("7bit", ContentTransferEncodingField.getEncoding(f));
     }
 

Modified: james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/field/ContentTypeFieldTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/field/ContentTypeFieldTest.java?rev=894103&r1=894102&r2=894103&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/field/ContentTypeFieldTest.java (original)
+++ james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/field/ContentTypeFieldTest.java Sun Dec 27 19:41:34 2009
@@ -20,7 +20,7 @@
 package org.apache.james.mime4j.field;
 
 import org.apache.james.mime4j.field.ContentTypeField;
-import org.apache.james.mime4j.field.AbstractField;
+import org.apache.james.mime4j.field.DefaultFieldParser;
 import org.apache.log4j.BasicConfigurator;
 
 import junit.framework.TestCase;
@@ -36,24 +36,24 @@
     public void testMimeTypeWithSemiColonNoParams() throws Exception  {
         ContentTypeField f = null;
         
-        f = (ContentTypeField) AbstractField.parse("Content-Type: text/html;");
+        f = (ContentTypeField) DefaultFieldParser.parse("Content-Type: text/html;");
         assertEquals("text/html", f.getMimeType());
     }
     
     public void testGetMimeType() throws Exception {
         ContentTypeField f = null;
         
-        f = (ContentTypeField) AbstractField.parse("Content-Type: text/PLAIN");
+        f = (ContentTypeField) DefaultFieldParser.parse("Content-Type: text/PLAIN");
         assertEquals("text/plain", f.getMimeType());
         
-        f = (ContentTypeField) AbstractField.parse("content-type:   TeXt / html   ");
+        f = (ContentTypeField) DefaultFieldParser.parse("content-type:   TeXt / html   ");
         assertEquals("text/html", f.getMimeType());
         
-        f = (ContentTypeField) AbstractField.parse("CONTENT-TYPE:   x-app/yada ;"
+        f = (ContentTypeField) DefaultFieldParser.parse("CONTENT-TYPE:   x-app/yada ;"
                                                     + "  param = yada");
         assertEquals("x-app/yada", f.getMimeType());
         
-        f = (ContentTypeField) AbstractField.parse("CONTENT-TYPE:   yada");
+        f = (ContentTypeField) DefaultFieldParser.parse("CONTENT-TYPE:   yada");
         assertEquals("", f.getMimeType());
     }
     
@@ -61,47 +61,47 @@
         ContentTypeField child = null;
         ContentTypeField parent = null;
         
-        child = (ContentTypeField) AbstractField.parse("Content-Type: child/type");
-        parent = (ContentTypeField) AbstractField.parse("Content-Type: parent/type");
+        child = (ContentTypeField) DefaultFieldParser.parse("Content-Type: child/type");
+        parent = (ContentTypeField) DefaultFieldParser.parse("Content-Type: parent/type");
         assertEquals("child/type", ContentTypeField.getMimeType(child, parent));
         
         child = null;
-        parent = (ContentTypeField) AbstractField.parse("Content-Type: parent/type");
+        parent = (ContentTypeField) DefaultFieldParser.parse("Content-Type: parent/type");
         assertEquals("text/plain", ContentTypeField.getMimeType(child, parent));
-        parent = (ContentTypeField) AbstractField.parse("Content-Type: multipart/digest");
+        parent = (ContentTypeField) DefaultFieldParser.parse("Content-Type: multipart/digest");
         assertEquals("message/rfc822", ContentTypeField.getMimeType(child, parent));
         
-        child = (ContentTypeField) AbstractField.parse("Content-Type:");
-        parent = (ContentTypeField) AbstractField.parse("Content-Type: parent/type");
+        child = (ContentTypeField) DefaultFieldParser.parse("Content-Type:");
+        parent = (ContentTypeField) DefaultFieldParser.parse("Content-Type: parent/type");
         assertEquals("text/plain", ContentTypeField.getMimeType(child, parent));
-        parent = (ContentTypeField) AbstractField.parse("Content-Type: multipart/digest");
+        parent = (ContentTypeField) DefaultFieldParser.parse("Content-Type: multipart/digest");
         assertEquals("message/rfc822", ContentTypeField.getMimeType(child, parent));
     }
     
     public void testGetCharsetStatic() throws Exception {
         ContentTypeField f = null;
         
-        f = (ContentTypeField) AbstractField.parse("Content-Type: some/type; charset=iso8859-1");
+        f = (ContentTypeField) DefaultFieldParser.parse("Content-Type: some/type; charset=iso8859-1");
         assertEquals("iso8859-1", ContentTypeField.getCharset(f));
         
-        f = (ContentTypeField) AbstractField.parse("Content-Type: some/type;");
+        f = (ContentTypeField) DefaultFieldParser.parse("Content-Type: some/type;");
         assertEquals("us-ascii", ContentTypeField.getCharset(f));
     }
     
     public void testGetParameter() throws Exception {
         ContentTypeField f = null;
         
-        f = (ContentTypeField) AbstractField.parse("CONTENT-TYPE:   text / html ;"
+        f = (ContentTypeField) DefaultFieldParser.parse("CONTENT-TYPE:   text / html ;"
                                                 + "  boundary=yada yada");
         assertEquals("yada", f.getParameter("boundary"));
         
-        f = (ContentTypeField) AbstractField.parse("Content-Type: x-app/yada;"
+        f = (ContentTypeField) DefaultFieldParser.parse("Content-Type: x-app/yada;"
                                                 + "  boUNdarY= \"ya:\\\"*da\"; "
                                                 + "\tcharset\t =  us-ascii");
         assertEquals("ya:\"*da", f.getParameter("boundary"));
         assertEquals("us-ascii", f.getParameter("charset"));
         
-        f = (ContentTypeField) AbstractField.parse("Content-Type: x-app/yada;  "
+        f = (ContentTypeField) DefaultFieldParser.parse("Content-Type: x-app/yada;  "
                             + "boUNdarY= \"ya \\\"\\\"\tda \\\"\"; "
                             + "\tcharset\t =  \"\\\"hepp\\\"  =us\t-ascii\"");
         assertEquals("ya \"\"\tda \"", f.getParameter("boundary"));

Modified: james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/field/FieldTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/field/FieldTest.java?rev=894103&r1=894102&r2=894103&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/field/FieldTest.java (original)
+++ james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/field/FieldTest.java Sun Dec 27 19:41:34 2009
@@ -22,7 +22,7 @@
 import org.apache.james.mime4j.MimeException;
 import org.apache.james.mime4j.field.ContentTransferEncodingField;
 import org.apache.james.mime4j.field.ContentTypeField;
-import org.apache.james.mime4j.field.AbstractField;
+import org.apache.james.mime4j.field.DefaultFieldParser;
 import org.apache.james.mime4j.field.UnstructuredField;
 import org.apache.james.mime4j.parser.Field;
 
@@ -33,14 +33,14 @@
     public void testGetName() throws Exception {
         Field f = null;
         
-        f = AbstractField.parse("Subject: Yada yada yada");
+        f = DefaultFieldParser.parse("Subject: Yada yada yada");
         assertEquals("Testing simple field", "Subject", f.getName());
         
-        f = AbstractField.parse("X-yada-yada: Yada yada yada");
+        f = DefaultFieldParser.parse("X-yada-yada: Yada yada yada");
         assertEquals("Testing an X- field", "X-yada-yada", f.getName());
         
         try {
-            f = AbstractField.parse("Yada yada yada");
+            f = DefaultFieldParser.parse("Yada yada yada");
             fail("MimeException not thrown when using an invalid field");
         } catch (MimeException e) {
         }
@@ -49,13 +49,13 @@
     public void testParse() throws Exception {
         Field f = null;
         
-        f = AbstractField.parse("Subject: Yada yada yada");
+        f = DefaultFieldParser.parse("Subject: Yada yada yada");
         assertTrue("Field should be UnstructuredField", 
                         f instanceof UnstructuredField);
-        f = AbstractField.parse("Content-Type: text/plain");
+        f = DefaultFieldParser.parse("Content-Type: text/plain");
         assertTrue("Field should be ContentTypeField", 
                         f instanceof ContentTypeField);
-        f = AbstractField.parse("Content-Transfer-Encoding: 7bit");
+        f = DefaultFieldParser.parse("Content-Transfer-Encoding: 7bit");
         assertTrue("Field should be ContentTransferEncodingField", 
                         f instanceof ContentTransferEncodingField);
     }

Modified: james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/field/UnstructuredFieldTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/field/UnstructuredFieldTest.java?rev=894103&r1=894102&r2=894103&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/field/UnstructuredFieldTest.java (original)
+++ james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/field/UnstructuredFieldTest.java Sun Dec 27 19:41:34 2009
@@ -19,9 +19,6 @@
 
 package org.apache.james.mime4j.field;
 
-import org.apache.james.mime4j.field.AbstractField;
-import org.apache.james.mime4j.field.UnstructuredField;
-
 import junit.framework.TestCase;
 
 public class UnstructuredFieldTest extends TestCase {
@@ -29,13 +26,13 @@
     public void testGetBody() throws Exception {
         UnstructuredField f = null;
         
-        f = (UnstructuredField) AbstractField.parse("Subject: Yada\r\n yada yada\r\n");
+        f = (UnstructuredField) DefaultFieldParser.parse("Subject: Yada\r\n yada yada\r\n");
         assertEquals("Testing folding value 1", "Yada yada yada", f.getValue());
         
-        f = (UnstructuredField) AbstractField.parse("Subject:  \r\n\tyada");
+        f = (UnstructuredField) DefaultFieldParser.parse("Subject:  \r\n\tyada");
         assertEquals("Testing folding value 2", " \tyada", f.getValue());
         
-        f = (UnstructuredField) AbstractField.parse("Subject:yada");
+        f = (UnstructuredField) DefaultFieldParser.parse("Subject:yada");
         assertEquals("Testing value without a leading ' '", "yada", f.getValue());
     }
 

Modified: james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/message/CopyConstructorTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/message/CopyConstructorTest.java?rev=894103&r1=894102&r2=894103&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/message/CopyConstructorTest.java (original)
+++ james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/message/CopyConstructorTest.java Sun Dec 27 19:41:34 2009
@@ -22,7 +22,7 @@
 import java.util.Arrays;
 import java.util.List;
 
-import org.apache.james.mime4j.field.AbstractField;
+import org.apache.james.mime4j.field.DefaultFieldParser;
 import org.apache.james.mime4j.parser.Field;
 
 import junit.framework.TestCase;
@@ -161,9 +161,9 @@
     }
 
     public void testCopyHeader() throws Exception {
-        Field f1 = AbstractField.parse("name1: value1");
-        Field f2 = AbstractField.parse("name2: value");
-        Field f3 = AbstractField.parse("name1: value2");
+        Field f1 = DefaultFieldParser.parse("name1: value1");
+        Field f2 = DefaultFieldParser.parse("name2: value");
+        Field f3 = DefaultFieldParser.parse("name1: value2");
 
         Header original = new Header();
         original.addField(f1);

Modified: james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/message/EntityTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/message/EntityTest.java?rev=894103&r1=894102&r2=894103&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/message/EntityTest.java (original)
+++ james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/message/EntityTest.java Sun Dec 27 19:41:34 2009
@@ -19,7 +19,7 @@
 
 package org.apache.james.mime4j.message;
 
-import org.apache.james.mime4j.field.AbstractField;
+import org.apache.james.mime4j.field.DefaultFieldParser;
 import org.apache.james.mime4j.message.Entity;
 
 import junit.framework.TestCase;
@@ -70,7 +70,7 @@
         assertNull(entity.getDispositionType());
 
         Header header = new Header();
-        header.setField(AbstractField.parse("Content-Disposition: inline"));
+        header.setField(DefaultFieldParser.parse("Content-Disposition: inline"));
         entity.setHeader(header);
 
         assertEquals("inline", entity.getDispositionType());
@@ -100,7 +100,7 @@
         assertNull(entity.getFilename());
 
         Header header = new Header();
-        header.setField(AbstractField.parse("Content-Disposition: attachment; "
+        header.setField(DefaultFieldParser.parse("Content-Disposition: attachment; "
                 + "filename=\"some file.dat\""));
         entity.setHeader(header);
 

Modified: james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/message/HeaderTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/message/HeaderTest.java?rev=894103&r1=894102&r2=894103&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/message/HeaderTest.java (original)
+++ james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/message/HeaderTest.java Sun Dec 27 19:41:34 2009
@@ -22,7 +22,7 @@
 import junit.framework.TestCase;
 
 import org.apache.commons.io.output.ByteArrayOutputStream;
-import org.apache.james.mime4j.field.AbstractField;
+import org.apache.james.mime4j.field.DefaultFieldParser;
 import org.apache.james.mime4j.parser.Field;
 import org.apache.james.mime4j.util.CharsetUtil;
 
@@ -34,8 +34,8 @@
 
     public void testHeader() throws Exception {
         Header header = new Header();
-        header.addField(AbstractField.parse(SUBJECT));
-        header.addField(AbstractField.parse(TO));
+        header.addField(DefaultFieldParser.parse(SUBJECT));
+        header.addField(DefaultFieldParser.parse(TO));
 
         assertNotNull("Subject found", header.getField("Subject"));
         assertNotNull("To found", header.getField("To"));
@@ -49,7 +49,7 @@
     public void testWriteSpecialCharacters() throws Exception {
         String hello = SWISS_GERMAN_HELLO;
         Header header = new Header();
-        header.addField(AbstractField.parse("Hello: " + hello));
+        header.addField(DefaultFieldParser.parse("Hello: " + hello));
         
         Field field = header.getField("Hello");
         assertNotNull(field);
@@ -65,9 +65,9 @@
 
     public void testRemoveFields() throws Exception {
         Header header = new Header();
-        header.addField(AbstractField.parse("Received: from foo by bar for james"));
-        header.addField(AbstractField.parse("Content-type: text/plain; charset=US-ASCII"));
-        header.addField(AbstractField.parse("ReCeIvEd: from bar by foo for james"));
+        header.addField(DefaultFieldParser.parse("Received: from foo by bar for james"));
+        header.addField(DefaultFieldParser.parse("Content-type: text/plain; charset=US-ASCII"));
+        header.addField(DefaultFieldParser.parse("ReCeIvEd: from bar by foo for james"));
 
         assertEquals(3, header.getFields().size());
         assertEquals(2, header.getFields("received").size());
@@ -84,9 +84,9 @@
 
     public void testRemoveNonExistantField() throws Exception {
         Header header = new Header();
-        header.addField(AbstractField.parse("Received: from foo by bar for james"));
-        header.addField(AbstractField.parse("Content-type: text/plain; charset=US-ASCII"));
-        header.addField(AbstractField.parse("ReCeIvEd: from bar by foo for james"));
+        header.addField(DefaultFieldParser.parse("Received: from foo by bar for james"));
+        header.addField(DefaultFieldParser.parse("Content-type: text/plain; charset=US-ASCII"));
+        header.addField(DefaultFieldParser.parse("ReCeIvEd: from bar by foo for james"));
 
         assertEquals(0, header.removeFields("noSuchField"));
 
@@ -97,12 +97,12 @@
 
     public void testSetField() throws Exception {
         Header header = new Header();
-        header.addField(AbstractField.parse("From: mime4j@james.apache.org"));
-        header.addField(AbstractField.parse("Received: from foo by bar for james"));
-        header.addField(AbstractField.parse("Content-type: text/plain; charset=US-ASCII"));
-        header.addField(AbstractField.parse("ReCeIvEd: from bar by foo for james"));
+        header.addField(DefaultFieldParser.parse("From: mime4j@james.apache.org"));
+        header.addField(DefaultFieldParser.parse("Received: from foo by bar for james"));
+        header.addField(DefaultFieldParser.parse("Content-type: text/plain; charset=US-ASCII"));
+        header.addField(DefaultFieldParser.parse("ReCeIvEd: from bar by foo for james"));
 
-        header.setField(AbstractField.parse("received: from nobody by noone for james"));
+        header.setField(DefaultFieldParser.parse("received: from nobody by noone for james"));
 
         assertEquals(3, header.getFields().size());
         assertEquals(1, header.getFields("received").size());
@@ -114,11 +114,11 @@
 
     public void testSetNonExistantField() throws Exception {
         Header header = new Header();
-        header.addField(AbstractField.parse("Received: from foo by bar for james"));
-        header.addField(AbstractField.parse("Content-type: text/plain; charset=US-ASCII"));
-        header.addField(AbstractField.parse("ReCeIvEd: from bar by foo for james"));
+        header.addField(DefaultFieldParser.parse("Received: from foo by bar for james"));
+        header.addField(DefaultFieldParser.parse("Content-type: text/plain; charset=US-ASCII"));
+        header.addField(DefaultFieldParser.parse("ReCeIvEd: from bar by foo for james"));
 
-        header.setField(AbstractField.parse("Message-ID: <msg9901@apache.org>"));
+        header.setField(DefaultFieldParser.parse("Message-ID: <msg9901@apache.org>"));
 
         assertEquals(4, header.getFields().size());
         assertEquals(1, header.getFields("message-id").size());

Modified: james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/message/MessageTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/message/MessageTest.java?rev=894103&r1=894102&r2=894103&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/message/MessageTest.java (original)
+++ james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/message/MessageTest.java Sun Dec 27 19:41:34 2009
@@ -33,7 +33,7 @@
 import junit.framework.TestCase;
 
 import org.apache.commons.io.IOUtils;
-import org.apache.james.mime4j.field.AbstractField;
+import org.apache.james.mime4j.field.DefaultFieldParser;
 import org.apache.james.mime4j.field.address.Group;
 import org.apache.james.mime4j.field.address.Mailbox;
 
@@ -53,13 +53,13 @@
         headerMultipartDigest = new Header();
         
         headerTextPlain.addField(
-                AbstractField.parse("Content-Type: text/plain"));
+                DefaultFieldParser.parse("Content-Type: text/plain"));
         headerMessageRFC822.addField(
-                AbstractField.parse("Content-Type: message/RFC822"));
+                DefaultFieldParser.parse("Content-Type: message/RFC822"));
         headerMultipartMixed.addField(
-                AbstractField.parse("Content-Type: multipart/mixed; boundary=foo"));
+                DefaultFieldParser.parse("Content-Type: multipart/mixed; boundary=foo"));
         headerMultipartDigest.addField(
-                AbstractField.parse("Content-Type: multipart/digest; boundary=foo"));
+                DefaultFieldParser.parse("Content-Type: multipart/digest; boundary=foo"));
     }
 
     public void testGetMimeType() {
@@ -146,7 +146,7 @@
         byte[] inputByte = getRawMessageAsByteArray();
 
         Message m = new Message(new ByteArrayInputStream(inputByte));
-        m.getHeader().addField(AbstractField.parse(testheader));
+        m.getHeader().addField(DefaultFieldParser.parse(testheader));
 
         assertEquals("header added", m.getHeader().getField(headerName)
                 .getBody(), headerValue);
@@ -166,7 +166,7 @@
 
         String id = "<msg17@localhost>";
         Header header = new Header();
-        header.setField(AbstractField.parse("Message-ID: " + id));
+        header.setField(DefaultFieldParser.parse("Message-ID: " + id));
         m.setHeader(header);
         assertEquals(id, m.getMessageId());
     }
@@ -187,11 +187,11 @@
 
         String subject = "testing 1 2";
         Header header = new Header();
-        header.setField(AbstractField.parse("Subject: " + subject));
+        header.setField(DefaultFieldParser.parse("Subject: " + subject));
         m.setHeader(header);
         assertEquals(subject, m.getSubject());
 
-        header.setField(AbstractField.parse("Subject: =?windows-1252?Q?99_=80?="));
+        header.setField(DefaultFieldParser.parse("Subject: =?windows-1252?Q?99_=80?="));
         assertEquals("99 \u20ac", m.getSubject());
     }
 
@@ -212,7 +212,7 @@
         assertNull(m.getDate());
 
         Header header = new Header();
-        header.setField(AbstractField.parse("Date: Thu, 1 Jan 1970 05:30:00 +0530"));
+        header.setField(DefaultFieldParser.parse("Date: Thu, 1 Jan 1970 05:30:00 +0530"));
         m.setHeader(header);
 
         assertEquals(new Date(0), m.getDate());
@@ -235,7 +235,7 @@
         assertNull(m.getSender());
 
         Header header = new Header();
-        header.setField(AbstractField.parse("Sender: john.doe@example.net"));
+        header.setField(DefaultFieldParser.parse("Sender: john.doe@example.net"));
         m.setHeader(header);
 
         assertEquals("john.doe@example.net", m.getSender().getAddress());
@@ -257,7 +257,7 @@
         assertNull(m.getFrom());
 
         Header header = new Header();
-        header.setField(AbstractField.parse("From: john.doe@example.net"));
+        header.setField(DefaultFieldParser.parse("From: john.doe@example.net"));
         m.setHeader(header);
 
         assertEquals("john.doe@example.net", m.getFrom().get(0).getAddress());
@@ -290,7 +290,7 @@
         assertNull(m.getTo());
 
         Header header = new Header();
-        header.setField(AbstractField.parse("To: john.doe@example.net"));
+        header.setField(DefaultFieldParser.parse("To: john.doe@example.net"));
         m.setHeader(header);
 
         assertEquals("john.doe@example.net", ((Mailbox) m.getTo().get(0))
@@ -328,7 +328,7 @@
         assertNull(m.getCc());
 
         Header header = new Header();
-        header.setField(AbstractField.parse("Cc: john.doe@example.net"));
+        header.setField(DefaultFieldParser.parse("Cc: john.doe@example.net"));
         m.setHeader(header);
 
         assertEquals("john.doe@example.net", ((Mailbox) m.getCc().get(0))
@@ -366,7 +366,7 @@
         assertNull(m.getBcc());
 
         Header header = new Header();
-        header.setField(AbstractField.parse("Bcc: john.doe@example.net"));
+        header.setField(DefaultFieldParser.parse("Bcc: john.doe@example.net"));
         m.setHeader(header);
 
         assertEquals("john.doe@example.net", ((Mailbox) m.getBcc().get(0))
@@ -404,7 +404,7 @@
         assertNull(m.getReplyTo());
 
         Header header = new Header();
-        header.setField(AbstractField.parse("Reply-To: john.doe@example.net"));
+        header.setField(DefaultFieldParser.parse("Reply-To: john.doe@example.net"));
         m.setHeader(header);
 
         assertEquals("john.doe@example.net", ((Mailbox) m.getReplyTo().get(0))

Modified: james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/message/MultipartFormTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/message/MultipartFormTest.java?rev=894103&r1=894102&r2=894103&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/message/MultipartFormTest.java (original)
+++ james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/message/MultipartFormTest.java Sun Dec 27 19:41:34 2009
@@ -23,7 +23,7 @@
 
 import junit.framework.TestCase;
 
-import org.apache.james.mime4j.field.AbstractField;
+import org.apache.james.mime4j.field.DefaultFieldParser;
 
 public class MultipartFormTest extends TestCase {
 
@@ -33,24 +33,24 @@
         Message message = new Message();
         Header header = new Header();
         header.addField(
-                AbstractField.parse("Content-Type: multipart/form-data; boundary=foo"));
+                DefaultFieldParser.parse("Content-Type: multipart/form-data; boundary=foo"));
         message.setHeader(header);
         
         Multipart multipart = new Multipart("alternative");
         multipart.setParent(message);
         BodyPart p1 = new BodyPart();
         Header h1 = new Header();
-        h1.addField(AbstractField.parse("Content-Type: text/plain"));
+        h1.addField(DefaultFieldParser.parse("Content-Type: text/plain"));
         p1.setHeader(h1);
         p1.setBody(bodyFactory.textBody("this stuff"));
         BodyPart p2 = new BodyPart();
         Header h2 = new Header();
-        h2.addField(AbstractField.parse("Content-Type: text/plain"));
+        h2.addField(DefaultFieldParser.parse("Content-Type: text/plain"));
         p2.setHeader(h2);
         p2.setBody(bodyFactory.textBody("that stuff"));
         BodyPart p3 = new BodyPart();
         Header h3 = new Header();
-        h3.addField(AbstractField.parse("Content-Type: text/plain"));
+        h3.addField(DefaultFieldParser.parse("Content-Type: text/plain"));
         p3.setHeader(h3);
         p3.setBody(bodyFactory.textBody("all kind of stuff"));
 



Mime
View raw message