james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject svn commit: r1138767 - in /james/mime4j/branches/mime4j-116-refactoring/dom/src: main/java/org/apache/james/mime4j/message/ test/java/org/apache/james/mime4j/message/
Date Thu, 23 Jun 2011 08:38:13 GMT
Author: bago
Date: Thu Jun 23 08:38:12 2011
New Revision: 1138767

URL: http://svn.apache.org/viewvc?rev=1138767&view=rev
Log:
Removed "parseAllFields" parameters from the logic. Users that do not want to parse all of
them will provide a custom FieldParser (Proposed refactoring for MIME4J-116)

Modified:
    james/mime4j/branches/mime4j-116-refactoring/dom/src/main/java/org/apache/james/mime4j/message/DefaultMessageBuilder.java
    james/mime4j/branches/mime4j-116-refactoring/dom/src/main/java/org/apache/james/mime4j/message/MaximalBodyDescriptor.java
    james/mime4j/branches/mime4j-116-refactoring/dom/src/main/java/org/apache/james/mime4j/message/MaximalBodyDescriptorFactory.java
    james/mime4j/branches/mime4j-116-refactoring/dom/src/main/java/org/apache/james/mime4j/message/MinimalBodyDescriptor.java
    james/mime4j/branches/mime4j-116-refactoring/dom/src/main/java/org/apache/james/mime4j/message/MinimalBodyDescriptorFactory.java
    james/mime4j/branches/mime4j-116-refactoring/dom/src/test/java/org/apache/james/mime4j/message/MaximalBodyDescriptorTest.java

Modified: james/mime4j/branches/mime4j-116-refactoring/dom/src/main/java/org/apache/james/mime4j/message/DefaultMessageBuilder.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/mime4j-116-refactoring/dom/src/main/java/org/apache/james/mime4j/message/DefaultMessageBuilder.java?rev=1138767&r1=1138766&r2=1138767&view=diff
==============================================================================
--- james/mime4j/branches/mime4j-116-refactoring/dom/src/main/java/org/apache/james/mime4j/message/DefaultMessageBuilder.java
(original)
+++ james/mime4j/branches/mime4j-116-refactoring/dom/src/main/java/org/apache/james/mime4j/message/DefaultMessageBuilder.java
Thu Jun 23 08:38:12 2011
@@ -298,7 +298,7 @@ public class DefaultMessageBuilder imple
             FieldParser<? extends ParsedField> fp = fieldParser != null ? fieldParser
: 
                 strict ? DefaultFieldParser.getParser() : LenientFieldParser.getParser();
             MutableBodyDescriptorFactory bdf = bodyDescFactory != null ? bodyDescFactory
:
-                new MinimalBodyDescriptorFactory(fp, true);
+                new MinimalBodyDescriptorFactory(fp);
             BodyFactory bf = bodyFactory != null ? bodyFactory : new BasicBodyFactory();
             MimeStreamParser parser = new MimeStreamParser(cfg, mon, bdf);
             // EntityBuilder expect the parser will send ParserFields for the well known
fields

Modified: james/mime4j/branches/mime4j-116-refactoring/dom/src/main/java/org/apache/james/mime4j/message/MaximalBodyDescriptor.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/mime4j-116-refactoring/dom/src/main/java/org/apache/james/mime4j/message/MaximalBodyDescriptor.java?rev=1138767&r1=1138766&r2=1138767&view=diff
==============================================================================
--- james/mime4j/branches/mime4j-116-refactoring/dom/src/main/java/org/apache/james/mime4j/message/MaximalBodyDescriptor.java
(original)
+++ james/mime4j/branches/mime4j-116-refactoring/dom/src/main/java/org/apache/james/mime4j/message/MaximalBodyDescriptor.java
Thu Jun 23 08:38:12 2011
@@ -61,16 +61,16 @@ public class MaximalBodyDescriptor exten
     }
     
     protected MaximalBodyDescriptor(final BodyDescriptor parent) {
-        this(parent, null, true, null);
+        this(parent, null, null);
     }
 
