You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mime4j-dev@james.apache.org by ol...@apache.org on 2011/07/11 21:48:57 UTC

svn commit: r1145308 [2/7] - in /james/mime4j/trunk: core/src/main/java/org/apache/james/mime4j/ core/src/main/java/org/apache/james/mime4j/codec/ core/src/main/java/org/apache/james/mime4j/io/ core/src/main/java/org/apache/james/mime4j/parser/ core/sr...

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/parser/MimeStreamParser.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/parser/MimeStreamParser.java?rev=1145308&r1=1145307&r2=1145308&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/parser/MimeStreamParser.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/parser/MimeStreamParser.java Mon Jul 11 19:48:50 2011
@@ -34,7 +34,7 @@ import org.apache.james.mime4j.stream.Re
 
 /**
  * <p>
- * Parses MIME (or RFC822) message streams of bytes or characters and reports 
+ * Parses MIME (or RFC822) message streams of bytes or characters and reports
  * parsing events to a <code>ContentHandler</code> instance.
  * </p>
  * <p>
@@ -51,7 +51,7 @@ public class MimeStreamParser {
     private ContentHandler handler = null;
     private boolean contentDecoding;
     private final MimeEntityConfig mimeEntityConfig;
-    
+
     private final MimeTokenStream mimeTokenStream;
 
     public MimeStreamParser(MimeTokenStream tokenStream) {
@@ -62,7 +62,7 @@ public class MimeStreamParser {
     }
 
     public MimeStreamParser(
-            final MimeEntityConfig config, 
+            final MimeEntityConfig config,
             boolean clone,
             final DecodeMonitor monitor,
             final BodyDescriptorBuilder bodyDescBuilder) {
@@ -77,7 +77,7 @@ public class MimeStreamParser {
             final MimeEntityConfig config,
             final DecodeMonitor monitor,
             final BodyDescriptorBuilder bodyDescBuilder) {
-        this(config != null ? config : new MimeEntityConfig(), config != null, 
+        this(config != null ? config : new MimeEntityConfig(), config != null,
                 monitor, bodyDescBuilder);
     }
 
@@ -88,11 +88,11 @@ public class MimeStreamParser {
     public MimeStreamParser() {
         this(new MimeEntityConfig(), false, null, null);
     }
-    
+
     /**
      * Determines whether this parser automatically decodes body content
      * based on the on the MIME fields with the standard defaults.
-     */ 
+     */
     public boolean isContentDecoding() {
         return contentDecoding;
     }
