classpathx-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Classpathx-discuss] bug in MimeTypeParameterList


From: Archit Shah
Subject: [Classpathx-discuss] bug in MimeTypeParameterList
Date: Mon, 24 Apr 2006 20:00:16 -0400
User-agent: Mozilla Thunderbird 1.0.7-1.1.fc4 (X11/20050929)

MimeType's toString doesn't insert the ';' separator before the parameter list. Apache SOAP 2.3.1 relies on the toString method of MimeType and MimeTypeParameterList for correct behavior and does not work with the current classpathx jaf release.

This test case shows the bug in action:

public class Test {
    public static void main(String[] args) throws Exception {
System.out.println(new javax.activation.MimeType("text/xml; charset=utf8"));
    }
}

The following patch fixes the bug by forcing a non-empty MimeTypeParameterList to start with ';' as indicated by the grammar in RFC2045.

diff -u -r1.6 MimeTypeParameterList.java
--- source/javax/activation/MimeTypeParameterList.java  25 Aug 2005
+++ source/javax/activation/MimeTypeParameterList.java  24 Apr 2006
@@ -231,11 +231,8 @@
         String name = (String)i.next();
         String value = (String)parameterValues.get(name.toLowerCase());

-        if (buffer.length() > 0)
-          {
-            buffer.append(';');
-            buffer.append(' ');
-          }
+        buffer.append(';');
+        buffer.append(' ');
         buffer.append(name);
         buffer.append('=');
         buffer.append(quote(value));

 -- Archit





reply via email to

[Prev in Thread] Current Thread [Next in Thread]