james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [3/5] james-jsieve git commit: JSIEVE-107 Decode headers before returning back
Date Tue, 14 Mar 2017 06:23:16 GMT
JSIEVE-107 Decode headers before returning back


Project: http://git-wip-us.apache.org/repos/asf/james-jsieve/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-jsieve/commit/641a6f93
Tree: http://git-wip-us.apache.org/repos/asf/james-jsieve/tree/641a6f93
Diff: http://git-wip-us.apache.org/repos/asf/james-jsieve/diff/641a6f93

Branch: refs/heads/JSIEVE-107
Commit: 641a6f93cdf47eaaf1c9fcf68941da5208418a76
Parents: b79a70c
Author: Daniele Depetrini <daniele.depetrini@infocert.it>
Authored: Mon Jun 6 15:40:52 2016 +0200
Committer: Laura Royet <lroyet@linagora.com>
Committed: Thu Jan 12 09:21:31 2017 +0100

----------------------------------------------------------------------
 .../apache/jsieve/util/check/ScriptCheckMailAdapter.java    | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-jsieve/blob/641a6f93/util/src/main/java/org/apache/jsieve/util/check/ScriptCheckMailAdapter.java
----------------------------------------------------------------------
diff --git a/util/src/main/java/org/apache/jsieve/util/check/ScriptCheckMailAdapter.java b/util/src/main/java/org/apache/jsieve/util/check/ScriptCheckMailAdapter.java
index fbb71c9..6a06c5c 100644
--- a/util/src/main/java/org/apache/jsieve/util/check/ScriptCheckMailAdapter.java
+++ b/util/src/main/java/org/apache/jsieve/util/check/ScriptCheckMailAdapter.java
@@ -34,6 +34,7 @@ import javax.mail.MessagingException;
 import java.io.IOException;
 import java.util.*;
 import javax.mail.internet.MimeUtility;
+import java.io.UnsupportedEncodingException;
 
 /**
  * Checks script execution for an email. The wrapped email is set by called
@@ -141,10 +142,12 @@ public class ScriptCheckMailAdapter implements MailAdapter {
                     //We need to do unfold headers here
                     result = new LinkedList<String>();
                     for (String value: values)
-                        result.add(MimeUtility.unfold(value));
+                        result.add(MimeUtility.decodeText(MimeUtility.unfold(value)));
                 }
             } catch (MessagingException e) {
                 throw new SieveMailException(e);
+            } catch (UnsupportedEncodingException e) {
+                throw new SieveMailException(e);
             }
         }
         return result;
@@ -265,7 +268,7 @@ public class ScriptCheckMailAdapter implements MailAdapter {
                 final Header header = (Header) en.nextElement();
                 final String name = header.getName();
                 if (name.trim().equalsIgnoreCase(headerName)) {
-                    builder.addAddresses(MimeUtility.unfold(header.getValue()));
+                    builder.addAddresses(MimeUtility.decodeText(MimeUtility.unfold(header.getValue())));
                 }
             }
 
@@ -274,6 +277,8 @@ public class ScriptCheckMailAdapter implements MailAdapter {
 
         } catch (MessagingException ex) {
             throw new SieveMailException(ex);
+        } catch (UnsupportedEncodingException ex) {
+            throw new SieveMailException(ex);
         } catch (ParseException ex) {
             throw new SieveMailException(ex);
         }


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message