james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mwiederk...@apache.org
Subject svn commit: r734093 - /james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/UnstructuredField.java
Date Tue, 13 Jan 2009 10:31:52 GMT
Author: mwiederkehr
Date: Tue Jan 13 02:31:38 2009
New Revision: 734093

URL: http://svn.apache.org/viewvc?rev=734093&view=rev
Log:
Deferred parsing of header fields (MIME4J-96).

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

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/UnstructuredField.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/UnstructuredField.java?rev=734093&r1=734092&r2=734093&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/UnstructuredField.java
(original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/UnstructuredField.java
Tue Jan 13 02:31:38 2009
@@ -25,6 +25,8 @@
  * Simple unstructured field such as <code>Subject</code>.
  */
 public class UnstructuredField extends Field {
+    private boolean parsed = false;
+
     private String value;
 
     UnstructuredField(String name, String body, String raw) {
@@ -33,9 +35,20 @@
     }
 
     public String getValue() {
+        if (!parsed)
+            parse();
+
         return value;
     }
 
+    private void parse() {
+        String body = getBody();
+
+        value = DecoderUtil.decodeEncodedWords(body);
+
+        parsed = true;
+    }
+
     public static class Parser implements FieldParser {
         public Field parse(final String name, final String body,
                 final String raw) {



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message