Hi All!

In preparation for the larger task I decided to try to correct some bugs:-)
I attached a patch for CAMEL-3985 [1].

I checked the functionality empirically by sending a mail component with
three charset (UTF-8, UTF-16 and iso-8859-1) with non standard characters
(Polish and Chinese) in personal and it seems to work. All unit tests pass
correctly.

I fixed this by inserting encoded personal in InternetAddress. The following
method seems to be more efficient than parsing an address by regular
expressions, and then passing parts to the constructor [2].

+    private static InternetAddress asEncodedInternetAddress(String address,
+           String charset) throws UnsupportedEncodingException,
AddressException {
+        InternetAddress internetAddress = new InternetAddress(address);
+        internetAddress.setPersonal(internetAddress.getPersonal(),
charset);
+        return internetAddress;
+    }

Would you please check and possibly indicate of what needs to be improved /
redo? BTW, I think that we can refactor MailBinding class so as not to pass
all the arguments (like exchange, endpoint, MailConfiguration etc.) to the
subsequent methods.

[1] https://issues.apache.org/jira/browse/CAMEL-3985
[2]
http://geronimo.apache.org/maven/specs/geronimo-javamail_1.4_spec/1.6/apidocs/javax/mail/internet/InternetAddress.html#InternetAddress%28java.lang.String,%20java.lang.String,%20java.lang.String%29

Michal

--
View this message in context: 
http://camel.465427.n5.nabble.com/Patch-for-CAMEL-3985-tp5523157p5523157.html
Sent from the Camel Development mailing list archive at Nabble.com.

Reply via email to