james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r654254 - in /james/jsieve/trunk/src/main/java/org/apache/jsieve: parser/address/SieveAddressBuilder.java util/check/ScriptCheckMailAdapter.java
Date Wed, 07 May 2008 20:18:32 GMT
Author: rdonkin
Date: Wed May  7 13:18:32 2008
New Revision: 654254

URL: http://svn.apache.org/viewvc?rev=654254&view=rev
Log:
Remove dependency of core library on java mail.

Modified:
    james/jsieve/trunk/src/main/java/org/apache/jsieve/parser/address/SieveAddressBuilder.java
    james/jsieve/trunk/src/main/java/org/apache/jsieve/util/check/ScriptCheckMailAdapter.java

Modified: james/jsieve/trunk/src/main/java/org/apache/jsieve/parser/address/SieveAddressBuilder.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/src/main/java/org/apache/jsieve/parser/address/SieveAddressBuilder.java?rev=654254&r1=654253&r2=654254&view=diff
==============================================================================
--- james/jsieve/trunk/src/main/java/org/apache/jsieve/parser/address/SieveAddressBuilder.java
(original)
+++ james/jsieve/trunk/src/main/java/org/apache/jsieve/parser/address/SieveAddressBuilder.java
Wed May  7 13:18:32 2008
@@ -26,10 +26,6 @@
 import java.util.Collections;
 import java.util.Enumeration;
 
-import javax.mail.Header;
-import javax.mail.Message;
-import javax.mail.MessagingException;
-
 import org.apache.jsieve.mail.MailAdapter;
 import org.apache.jsieve.mail.SieveMailException;
 import org.apache.jsieve.mail.MailAdapter.Address;
@@ -50,39 +46,6 @@
  */
 public class SieveAddressBuilder {
 
-    /**
-     * Parses the value from the given message into addresses.
-     * 
-     * @param headerName
-     *                header name, to be matched case insensitively
-     * @param message
-     *                <code>Message</code>, not null
-     * @return <code>Address</code> array, not null possibly empty
-     * @throws SieveMailException
-     */
-    public static Address[] parseAddresses(final String headerName,
-            final Message message) throws SieveMailException {
-        try {
-            final SieveAddressBuilder builder = new SieveAddressBuilder();
-
-            for (Enumeration en = message.getAllHeaders(); en.hasMoreElements();) {
-                final Header header = (Header) en.nextElement();
-                final String name = header.getName();
-                if (name.trim().equalsIgnoreCase(headerName)) {
-                    builder.addAddresses(header.getValue());
-                }
-            }
-
-            final Address[] results = builder.getAddresses();
-            return results;
-
-        } catch (MessagingException ex) {
-            throw new SieveMailException(ex);
-        } catch (ParseException ex) {
-            throw new SieveMailException(ex);
-        }
-    }
-
     private static final Address[] EMPTY_ADDRESSES = {};
 
     private final Collection addresses;

Modified: james/jsieve/trunk/src/main/java/org/apache/jsieve/util/check/ScriptCheckMailAdapter.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/src/main/java/org/apache/jsieve/util/check/ScriptCheckMailAdapter.java?rev=654254&r1=654253&r2=654254&view=diff
==============================================================================
--- james/jsieve/trunk/src/main/java/org/apache/jsieve/util/check/ScriptCheckMailAdapter.java
(original)
+++ james/jsieve/trunk/src/main/java/org/apache/jsieve/util/check/ScriptCheckMailAdapter.java
Wed May  7 13:18:32 2008
@@ -32,6 +32,7 @@
 import javax.mail.Message;
 import javax.mail.MessagingException;
 
+import org.apache.jsieve.parser.generated.ParseException;
 import org.apache.jsieve.exception.SieveException;
 import org.apache.jsieve.mail.Action;
 import org.apache.jsieve.mail.MailAdapter;
@@ -279,7 +280,40 @@
 
     public Address[] parseAddresses(String headerName)
             throws SieveMailException {
-        return SieveAddressBuilder.parseAddresses(headerName, mail);
+        return parseAddresses(headerName, mail);
+    }
+
+    /**
+     * Parses the value from the given message into addresses.
+     * 
+     * @param headerName
+     *                header name, to be matched case insensitively
+     * @param message
+     *                <code>Message</code>, not null
+     * @return <code>Address</code> array, not null possibly empty
+     * @throws SieveMailException
+     */
+    public Address[] parseAddresses(final String headerName,
+            final Message message) throws SieveMailException {
+        try {
+           final SieveAddressBuilder builder = new SieveAddressBuilder();
+
+            for (Enumeration en = message.getAllHeaders(); en.hasMoreElements();) {
+                final Header header = (Header) en.nextElement();
+                final String name = header.getName();
+                if (name.trim().equalsIgnoreCase(headerName)) {
+                    builder.addAddresses(header.getValue());
+                }
+            }
+
+            final Address[] results = builder.getAddresses();
+            return results;
+
+        } catch (MessagingException 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