-    public MaximalBodyDescriptor(final BodyDescriptor parent, final FieldParser<?>
fieldParser, final boolean parseAllFields, final DecodeMonitor monitor) {
-        super(parent, fieldParser, parseAllFields, monitor);
+    public MaximalBodyDescriptor(final BodyDescriptor parent, final FieldParser<?>
fieldParser, final DecodeMonitor monitor) {
+        super(parent, fieldParser, monitor);
     }
 
     @Override
     public MutableBodyDescriptor newChild() {
-        return new MaximalBodyDescriptor(this, getFieldParser(), getParseAllFields(), getDecodeMonitor());
+        return new MaximalBodyDescriptor(this, getFieldParser(), getDecodeMonitor());
     }
 
     @Override

Modified: james/mime4j/branches/mime4j-116-refactoring/dom/src/main/java/org/apache/james/mime4j/message/MaximalBodyDescriptorFactory.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/mime4j-116-refactoring/dom/src/main/java/org/apache/james/mime4j/message/MaximalBodyDescriptorFactory.java?rev=1138767&r1=1138766&r2=1138767&view=diff
==============================================================================
--- james/mime4j/branches/mime4j-116-refactoring/dom/src/main/java/org/apache/james/mime4j/message/MaximalBodyDescriptorFactory.java
(original)
+++ james/mime4j/branches/mime4j-116-refactoring/dom/src/main/java/org/apache/james/mime4j/message/MaximalBodyDescriptorFactory.java
Thu Jun 23 08:38:12 2011
@@ -27,20 +27,18 @@ import org.apache.james.mime4j.stream.Mu
 public class MaximalBodyDescriptorFactory implements MutableBodyDescriptorFactory {
 
     private final FieldParser<?> fieldParser;
-    private final boolean parseAllFields;
 
     public MaximalBodyDescriptorFactory() {
-        this(null, false);
+        this(null);
     }
 
     public MaximalBodyDescriptorFactory(final 
-            FieldParser<?> fieldParser, final boolean parseAllFields) {
+            FieldParser<?> fieldParser) {
         this.fieldParser = fieldParser;
-        this.parseAllFields = parseAllFields;
     }
 
     public MutableBodyDescriptor newInstance(DecodeMonitor monitor) {
-        return new MaximalBodyDescriptor(null, fieldParser, parseAllFields, monitor);
+        return new MaximalBodyDescriptor(null, fieldParser, monitor);
     }
     
 } 

Modified: james/mime4j/branches/mime4j-116-refactoring/dom/src/main/java/org/apache/james/mime4j/message/MinimalBodyDescriptor.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/mime4j-116-refactoring/dom/src/main/java/org/apache/james/mime4j/message/MinimalBodyDescriptor.java?rev=1138767&r1=1138766&r2=1138767&view=diff
==============================================================================
--- james/mime4j/branches/mime4j-116-refactoring/dom/src/main/java/org/apache/james/mime4j/message/MinimalBodyDescriptor.java
(original)
+++ james/mime4j/branches/mime4j-116-refactoring/dom/src/main/java/org/apache/james/mime4j/message/MinimalBodyDescriptor.java
Thu Jun 23 08:38:12 2011
@@ -74,8 +74,6 @@ public class MinimalBodyDescriptor imple
 
     private final FieldParser<?> fieldParser;
 
-    private final boolean parseAllFields;
-    
     /**
      * Creates a new root <code>BodyDescriptor</code> instance.
      */
@@ -87,7 +85,7 @@ public class MinimalBodyDescriptor imple
      * Creates a new root <code>BodyDescriptor</code> instance with the given
parent
      */
     public MinimalBodyDescriptor(final BodyDescriptor parent) {
-        this(parent, null, false, null);
+        this(parent, null, null);
     }
 
     /**
@@ -96,7 +94,7 @@ public class MinimalBodyDescriptor imple
      * @param parent the descriptor of the parent or <code>null</code> if this
      *        is the root descriptor.
      */
-    public MinimalBodyDescriptor(final BodyDescriptor parent, final FieldParser<?>
fieldParser, boolean parseAllFields, final DecodeMonitor monitor) {
+    public MinimalBodyDescriptor(final BodyDescriptor parent, final FieldParser<?>
fieldParser, final DecodeMonitor monitor) {
         if (parent != null && MimeUtil.isSameMimeType("multipart/digest", parent.getMimeType()))
{
             this.mimeType = EMAIL_MESSAGE_MIME_TYPE;
             this.subType = SUB_TYPE_EMAIL;
@@ -107,7 +105,6 @@ public class MinimalBodyDescriptor imple
             this.mediaType = DEFAULT_MEDIA_TYPE;
         }
         this.fieldParser = fieldParser != null ? fieldParser : DefaultFieldParser.getParser();
-        this.parseAllFields = parseAllFields;
         this.monitor = monitor != null ? monitor : DecodeMonitor.SILENT;
     }
     
@@ -119,12 +116,8 @@ public class MinimalBodyDescriptor imple
         return fieldParser;
     }
     
-    protected boolean getParseAllFields() {
-        return parseAllFields;
-    }
-    
     public MutableBodyDescriptor newChild() {
-        return new MinimalBodyDescriptor(this, getFieldParser(), getParseAllFields(), getDecodeMonitor());
+        return new MinimalBodyDescriptor(this, getFieldParser(), getDecodeMonitor());
     }
     
     /**
@@ -141,9 +134,9 @@ public class MinimalBodyDescriptor imple
             return parseContentLength(field);
         } else if (name.equalsIgnoreCase(FieldName.CONTENT_TYPE) && contentTypeField
== null) {
             return parseContentType(field);
-        } else if (getParseAllFields()) {
+        } else {
             return getFieldParser().parse(field, monitor);
-        } else return null;
+        }
     }
 
     private ParsedField parseContentTransferEncoding(Field field) throws MimeException {

Modified: james/mime4j/branches/mime4j-116-refactoring/dom/src/main/java/org/apache/james/mime4j/message/MinimalBodyDescriptorFactory.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/mime4j-116-refactoring/dom/src/main/java/org/apache/james/mime4j/message/MinimalBodyDescriptorFactory.java?rev=1138767&r1=1138766&r2=1138767&view=diff
==============================================================================
--- james/mime4j/branches/mime4j-116-refactoring/dom/src/main/java/org/apache/james/mime4j/message/MinimalBodyDescriptorFactory.java
(original)
+++ james/mime4j/branches/mime4j-116-refactoring/dom/src/main/java/org/apache/james/mime4j/message/MinimalBodyDescriptorFactory.java
Thu Jun 23 08:38:12 2011
@@ -27,16 +27,14 @@ import org.apache.james.mime4j.stream.Mu
 public class MinimalBodyDescriptorFactory implements MutableBodyDescriptorFactory {
 
     private final FieldParser<?> fieldParser;
-    private final boolean parseAllFields;
 
     public MinimalBodyDescriptorFactory(final 
-            FieldParser<?> fieldParser, final boolean parseAllFields) {
+            FieldParser<?> fieldParser) {
         this.fieldParser = fieldParser;
-        this.parseAllFields = parseAllFields;
     }
 
     public MutableBodyDescriptor newInstance(DecodeMonitor monitor) {
-        return new MinimalBodyDescriptor(null, fieldParser, parseAllFields, monitor);
+        return new MinimalBodyDescriptor(null, fieldParser, monitor);
     }
     
 } 

Modified: james/mime4j/branches/mime4j-116-refactoring/dom/src/test/java/org/apache/james/mime4j/message/MaximalBodyDescriptorTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/mime4j-116-refactoring/dom/src/test/java/org/apache/james/mime4j/message/MaximalBodyDescriptorTest.java?rev=1138767&r1=1138766&r2=1138767&view=diff
==============================================================================
--- james/mime4j/branches/mime4j-116-refactoring/dom/src/test/java/org/apache/james/mime4j/message/MaximalBodyDescriptorTest.java
(original)
+++ james/mime4j/branches/mime4j-116-refactoring/dom/src/test/java/org/apache/james/mime4j/message/MaximalBodyDescriptorTest.java
Thu Jun 23 08:38:12 2011
@@ -41,7 +41,7 @@ public class MaximalBodyDescriptorTest e
         MimeEntityConfig config = new MimeEntityConfig();
         config.setStrictParsing(true);
         parser = new MimeTokenStream(config, 
-                new MaximalBodyDescriptorFactory(null, false));
+                new MaximalBodyDescriptorFactory(null));
     }
 
     @Override



Mime
View raw message