[mule-scm] [mule][25299] branches/mule-3.3.x: Merged revisions 25298 via svnmerge from

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[mule-scm] [mule][25299] branches/mule-3.3.x: Merged revisions 25298 via svnmerge from

damian.bakarcic
[mule][25299] branches/mule-3.3.x: Merged revisions 25298 via svnmerge from
Revision
25299
Author
damian.bakarcic
Date
2013-02-22 08:40:43 -0600 (Fri, 22 Feb 2013)

Log Message

Merged revisions 25298 via svnmerge from 
https://svn.codehaus.org/mule/branches/mule-3.2.x

................
  r25298 | damian.bakarcic | 2013-02-22 09:12:30 -0300 (Fri, 22 Feb 2013) | 11 lines
  
  Merged revisions 25294 via svnmerge from 
  https://svn.codehaus.org/mule/branches/mule-3.1.x
  
  ........
    r25294 | damian.bakarcic | 2013-02-21 16:17:15 -0300 (Thu, 21 Feb 2013) | 5 lines
    
    MULE-6690: StringToEmailMessage doesn't encode subject correctly
    
    - Added the transformer output encoding to the message subject when the MimeMessage is being constructed inside the StringToEmailMessage transformer. 
  ........
................

Modified Paths

Property Changed

Diff

Property changes: branches/mule-3.3.x


Modified: svnmerge-integrated

+ /branches/mule-3.2.x:1-22786,22788-22794,22796-22822,22824-22832,22834-22855,22858-22905,22907,22909-22924,22926-22950,22952-22988,22990-22991,22993-23033,23035-23048,23050-23055,23057-23069,23071-23114,23116-23125,23127-23131,23133-23134,23136-23153,23155-23163,23165-23243,23245-23247,23249-23254,23256-23315,23317-23323,23325-23347,23349-23380,23382-23384,23386-23404,23406-23423,23425-23440,23442-23465,23467-23478,23480-23570,23572-23583,23585-23587,23589-23590,23592-23607,23609-23622,23625-23631,23634-23676,23678-23682,23684-23710,23712-23751,23753-23807,23809-23814,23816-23857,23859-23873,23875-23885,23887-23891,23893-23894,23896,23898-23958,23960-24069,24071-24086,24089-24120,24122-24136,24138-24251,24254-24284,24286-24425,24429,24434,24441,24467,24471,24477,24481,24483,24487,24500,24526,24530,24534,24539,24542,24545,24548,24571,24574,24578,24582,24587,24592,24596,24600,24603,24606,24613-24628,24635-24641,24650,24661,24666,24671,24674,24680-24681,246 84-24693,24695,24706,24712,24719-24721,24724,24740,24743,24752-24753,24756-24757,24763,24768,24785-24786,24796,24832,24835,24841-24842,24846,24852,24875,24892,24897,24910,24915,24930,24957,24962,24970,24983,24990,25015,25030,25043,25064,25068,25072,25075,25077,25096,25156,25158,25185,25196,25202,25208,25227,25233-25234,25236,25245,25298

Modified: svn:mergeinfo

/branches/mule-3.2.x:23038,23057,23254,23267,23270-23272,23456,23460,23470,23472,23476,23480,23500,23508-23510,23518,23579,23594,23598,23602,23611,23620,23635,23637,23645,23649,23655,23657,23662,23665,23667,23669,23673-23675,23681,23686,23689,23691,23694,23696,23702,23707,23712,23714,23717,23719,23721-23722,23726,23731,23736,23738,23741,23747,23750,23754,23756,23762-23763,23775,23778-23780,23801,23819,23828,23834,23848,23865,23867,23869,23873,23876,23882-23883,23885,23896,23900,23908,23914,23937-23944,23951,24048-24050,24062,24073,24100,24117,24132-24133,24182-24187,24203,24208,24237-24244,24246,24250,24256,24264,24276-24279,24293-24296,24319,24350,24355,24358,24363,24371,24376,24378,24381,24384,24389-24391,24404-24408,24415,24424,24429,24434,24441,24467,24471,24477,24481,24483,24487,24500,24526,24530,24534,24539,24542,24548,24571,24574,24578,24582,24587,24592,24596,24600,24603,24606,24613-24614,24617-24618,24620,24625,24628,24635-24636,24641,24650,24661,2466 6,24680-24681,24684,24686,24693,24695,24706,24719-24721,24724,24740,24743,24752-24753,24756-24757,24763,24768,24785-24786,24796,24832,24835,24841-24842,24846,24852,24875,24892,24897,24910,24915,24930,24957,24962,24970,24983,24990,25015,25030,25043,25064,25068,25072,25075,25077,25096,25156,25158,25185,25196,25202,25208,25227,25233 + /branches/mule-3.1.x:23002,23163,23454-23455,23459,23471,23475,23499,23506,23509,23516,23596,23610,23618,23628-23631,23634,23644,23647-23648,23653-23654,23659-23661,23672,23674,23679-23680,23684,23693,23700,23713,23734-23735,23749,23753,23761,23777,23800,23818,23859-23860,23864,23872,23884,23899,23907,23935,24072,24097,24118,24202,24318,24349,24354,24362,24370,24388,24414,24466,24470,24482,24486,24525,24529,24533,24537-24538,24547,24570,24577,24586,24595,24599,24619,24623-24624,24634,24665,24677-24679,24705,24739,24742,24749-24751,24851,24874,24891,24914,24956,24959,24969,24980,24988-24989,25042,25063,25095,25195,25198,25225,25232,25294 /branches/mule-3.2.x:23038,23057,23254,23267,23270-23272,23456,23460,23470,23472,23476,23480,23500,23508-23510,23518,23579,23594,23598,23602,23611,23620,23635,23637,23645,23649,23655,23657,23662,23665,23667,23669,23673-23675,23681,23686,23689,23691,23694,23696,23702,23707,23712,23714,23717,23719,23721-23722,23726,23731,23736,23738,23741,23747,23750,23754,23756,23762-23763,23775,23778-23780,23801,23819,23828,23834,23848,23865,23867,23869,23873,23876,23882-23883,23885,23896,23900,23908,23914,23937-23944,23951,24048-24050,24062,24073,24100,24117,24132-24133,24182-24187,24203,24208,24237-24244,24246,24250,24256,24264,24276-24279,24293-24296,24319,24350,24355,24358,24363,24371,24376,24378,24381,24384,24389-24391,24404-24408,24415,24424,24429,24434,24441,24467,24471,24477,24481,24483,24487,24500,24526,24530,24534,24539,24542,24548,24571,24574,24578,24582,24587,24592,24596,24600,24603,24606,24613-24614,24617-24618,24620,24625,24628,24635-24636,24641,24650,246 61,24666,24680-24681,24684,24686,24693,24695,24706,24719-24721,24724,24740,24743,24752-24753,24756-24757,24763,24768,24785-24786,24796,24832,24835,24841-24842,24846,24852,24875,24892,24897,24910,24915,24930,24957,24962,24970,24983,24990,25015,25030,25043,25064,25068,25072,25075,25077,25096,25156,25158,25185,25196,25202,25208,25227,25233,25298

