geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sa...@apache.org
Subject svn commit: r1635863 - in /geronimo/specs/trunk/geronimo-javamail_1.4_spec/src/main/java: javax/mail/internet/ParameterList.java org/apache/geronimo/mail/handlers/TextHandler.java
Date Fri, 31 Oct 2014 21:12:48 GMT
Author: salyh
Date: Fri Oct 31 21:12:48 2014
New Revision: 1635863

URL: http://svn.apache.org/r1635863
Log:
fixed GERONIMO-6438, geronimo-javamail_1.4_spec wrong cast

Modified:
    geronimo/specs/trunk/geronimo-javamail_1.4_spec/src/main/java/javax/mail/internet/ParameterList.java
    geronimo/specs/trunk/geronimo-javamail_1.4_spec/src/main/java/org/apache/geronimo/mail/handlers/TextHandler.java

Modified: geronimo/specs/trunk/geronimo-javamail_1.4_spec/src/main/java/javax/mail/internet/ParameterList.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-javamail_1.4_spec/src/main/java/javax/mail/internet/ParameterList.java?rev=1635863&r1=1635862&r2=1635863&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-javamail_1.4_spec/src/main/java/javax/mail/internet/ParameterList.java
(original)
+++ geronimo/specs/trunk/geronimo-javamail_1.4_spec/src/main/java/javax/mail/internet/ParameterList.java
Fri Oct 31 21:12:48 2014
@@ -26,6 +26,7 @@ import java.util.Collections;
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.StringTokenizer;
@@ -48,7 +49,7 @@ public class ParameterList {
 
     private static final int HEADER_SIZE_LIMIT = 76;
 
-    private Map _parameters = new HashMap();
+    private Map _parameters = new LinkedHashMap(); //predictable iteration order, see toString()
 
     private boolean encodeParameters = false;
     private boolean decodeParameters = false;

Modified: geronimo/specs/trunk/geronimo-javamail_1.4_spec/src/main/java/org/apache/geronimo/mail/handlers/TextHandler.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-javamail_1.4_spec/src/main/java/org/apache/geronimo/mail/handlers/TextHandler.java?rev=1635863&r1=1635862&r2=1635863&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-javamail_1.4_spec/src/main/java/org/apache/geronimo/mail/handlers/TextHandler.java
(original)
+++ geronimo/specs/trunk/geronimo-javamail_1.4_spec/src/main/java/org/apache/geronimo/mail/handlers/TextHandler.java
Fri Oct 31 21:12:48 2014
@@ -131,16 +131,18 @@ public class TextHandler implements Data
      */
     public void writeTo(Object object, String contentType, OutputStream outputstream)
             throws IOException {
-        OutputStreamWriter os;
-        try {
-            String charset = getCharSet(contentType);
-            os = new OutputStreamWriter(outputstream, charset);
-        } catch (Exception ex) {
-            throw new UnsupportedEncodingException(ex.toString());
+        if(object instanceof String) {
+            OutputStreamWriter os;
+            try {
+                String charset = getCharSet(contentType);
+                os = new OutputStreamWriter(outputstream, charset);
+            } catch (Exception ex) {
+                throw new UnsupportedEncodingException(ex.toString());
+            }
+            String content = (String) object;
+            os.write(content, 0, content.length());
+            os.flush();
         }
-        String content = (String) object;
-        os.write(content, 0, content.length());
-        os.flush();
     }
 
     /**



Mime
View raw message