Quantcast

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

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

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

damian.bakarcic
[mule][25305] branches/mule-3.x: Merged revisions 25299 via svnmerge from
Revision
25305
Author
damian.bakarcic
Date
2013-02-25 06:28:23 -0600 (Mon, 25 Feb 2013)

Log Message

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

................
  r25299 | damian.bakarcic | 2013-02-22 11:40:43 -0300 (Fri, 22 Feb 2013) | 18 lines
  
  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.x


Modified: svnmerge-integrated

+ /branches/mule-3.3.x:1-24195,24197-24200,24202-24241,24243-24289,24294,24297,24299,24304,24310,24313,24316,24320,24323,24326-24327,24330-24332,24337,24340-24341,24352,24356,24359-24360,24364,24366,24368,24372,24374,24377-24379,24382,24385,24387,24392,24394,24397,24403-24436,24438-24439,24442,24445-24446,24448-24457,24468,24472,24478,24484,24488,24491,24496,24502-24503,24508,24512,24518,24522,24527,24531,24535,24540,24543,24549,24551,24553,24564,24572,24575,24579,24583,24588,24590,24593,24597,24601,24604,24607,24615,24621,24626,24629,24637,24639,24642-24691,24693,24695-24757,24759-24798,24800-24803,24805-24828,24830,24833,24836,24838,24843,24847,24854-24855,24887,24893-24894,24911,24916,24920,24931,24940,24942,24960,24963-24971,24977,24981-24982,24984,24991,25008,25016,25021,25024,25026-25028,25032,25040-25046,25055,25059,25065,25067,25069,25073-25079,25081-25082,25091,25100,25117,25120,25124,25148,25151,25157,25160,25186,25190,25197,25203,25209,25211,252 28,25237,25239,25241,25246-25247,25250,25254,25258,25278,25299,25303

Modified: svn:mergeinfo

