james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mwiederk...@apache.org
Subject svn commit: r836402 - /james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/DelegatingFieldParser.java
Date Sun, 15 Nov 2009 20:14:53 GMT
Author: mwiederkehr
Date: Sun Nov 15 20:14:53 2009
New Revision: 836402

URL: http://svn.apache.org/viewvc?rev=836402&view=rev
Log:
Made DEFAULT_PARSER static final to prevent NPE in certain conditions, should fix MIME4J-139.

Modified:
    james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/DelegatingFieldParser.java

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/DelegatingFieldParser.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/DelegatingFieldParser.java?rev=836402&r1=836401&r2=836402&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/DelegatingFieldParser.java
(original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/DelegatingFieldParser.java
Sun Nov 15 20:14:53 2009
@@ -25,10 +25,10 @@
 import org.apache.james.mime4j.util.ByteSequence;
 
 public class DelegatingFieldParser implements FieldParser {
-    
+    private static final FieldParser DEFAULT_PARSER = UnstructuredField.PARSER;
+
     private Map<String, FieldParser> parsers = new HashMap<String, FieldParser>();
-    private FieldParser defaultParser = UnstructuredField.PARSER;
-    
+
     /**
      * Sets the parser used for the field named <code>name</code>.
      * @param name the name of the field
@@ -40,8 +40,8 @@
     
     public FieldParser getParser(final String name) {
         final FieldParser field = parsers.get(name.toLowerCase());
-        if(field==null) {
-            return defaultParser;
+        if (field == null) {
+            return DEFAULT_PARSER;
         }
         return field;
     }



Mime
View raw message