james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject svn commit: r894484 - in /james/mime4j/branches/cycleclean: core/src/main/java/org/apache/james/mime4j/descriptor/ core/src/main/java/org/apache/james/mime4j/field/ core/src/main/java/org/apache/james/mime4j/message/ core/src/main/java/org/apache/james...
Date Tue, 29 Dec 2009 21:26:37 GMT
Author: bago
Date: Tue Dec 29 21:26:35 2009
New Revision: 894484

URL: http://svn.apache.org/viewvc?rev=894484&view=rev
Log:
RawField does no more implement Field.
Field has moved to the filed package.
parser package works with RawField and not with Field.
No more confusion about Field being a parsed or a raw field. (MIME4J-149)

Added:
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/Field.java
  (contents, props changed)
      - copied, changed from r894340, james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/parser/Field.java
Removed:
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/Field.java
Modified:
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/descriptor/DefaultBodyDescriptor.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/descriptor/MaximalBodyDescriptor.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/descriptor/MutableBodyDescriptor.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/Fields.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/ParsedField.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/Entity.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/Header.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/Message.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/MessageBuilder.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/MessageWriter.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/SimpleContentHandler.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/AbstractContentHandler.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/AbstractEntity.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/ContentHandler.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/EntityStateMachine.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/MimeStreamParser.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/MimeTokenStream.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/RawEntity.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/RawField.java
    james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/descriptor/BaseTestForBodyDescriptors.java
    james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/field/FieldTest.java
    james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/field/FieldsTest.java
    james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/CopyConstructorTest.java
    james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/ExampleMessagesRoundtripTest.java
    james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/HeaderTest.java
    james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/MessageParserTest.java
    james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/parser/MimeStreamParserExampleMessagesTest.java
    james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/parser/MimeStreamParserTest.java
    james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/parser/TestHandler.java
    james/mime4j/branches/cycleclean/examples/src/main/java/org/apache/james/mime4j/samples/tree/MessageTree.java