/branches/mule-3.2.x: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,24434,24441,24467,24471,24477,24481,24483,24487,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,24666,24680-24681,24684,24686,24693,24695,24706,24719-24721,24724,24740,24743,24752-24753,24763,24768,24785-24786,24796,24832,24835,24841-24842,24846,24852,24875,24892,24897,24910,24915,24930,24957,24983,24990,25015,25030,25043,25064,25068,25072,25075,25077,25096,25156,25158,25185,25196,25202,25227,25233 /branches/mule-3.3.x:24204,24209,24211-24214,24216-24218,24223-24224,24226,24231-24241,24245,24248,24257,24259-24265,24269-24284,24294,24297,24299,24304,24310,24313,24316,24320,24323,24326-24327,24330-24332,24337,24340-24341,24352,24356,24359-24360,24364,24366,24368,24372,24374,24377-24379,24382,24385,24387,24392,24394,24397,24403,24405-24407,24409-24410,24412-24413,24416-24418,24420,24422-24423,24425-24427,24430-24433,24435-24436,24438-24439,24442,24445-24446,24448,24450-24451,24453-24457,24468,24472,24478,24484,24488,24491,24496,24502,24508,24512,24518,24522,24527,24531,24535,24540,24543,24549,24551,24564,24572,24575,24579,24583,24588,24590,24593,24597,24601,24604,24607,24615,24621,24626,24629,24637,24639,24642-24646,24648,24651-24652,24655,24657-24658,24660,24663-24667,24669,24682,24685,24687,24690,24696,24698-24699,24702,24707,24714,24716-24718,24722,24725,24727-24738,24741,24744-24748,24750,24754-24755,24759-24760,24764,24769,24771,24773-24774,247 77,24780-24783,24787-24788,24791-24792,24794,24797,24801-24802,24806-24807,24824-24828,24830,24833,24836,24838,24843,24847,24854-24855,24887,24893-24894,24911,24916,24920,24931,24940,24942,24960,24963-24964,24966,24977,24981-24982,24984,24991,25008,25016,25021,25024,25026-25028,25032,25040-25041,25044,25046,25055,25059,25065,25067,25069,25073-25074,25076,25078-25079,25081-25082,25091,25100,25117,25124,25148,25151,25157,25160,25186,25197,25203,25211,25228,25237,25239,25241,25246-25247,25250,25254,25258,25278,25303 + /branches/mule-3.1.x: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,24980,24988-24989,25042,25063,25095,25195,25198,25225,25232,25294 /branches/mule-3.2.x: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,24434,24441,24467,24471,24477,24481,24483,24487,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,24666,24680-24681,24684,24686,24693,24695,24706,24719-24721,24724,24740,24743,24752-24753,24763,24768,24785-24786,24796,24832,24835,24841-24842,24846,24852,24875,24892,24897,24910,24915,24930,24957,24983,24990,25015,25030,25043,25064,25068,25072,25075,25077,25096,25156,25158,25185,25196,25202,25227,25233,25298 /branches/mule-3.3.x:24204,24209,24211-24214,24216-24218,24223-24224,24226,24231-24241,24245,24248,24257,24259-24265,24269-24284,24294,24297,24299,24304,24310,24313,24316,24320,24323,24326-24327,24330-24332,24337,24340-24341,24352,24356,24359-24360,24364,24366,24368,24372,24374,24377-24379,24382,24385,24387,24392,24394,24397,24403,24405-24407,24409-24410,24412-24413,24416-24418,24420,24422-24423,24425-24427,24430-24433,24435-24436,24438-24439,24442,24445-24446,24448,24450-24451,24453-24457,24468,24472,24478,24484,24488,24491,24496,24502,24508,24512,24518,24522,24527,24531,24535,24540,24543,24549,24551,24564,24572,24575,24579,24583,24588,24590,24593,24597,24601,24604,24607,24615,24621,24626,24629,24637,24639,24642-24646,24648,24651-24652,24655,24657-24658,24660,24663-24667,24669,24682,24685,24687,24690,24696,24698-24699,24702,24707,24714,24716-24718,24722,24725,24727-24738,24741,24744-24748,24750,24754-24755,24759-24760,24764,24769,24771,24773-24774,247 77,24780-24783,24787-24788,24791-24792,24794,24797,24801-24802,24806-24807,24824-24828,24830,24833,24836,24838,24843,24847,24854-24855,24887,24893-24894,24911,24916,24920,24931,24940,24942,24960,24963-24964,24966,24977,24981-24982,24984,24991,25008,25016,25021,25024,25026-25028,25032,25040-25041,25044,25046,25055,25059,25065,25067,25069,25073-25074,25076,25078-25079,25081-25082,25091,25100,25117,25124,25148,25151,25157,25160,25186,25197,25203,25211,25228,25237,25239,25241,25246-25247,25250,25254,25258,25278,25299,25303

Modified: branches/mule-3.x/transports/email/src/main/java/org/mule/transport/email/transformers/StringToEmailMessage.java (25304 => 25305)


--- branches/mule-3.x/transports/email/src/main/java/org/mule/transport/email/transformers/StringToEmailMessage.java	2013-02-23 04:04:52 UTC (rev 25304)
+++ branches/mule-3.x/transports/email/src/main/java/org/mule/transport/email/transformers/StringToEmailMessage.java	2013-02-25 12:28:23 UTC (rev 25305)
@@ -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.x/transports/email/src/test/java/org/mule/transport/email/transformers/MailMessageTransformersNonAsciiTestCase.java (25304 => 25305)


--- branches/mule-3.x/transports/email/src/test/java/org/mule/transport/email/transformers/MailMessageTransformersNonAsciiTestCase.java	2013-02-23 04:04:52 UTC (rev 25304)
+++ branches/mule-3.x/transports/email/src/test/java/org/mule/transport/email/transformers/MailMessageTransformersNonAsciiTestCase.java	2013-02-25 12:28:23 UTC (rev 25305)
@@ -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

Loading...