Author: mwiederkehr
Date: Fri Jan 16 07:14:56 2009
New Revision: 735031

URL: http://svn.apache.org/viewvc?rev=735031&view=rev
Log:
changed maximum number of characters per line in MimeUtil.fold() to 76 because 
of RFC 2047 (MIME4J-100)

Modified:
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/util/MimeUtil.java
    
james/mime4j/trunk/src/test/java/org/apache/james/mime4j/util/MimeUtilTest.java

Modified: 
james/mime4j/trunk/src/main/java/org/apache/james/mime4j/util/MimeUtil.java
URL: 
http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/util/MimeUtil.java?rev=735031&r1=735030&r2=735031&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/util/MimeUtil.java 
(original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/util/MimeUtil.java 
Fri Jan 16 07:14:56 2009
@@ -395,11 +395,12 @@
 
     /**
      * Splits the specified string into a multiple-line representation with
-     * lines no longer than 78 characters (see <a
-     * href='http://www.faqs.org/rfcs/rfc5322.html'>RFC 5322</a> section
-     * 2.2.3.). If the string contains non-whitespace sequences longer than 78
-     * characters a line break is inserted at the whitespace character 
following
-     * the sequence resulting in a line longer than 78 characters.
+     * lines no longer than 76 characters (because the line might contain
+     * encoded words; see <a href='http://www.faqs.org/rfcs/rfc2047.html'>RFC
+     * 2047</a> section 2). If the string contains non-whitespace sequences
+     * 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.
@@ -409,7 +410,7 @@
      * @return a multiple-line representation of the given string.
      */
     public static String fold(String s, int usedCharacters) {
-        final int maxCharacters = 78;
+        final int maxCharacters = 76;
 
         final int length = s.length();
         if (usedCharacters + length <= maxCharacters)

Modified: 
james/mime4j/trunk/src/test/java/org/apache/james/mime4j/util/MimeUtilTest.java
URL: 
http://svn.apache.org/viewvc/james/mime4j/trunk/src/test/java/org/apache/james/mime4j/util/MimeUtilTest.java?rev=735031&r1=735030&r2=735031&view=diff
==============================================================================
--- 
james/mime4j/trunk/src/test/java/org/apache/james/mime4j/util/MimeUtilTest.java 
(original)
+++ 
james/mime4j/trunk/src/test/java/org/apache/james/mime4j/util/MimeUtilTest.java 
Fri Jan 16 07:14:56 2009
@@ -22,11 +22,11 @@
 public class MimeUtilTest extends TestCase {
 
     public void testFold() throws Exception {
-        assertEquals("this is\r\n a test", MimeUtil.fold("this is a test", 
70));
-        assertEquals("this is\r\n a test", MimeUtil.fold("this is a test", 
71));
-        assertEquals("this\r\n is a test", MimeUtil.fold("this is a test", 
72));
+        assertEquals("this is\r\n a test", MimeUtil.fold("this is a test", 
68));
+        assertEquals("this is\r\n a test", MimeUtil.fold("this is a test", 
69));
+        assertEquals("this\r\n is a test", MimeUtil.fold("this is a test", 
70));
         assertEquals("this  \r\n   is a test", MimeUtil.fold(
-                "this     is a test", 72));
+                "this     is a test", 70));
     }
 
     public void testFoldOverlyLongNonWhitespace() throws Exception {



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to