Modified: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/descriptor/DefaultBodyDescriptor.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/descriptor/DefaultBodyDescriptor.java?rev=894484&r1=894483&r2=894484&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/descriptor/DefaultBodyDescriptor.java
(original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/descriptor/DefaultBodyDescriptor.java
Tue Dec 29 21:26:35 2009
@@ -24,7 +24,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.james.mime4j.parser.Field;
+import org.apache.james.mime4j.parser.RawField;
 import org.apache.james.mime4j.util.MimeUtil;
 
 /**
@@ -92,7 +92,7 @@
      * 
      * @param field the MIME field.
      */
-    public void addField(Field field) {
+    public void addField(RawField field) {
         String name = field.getName();
         String value = field.getBody();
 

Modified: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/descriptor/MaximalBodyDescriptor.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/descriptor/MaximalBodyDescriptor.java?rev=894484&r1=894483&r2=894484&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/descriptor/MaximalBodyDescriptor.java
(original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/descriptor/MaximalBodyDescriptor.java
Tue Dec 29 21:26:35 2009
@@ -31,7 +31,7 @@
 import org.apache.james.mime4j.field.language.parser.ContentLanguageParser;
 import org.apache.james.mime4j.field.mimeversion.parser.MimeVersionParser;
 import org.apache.james.mime4j.field.structured.parser.StructuredFieldParser;
-import org.apache.james.mime4j.parser.Field;
+import org.apache.james.mime4j.parser.RawField;
 import org.apache.james.mime4j.util.MimeUtil;
 
 /**
@@ -105,7 +105,7 @@
     }
     
     @Override
-    public void addField(Field field) {
+    public void addField(RawField field) {
         String name = field.getName();
         String value = field.getBody();
         name = name.trim().toLowerCase();

Modified: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/descriptor/MutableBodyDescriptor.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/descriptor/MutableBodyDescriptor.java?rev=894484&r1=894483&r2=894484&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/descriptor/MutableBodyDescriptor.java
(original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/descriptor/MutableBodyDescriptor.java
Tue Dec 29 21:26:35 2009
@@ -20,7 +20,7 @@
 
 package org.apache.james.mime4j.descriptor;
 
-import org.apache.james.mime4j.parser.Field;
+import org.apache.james.mime4j.parser.RawField;
 
 /**
  * Adds mutator.
@@ -31,6 +31,6 @@
      * Adds a field to the body descriptor.
      * @param field the MIME field.
      */
-    void addField(Field field);
+    void addField(RawField field);
 
 }

Copied: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/Field.java
(from r894340, james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/parser/Field.java)
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/Field.java?p2=james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/Field.java&p1=james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/parser/Field.java&r1=894340&r2=894484&rev=894484&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/parser/Field.java (original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/Field.java
Tue Dec 29 21:26:35 2009
@@ -17,7 +17,7 @@
  * under the License.                                           *
  ****************************************************************/
 
-package org.apache.james.mime4j.parser;
+package org.apache.james.mime4j.field;
 
 import org.apache.james.mime4j.util.ByteSequence;
 

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

Modified: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/Fields.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/Fields.java?rev=894484&r1=894483&r2=894484&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/Fields.java
(original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/Fields.java
Tue Dec 29 21:26:35 2009
@@ -30,7 +30,6 @@
 import org.apache.james.mime4j.codec.EncoderUtil;
 import org.apache.james.mime4j.field.address.Address;
 import org.apache.james.mime4j.field.address.Mailbox;
-import org.apache.james.mime4j.parser.Field;
 import org.apache.james.mime4j.util.ByteSequence;
 import org.apache.james.mime4j.util.ContentUtil;
 import org.apache.james.mime4j.util.MimeUtil;

Modified: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/ParsedField.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/ParsedField.java?rev=894484&r1=894483&r2=894484&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/ParsedField.java
(original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/ParsedField.java
Tue Dec 29 21:26:35 2009
@@ -19,7 +19,6 @@
 
 package org.apache.james.mime4j.field;
 
-import org.apache.james.mime4j.parser.Field;
 
 public interface ParsedField extends Field {
 

Modified: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/Entity.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/Entity.java?rev=894484&r1=894483&r2=894484&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/Entity.java
(original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/Entity.java
Tue Dec 29 21:26:35 2009
@@ -27,9 +27,9 @@
 import org.apache.james.mime4j.field.ContentDispositionField;
 import org.apache.james.mime4j.field.ContentTransferEncodingField;
 import org.apache.james.mime4j.field.ContentTypeField;
+import org.apache.james.mime4j.field.Field;
 import org.apache.james.mime4j.field.FieldName;
 import org.apache.james.mime4j.field.Fields;
-import org.apache.james.mime4j.parser.Field;
 import org.apache.james.mime4j.util.MimeUtil;
 
 /**

Modified: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/Header.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/Header.java?rev=894484&r1=894483&r2=894484&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/Header.java
(original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/Header.java
Tue Dec 29 21:26:35 2009
@@ -30,9 +30,11 @@
 
 import org.apache.james.mime4j.MimeException;
 import org.apache.james.mime4j.MimeIOException;
+import org.apache.james.mime4j.field.DefaultFieldParser;
+import org.apache.james.mime4j.field.Field;
 import org.apache.james.mime4j.parser.AbstractContentHandler;
-import org.apache.james.mime4j.parser.Field;
 import org.apache.james.mime4j.parser.MimeStreamParser;
+import org.apache.james.mime4j.parser.RawField;
 
 /**
  * The header of an entity (see RFC 2045).
@@ -81,8 +83,9 @@
                 parser.stop();
             }
             @Override
-            public void field(Field field) throws MimeException {
-                addField(field);
+            public void field(RawField field) throws MimeException {
+                Field parsedField = DefaultFieldParser.parse(field.getRaw()); 
+                addField(parsedField);
             }
         });
         try {

Modified: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/Message.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/Message.java?rev=894484&r1=894483&r2=894484&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/Message.java
(original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/Message.java
Tue Dec 29 21:26:35 2009
@@ -32,6 +32,7 @@
 import org.apache.james.mime4j.MimeIOException;
 import org.apache.james.mime4j.field.AddressListField;
 import org.apache.james.mime4j.field.DateTimeField;
+import org.apache.james.mime4j.field.Field;
 import org.apache.james.mime4j.field.FieldName;
 import org.apache.james.mime4j.field.Fields;
 import org.apache.james.mime4j.field.MailboxField;
@@ -41,7 +42,6 @@
 import org.apache.james.mime4j.field.address.AddressList;
 import org.apache.james.mime4j.field.address.Mailbox;
 import org.apache.james.mime4j.field.address.MailboxList;
-import org.apache.james.mime4j.parser.Field;
 import org.apache.james.mime4j.parser.MimeEntityConfig;
 import org.apache.james.mime4j.parser.MimeStreamParser;
 import org.apache.james.mime4j.storage.DefaultStorageProvider;

Modified: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/MessageBuilder.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/MessageBuilder.java?rev=894484&r1=894483&r2=894484&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/MessageBuilder.java
(original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/MessageBuilder.java
Tue Dec 29 21:26:35 2009
@@ -28,9 +28,10 @@
 import org.apache.james.mime4j.codec.QuotedPrintableInputStream;
 import org.apache.james.mime4j.descriptor.BodyDescriptor;
 import org.apache.james.mime4j.field.DefaultFieldParser;
+import org.apache.james.mime4j.field.Field;
 import org.apache.james.mime4j.parser.ContentHandler;
-import org.apache.james.mime4j.parser.Field;
 import org.apache.james.mime4j.parser.MimeStreamParser;
+import org.apache.james.mime4j.parser.RawField;
 import org.apache.james.mime4j.storage.StorageProvider;
 import org.apache.james.mime4j.util.ByteArrayBuffer;
 import org.apache.james.mime4j.util.ByteSequence;
@@ -96,7 +97,7 @@
     /**
      * @see org.apache.james.mime4j.parser.ContentHandler#field(Field)
      */
-    public void field(Field field) throws MimeException {
+    public void field(RawField field) throws MimeException {
         expect(Header.class);
         Field parsedField = DefaultFieldParser.parse(field.getRaw()); 
         ((Header) stack.peek()).addField(parsedField);

Modified: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/MessageWriter.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/MessageWriter.java?rev=894484&r1=894483&r2=894484&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/MessageWriter.java
(original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/MessageWriter.java
Tue Dec 29 21:26:35 2009
@@ -24,8 +24,8 @@
 
 import org.apache.james.mime4j.codec.CodecUtil;
 import org.apache.james.mime4j.field.ContentTypeField;
+import org.apache.james.mime4j.field.Field;
 import org.apache.james.mime4j.field.FieldName;
-import org.apache.james.mime4j.parser.Field;
 import org.apache.james.mime4j.util.ByteArrayBuffer;
 import org.apache.james.mime4j.util.ByteSequence;
 import org.apache.james.mime4j.util.ContentUtil;

Modified: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/SimpleContentHandler.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/SimpleContentHandler.java?rev=894484&r1=894483&r2=894484&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/SimpleContentHandler.java
(original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/SimpleContentHandler.java
Tue Dec 29 21:26:35 2009
@@ -24,8 +24,9 @@
 import org.apache.james.mime4j.codec.QuotedPrintableInputStream;
 import org.apache.james.mime4j.descriptor.BodyDescriptor;
 import org.apache.james.mime4j.field.DefaultFieldParser;
+import org.apache.james.mime4j.field.Field;
 import org.apache.james.mime4j.parser.AbstractContentHandler;
-import org.apache.james.mime4j.parser.Field;
+import org.apache.james.mime4j.parser.RawField;
 import org.apache.james.mime4j.util.MimeUtil;
 
 import java.io.InputStream;
@@ -76,7 +77,7 @@
      * @see org.apache.james.mime4j.parser.AbstractContentHandler#field(Field)
      */
     @Override
-    public final void field(Field field) throws MimeException {
+    public final void field(RawField field) throws MimeException {
         Field parsedField = DefaultFieldParser.parse(field.getRaw()); 
         currHeader.addField(parsedField);
     }

Modified: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/AbstractContentHandler.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/AbstractContentHandler.java?rev=894484&r1=894483&r2=894484&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/AbstractContentHandler.java
(original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/AbstractContentHandler.java
Tue Dec 29 21:26:35 2009
@@ -79,7 +79,7 @@
     /**
      * @see org.apache.james.mime4j.parser.ContentHandler#field(Field)
      */
-    public void field(Field field) throws MimeException {
+    public void field(RawField field) throws MimeException {
     }
     
     /**

Modified: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/AbstractEntity.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/AbstractEntity.java?rev=894484&r1=894483&r2=894484&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/AbstractEntity.java
(original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/AbstractEntity.java
Tue Dec 29 21:26:35 2009
@@ -54,7 +54,7 @@
     private final ByteArrayBuffer linebuf;
 
     private int lineCount;
-    private Field field;
+    private RawField field;
     private boolean endOfHeader;
     private int headerCount;
 
@@ -253,7 +253,7 @@
      * @throws IllegalStateException {@link #getState()} returns another
      *   value than {@link EntityStates#T_FIELD}.
      */
-    public Field getField() {
+    public RawField getField() {
         switch (getState()) {
         case EntityStates.T_FIELD:
             return field;

Modified: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/ContentHandler.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/ContentHandler.java?rev=894484&r1=894483&r2=894484&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/ContentHandler.java
(original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/ContentHandler.java
Tue Dec 29 21:26:35 2009
@@ -121,10 +121,10 @@
     /**
      * Called for each field of a header.
      * 
-     * @param field the MIME field.
+     * @param rawField the MIME field.
      * @throws MimeException on processing errors
      */
-    void field(Field field) throws MimeException;
+    void field(RawField rawField) throws MimeException;
 
     /**
      * Called when there are no more header fields in a message or body part.

Modified: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/EntityStateMachine.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/EntityStateMachine.java?rev=894484&r1=894483&r2=894484&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/EntityStateMachine.java
(original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/EntityStateMachine.java
Tue Dec 29 21:26:35 2009
@@ -98,6 +98,6 @@
      * @throws IllegalStateException if a header field cannot be
      *  obtained at the current stage of the parsing process. 
      */
-    Field getField() throws IllegalStateException;
+    RawField getField() throws IllegalStateException;
     
 }

Modified: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/MimeStreamParser.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/MimeStreamParser.java?rev=894484&r1=894483&r2=894484&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/MimeStreamParser.java
(original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/MimeStreamParser.java
Tue Dec 29 21:26:35 2009
@@ -26,7 +26,6 @@
 
 import org.apache.james.mime4j.MimeException;
 import org.apache.james.mime4j.descriptor.BodyDescriptor;
-import org.apache.james.mime4j.field.FieldName;
 
 /**
  * <p>
@@ -95,7 +94,7 @@
         InputStream inputStream = is;
         if (headless) {
             ByteArrayInputStream headerInputStream = new ByteArrayInputStream(
-                    (FieldName.CONTENT_TYPE + ": " + mimeEntityConfig.getDefaultContentType()
+                    ("Content-Type: " + mimeEntityConfig.getDefaultContentType()
                             + "\r\n\r\n").getBytes("iso-8859-1"));
             inputStream = new SequenceInputStream(headerInputStream, is);
         }

Modified: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/MimeTokenStream.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/MimeTokenStream.java?rev=894484&r1=894483&r2=894484&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/MimeTokenStream.java
(original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/MimeTokenStream.java
Tue Dec 29 21:26:35 2009
@@ -339,7 +339,7 @@
      * @throws IllegalStateException {@link #getState()} returns another
      *   value than {@link #T_FIELD}.
      */
-    public Field getField() {
+    public RawField getField() {
         return currentStateMachine.getField();
     }
     

Modified: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/RawEntity.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/RawEntity.java?rev=894484&r1=894483&r2=894484&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/RawEntity.java
(original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/RawEntity.java
Tue Dec 29 21:26:35 2009
@@ -71,7 +71,7 @@
     /**
      * This method has no effect and always returns <code>null</code>.
      */
-    public Field getField() {
+    public RawField getField() {
         return null;
     }
 

Modified: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/RawField.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/RawField.java?rev=894484&r1=894483&r2=894484&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/RawField.java
(original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/parser/RawField.java
Tue Dec 29 21:26:35 2009
@@ -26,7 +26,7 @@
 /**
  * The basic immutable MIME field.
  */
-class RawField implements Field {
+public class RawField {
 
     private final ByteSequence raw;
     private int colonIdx;

Modified: james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/descriptor/BaseTestForBodyDescriptors.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/descriptor/BaseTestForBodyDescriptors.java?rev=894484&r1=894483&r2=894484&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/descriptor/BaseTestForBodyDescriptors.java
(original)
+++ james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/descriptor/BaseTestForBodyDescriptors.java
Tue Dec 29 21:26:35 2009
@@ -21,7 +21,8 @@
 
 import junit.framework.TestCase;
 
-import org.apache.james.mime4j.parser.Field;
+import org.apache.james.mime4j.field.Field;
+import org.apache.james.mime4j.parser.RawField;
 import org.apache.james.mime4j.util.ByteSequence;
 
 public abstract class BaseTestForBodyDescriptors extends TestCase {
@@ -211,12 +212,13 @@
         assertNull(descriptor.getCharset());
     }
     
-    private static final class TestField implements Field {
+    private static final class TestField extends RawField {
 
         private final String name;
         private final String body;
 
         public TestField(String name, String body){
+        	super(null, -1);
             this.name = name;
             this.body = body;
         }

Modified: james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/field/FieldTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/field/FieldTest.java?rev=894484&r1=894483&r2=894484&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/field/FieldTest.java
(original)
+++ james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/field/FieldTest.java
Tue Dec 29 21:26:35 2009
@@ -24,7 +24,6 @@
 import org.apache.james.mime4j.field.ContentTypeField;
 import org.apache.james.mime4j.field.DefaultFieldParser;
 import org.apache.james.mime4j.field.UnstructuredField;
-import org.apache.james.mime4j.parser.Field;
 
 import junit.framework.TestCase;
 

Modified: james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/field/FieldsTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/field/FieldsTest.java?rev=894484&r1=894483&r2=894484&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/field/FieldsTest.java
(original)
+++ james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/field/FieldsTest.java
Tue Dec 29 21:26:35 2009
@@ -29,7 +29,6 @@
 
 import org.apache.james.mime4j.field.address.Group;
 import org.apache.james.mime4j.field.address.Mailbox;
-import org.apache.james.mime4j.parser.Field;
 import org.apache.james.mime4j.util.ByteSequence;
 import org.apache.james.mime4j.util.ContentUtil;
 import org.apache.james.mime4j.util.MimeUtil;

Modified: james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/CopyConstructorTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/CopyConstructorTest.java?rev=894484&r1=894483&r2=894484&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/CopyConstructorTest.java
(original)
+++ james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/CopyConstructorTest.java
Tue Dec 29 21:26:35 2009
@@ -23,7 +23,7 @@
 import java.util.List;
 
 import org.apache.james.mime4j.field.DefaultFieldParser;
-import org.apache.james.mime4j.parser.Field;
+import org.apache.james.mime4j.field.Field;
 
 import junit.framework.TestCase;
 

Modified: james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/ExampleMessagesRoundtripTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/ExampleMessagesRoundtripTest.java?rev=894484&r1=894483&r2=894484&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/ExampleMessagesRoundtripTest.java
(original)
+++ james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/ExampleMessagesRoundtripTest.java
Tue Dec 29 21:26:35 2009
@@ -26,6 +26,7 @@
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.net.URISyntaxException;
+import java.net.URL;
 
 import junit.framework.Test;
 import junit.framework.TestCase;
@@ -94,13 +95,16 @@
 
         public ExampleMessagesRountripTestSuite() throws IOException, URISyntaxException
{
             super();
-            File dir = new File(ExampleMessagesRountripTestSuite.class.getResource(TESTS_FOLDER).toURI());
-            File[] files = dir.listFiles();
-            
-            for (File f : files) {
-                if (f.getName().toLowerCase().endsWith(".msg")) {
-                    addTest(new ExampleMessagesRoundtripTest(f.getName().substring(0, f.getName().length()-4),
f));
-                }
+            URL resource = ExampleMessagesRountripTestSuite.class.getResource(TESTS_FOLDER);
+            if (resource != null) {
+				File dir = new File(resource.toURI());
+	            File[] files = dir.listFiles();
+	            
+	            for (File f : files) {
+	                if (f.getName().toLowerCase().endsWith(".msg")) {
+	                    addTest(new ExampleMessagesRoundtripTest(f.getName().substring(0, f.getName().length()-4),
f));
+	                }
+	            }
             }
         }
         

Modified: james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/HeaderTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/HeaderTest.java?rev=894484&r1=894483&r2=894484&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/HeaderTest.java
(original)
+++ james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/HeaderTest.java
Tue Dec 29 21:26:35 2009
@@ -23,7 +23,7 @@
 
 import org.apache.commons.io.output.ByteArrayOutputStream;
 import org.apache.james.mime4j.field.DefaultFieldParser;
-import org.apache.james.mime4j.parser.Field;
+import org.apache.james.mime4j.field.Field;
 import org.apache.james.mime4j.util.CharsetUtil;
 
 public class HeaderTest extends TestCase {

Modified: james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/MessageParserTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/MessageParserTest.java?rev=894484&r1=894483&r2=894484&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/MessageParserTest.java
(original)
+++ james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/MessageParserTest.java
Tue Dec 29 21:26:35 2009
@@ -20,7 +20,7 @@
 package org.apache.james.mime4j.message;
 
 import org.apache.commons.io.IOUtils;
-import org.apache.james.mime4j.parser.Field;
+import org.apache.james.mime4j.field.Field;
 import org.apache.james.mime4j.parser.MimeEntityConfig;
 import org.apache.james.mime4j.util.ContentUtil;
 import org.apache.james.mime4j.util.CharsetUtil;
@@ -36,6 +36,7 @@
 import java.io.OutputStream;
 import java.io.UnsupportedEncodingException;
 import java.net.URISyntaxException;
+import java.net.URL;
 import java.util.List;
 
 import junit.framework.Test;
@@ -69,15 +70,18 @@
         private static final String TESTS_FOLDER = "/testmsgs";
 
         public MessageParserTestSuite() throws URISyntaxException {
-			File dir = new File(MessageParserTestSuite.class.getResource(TESTS_FOLDER).toURI());
-            File[] files = dir.listFiles();
-            
-            for (int i = 0; i < files.length && i < 5000; i++) {
-                File f = files[i];
-                if (f.getName().toLowerCase().endsWith(".msg")) {
-                    addTest(new MessageParserTest(f.getName().substring(0, f.getName().length()-4),
f));
-                }
-            }
+			URL resource = MessageParserTestSuite.class.getResource(TESTS_FOLDER);
+			if (resource != null) {
+				File dir = new File(resource.toURI());
+	            File[] files = dir.listFiles();
+	            
+	            for (int i = 0; i < files.length && i < 5000; i++) {
+	                File f = files[i];
+	                if (f.getName().toLowerCase().endsWith(".msg")) {
+	                    addTest(new MessageParserTest(f.getName().substring(0, f.getName().length()-4),
f));
+	                }
+	            }
+			}
         }
         
         public static File getFile(String name) throws URISyntaxException {

Modified: james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/parser/MimeStreamParserExampleMessagesTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/parser/MimeStreamParserExampleMessagesTest.java?rev=894484&r1=894483&r2=894484&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/parser/MimeStreamParserExampleMessagesTest.java
(original)
+++ james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/parser/MimeStreamParserExampleMessagesTest.java
Tue Dec 29 21:26:35 2009
@@ -25,6 +25,7 @@
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.net.URISyntaxException;
+import java.net.URL;
 
 import junit.framework.Test;
 import junit.framework.TestCase;
@@ -97,13 +98,16 @@
 
         public MimeStreamParserExampleMessagesTestSuite() throws IOException, URISyntaxException
{
             super();
-            File dir = new File(MimeStreamParserExampleMessagesTestSuite.class.getResource(TESTS_FOLDER).toURI());
-            File[] files = dir.listFiles();
-            
-            for (File f : files) {
-                if (f.getName().toLowerCase().endsWith(".msg")) {
-                    addTest(new MimeStreamParserExampleMessagesTest(f.getName().substring(0,
f.getName().length()-4), f));
-                }
+            URL resource = MimeStreamParserExampleMessagesTestSuite.class.getResource(TESTS_FOLDER);
+            if (resource != null) {
+				File dir = new File(resource.toURI());
+	            File[] files = dir.listFiles();
+	            
+	            for (File f : files) {
+	                if (f.getName().toLowerCase().endsWith(".msg")) {
+	                    addTest(new MimeStreamParserExampleMessagesTest(f.getName().substring(0,
f.getName().length()-4), f));
+	                }
+	            }
             }
         }
         

Modified: james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/parser/MimeStreamParserTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/parser/MimeStreamParserTest.java?rev=894484&r1=894483&r2=894484&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/parser/MimeStreamParserTest.java
(original)
+++ james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/parser/MimeStreamParserTest.java
Tue Dec 29 21:26:35 2009
@@ -141,7 +141,7 @@
         MimeStreamParser parser = new MimeStreamParser();
         parser.setContentHandler(new AbstractContentHandler() {
             @Override
-            public void field(Field field) {
+            public void field(RawField field) {
                 assertEquals(expected.removeFirst(), decode(field.getRaw()));
             }
         });
@@ -165,7 +165,7 @@
         MimeStreamParser parser = new MimeStreamParser();
         parser.setContentHandler(new AbstractContentHandler() {
             @Override
-            public void field(Field field) {
+            public void field(RawField field) {
                 assertEquals(expected.removeFirst(), decode(field.getRaw()));
             }
         });
@@ -189,7 +189,7 @@
         MimeStreamParser parser = new MimeStreamParser();
         parser.setContentHandler(new AbstractContentHandler() {
             @Override
-            public void field(Field field) {
+            public void field(RawField field) {
                 assertEquals(expected.removeFirst(), decode(field.getRaw()));
             }
         });
@@ -250,7 +250,7 @@
         MimeStreamParser parser = new MimeStreamParser();
         parser.setContentHandler(new AbstractContentHandler() {
             @Override
-            public void field(Field field) {
+            public void field(RawField field) {
                 assertEquals(expected.removeFirst(), decode(field.getRaw()));
             }
         });
@@ -299,7 +299,7 @@
             }
 
             @Override
-            public void field(Field field) {
+            public void field(RawField field) {
                 fail("field shouldn't be called for empty stream");
             }
 
@@ -342,7 +342,7 @@
         MimeStreamParser parser = new MimeStreamParser();
         parser.setContentHandler(new AbstractContentHandler() {
             @Override
-            public void field(Field field) {
+            public void field(RawField field) {
                 fail("No fields should be reported");
             }
             @Override
@@ -373,7 +373,7 @@
         MimeStreamParser parser = new MimeStreamParser();
         parser.setContentHandler(new AbstractContentHandler() {
             @Override
-            public void field(Field field) {
+            public void field(RawField field) {
                 assertEquals(expected.removeFirst(), decode(field.getRaw()));
             }
             @Override
@@ -401,7 +401,7 @@
         MimeStreamParser parser = new MimeStreamParser();
         parser.setContentHandler(new AbstractContentHandler() {
             @Override
-            public void field(Field field) {
+            public void field(RawField field) {
                 assertEquals(expected.removeFirst(), decode(field.getRaw()));
             }
         });
@@ -420,7 +420,7 @@
         parser = new MimeStreamParser();
         parser.setContentHandler(new AbstractContentHandler() {
             @Override
-            public void field(Field field) {
+            public void field(RawField field) {
                 assertEquals(expected.removeFirst(), decode(field.getRaw()));
             }
         });

Modified: james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/parser/TestHandler.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/parser/TestHandler.java?rev=894484&r1=894483&r2=894484&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/parser/TestHandler.java
(original)
+++ james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/parser/TestHandler.java
Tue Dec 29 21:26:35 2009
@@ -91,7 +91,7 @@
     public void startHeader() {
         sb.append("<header>\r\n");
     }
-    public void field(Field field) {
+    public void field(RawField field) {
         sb.append("<field>\r\n"
                 + escape(ContentUtil.decode(field.getRaw()))
                 + "</field>\r\n");

Modified: james/mime4j/branches/cycleclean/examples/src/main/java/org/apache/james/mime4j/samples/tree/MessageTree.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/examples/src/main/java/org/apache/james/mime4j/samples/tree/MessageTree.java?rev=894484&r1=894483&r2=894484&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/examples/src/main/java/org/apache/james/mime4j/samples/tree/MessageTree.java
(original)
+++ james/mime4j/branches/cycleclean/examples/src/main/java/org/apache/james/mime4j/samples/tree/MessageTree.java
Tue Dec 29 21:26:35 2009
@@ -43,6 +43,7 @@
 import org.apache.james.mime4j.field.AddressListField;
 import org.apache.james.mime4j.field.ContentTypeField;
 import org.apache.james.mime4j.field.DateTimeField;
+import org.apache.james.mime4j.field.Field;
 import org.apache.james.mime4j.field.UnstructuredField;
 import org.apache.james.mime4j.field.address.Mailbox;
 import org.apache.james.mime4j.field.address.MailboxList;
@@ -54,7 +55,6 @@
 import org.apache.james.mime4j.message.Message;
 import org.apache.james.mime4j.message.Multipart;
 import org.apache.james.mime4j.message.TextBody;
-import org.apache.james.mime4j.parser.Field;
 
 /**
  * Displays a parsed Message in a window. The window will be divided into



Mime
View raw message