@@ -100,7 +100,7 @@ public class MimeStreamParser {
     /**
      * Defines whether parser should automatically decode body content
      * based on the on the MIME fields with the standard defaults.
-     */ 
+     */
     public void setContentDecoding(boolean b) {
         this.contentDecoding = b;
     }
@@ -109,7 +109,7 @@ public class MimeStreamParser {
      * Parses a stream of bytes containing a MIME message. If the mime config of this
      * object contains a not null defaultContentType
      * ({@link MimeEntityConfig#getDefaultContentType()}) a headless parsing is performed.
-     * 
+     *
      * @param is the stream to parse.
      * @throws MimeException if the message can not be processed
      * @throws IOException on I/O errors.
@@ -131,9 +131,9 @@ public class MimeStreamParser {
                     BodyDescriptor desc = mimeTokenStream.getBodyDescriptor();
                     InputStream bodyContent;
                     if (contentDecoding) {
-                        bodyContent = mimeTokenStream.getDecodedInputStream(); 
+                        bodyContent = mimeTokenStream.getDecodedInputStream();
                     } else {
-                        bodyContent = mimeTokenStream.getInputStream(); 
+                        bodyContent = mimeTokenStream.getInputStream();
                     }
                     handler.body(desc, bodyContent);
                     break;
@@ -181,10 +181,10 @@ public class MimeStreamParser {
             state = mimeTokenStream.next();
         }
     }
-    
+
     /**
      * Determines if this parser is currently in raw mode.
-     * 
+     *
      * @return <code>true</code> if in raw mode, <code>false</code>
      *         otherwise.
      * @see #setRaw(boolean)
@@ -192,28 +192,28 @@ public class MimeStreamParser {
     public boolean isRaw() {
         return mimeTokenStream.isRaw();
     }
-    
+
     /**
-     * Enables raw mode. In raw mode all future entities (messages 
+     * Enables raw mode. In raw mode all future entities (messages
      * or body parts) in the stream will be reported to the
      * {@link ContentHandler#raw(InputStream)} handler method only.
-     * The stream will contain the entire unparsed entity contents 
+     * The stream will contain the entire unparsed entity contents
      * including header fields and whatever is in the body.
      */
     public void setRaw() {
         mimeTokenStream.setRecursionMode(RecursionMode.M_RAW);
     }
-    
+
     /**
-     * Enables flat mode. In flat mode rfc822 parts are not recursively 
+     * Enables flat mode. In flat mode rfc822 parts are not recursively
      * parsed and multipart content is handled as a single "simple" stream.
      */
     public void setFlat() {
         mimeTokenStream.setRecursionMode(RecursionMode.M_FLAT);
     }
-    
+
     /**
-     * Enables recursive mode. In tihs mode rfc822 parts are recursively 
+     * Enables recursive mode. In tihs mode rfc822 parts are recursively
      * parsed.
      */
     public void setRecurse() {
@@ -223,11 +223,11 @@ public class MimeStreamParser {
     /**
      * Finishes the parsing and stops reading lines.
      * NOTE: No more lines will be parsed but the parser
-     * will still call 
+     * will still call
      * {@link ContentHandler#endMultipart()},
      * {@link ContentHandler#endBodyPart()},
      * {@link ContentHandler#endMessage()}, etc to match previous calls
-     * to 
+     * to
      * {@link ContentHandler#startMultipart(BodyDescriptor)},
      * {@link ContentHandler#startBodyPart()},
      * {@link ContentHandler#startMessage()}, etc.
@@ -235,11 +235,11 @@ public class MimeStreamParser {
     public void stop() {
         mimeTokenStream.stop();
     }
-    
+
     /**
-     * Sets the <code>ContentHandler</code> to use when reporting 
+     * Sets the <code>ContentHandler</code> to use when reporting
      * parsing events.
-     * 
+     *
      * @param h the <code>ContentHandler</code>.
      */
     public void setContentHandler(ContentHandler h) {

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/BodyDescriptor.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/BodyDescriptor.java?rev=1145308&r1=1145307&r2=1145308&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/BodyDescriptor.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/BodyDescriptor.java Mon Jul 11 19:48:50 2011
@@ -20,8 +20,8 @@
 package org.apache.james.mime4j.stream;
 
 /**
- * Encapsulates the values of the MIME-specific header fields 
- * (which starts with <code>Content-</code>). 
+ * Encapsulates the values of the MIME-specific header fields
+ * (which starts with <code>Content-</code>).
  */
 public interface BodyDescriptor extends ContentDescriptor {
 

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/ContentDescriptor.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/ContentDescriptor.java?rev=1145308&r1=1145307&r2=1145308&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/ContentDescriptor.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/ContentDescriptor.java Mon Jul 11 19:48:50 2011
@@ -20,7 +20,7 @@
 package org.apache.james.mime4j.stream;
 
 /**
- * Represents common content properties. 
+ * Represents common content properties.
  */
 public interface ContentDescriptor {
 
@@ -33,7 +33,7 @@ public interface ContentDescriptor {
      *   "text/plain", if no content-type was specified.
      */
     String getMimeType();
-    
+
     /**
      * Gets the defaulted MIME media type for this content.
      * For example <code>TEXT</code>, <code>IMAGE</code>, <code>MULTIPART</code>
@@ -50,7 +50,7 @@ public interface ContentDescriptor {
      * otherwise the correct default (<code>PLAIN</code>)
      */
     String getSubType();
-    
+
     /**
      * <p>The body descriptors character set, defaulted appropriately for the MIME type.</p>
      * <p>

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/DefaultFieldBuilder.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/DefaultFieldBuilder.java?rev=1145308&r1=1145307&r2=1145308&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/DefaultFieldBuilder.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/DefaultFieldBuilder.java Mon Jul 11 19:48:50 2011
@@ -28,7 +28,7 @@ import org.apache.james.mime4j.util.Byte
 public class DefaultFieldBuilder implements FieldBuilder {
 
     private static final BitSet FIELD_CHARS = new BitSet();
-    
+
     static {
         for (int i = 0x21; i <= 0x39; i++) {
             FIELD_CHARS.set(i);
@@ -45,11 +45,11 @@ public class DefaultFieldBuilder impleme
         this.buf = new ByteArrayBuffer(1024);
         this.maxlen = maxlen;
     }
-    
+
     public void reset() {
         this.buf.clear();
     }
-    
+
     public void append(final ByteArrayBuffer line) throws MaxHeaderLengthLimitException {
         if (line == null) {
             return;
@@ -57,10 +57,10 @@ public class DefaultFieldBuilder impleme
         int len = line.length();
         if (this.maxlen > 0 && this.buf.length() + len >= this.maxlen) {
             throw new MaxHeaderLengthLimitException("Maximum header length limit exceeded");
-        }        
+        }
         this.buf.append(line.buffer(), 0, line.length());
     }
-    
+
     public RawField build() throws MimeException {
         int len = this.buf.length();
         if (len > 0) {
@@ -77,15 +77,15 @@ public class DefaultFieldBuilder impleme
         for (int i = 0; i < name.length(); i++) {
             char ch = name.charAt(i);
             if (!FIELD_CHARS.get(ch)) {
-                throw new MimeException("MIME field name contains illegal characters: " 
+                throw new MimeException("MIME field name contains illegal characters: "
                         + field.getName());
             }
         }
         return field;
     }
-    
+
     public ByteArrayBuffer getRaw() {
         return this.buf;
     }
-    
+
 }

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/EntityState.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/EntityState.java?rev=1145308&r1=1145307&r2=1145308&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/EntityState.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/EntityState.java Mon Jul 11 19:48:50 2011
@@ -45,7 +45,7 @@ public enum EntityState {
     T_START_HEADER,
     /**
      * This token indicates, that a message parts field has now
-     * been parsed. 
+     * been parsed.
      */
     T_FIELD,
     /**
@@ -63,12 +63,12 @@ public enum EntityState {
     T_END_MULTIPART,
     /**
      * This token indicates, that a multiparts preamble is being
-     * parsed. 
+     * parsed.
      */
     T_PREAMBLE,
     /**
      * This token indicates, that a multiparts epilogue is being
-     * parsed. 
+     * parsed.
      */
     T_EPILOGUE,
     /**

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/EntityStateMachine.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/EntityStateMachine.java?rev=1145308&r1=1145307&r2=1145308&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/EntityStateMachine.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/EntityStateMachine.java Mon Jul 11 19:48:50 2011
@@ -25,20 +25,20 @@ import java.io.IOException;
 import java.io.InputStream;
 
 /**
- * Represents the interal state of a MIME entity, which is being retrieved 
+ * Represents the interal state of a MIME entity, which is being retrieved
  * from an input stream by a MIME parser.
  */
 public interface EntityStateMachine {
 
     /**
      * Return the current state of the entity.
-     * 
+     *
      * @see EntityState
-     * 
+     *
      * @return current state
      */
     EntityState getState();
-    
+
     /**
      * Sets the current recursion mode.
      * The recursion mode specifies the approach taken to parsing parts.
@@ -46,67 +46,67 @@ public interface EntityStateMachine {
      * {@link RecursionMode#M_RECURSE} mode recursively parses each mail
      * when an <code>message/rfc822</code> part is encounted;
      * {@link RecursionMode#M_NO_RECURSE} does not.
-     * 
+     *
      * @see RecursionMode
-     * 
+     *
      * @param recursionMode
      */
     void setRecursionMode(RecursionMode recursionMode);
-    
+
     /**
-     * Advances the state machine to the next state in the 
-     * process of the MIME stream parsing. This method 
-     * may return an new state machine that represents an embedded 
-     * entity, which must be parsed before the parsing process of 
+     * Advances the state machine to the next state in the
+     * process of the MIME stream parsing. This method
+     * may return an new state machine that represents an embedded
+     * entity, which must be parsed before the parsing process of
      * the current entity can proceed.
-     * 
-     * @return a state machine of an embedded entity, if encountered, 
+     *
+     * @return a state machine of an embedded entity, if encountered,
      * <code>null</code> otherwise.
-     *  
+     *
      * @throws IOException if an I/O error occurs.
-     * @throws MimeException if the message can not be processed due 
+     * @throws MimeException if the message can not be processed due
      *  to the MIME specification violation.
      */
     EntityStateMachine advance() throws IOException, MimeException;
-    
+
     /**
      * Returns description of the entity body.
-     * 
+     *
      * @return body description
-     * 
+     *
      * @throws IllegalStateException if the body description cannot be
-     *  obtained at the current stage of the parsing process. 
+     *  obtained at the current stage of the parsing process.
      */
     BodyDescriptor getBodyDescriptor() throws IllegalStateException;
-    
+
     /**
      * Returns content stream of the entity body.
-     * 
+     *
      * @return input stream
-     * 
+     *
      * @throws IllegalStateException if the content stream cannot be
-     *  obtained at the current stage of the parsing process. 
+     *  obtained at the current stage of the parsing process.
      */
     InputStream getContentStream() throws IllegalStateException;
-    
+
     /**
      * Returns the decoded content stream of the entity body.
-     * 
+     *
      * @return input stream
-     * 
+     *
      * @throws IllegalStateException if the content stream cannot be
-     *  obtained at the current stage of the parsing process. 
+     *  obtained at the current stage of the parsing process.
      */
     InputStream getDecodedContentStream() throws IllegalStateException;
- 
+
     /**
      * Returns current header field.
-     * 
+     *
      * @return header field
-     * 
+     *
      * @throws IllegalStateException if a header field cannot be
-     *  obtained at the current stage of the parsing process. 
+     *  obtained at the current stage of the parsing process.
      */
     Field getField() throws IllegalStateException;
-    
+
 }

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/Event.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/Event.java?rev=1145308&r1=1145307&r2=1145308&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/Event.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/Event.java Mon Jul 11 19:48:50 2011
@@ -22,25 +22,25 @@ package org.apache.james.mime4j.stream;
 /**
  * Enumerates events which can be monitored.
  */
-public final class Event { 
+public final class Event {
 
     /** Indicates that a body part ended prematurely. */
-    public static final Event MIME_BODY_PREMATURE_END 
+    public static final Event MIME_BODY_PREMATURE_END
         = new Event("Body part ended prematurely. " +
-                "Boundary detected in header or EOF reached."); 
+                "Boundary detected in header or EOF reached.");
     /** Indicates that unexpected end of headers detected.*/
-    public static final Event HEADERS_PREMATURE_END 
+    public static final Event HEADERS_PREMATURE_END
         = new Event("Unexpected end of headers detected. " +
                 "Higher level boundary detected or EOF reached.");
     /** Indicates that unexpected end of headers detected.*/
-    public static final Event INVALID_HEADER 
+    public static final Event INVALID_HEADER
         = new Event("Invalid header encountered");
     /** Indicates that an obsolete syntax header has been detected */
-    public static final Event OBSOLETE_HEADER 
+    public static final Event OBSOLETE_HEADER
         = new Event("Obsolete header encountered");
-    
+
     private final String code;
-    
+
     public Event(final String code) {
         super();
         if (code == null) {
@@ -48,7 +48,7 @@ public final class Event { 
         }
         this.code = code;
     }
-    
+
     @Override
     public int hashCode() {
         return code.hashCode();
@@ -65,10 +65,10 @@ public final class Event { 
             return false;
         }
     }
-    
+
     @Override
     public String toString() {
         return code;
     }
-    
-}
\ No newline at end of file
+
+}

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/FallbackBodyDescriptorBuilder.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/FallbackBodyDescriptorBuilder.java?rev=1145308&r1=1145307&r2=1145308&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/FallbackBodyDescriptorBuilder.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/FallbackBodyDescriptorBuilder.java Mon Jul 11 19:48:50 2011
@@ -28,11 +28,11 @@ import org.apache.james.mime4j.codec.Dec
 import org.apache.james.mime4j.util.MimeUtil;
 
 /**
- * Encapsulates the values of the MIME-specific header fields 
- * (which starts with <code>Content-</code>). 
+ * Encapsulates the values of the MIME-specific header fields
+ * (which starts with <code>Content-</code>).
  */
 class FallbackBodyDescriptorBuilder implements BodyDescriptorBuilder {
-    
+
     private static final String US_ASCII = "us-ascii";
     private static final String SUB_TYPE_EMAIL = "rfc822";
     private static final String MEDIA_TYPE_TEXT = "text";
@@ -44,7 +44,7 @@ class FallbackBodyDescriptorBuilder impl
 
     private final String parentMimeType;
     private final DecodeMonitor monitor;
-    
+
     private String mediaType;
     private String subType;
     private String mimeType;
@@ -52,7 +52,7 @@ class FallbackBodyDescriptorBuilder impl
     private String charset;
     private String transferEncoding;
     private long contentLength;
-    
+
     /**
      * Creates a new root <code>BodyDescriptor</code> instance.
      */
@@ -62,7 +62,7 @@ class FallbackBodyDescriptorBuilder impl
 
     /**
      * Creates a new <code>BodyDescriptor</code> instance.
-     * 
+     *
      * @param parent the descriptor of the parent or <code>null</code> if this
      *        is the root descriptor.
      */
@@ -72,21 +72,21 @@ class FallbackBodyDescriptorBuilder impl
         this.monitor = monitor != null ? monitor : DecodeMonitor.SILENT;
         reset();
     }
-    
+
     public void reset() {
         mimeType = null;
         subType = null;
         mediaType = null;
-        boundary = null;        
-        charset = null;   
+        boundary = null;
+        charset = null;
         transferEncoding = null;
         contentLength = -1;
     }
 
     public BodyDescriptorBuilder newChild() {
-		return new FallbackBodyDescriptorBuilder(mimeType, monitor);
+        return new FallbackBodyDescriptorBuilder(mimeType, monitor);
     }
-    
+
     public BodyDescriptor build() {
         String actualMimeType = mimeType;
         String actualMediaType = mediaType;
@@ -102,25 +102,25 @@ class FallbackBodyDescriptorBuilder impl
                 actualMediaType = DEFAULT_MEDIA_TYPE;
                 actualSubType = DEFAULT_SUB_TYPE;
             }
-        } 
+        }
         if (actualCharset == null && MEDIA_TYPE_TEXT.equals(actualMediaType)) {
             actualCharset = US_ASCII;
         }
-        return new BasicBodyDescriptor(actualMimeType, actualMediaType, actualSubType, 
-                boundary, actualCharset, 
-                transferEncoding != null ? transferEncoding : "7bit", 
+        return new BasicBodyDescriptor(actualMimeType, actualMediaType, actualSubType,
+                boundary, actualCharset,
+                transferEncoding != null ? transferEncoding : "7bit",
                 contentLength);
     }
 
     /**
-     * Should be called for each <code>Content-</code> header field of 
+     * Should be called for each <code>Content-</code> header field of
      * a MIME message or part.
-     * 
+     *
      * @param field the MIME field.
      */
     public Field addField(RawField field) throws MimeException {
         String name = field.getName().toLowerCase(Locale.US);
-        
+
         if (name.equals("content-transfer-encoding") && transferEncoding == null) {
             String value = field.getBody();
             if (value != null) {
@@ -136,7 +136,7 @@ class FallbackBodyDescriptorBuilder impl
                 try {
                     contentLength = Long.parseLong(value.trim());
                 } catch (NumberFormatException e) {
-                    if (monitor.warn("Invalid content length: " + value, 
+                    if (monitor.warn("Invalid content length: " + value,
                             "ignoring Content-Length header")) {
                         throw new MimeException("Invalid Content-Length header: " + value);
                     }
@@ -162,7 +162,7 @@ class FallbackBodyDescriptorBuilder impl
             String name = nmp.getName().toLowerCase(Locale.US);
             params.put(name, nmp.getValue());
         }
-        
+
         String type = null;
         String subtype = null;
         if (main != null) {
@@ -177,7 +177,7 @@ class FallbackBodyDescriptorBuilder impl
                     valid = true;
                 }
             }
-            
+
             if (!valid) {
                 main = null;
                 type = null;
@@ -185,19 +185,19 @@ class FallbackBodyDescriptorBuilder impl
             }
         }
         String b = params.get("boundary");
-        
-        if (main != null 
-                && ((main.startsWith("multipart/") && b != null) 
+
+        if (main != null
+                && ((main.startsWith("multipart/") && b != null)
                         || !main.startsWith("multipart/"))) {
             mimeType = main;
             mediaType = type;
             subType = subtype;
         }
-        
+
         if (MimeUtil.isMultipart(mimeType)) {
             boundary = b;
         }
-        
+
         String c = params.get("charset");
         charset = null;
         if (c != null) {

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/Field.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/Field.java?rev=1145308&r1=1145307&r2=1145308&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/Field.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/Field.java Mon Jul 11 19:48:50 2011
@@ -25,23 +25,23 @@ import org.apache.james.mime4j.util.Byte
  * Abstract MIME field.
  */
 public interface Field {
-    
+
     /**
      * Gets the name of the field (<code>Subject</code>, <code>From</code>, etc).
-     * 
+     *
      * @return the field name.
      */
     String getName();
 
     /**
      * Gets the unparsed and possibly encoded (see RFC 2047) field body string.
-     * 
+     *
      * @return the unparsed field body string.
      */
     String getBody();
 
     /**
-     * Gets original (raw) representation of the field, if available, 
+     * Gets original (raw) representation of the field, if available,
      * <code>null</code> otherwise.
      */
     ByteSequence getRaw();

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/FieldBuilder.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/FieldBuilder.java?rev=1145308&r1=1145307&r2=1145308&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/FieldBuilder.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/FieldBuilder.java Mon Jul 11 19:48:50 2011
@@ -24,12 +24,12 @@ import org.apache.james.mime4j.util.Byte
 
 public interface FieldBuilder {
 
-    void reset(); 
-    
+    void reset();
+
     void append(ByteArrayBuffer line) throws MimeException;
-    
+
     RawField build() throws MimeException;
-    
+
     ByteArrayBuffer getRaw();
-    
+
 }

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/LenientFieldBuilder.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/LenientFieldBuilder.java?rev=1145308&r1=1145307&r2=1145308&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/LenientFieldBuilder.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/LenientFieldBuilder.java Mon Jul 11 19:48:50 2011
@@ -28,17 +28,17 @@ public class LenientFieldBuilder impleme
 
     private final ByteArrayBuffer buf;
     private final int maxlen;
-    
+
 
     public LenientFieldBuilder(int maxlen) {
         this.buf = new ByteArrayBuffer(1024);
         this.maxlen = maxlen;
     }
-    
+
     public void reset() {
         this.buf.clear();
     }
-    
+
     public void append(final ByteArrayBuffer line) throws MaxHeaderLengthLimitException {
         if (line == null) {
             return;
@@ -52,11 +52,11 @@ public class LenientFieldBuilder impleme
         }
         int beginIndex = 0;
         int endIndex = len;
-        while (beginIndex < endIndex 
+        while (beginIndex < endIndex
                 && CharsetUtil.isWhitespace((char)(line.byteAt(beginIndex) & 0xff))) {
             beginIndex++;
         }
-        while (endIndex > beginIndex 
+        while (endIndex > beginIndex
                 && CharsetUtil.isWhitespace((char)(line.byteAt(endIndex - 1) & 0xff))) {
             endIndex--;
         }
@@ -65,7 +65,7 @@ public class LenientFieldBuilder impleme
         }
         this.buf.append(line.buffer(), beginIndex, endIndex - beginIndex);
     }
-    
+
     public RawField build() throws MimeException {
         if (this.buf == null) {
             return null;
@@ -74,9 +74,9 @@ public class LenientFieldBuilder impleme
         // Discard modified raw data
         return new RawField(field.getName(), field.getBody());
     }
-    
+
     public ByteArrayBuffer getRaw() {
         return null;
     }
-    
+
 }

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/MimeEntity.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/MimeEntity.java?rev=1145308&r1=1145307&r2=1145308&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/MimeEntity.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/MimeEntity.java Mon Jul 11 19:48:50 2011
@@ -102,7 +102,7 @@ class MimeEntity implements EntityStateM
             BodyDescriptorBuilder bodyDescBuilder) {
         this(lineSource, instream, config, startState, endState,
                 config.isStrictParsing() ? DecodeMonitor.STRICT : DecodeMonitor.SILENT,
-                new DefaultFieldBuilder(config.getMaxHeaderLen()), 
+                new DefaultFieldBuilder(config.getMaxHeaderLen()),
                 bodyDescBuilder);
     }
 
@@ -114,7 +114,7 @@ class MimeEntity implements EntityStateM
         this(lineSource, instream, config,
                 EntityState.T_START_MESSAGE, EntityState.T_END_MESSAGE,
                 config.isStrictParsing() ? DecodeMonitor.STRICT : DecodeMonitor.SILENT,
-                new DefaultFieldBuilder(config.getMaxHeaderLen()), 
+                new DefaultFieldBuilder(config.getMaxHeaderLen()),
                 bodyDescBuilder);
     }
 
@@ -126,7 +126,7 @@ class MimeEntity implements EntityStateM
         this(lineSource, instream, new MimeEntityConfig(),
                 EntityState.T_START_MESSAGE, EntityState.T_END_MESSAGE,
                 DecodeMonitor.SILENT,
-                fieldBuilder, 
+                fieldBuilder,
                 bodyDescBuilder);
     }
 
@@ -137,7 +137,7 @@ class MimeEntity implements EntityStateM
         this(lineSource, instream, new MimeEntityConfig(),
                 EntityState.T_START_MESSAGE, EntityState.T_END_MESSAGE,
                 DecodeMonitor.SILENT,
-                new DefaultFieldBuilder(-1), 
+                new DefaultFieldBuilder(-1),
                 bodyDescBuilder);
     }
 

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/MimeEntityConfig.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/MimeEntityConfig.java?rev=1145308&r1=1145307&r2=1145308&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/MimeEntityConfig.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/MimeEntityConfig.java Mon Jul 11 19:48:50 2011
@@ -48,7 +48,7 @@ public final class MimeEntityConfig impl
 
     /**
      * @see #setMalformedHeaderStartsBody(boolean)
-     * 
+     *
      * @return true if malformed header should "end" the headers and be part of
      *         the body
      */
@@ -59,7 +59,7 @@ public final class MimeEntityConfig impl
     /**
      * Define the behaviour for dealing with malformed headers while in lenient
      * mode
-     * 
+     *
      * @param malformedHeaderStartsBody
      *            <code>true</code> to make the parser interpret a malformed
      *            header as end of the headers and as part of the body (as if
@@ -73,9 +73,9 @@ public final class MimeEntityConfig impl
 
     /**
      * Returns the value of the strict parsing mode
-     * 
+     *
      * @see #setStrictParsing(boolean)
-     * 
+     *
      * @return value of the strict parsing mode
      */
     public boolean isStrictParsing() {
@@ -90,7 +90,7 @@ public final class MimeEntityConfig impl
      * <code>false</code> minor violations will result in a warning in the log.
      * <p>
      * Default value: <code>false</code>
-     * 
+     *
      * @param strictParsing
      *            value of the strict parsing mode
      */
@@ -100,9 +100,9 @@ public final class MimeEntityConfig impl
 
     /**
      * Returns the maximum line length limit
-     * 
+     *
      * @see #setMaxLineLen(int)
-     * 
+     *
      * @return value of the the maximum line length limit
      */
     public int getMaxLineLen() {
@@ -116,7 +116,7 @@ public final class MimeEntityConfig impl
      * positive value the line length check will be disabled.
      * <p>
      * Default value: <code>1000</code>
-     * 
+     *
      * @param maxLineLen
      *            maximum line length limit
      */
@@ -126,9 +126,9 @@ public final class MimeEntityConfig impl
 
     /**
      * Returns the maximum header limit
-     * 
+     *
      * @see #setMaxHeaderCount(int)
-     * 
+     *
      * @return value of the the maximum header limit
      */
     public int getMaxHeaderCount() {
@@ -142,7 +142,7 @@ public final class MimeEntityConfig impl
      * header limit check will be disabled.
      * <p>
      * Default value: <code>1000</code>
-     * 
+     *
      * @param maxHeaderCount
      *            maximum header limit
      */
@@ -152,9 +152,9 @@ public final class MimeEntityConfig impl
 
     /**
      * Returns the maximum header length limit
-     * 
+     *
      * @see #setMaxHeaderLen(int)
-     * 
+     *
      * @return value of the maximum header length limit
      */
     public int getMaxHeaderLen() {
@@ -173,7 +173,7 @@ public final class MimeEntityConfig impl
      * terminators).
      * <p>
      * Default value: <code>10000</code>
-     * 
+     *
      * @param maxHeaderLen
      *            maximum header length limit
      */
@@ -183,9 +183,9 @@ public final class MimeEntityConfig impl
 
     /**
      * Returns the maximum content length limit
-     * 
+     *
      * @see #setMaxContentLen(long)
-     * 
+     *
      * @return value of the the maximum content length limit
      */
     public long getMaxContentLen() {
@@ -199,7 +199,7 @@ public final class MimeEntityConfig impl
      * the content length check will be disabled.
      * <p>
      * Default value: <code>-1</code>
-     * 
+     *
      * @param maxContentLen
      *            maximum content length limit
      */
@@ -209,7 +209,7 @@ public final class MimeEntityConfig impl
 
     /**
      * Returns the value of the line number counting mode.
-     * 
+     *
      * @return value of the line number counting mode.
      */
     public boolean isCountLineNumbers() {
@@ -221,7 +221,7 @@ public final class MimeEntityConfig impl
      * numbers are included in the debug output.
      * <p>
      * Default value: <code>false</code>
-     * 
+     *
      * @param countLineNumbers
      *            value of the line number counting mode.
      */
@@ -232,7 +232,7 @@ public final class MimeEntityConfig impl
     /**
      * Returns the value of the default content type. When not null, indicates
      * that the parsing should be headless.
-     * 
+     *
      * @return default content type when parsing headless, null otherwise
      * @see org.apache.james.mime4j.parser.MimeStreamParser#parse(java.io.InputStream)
      */
@@ -245,7 +245,7 @@ public final class MimeEntityConfig impl
      * should be headless.
      * <p>
      * Default value: <code>null</code>
-     * 
+     *
      * @param contentType
      *            value of the default content type when parsing headless, null
      *            otherwise

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/MimeParseEventException.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/MimeParseEventException.java?rev=1145308&r1=1145307&r2=1145308&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/MimeParseEventException.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/MimeParseEventException.java Mon Jul 11 19:48:50 2011
@@ -22,17 +22,17 @@ package org.apache.james.mime4j.stream;
 import org.apache.james.mime4j.MimeException;
 
 /**
- * Indicates that strict parsing has been enabled 
+ * Indicates that strict parsing has been enabled
  * and an optional invality has been found in the input.
  * {@link #getEvent()} indicates the type of invalidity.
  */
 public class MimeParseEventException extends MimeException {
-    
+
     private static final long serialVersionUID = 4632991604246852302L;
     private final Event event;
-    
+
     /**
-     * Constructs an exception 
+     * Constructs an exception
      * @param event <code>MimeTokenStream.Event</code>, not null
      */
     public MimeParseEventException(final Event event) {

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/MimeTokenStream.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/MimeTokenStream.java?rev=1145308&r1=1145307&r2=1145308&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/MimeTokenStream.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/MimeTokenStream.java Mon Jul 11 19:48:50 2011
@@ -71,23 +71,23 @@ import org.apache.james.mime4j.util.Char
  * one instance per thread.</p>
  */
 public class MimeTokenStream {
-    
+
     private final MimeEntityConfig config;
     private final DecodeMonitor monitor;
     private final FieldBuilder fieldBuilder;
     private final BodyDescriptorBuilder bodyDescBuilder;
     private final LinkedList<EntityStateMachine> entities = new LinkedList<EntityStateMachine>();
-    
+
     private EntityState state = EntityState.T_END_OF_STREAM;
     private EntityStateMachine currentStateMachine;
     private RecursionMode recursionMode = RecursionMode.M_RECURSE;
     private MimeEntity rootentity;
-    
+
     /**
      * Constructs a standard (lax) stream.
      * Optional validation events will be logged only.
-     * Use {@link MimeEntityConfig#setStrictParsing(boolean)} to turn on strict 
-     * parsing mode and pass the config object to 
+     * Use {@link MimeEntityConfig#setStrictParsing(boolean)} to turn on strict
+     * parsing mode and pass the config object to
      * {@link MimeTokenStream#MimeTokenStream(MimeEntityConfig)} to create
      * a stream that strictly validates the input.
      */
@@ -98,32 +98,32 @@ public class MimeTokenStream {
     public MimeTokenStream(final MimeEntityConfig config) {
         this(config, null, null, null);
     }
-        
+
     public MimeTokenStream(
-            final MimeEntityConfig config, 
+            final MimeEntityConfig config,
             final BodyDescriptorBuilder bodyDescBuilder) {
         this(config, null, null, bodyDescBuilder);
     }
 
     public MimeTokenStream(
-            final MimeEntityConfig config, 
+            final MimeEntityConfig config,
             final DecodeMonitor monitor,
             final BodyDescriptorBuilder bodyDescBuilder) {
         this(config, monitor, null, bodyDescBuilder);
     }
 
     public MimeTokenStream(
-            final MimeEntityConfig config, 
+            final MimeEntityConfig config,
             final DecodeMonitor monitor,
             final FieldBuilder fieldBuilder,
             final BodyDescriptorBuilder bodyDescBuilder) {
         super();
         this.config = config != null ? config : new MimeEntityConfig();
-        this.fieldBuilder = fieldBuilder != null ? fieldBuilder : 
+        this.fieldBuilder = fieldBuilder != null ? fieldBuilder :
             new DefaultFieldBuilder(this.config.getMaxHeaderLen());
-        this.monitor = monitor != null ? monitor : 
+        this.monitor = monitor != null ? monitor :
             (this.config.isStrictParsing() ? DecodeMonitor.STRICT : DecodeMonitor.SILENT);
-        this.bodyDescBuilder = bodyDescBuilder != null ? bodyDescBuilder : 
+        this.bodyDescBuilder = bodyDescBuilder != null ? bodyDescBuilder :
             new FallbackBodyDescriptorBuilder();
     }
 
@@ -135,16 +135,16 @@ public class MimeTokenStream {
         doParse(stream, EntityState.T_START_MESSAGE);
     }
 
-    /** 
-     * <p>Instructs the {@code MimeTokenStream} to parse the given content with 
+    /**
+     * <p>Instructs the {@code MimeTokenStream} to parse the given content with
      * the content type. The message stream is assumed to have no message header
-     * and is expected to begin with a message body. This can be the case when 
-     * the message content is transmitted using a different transport protocol 
+     * and is expected to begin with a message body. This can be the case when
+     * the message content is transmitted using a different transport protocol
      * such as HTTP.</p>
-     * <p>If the {@code MimeTokenStream} has already been in use, resets the 
+     * <p>If the {@code MimeTokenStream} has already been in use, resets the
      * streams internal state.</p>
      * @return a parsed Field representing the input contentType
-     */    
+     */
     public Field parseHeadless(InputStream stream, String contentType) {
         if (contentType == null) {
             throw new IllegalArgumentException("Content type may not be null");
@@ -158,7 +158,7 @@ public class MimeTokenStream {
             // should never happen
             throw new IllegalArgumentException(ex.getMessage());
         }
-        
+
         doParse(stream, EntityState.T_END_HEADER);
         try {
             next();
@@ -184,7 +184,7 @@ public class MimeTokenStream {
                 lineSource,
                 stream,
                 config,
-                start, 
+                start,
                 EntityState.T_END_MESSAGE,
                 monitor,
                 fieldBuilder,
@@ -199,7 +199,7 @@ public class MimeTokenStream {
 
     /**
      * Determines if this parser is currently in raw mode.
-     * 
+     *
      * @return <code>true</code> if in raw mode, <code>false</code>
      *         otherwise.
      * @see #setRecursionMode(int)
@@ -207,7 +207,7 @@ public class MimeTokenStream {
     public boolean isRaw() {
         return recursionMode == RecursionMode.M_RAW;
     }
-    
+
     /**
      * Gets the current recursion mode.
      * The recursion mode specifies the approach taken to parsing parts.
@@ -220,7 +220,7 @@ public class MimeTokenStream {
     public RecursionMode getRecursionMode() {
         return recursionMode;
     }
-    
+
     /**
      * Sets the current recursion.
      * The recursion mode specifies the approach taken to parsing parts.
@@ -240,7 +240,7 @@ public class MimeTokenStream {
     /**
      * Finishes the parsing and stops reading lines.
      * NOTE: No more lines will be parsed but the parser
-     * will still trigger 'end' events to match previously 
+     * will still trigger 'end' events to match previously
      * triggered 'start' events.
      */
     public void stop() {
@@ -259,7 +259,7 @@ public class MimeTokenStream {
      * <p/>
      * This method is valid, if {@link #getState()} returns either of
      * {@link #T_RAW_ENTITY}, {@link #T_PREAMBLE}, or {@link #T_EPILOGUE}.
-     * 
+     *
      * @return Data stream, depending on the current state.
      * @throws IllegalStateException {@link #getState()} returns an
      *   invalid value.
@@ -267,14 +267,14 @@ public class MimeTokenStream {
     public InputStream getInputStream() {
         return currentStateMachine.getContentStream();
     }
-    
+
     /**
-     * This method returns a transfer decoded stream based on the MIME 
+     * This method returns a transfer decoded stream based on the MIME
      * fields with the standard defaults.
      * <p/>
      * This method is valid, if {@link #getState()} returns either of
      * {@link #T_RAW_ENTITY}, {@link #T_PREAMBLE}, or {@link #T_EPILOGUE}.
-     * 
+     *
      * @return Data stream, depending on the current state.
      * @throws IllegalStateException {@link #getState()} returns an
      *   invalid value.
@@ -285,17 +285,17 @@ public class MimeTokenStream {
 
     /**
      * Gets a reader configured for the current body or body part.
-     * The reader will return a transfer and charset decoded 
+     * The reader will return a transfer and charset decoded
      * stream of characters based on the MIME fields with the standard
      * defaults.
      * This is a conveniance method and relies on {@link #getInputStream()}.
      * Consult the javadoc for that method for known limitations.
-     * 
+     *
      * @return <code>Reader</code>, not null
-     * @see #getInputStream 
+     * @see #getInputStream
      * @throws IllegalStateException {@link #getState()} returns an
-     *   invalid value 
-     * @throws UnsupportedCharsetException if there is no JVM support 
+     *   invalid value
+     * @throws UnsupportedCharsetException if there is no JVM support
      * for decoding the charset
      * @throws IllegalCharsetNameException if the charset name specified
      * in the mime type is illegal
@@ -312,7 +312,7 @@ public class MimeTokenStream {
         final InputStream instream = getDecodedInputStream();
         return new InputStreamReader(instream, charset);
     }
-    
+
     /**
      * <p>Gets a descriptor for the current entity.
      * This method is valid if {@link #getState()} returns:</p>
@@ -337,7 +337,7 @@ public class MimeTokenStream {
     public Field getField() {
         return currentStateMachine.getField();
     }
-    
+
     /**
      * This method advances the token stream to the next token.
      * @throws IllegalStateException The method has been called, although
@@ -371,7 +371,7 @@ public class MimeTokenStream {
 
     /**
      * Renders a state as a string suitable for logging.
-     * @param state 
+     * @param state
      * @return rendered as string, not null
      */
     public static final String stateToString(EntityState state) {

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/RawEntity.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/RawEntity.java?rev=1145308&r1=1145307&r2=1145308&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/RawEntity.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/RawEntity.java Mon Jul 11 19:48:50 2011
@@ -23,21 +23,21 @@ package org.apache.james.mime4j.stream;
 import java.io.InputStream;
 
 /**
- * Raw MIME entity. Such entities will not be parsed into elements 
+ * Raw MIME entity. Such entities will not be parsed into elements
  * by the parser. They are meant to be consumed as a raw data stream
- * by the caller.  
+ * by the caller.
  */
 public class RawEntity implements EntityStateMachine {
 
     private final InputStream stream;
 
     private EntityState state;
-    
+
     RawEntity(InputStream stream) {
         this.stream = stream;
         this.state = EntityState.T_RAW_ENTITY;
     }
-    
+
     public EntityState getState() {
         return state;
     }
@@ -52,7 +52,7 @@ public class RawEntity implements Entity
         state = EntityState.T_END_OF_STREAM;
         return null;
     }
-    
+
     /**
      * Returns raw data stream.
      */
@@ -94,5 +94,5 @@ public class RawEntity implements Entity
     public InputStream getDecodedContentStream() throws IllegalStateException {
         throw new IllegalStateException("Raw entity does not support stream decoding");
     }
-    
+
 }

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/RawField.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/RawField.java?rev=1145308&r1=1145307&r2=1145308&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/RawField.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/RawField.java Mon Jul 11 19:48:50 2011
@@ -37,8 +37,8 @@ public final class RawField implements F
         if (name == null) {
             throw new IllegalArgumentException("Field may not be null");
         }
-    	this.raw = raw;
-    	this.delimiterIdx = delimiterIdx;
+        this.raw = raw;
+        this.delimiterIdx = delimiterIdx;
         this.name = name.trim();
         this.body = body;
     }
@@ -86,5 +86,5 @@ public final class RawField implements F
             return buf.toString();
         }
     }
-    
+
 }

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/RecursionMode.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/RecursionMode.java?rev=1145308&r1=1145307&r2=1145308&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/RecursionMode.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/stream/RecursionMode.java Mon Jul 11 19:48:50 2011
@@ -24,22 +24,22 @@ package org.apache.james.mime4j.stream;
  */
 public enum RecursionMode {
 
-    /** 
-     * Recursively parse every <code>message/rfc822</code> part 
+    /**
+     * Recursively parse every <code>message/rfc822</code> part
      */
     M_RECURSE,
     /**
-     * Do not recurse <code>message/rfc822</code> parts 
+     * Do not recurse <code>message/rfc822</code> parts
      */
     M_NO_RECURSE,
-    /** 
+    /**
      * Parse into raw entities
      */
     M_RAW,
     /**
      * Do not recurse <code>message/rfc822</code> parts
-     * and treat multiparts as a single flat body. 
+     * and treat multiparts as a single flat body.
      */
     M_FLAT
-    
+
 }

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/util/ByteArrayBuffer.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/util/ByteArrayBuffer.java?rev=1145308&r1=1145307&r2=1145308&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/util/ByteArrayBuffer.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/util/ByteArrayBuffer.java Mon Jul 11 19:48:50 2011
@@ -24,7 +24,7 @@ package org.apache.james.mime4j.util;
  * A resizable byte array.
  */
 public final class ByteArrayBuffer implements ByteSequence {
-    
+
     private byte[] buffer;
     private int len;
 
@@ -33,13 +33,13 @@ public final class ByteArrayBuffer imple
         if (capacity < 0) {
             throw new IllegalArgumentException("Buffer capacity may not be negative");
         }
-        this.buffer = new byte[capacity]; 
+        this.buffer = new byte[capacity];
     }
 
     public ByteArrayBuffer(byte[] bytes, boolean dontCopy) {
         this(bytes, bytes.length, dontCopy);
     }
-    
+
     public ByteArrayBuffer(byte[] bytes, int len, boolean dontCopy) {
         if (bytes == null)
             throw new IllegalArgumentException();
@@ -61,7 +61,7 @@ public final class ByteArrayBuffer imple
         System.arraycopy(this.buffer, 0, newbuffer, 0, this.len);
         this.buffer = newbuffer;
     }
-    
+
     public void append(final byte[] b, int off, int len) {
         if (b == null) {
             return;
@@ -93,26 +93,26 @@ public final class ByteArrayBuffer imple
     public void clear() {
         this.len = 0;
     }
-    
+
     public byte[] toByteArray() {
-        byte[] b = new byte[this.len]; 
+        byte[] b = new byte[this.len];
         if (this.len > 0) {
             System.arraycopy(this.buffer, 0, b, 0, this.len);
         }
         return b;
     }
-    
+
     public byte byteAt(int i) {
         if (i < 0 || i >= this.len)
             throw new IndexOutOfBoundsException();
 
         return this.buffer[i];
     }
-    
+
     public int capacity() {
         return this.buffer.length;
     }
-    
+
     public int length() {
         return this.len;
     }
@@ -149,7 +149,7 @@ public final class ByteArrayBuffer imple
         }
         this.len = len;
     }
-    
+
     public void remove(int off, int len) {
         if ((off < 0) || (off > this.len) || (len < 0) ||
                 ((off + len) < 0) || ((off + len) > this.len)) {
@@ -164,13 +164,13 @@ public final class ByteArrayBuffer imple
         }
         this.len -= len;
     }
-    
+
     public boolean isEmpty() {
-        return this.len == 0; 
+        return this.len == 0;
     }
-    
+
     public boolean isFull() {
-        return this.len == this.buffer.length; 
+        return this.len == this.buffer.length;
     }
 
     @Override

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/util/ByteSequence.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/util/ByteSequence.java?rev=1145308&r1=1145307&r2=1145308&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/util/ByteSequence.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/util/ByteSequence.java Mon Jul 11 19:48:50 2011
@@ -31,14 +31,14 @@ public interface ByteSequence {
 
     /**
      * Returns the length of this byte sequence.
-     * 
+     *
      * @return the number of <code>byte</code>s in this sequence.
      */
     int length();
 
     /**
      * Returns the <code>byte</code> value at the specified index.
-     * 
+     *
      * @param index
      *            the index of the <code>byte</code> value to be returned.
      * @return the corresponding <code>byte</code> value
@@ -50,7 +50,7 @@ public interface ByteSequence {
     /**
      * Copies the contents of this byte sequence into a newly allocated byte
      * array and returns that array.
-     * 
+     *
      * @return a byte array holding a copy of this byte sequence.
      */
     byte[] toByteArray();

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/util/CharsetUtil.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/util/CharsetUtil.java?rev=1145308&r1=1145307&r2=1145308&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/util/CharsetUtil.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/util/CharsetUtil.java Mon Jul 11 19:48:50 2011
@@ -24,10 +24,10 @@ import java.nio.charset.IllegalCharsetNa
 import java.nio.charset.UnsupportedCharsetException;
 
 /**
- * Utility class for working with character sets. 
+ * Utility class for working with character sets.
  */
 public class CharsetUtil {
-    
+
     /** carriage return - line feed sequence */
     public static final String CRLF = "\r\n";
 
@@ -54,7 +54,7 @@ public class CharsetUtil {
     /**
      * Returns <code>true</code> if the specified character falls into the US
      * ASCII character set (Unicode range 0000 to 007f).
-     * 
+     *
      * @param ch
      *            character to test.
      * @return <code>true</code> if the specified character falls into the US
@@ -67,7 +67,7 @@ public class CharsetUtil {
     /**
      * Returns <code>true</code> if the specified string consists entirely of
      * US ASCII characters.
-     * 
+     *
      * @param s
      *            string to test.
      * @return <code>true</code> if the specified string consists entirely of
@@ -89,7 +89,7 @@ public class CharsetUtil {
     /**
      * Returns <code>true</code> if the specified character is a whitespace
      * character (CR, LF, SP or HT).
-     * 
+     *
      * @param ch
      *            character to test.
      * @return <code>true</code> if the specified character is a whitespace
@@ -102,7 +102,7 @@ public class CharsetUtil {
     /**
      * Returns <code>true</code> if the specified string consists entirely of
      * whitespace characters.
-     * 
+     *
      * @param s
      *            string to test.
      * @return <code>true</code> if the specified string consists entirely of
@@ -122,12 +122,12 @@ public class CharsetUtil {
     }
 
     /**
-     * Returns a {@link Charset} instance if character set with the given name 
-     * is recognized and supported by Java runtime. Returns <code>null</code> 
+     * Returns a {@link Charset} instance if character set with the given name
+     * is recognized and supported by Java runtime. Returns <code>null</code>
      * otherwise.
      * <p/>
-     * This method is a wrapper around {@link Charset#forName(String)} method 
-     * that catches {@link IllegalCharsetNameException} and 
+     * This method is a wrapper around {@link Charset#forName(String)} method
+     * that catches {@link IllegalCharsetNameException} and
      *  {@link UnsupportedCharsetException} and returns <code>null</code>.
      */
     public static Charset lookup(final String name) {
@@ -142,5 +142,5 @@ public class CharsetUtil {
             return null;
         }
     }
-    
- }
\ No newline at end of file
+
+ }

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/util/ContentUtil.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/util/ContentUtil.java?rev=1145308&r1=1145307&r2=1145308&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/util/ContentUtil.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/util/ContentUtil.java Mon Jul 11 19:48:50 2011
@@ -34,7 +34,7 @@ public class ContentUtil {
     /**
      * Encodes the specified string into an immutable sequence of bytes using
      * the US-ASCII charset.
-     * 
+     *
      * @param string
      *            string to encode.
      * @return encoded string as an immutable sequence of bytes.
@@ -53,7 +53,7 @@ public class ContentUtil {
     /**
      * Encodes the specified string into an immutable sequence of bytes using
      * the specified charset.
-     * 
+     *
      * @param charset
      *            Java charset to be used for the conversion.
      * @param string
@@ -76,7 +76,7 @@ public class ContentUtil {
     /**
      * Decodes the specified sequence of bytes into a string using the US-ASCII
      * charset.
-     * 
+     *
      * @param byteSequence
      *            sequence of bytes to decode.
      * @return decoded string.
@@ -91,7 +91,7 @@ public class ContentUtil {
     /**
      * Decodes the specified sequence of bytes into a string using the specified
      * charset.
-     * 
+     *
      * @param charset
      *            Java charset to be used for the conversion.
      * @param byteSequence
@@ -105,7 +105,7 @@ public class ContentUtil {
     /**
      * Decodes a sub-sequence of the specified sequence of bytes into a string
      * using the US-ASCII charset.
-     * 
+     *
      * @param byteSequence
      *            sequence of bytes to decode.
      * @param offset
@@ -128,7 +128,7 @@ public class ContentUtil {
     /**
      * Decodes a sub-sequence of the specified sequence of bytes into a string
      * using the specified charset.
-     * 
+     *
      * @param charset
      *            Java charset to be used for the conversion.
      * @param byteSequence

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/util/EmptyByteSequence.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/util/EmptyByteSequence.java?rev=1145308&r1=1145307&r2=1145308&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/util/EmptyByteSequence.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/util/EmptyByteSequence.java Mon Jul 11 19:48:50 2011
@@ -33,4 +33,4 @@ final class EmptyByteSequence implements
     public byte[] toByteArray() {
         return EMPTY_BYTES;
     }
-}
\ No newline at end of file
+}

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/util/LangUtils.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/util/LangUtils.java?rev=1145308&r1=1145307&r2=1145308&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/util/LangUtils.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/util/LangUtils.java Mon Jul 11 19:48:50 2011
@@ -46,7 +46,7 @@ public final class LangUtils {
 
     /**
      * Check if two objects are equal.
-     * 
+     *
      * @param obj1 first object to compare, may be {@code null}
      * @param obj2 second object to compare, may be {@code null}
      * @return {@code true} if the objects are equal or both null
@@ -57,7 +57,7 @@ public final class LangUtils {
 
     /**
      * Check if two strings are equal, ignoring case considerations.
-     * 
+     *
      * @param s1 first string to compare, may be {@code null}
      * @param s2 second string to compare, may be {@code null}
      * @return {@code true} if the objects are equal or both null

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/util/MimeUtil.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/util/MimeUtil.java?rev=1145308&r1=1145307&r2=1145308&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/util/MimeUtil.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/util/MimeUtil.java Mon Jul 11 19:48:50 2011
@@ -32,7 +32,7 @@ import java.util.TimeZone;
  * A utility class, which provides some MIME related application logic.
  */
 public final class MimeUtil {
-    
+
     /**
      * The <code>quoted-printable</code> encoding.
      */
@@ -56,7 +56,7 @@ public final class MimeUtil {
 
     // used to create unique ids
     private static final Random random = new Random();
-    
+
     // used to create unique ids
     private static int counter = 0;
 
@@ -64,7 +64,7 @@ public final class MimeUtil {
         // this is an utility class to be used statically.
         // this constructor protect from instantiation.
     }
-    
+
     /**
      * Returns, whether the given two MIME types are identical.
      */
@@ -73,7 +73,7 @@ public final class MimeUtil {
     }
 
     /**
-     * Returns true, if the given MIME type is that of a message. 
+     * Returns true, if the given MIME type is that of a message.
      */
     public static boolean isMessage(String pMimeType) {
         return pMimeType != null  &&  pMimeType.equalsIgnoreCase("message/rfc822");
@@ -103,7 +103,7 @@ public final class MimeUtil {
     /**
      * Creates a new unique message boundary string that can be used as boundary
      * parameter for the Content-Type header field of a message.
-     * 
+     *
      * @return a new unique message boundary string.
      */
     /* TODO - From rfc2045:
@@ -135,9 +135,9 @@ public final class MimeUtil {
      * header field such as Message-ID or In-Reply-To. If the given host name is
      * not <code>null</code> it will be used as suffix for the message ID
      * (following an at sign).
-     * 
+     *
      * The resulting string is enclosed in angle brackets (&lt; and &gt;);
-     * 
+     *
      * @param hostName host name to be included in the message ID or
      *            <code>null</code> if no host name should be included.
      * @return a new unique message identifier.
@@ -159,7 +159,7 @@ public final class MimeUtil {
 
     /**
      * Formats the specified date into a RFC 822 date-time string.
-     * 
+     *
      * @param date
      *            date to be formatted into a string.
      * @param zone
@@ -187,7 +187,7 @@ public final class MimeUtil {
      * longer than 76 characters a line break is inserted at the whitespace
      * character following the sequence resulting in a line longer than 76
      * characters.
-     * 
+     *
      * @param s
      *            string to split.
      * @param usedCharacters
@@ -226,7 +226,7 @@ public final class MimeUtil {
 
     /**
      * Unfold a multiple-line representation into a single line.
-     * 
+     *
      * @param s
      *            string to unfold.
      * @return unfolded string.

Modified: james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/EncodeUtils.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/EncodeUtils.java?rev=1145308&r1=1145307&r2=1145308&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/EncodeUtils.java (original)
+++ james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/EncodeUtils.java Mon Jul 11 19:48:50 2011
@@ -21,18 +21,18 @@ package org.apache.james.mime4j;
 
 
 public class EncodeUtils {
-    
+
     public static final int MASK = 0x3F;
-    public static final int FIRST_MASK = MASK << 18; 
-    public static final int SECOND_MASK = MASK << 12; 
-    public static final int THIRD_MASK = MASK << 6; 
-    public static final int FORTH_MASK = MASK; 
-    
+    public static final int FIRST_MASK = MASK << 18;
+    public static final int SECOND_MASK = MASK << 12;
+    public static final int THIRD_MASK = MASK << 6;
+    public static final int FORTH_MASK = MASK;
+
     public static final byte[] ENCODING = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
         'O', 'P' ,'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
         'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3',
         '4', '5', '6', '7', '8', '9', '+', '/'};
-    
+
     public static final void main(String[] args) throws Exception {
         byte[] bytes = {(byte) 0, (byte) 128, (byte) 0};
         System.out.println(new String(toBase64(bytes)));
@@ -40,7 +40,7 @@ public class EncodeUtils {
         System.out.println(new String(toBase64("Monday".getBytes())));
         System.out.println(new String(toBase64("M\u00F6nchengladbach\r\n".getBytes("ISO-8859-1"))));
     }
-    
+
     public static byte[] toBase64(byte[] in) {
         int inputLength = in.length;
         int outputLength = (int) Math.floor((4*inputLength) / 3f) + 3;
@@ -62,7 +62,7 @@ public class EncodeUtils {
             index = (quantum & FORTH_MASK);
             outputIndex = setResult(results, outputIndex, ENCODING[index]);
         }
-        
+
         switch (inputLength - inputIndex) {
             case 1:
                 int quantum = in[inputIndex++] << 16;
@@ -73,7 +73,7 @@ public class EncodeUtils {
                 outputIndex = setResult(results, outputIndex, (byte) '=');
                 outputIndex = setResult(results, outputIndex, (byte) '=');
                 break;
-                
+
             case 2:
                 quantum = (in[inputIndex++] << 16) + (in[inputIndex++] << 8);
                 index = (quantum & FIRST_MASK) >> 18;
@@ -85,7 +85,7 @@ public class EncodeUtils {
                 outputIndex = setResult(results, outputIndex, (byte) '=');
                 break;
         }
-        
+
         return results;
     }