You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by ma...@apache.org on 2012/05/10 10:56:18 UTC
svn commit: r1336542 -
/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/utils/MessageUtils.java
Author: manolo
Date: Thu May 10 08:56:18 2012
New Revision: 1336542
URL: http://svn.apache.org/viewvc?rev=1336542&view=rev
Log:
Fix NPE
Modified:
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/utils/MessageUtils.java
Modified: james/hupa/trunk/server/src/main/java/org/apache/hupa/server/utils/MessageUtils.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/utils/MessageUtils.java?rev=1336542&r1=1336541&r2=1336542&view=diff
==============================================================================
--- james/hupa/trunk/server/src/main/java/org/apache/hupa/server/utils/MessageUtils.java (original)
+++ james/hupa/trunk/server/src/main/java/org/apache/hupa/server/utils/MessageUtils.java Thu May 10 08:56:18 2012
@@ -203,6 +203,9 @@ public class MessageUtils {
* =?ISO-8859-1?Q?No=20hay=20ma=F1ana?= <he...@hupa.org>
*/
public static String encodeEmail(String s) {
+ if (s == null) {
+ return s;
+ }
Pattern p = Pattern.compile("^\\s*(.*?)\\s*(<[^>]+>)\\s*");
Matcher m = p.matcher(s);
return m.matches() ? encodeTexts(m.group(1)) + " " + m.group(2) : s;
@@ -213,9 +216,11 @@ public class MessageUtils {
*/
public static String encodeTexts(String s) {
String ret = s;
- try {
- ret = MimeUtility.encodeText(s, "ISO-8859-1", null);
- } catch (UnsupportedEncodingException e) {
+ if (s != null) {
+ try {
+ ret = MimeUtility.encodeText(s, "ISO-8859-1", null);
+ } catch (UnsupportedEncodingException e) {
+ }
}
return ret;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org