Modified: branches/mule-3.3.x/transports/email/src/main/java/org/mule/transport/email/transformers/StringToEmailMessage.java (25298 => 25299)


--- branches/mule-3.3.x/transports/email/src/main/java/org/mule/transport/email/transformers/StringToEmailMessage.java	2013-02-22 12:12:30 UTC (rev 25298)
+++ branches/mule-3.3.x/transports/email/src/main/java/org/mule/transport/email/transformers/StringToEmailMessage.java	2013-02-22 14:40:43 UTC (rev 25299)
@@ -112,7 +112,7 @@
 
         try
         {
-            Message email = new MimeMessage(((SmtpConnector) endpoint.getConnector()).getSessionDetails(endpoint).getSession());
+            MimeMessage email = new MimeMessage(((SmtpConnector) endpoint.getConnector()).getSessionDetails(endpoint).getSession());
 
             email.setRecipients(Message.RecipientType.TO, MailUtils.stringToInternetAddresses(to));
 
@@ -139,7 +139,7 @@
                 email.setReplyTo(MailUtils.stringToInternetAddresses(replyTo));
             }
 
-            email.setSubject(subject);
+            email.setSubject(subject, outputEncoding);
 
             for (Iterator iterator = headers.entrySet().iterator(); iterator.hasNext();)
             {

Modified: branches/mule-3.3.x/transports/email/src/test/java/org/mule/transport/email/transformers/MailMessageTransformersNonAsciiTestCase.java (25298 => 25299)


--- branches/mule-3.3.x/transports/email/src/test/java/org/mule/transport/email/transformers/MailMessageTransformersNonAsciiTestCase.java	2013-02-22 12:12:30 UTC (rev 25298)
+++ branches/mule-3.3.x/transports/email/src/test/java/org/mule/transport/email/transformers/MailMessageTransformersNonAsciiTestCase.java	2013-02-22 14:40:43 UTC (rev 25299)
@@ -10,12 +10,27 @@
 
 package org.mule.transport.email.transformers;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.mule.DefaultMuleMessage;
+import org.mule.api.MuleMessage;
+import org.mule.api.transformer.Transformer;
 import org.mule.config.i18n.LocaleMessageHandler;
+import org.mule.transport.email.MailProperties;
 
+import java.util.HashMap;
 import java.util.Locale;
+import java.util.Map;
 
+import javax.mail.internet.MimeMessage;
+
+import org.junit.Test;
+
 public class MailMessageTransformersNonAsciiTestCase extends MailMessageTransformersTestCase
 {
+
     @Override
     protected String getContentType() 
     {
@@ -28,4 +43,27 @@
         return LocaleMessageHandler.getString("test-data", Locale.JAPAN,
             "MailMessageTransformersNonAsciiTestCase.getResultData", new Object[] {});
     }
+
+    @Test
+    public void testNonAsciiSubjectEncodingInRoundtripTransformation() throws Exception
+    {
+        Transformer roundTripTransformer = super.getRoundTripTransformer();
+
+        // Build message setting the non-ascii message subject as a property for the transformer.
+        Map<String, Object> outboundProperties = new HashMap<String, Object>();
+        String testSubject = (String) getResultData();
+        outboundProperties.put(MailProperties.SUBJECT_PROPERTY, testSubject);
+        MuleMessage message = new DefaultMuleMessage(testSubject, outboundProperties, muleContext);
+
+        // Hack to set the default charset used by the javax.mail API to perform the mail subject encoding as iso-8859-1.
+        System.setProperty("mail.mime.charset", "iso-8859-1");
+
+        // Transform.
+        Object result = roundTripTransformer.transform(message, "iso-2022-jp");
+
+        assertNotNull("The result of the roundtrip transform shouldn't be null", result);
+        assertTrue(result instanceof MimeMessage);
+        // Assert that the mail subject has been correctly encoded in iso-2022-jp.
+        assertEquals(((MimeMessage) result).getSubject(), testSubject);
+    }
 }

To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email