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 fe...@apache.org on 2011/04/05 18:34:12 UTC

svn commit: r1089122 [1/2] - in /james/mailet: base/trunk/ base/trunk/src/main/java/org/apache/mailet/base/ base/trunk/src/test/java/org/apache/mailet/base/ base/trunk/src/test/java/org/apache/mailet/base/test/ crypto/trunk/ crypto/trunk/src/main/java/...

Author: felixk
Date: Tue Apr  5 16:34:10 2011
New Revision: 1089122

URL: http://svn.apache.org/viewvc?rev=1089122&view=rev
Log:
- Parameterized many variables/parameters for type safety (see MAILET-38)
- Use our own snapshots where needed

Modified:
    james/mailet/base/trunk/pom.xml
    james/mailet/base/trunk/src/main/java/org/apache/mailet/base/GenericMailet.java
    james/mailet/base/trunk/src/main/java/org/apache/mailet/base/GenericMatcher.java
    james/mailet/base/trunk/src/main/java/org/apache/mailet/base/GenericRecipientMatcher.java
    james/mailet/base/trunk/src/main/java/org/apache/mailet/base/MatcherInverter.java
    james/mailet/base/trunk/src/main/java/org/apache/mailet/base/StringUtils.java
    james/mailet/base/trunk/src/test/java/org/apache/mailet/base/MatcherInverterTest.java
    james/mailet/base/trunk/src/test/java/org/apache/mailet/base/test/FakeMail.java
    james/mailet/base/trunk/src/test/java/org/apache/mailet/base/test/FakeMailContext.java
    james/mailet/base/trunk/src/test/java/org/apache/mailet/base/test/FakeMailetConfig.java
    james/mailet/base/trunk/src/test/java/org/apache/mailet/base/test/FakeMimeMessage.java
    james/mailet/crypto/trunk/pom.xml
    james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/KeyStoreHolder.java
    james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/SMIMEKeyHolder.java
    james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/mailet/AbstractSign.java
    james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/mailet/SMIMECheckSignature.java
    james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/mailet/SMIMEDecrypt.java
    james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/matcher/IsSMIMEEncrypted.java
    james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/matcher/IsSMIMESigned.java
    james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/matcher/IsX509CertificateSubject.java
    james/mailet/maven-mailetdocs-plugin/trunk/pom.xml
    james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/DefaultDescriptorsExtractor.java
    james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/DescriptorsExtractor.java
    james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/MailetdocsMojo.java
    james/mailet/standard/trunk/pom.xml
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/ClamAVScan.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/MailAttributesToMimeHeaders.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/OnlyText.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/PostmasterAlias.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/RecoverAttachment.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/RemoveMailAttribute.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/RemoveMimeHeader.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/SetMailAttribute.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/StripAttachment.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/UseHeaderRecipients.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/AbstractQuotaMatcher.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/All.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/AttachmentFileNameIs.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/CompareNumericHeaderValue.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/FetchedFrom.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/HasAttachment.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/HasHabeasWarrantMark.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/HasHeader.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/HasMailAttribute.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/HasMailAttributeWithValue.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/HostIs.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/IsSingleRecipient.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/RecipientIs.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/RelayLimit.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/SMTPAuthSuccessful.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/SMTPAuthUserIs.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/SMTPIsAuthNetwork.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/SenderHostIs.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/SenderHostIsLocal.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/SenderIs.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/SenderIsNull.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/SizeGreaterThan.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/SubjectIs.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/SubjectStartsWith.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/UserIs.java
    james/mailet/standard/trunk/src/test/java/org/apache/james/transport/mailets/StripAttachmentTest.java
    james/mailet/standard/trunk/src/test/java/org/apache/james/transport/matchers/AbstractHasMailAttributeTest.java
    james/mailet/standard/trunk/src/test/java/org/apache/james/transport/matchers/AbstractSenderIsTest.java
    james/mailet/standard/trunk/src/test/java/org/apache/james/transport/matchers/AllTest.java
    james/mailet/standard/trunk/src/test/java/org/apache/james/transport/matchers/FetchedFromTest.java
    james/mailet/standard/trunk/src/test/java/org/apache/james/transport/matchers/HasHeaderTest.java
    james/mailet/standard/trunk/src/test/java/org/apache/james/transport/matchers/HasMailAttributeWithValueTest.java
    james/mailet/standard/trunk/src/test/java/org/apache/james/transport/matchers/HostIsLocalTest.java
    james/mailet/standard/trunk/src/test/java/org/apache/james/transport/matchers/HostIsTest.java
    james/mailet/standard/trunk/src/test/java/org/apache/james/transport/matchers/IsSingleRecipientTest.java
    james/mailet/standard/trunk/src/test/java/org/apache/james/transport/matchers/RecipientIsTest.java
    james/mailet/standard/trunk/src/test/java/org/apache/james/transport/matchers/SMTPAuthUserIsTest.java
    james/mailet/standard/trunk/src/test/java/org/apache/james/transport/matchers/SMTPIsAuthNetworkTest.java
    james/mailet/standard/trunk/src/test/java/org/apache/james/transport/matchers/SenderIsNullTest.java
    james/mailet/standard/trunk/src/test/java/org/apache/james/transport/matchers/SenderIsTest.java
    james/mailet/standard/trunk/src/test/java/org/apache/james/transport/matchers/SizeGreaterThanTest.java
    james/mailet/standard/trunk/src/test/java/org/apache/james/transport/matchers/SubjectIsTest.java
    james/mailet/standard/trunk/src/test/java/org/apache/james/transport/matchers/SubjectStartsWithTest.java
    james/mailet/standard/trunk/src/test/java/org/apache/james/transport/matchers/UserIsTest.java

Modified: james/mailet/base/trunk/pom.xml
URL: http://svn.apache.org/viewvc/james/mailet/base/trunk/pom.xml?rev=1089122&r1=1089121&r2=1089122&view=diff
==============================================================================
--- james/mailet/base/trunk/pom.xml (original)
+++ james/mailet/base/trunk/pom.xml Tue Apr  5 16:34:10 2011
@@ -77,7 +77,7 @@
     <dependency>
       <groupId>org.apache.james</groupId>
       <artifactId>apache-mailet</artifactId>
-      <version>2.4</version>
+      <version>2.5-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>junit</groupId>

Modified: james/mailet/base/trunk/src/main/java/org/apache/mailet/base/GenericMailet.java
URL: http://svn.apache.org/viewvc/james/mailet/base/trunk/src/main/java/org/apache/mailet/base/GenericMailet.java?rev=1089122&r1=1089121&r2=1089122&view=diff
==============================================================================
--- james/mailet/base/trunk/src/main/java/org/apache/mailet/base/GenericMailet.java (original)
+++ james/mailet/base/trunk/src/main/java/org/apache/mailet/base/GenericMailet.java Tue Apr  5 16:34:10 2011
@@ -119,7 +119,7 @@ public abstract class GenericMailet impl
      * @return an Iterator of String objects containing the names of
      *          the mailet's initialization parameters
      */
-    public Iterator getInitParameterNames() {
+    public Iterator<String> getInitParameterNames() {
         return config.getInitParameterNames();
     }
 
@@ -242,16 +242,16 @@ public abstract class GenericMailet impl
             return;
         }
         
-        Collection allowed = new HashSet();
-        Collection bad = new ArrayList();
+        Collection<String> allowed = new HashSet<String>();
+        Collection<String> bad = new ArrayList<String>();
         
         for (int i = 0; i < allowedArray.length; i++) {
             allowed.add(allowedArray[i]);
         }
         
-        Iterator iterator = getInitParameterNames();
+        Iterator<String> iterator = getInitParameterNames();
         while (iterator.hasNext()) {
-            String parameter = (String) iterator.next();
+            String parameter = iterator.next();
             if (!allowed.contains(parameter)) {
                 bad.add(parameter);
             }

Modified: james/mailet/base/trunk/src/main/java/org/apache/mailet/base/GenericMatcher.java
URL: http://svn.apache.org/viewvc/james/mailet/base/trunk/src/main/java/org/apache/mailet/base/GenericMatcher.java?rev=1089122&r1=1089121&r2=1089122&view=diff
==============================================================================
--- james/mailet/base/trunk/src/main/java/org/apache/mailet/base/GenericMatcher.java (original)
+++ james/mailet/base/trunk/src/main/java/org/apache/mailet/base/GenericMatcher.java Tue Apr  5 16:34:10 2011
@@ -23,6 +23,7 @@ package org.apache.mailet.base;
 import javax.mail.MessagingException;
 
 import org.apache.mailet.Mail;
+import org.apache.mailet.MailAddress;
 import org.apache.mailet.MailetContext;
 import org.apache.mailet.Matcher;
 import org.apache.mailet.MatcherConfig;
@@ -170,5 +171,5 @@ public abstract class GenericMatcher imp
      * @throws javax.mail.MessagingException - if an exception occurs that interferes with the mailet's normal operation
      *          occurred
      */
-    public abstract Collection match(Mail mail) throws MessagingException;
+    public abstract Collection<MailAddress> match(Mail mail) throws MessagingException;
 }

Modified: james/mailet/base/trunk/src/main/java/org/apache/mailet/base/GenericRecipientMatcher.java
URL: http://svn.apache.org/viewvc/james/mailet/base/trunk/src/main/java/org/apache/mailet/base/GenericRecipientMatcher.java?rev=1089122&r1=1089121&r2=1089122&view=diff
==============================================================================
--- james/mailet/base/trunk/src/main/java/org/apache/mailet/base/GenericRecipientMatcher.java (original)
+++ james/mailet/base/trunk/src/main/java/org/apache/mailet/base/GenericRecipientMatcher.java Tue Apr  5 16:34:10 2011
@@ -47,9 +47,9 @@ public abstract class GenericRecipientMa
      * @param mail - the message and routing information to determine whether to match
      * @return Collection the Collection of MailAddress objects that have been matched
      */
-    public final Collection match(Mail mail) throws MessagingException {
-        Collection matching = new Vector();
-        for (Iterator i = mail.getRecipients().iterator(); i.hasNext(); ) {
+    public final Collection<MailAddress> match(Mail mail) throws MessagingException {
+        Collection<MailAddress> matching = new Vector<MailAddress>();
+        for (Iterator<MailAddress> i = mail.getRecipients().iterator(); i.hasNext(); ) {
             MailAddress rec = (MailAddress) i.next();
             if (matchRecipient(rec)) {
                 matching.add(rec);

Modified: james/mailet/base/trunk/src/main/java/org/apache/mailet/base/MatcherInverter.java
URL: http://svn.apache.org/viewvc/james/mailet/base/trunk/src/main/java/org/apache/mailet/base/MatcherInverter.java?rev=1089122&r1=1089121&r2=1089122&view=diff
==============================================================================
--- james/mailet/base/trunk/src/main/java/org/apache/mailet/base/MatcherInverter.java (original)
+++ james/mailet/base/trunk/src/main/java/org/apache/mailet/base/MatcherInverter.java Tue Apr  5 16:34:10 2011
@@ -26,6 +26,7 @@ import java.util.Collection;
 import javax.mail.MessagingException;
 
 import org.apache.mailet.Mail;
+import org.apache.mailet.MailAddress;
 import org.apache.mailet.Matcher;
 import org.apache.mailet.MatcherConfig;
 
@@ -73,11 +74,11 @@ public class MatcherInverter implements 
      * Return a Collection of "not matched" recipients
      *
      */
-    public Collection match(Mail mail) throws MessagingException {
+    public Collection<MailAddress> match(Mail mail) throws MessagingException {
         // Create a new recipient Collection cause mail.getRecipients() give a reference to the internal 
         // list of recipients. If we make changes there the original collection whould be corrupted
-        Collection recipients = new ArrayList(mail.getRecipients());
-        Collection matchedRcpts = wrappedMatcher.match(mail);
+        Collection<MailAddress> recipients = new ArrayList<MailAddress>(mail.getRecipients());
+        Collection<MailAddress> matchedRcpts = wrappedMatcher.match(mail);
         
         // check if a only a part of the recipients matched
         if (matchedRcpts != null) {

Modified: james/mailet/base/trunk/src/main/java/org/apache/mailet/base/StringUtils.java
URL: http://svn.apache.org/viewvc/james/mailet/base/trunk/src/main/java/org/apache/mailet/base/StringUtils.java?rev=1089122&r1=1089121&r2=1089122&view=diff
==============================================================================
--- james/mailet/base/trunk/src/main/java/org/apache/mailet/base/StringUtils.java (original)
+++ james/mailet/base/trunk/src/main/java/org/apache/mailet/base/StringUtils.java Tue Apr  5 16:34:10 2011
@@ -42,7 +42,7 @@ public final class StringUtils {
      */
     public static String[] split(String text, String pattern) {
         String[] array = text.split(pattern, -1);
-        ArrayList list = new ArrayList();
+        ArrayList<String> list = new ArrayList<String>();
         for (int i = 0; i < array.length; i++) {
             boolean escaped = false;
             if (i > 0 && array[i - 1].endsWith("\\")) {

Modified: james/mailet/base/trunk/src/test/java/org/apache/mailet/base/MatcherInverterTest.java
URL: http://svn.apache.org/viewvc/james/mailet/base/trunk/src/test/java/org/apache/mailet/base/MatcherInverterTest.java?rev=1089122&r1=1089121&r2=1089122&view=diff
==============================================================================
--- james/mailet/base/trunk/src/test/java/org/apache/mailet/base/MatcherInverterTest.java (original)
+++ james/mailet/base/trunk/src/test/java/org/apache/mailet/base/MatcherInverterTest.java Tue Apr  5 16:34:10 2011
@@ -35,7 +35,7 @@ public class MatcherInverterTest extends
     public void testAllMatch() throws MessagingException {
         MatcherInverter inverter = new MatcherInverter(new GenericMatcher() {
 
-            public Collection match(Mail mail) throws MessagingException {
+            public Collection<MailAddress> match(Mail mail) throws MessagingException {
                 return null;
             }
         });
@@ -51,7 +51,7 @@ public class MatcherInverterTest extends
         
         MatcherInverter inverter = new MatcherInverter(new GenericMatcher() {
 
-            public Collection match(Mail mail) throws MessagingException {
+            public Collection<MailAddress> match(Mail mail) throws MessagingException {
                 return mail.getRecipients();
             }
         });
@@ -67,7 +67,7 @@ public class MatcherInverterTest extends
         
         MatcherInverter inverter = new MatcherInverter(new GenericMatcher() {
 
-            public Collection match(Mail mail) throws MessagingException {
+            public Collection<MailAddress> match(Mail mail) throws MessagingException {
                 return Arrays.asList(new MailAddress[] {address1});
             }
         });

Modified: james/mailet/base/trunk/src/test/java/org/apache/mailet/base/test/FakeMail.java
URL: http://svn.apache.org/viewvc/james/mailet/base/trunk/src/test/java/org/apache/mailet/base/test/FakeMail.java?rev=1089122&r1=1089121&r2=1089122&view=diff
==============================================================================
--- james/mailet/base/trunk/src/test/java/org/apache/mailet/base/test/FakeMail.java (original)
+++ james/mailet/base/trunk/src/test/java/org/apache/mailet/base/test/FakeMail.java Tue Apr  5 16:34:10 2011
@@ -37,7 +37,7 @@ public class FakeMail implements Mail {
 
     private MimeMessage msg = null;
 
-    private Collection recipients = new ArrayList();
+    private Collection<MailAddress> recipients = new ArrayList<MailAddress>();
 
     private String name = null;
 
@@ -49,7 +49,7 @@ public class FakeMail implements Mail {
 
     private Date lastUpdated;
 
-    private HashMap attributes = new HashMap();
+    private HashMap<String, Serializable> attributes = new HashMap<String, Serializable>();
 
     private static final long serialVersionUID = 1L;
 
@@ -78,11 +78,11 @@ public class FakeMail implements Mail {
         return msg;
     }
 
-    public Collection getRecipients() {
+    public Collection<MailAddress> getRecipients() {
         return recipients;
     }
 
-    public void setRecipients(Collection recipients) {
+    public void setRecipients(Collection<MailAddress> recipients) {
         this.recipients = recipients;
     }
 
@@ -122,7 +122,7 @@ public class FakeMail implements Mail {
         return (Serializable) attributes.get(name);
     }
 
-    public Iterator getAttributeNames() {
+    public Iterator<String> getAttributeNames() {
         return attributes.keySet().iterator();
     }
 
@@ -141,7 +141,7 @@ public class FakeMail implements Mail {
 
     public Serializable setAttribute(String name, Serializable object) {
 
-        return (Serializable) attributes.put(name, object);
+        return (Serializable) attributes.put(name, (Serializable)object);
     }
 
     public long getMessageSize() throws MessagingException {

Modified: james/mailet/base/trunk/src/test/java/org/apache/mailet/base/test/FakeMailContext.java
URL: http://svn.apache.org/viewvc/james/mailet/base/trunk/src/test/java/org/apache/mailet/base/test/FakeMailContext.java?rev=1089122&r1=1089121&r2=1089122&view=diff
==============================================================================
--- james/mailet/base/trunk/src/test/java/org/apache/mailet/base/test/FakeMailContext.java (original)
+++ james/mailet/base/trunk/src/test/java/org/apache/mailet/base/test/FakeMailContext.java Tue Apr  5 16:34:10 2011
@@ -19,19 +19,25 @@
 
 package org.apache.mailet.base.test;
 
+import org.apache.mailet.HostAddress;
+import org.apache.mailet.LookupException;
 import org.apache.mailet.MailetContext;
 import org.apache.mailet.Mail;
 import org.apache.mailet.MailAddress;
+import org.apache.mailet.TemporaryLookupException;
 
 import javax.mail.MessagingException;
 import javax.mail.internet.MimeMessage;
+
+import java.io.Serializable;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.List;
 
 public class FakeMailContext implements MailetContext {
     
-    HashMap attributes = new HashMap();
+    HashMap<String, Object> attributes = new HashMap<String, Object>();
 
     public void bounce(Mail mail, String message) throws MessagingException {
         // trivial implementation
@@ -41,7 +47,7 @@ public class FakeMailContext implements 
         // trivial implementation
     }
 
-    public Collection getMailServers(String host) {
+    public Collection<String> getMailServers(String host) {
         return null;  // trivial implementation
     }
 
@@ -53,7 +59,7 @@ public class FakeMailContext implements 
         return attributes.get(name);
     }
 
-    public Iterator getAttributeNames() {
+    public Iterator<String> getAttributeNames() {
         return attributes.keySet().iterator();
     }
 
@@ -98,11 +104,11 @@ public class FakeMailContext implements 
         throw new UnsupportedOperationException("MOCKed method");
     }
 
-    public void sendMail(MailAddress sender, Collection recipients, MimeMessage msg) throws MessagingException {
+    public void sendMail(MailAddress sender, Collection<MailAddress> recipients, MimeMessage msg) throws MessagingException {
         throw new UnsupportedOperationException("MOCKed method");
     }
 
-    public void sendMail(MailAddress sender, Collection recipients, MimeMessage msg, String state) throws MessagingException {
+    public void sendMail(MailAddress sender, Collection<MailAddress> recipients, MimeMessage msg, String state) throws MessagingException {
         throw new UnsupportedOperationException("MOCKed method");
     }
 
@@ -110,7 +116,7 @@ public class FakeMailContext implements 
         throw new UnsupportedOperationException("MOCKed method");
     }
 
-    public void setAttribute(String name, Object object) {
+    public void setAttribute(String name, Serializable object) {
         attributes.put(name,object);
     }
 
@@ -118,7 +124,23 @@ public class FakeMailContext implements 
         // trivial implementation
     }
 
-    public Iterator getSMTPHostAddresses(String domainName) {
+    public Iterator<HostAddress> getSMTPHostAddresses(String domainName) {
         return null;  // trivial implementation
     }
+
+    public void setAttribute(String name, Object value) {
+        throw new UnsupportedOperationException("MOCKed method");
+    }
+
+    public void log(LogLevel level, String message) {
+        throw new UnsupportedOperationException("MOCKed method");
+    }
+
+    public void log(LogLevel level, String message, Throwable t) {
+        throw new UnsupportedOperationException("MOCKed method");
+    }
+
+    public List<String> dnsLookup(String name, RecordType type) throws TemporaryLookupException, LookupException {
+        return null;   // trivial implementation
+    }
 }

Modified: james/mailet/base/trunk/src/test/java/org/apache/mailet/base/test/FakeMailetConfig.java
URL: http://svn.apache.org/viewvc/james/mailet/base/trunk/src/test/java/org/apache/mailet/base/test/FakeMailetConfig.java?rev=1089122&r1=1089121&r2=1089122&view=diff
==============================================================================
--- james/mailet/base/trunk/src/test/java/org/apache/mailet/base/test/FakeMailetConfig.java (original)
+++ james/mailet/base/trunk/src/test/java/org/apache/mailet/base/test/FakeMailetConfig.java Tue Apr  5 16:34:10 2011
@@ -19,17 +19,19 @@
 
 package org.apache.mailet.base.test;
 
-import org.apache.mailet.MailetConfig;
-import org.apache.mailet.MailetContext;
-
 import java.util.Iterator;
 import java.util.Properties;
 
+import org.apache.mailet.MailetConfig;
+import org.apache.mailet.MailetContext;
+
 /**
  * MailetConfig over Properties
  */
 public class FakeMailetConfig extends Properties implements MailetConfig {
 
+    private static final long serialVersionUID = 1L;
+
     public String mailetName;
     public MailetContext mc;
 

Modified: james/mailet/base/trunk/src/test/java/org/apache/mailet/base/test/FakeMimeMessage.java
URL: http://svn.apache.org/viewvc/james/mailet/base/trunk/src/test/java/org/apache/mailet/base/test/FakeMimeMessage.java?rev=1089122&r1=1089121&r2=1089122&view=diff
==============================================================================
--- james/mailet/base/trunk/src/test/java/org/apache/mailet/base/test/FakeMimeMessage.java (original)
+++ james/mailet/base/trunk/src/test/java/org/apache/mailet/base/test/FakeMimeMessage.java Tue Apr  5 16:34:10 2011
@@ -34,16 +34,17 @@ import java.io.ByteArrayInputStream;
 import java.io.InputStream;
 import java.io.IOException;
 import java.io.OutputStream;
+import java.io.Serializable;
 import java.io.UnsupportedEncodingException;
 
 public class FakeMimeMessage extends MimeMessage {
 
-    private final List m_fromAddresses = new ArrayList();
+    private final List<Serializable> m_fromAddresses = new ArrayList<Serializable>();
     private Address m_senderAddress;
-    private final List m_toRecepients = new ArrayList();
-    private final List m_ccRecepients = new ArrayList();
-    private final List m_bccRecepients = new ArrayList();
-    private final List m_replyToAddresses = new ArrayList();
+    private final List<Serializable> m_toRecepients = new ArrayList<Serializable>();
+    private final List<Serializable> m_ccRecepients = new ArrayList<Serializable>();
+    private final List<Serializable> m_bccRecepients = new ArrayList<Serializable>();
+    private final List<Serializable> m_replyToAddresses = new ArrayList<Serializable>();
     private String m_subject;
     private int m_iMessageNumber;
     private boolean m_bIsExpunged;
@@ -52,7 +53,7 @@ public class FakeMimeMessage extends Mim
     private String[] m_contentLanguage;
     private String m_fileName;
     private DataHandler m_dataHandler;
-    private HashMap m_contentHeaders = new HashMap();
+    private HashMap<String, String> m_contentHeaders = new HashMap<String, String>();
     private Flags m_setFlags = new Flags();
     private boolean m_doMatch;
 
@@ -96,16 +97,16 @@ public class FakeMimeMessage extends Mim
     }
 
     public Address[] getRecipients(Message.RecipientType recipientType) throws MessagingException {
-        List recipientsList = getRecipientsList(recipientType);
-        List recipientAddresses = new ArrayList();
-        for (Iterator iterator = recipientsList.iterator(); iterator.hasNext();) {
+        List<Serializable> recipientsList = getRecipientsList(recipientType);
+        List<Serializable> recipientAddresses = new ArrayList<Serializable>();
+        for (Iterator<Serializable> iterator = recipientsList.iterator(); iterator.hasNext();) {
             String recipient = (String) iterator.next();
             recipientAddresses.add(new InternetAddress(recipient));
         }
         return (Address[]) (recipientAddresses.toArray(new Address[]{}));
     }
 
-    private List getRecipientsList(Message.RecipientType recipientType) {
+    private List<Serializable> getRecipientsList(Message.RecipientType recipientType) {
         if (Message.RecipientType.TO.equals(recipientType)) return m_toRecepients; 
         if (Message.RecipientType.CC.equals(recipientType)) return m_ccRecepients; 
         if (Message.RecipientType.BCC.equals(recipientType)) return m_bccRecepients;
@@ -113,7 +114,7 @@ public class FakeMimeMessage extends Mim
     }
     
     public Address[] getAllRecipients() throws MessagingException {
-        List allRecipients = new ArrayList();
+        List<Serializable> allRecipients = new ArrayList<Serializable>();
         allRecipients.addAll(m_toRecepients);
         allRecipients.addAll(m_ccRecepients);
         allRecipients.addAll(m_bccRecepients);
@@ -341,12 +342,12 @@ public class FakeMimeMessage extends Mim
         m_contentHeaders.remove(name);
     }
 
-    public Enumeration getAllHeaders() throws MessagingException {
+    public Enumeration<String> getAllHeaders() throws MessagingException {
         return Collections.enumeration(m_contentHeaders.values());
     }
 
-    public Enumeration getMatchingHeaders(String[] names) throws MessagingException {
-        ArrayList matchingHeaders = new ArrayList();
+    public Enumeration<String> getMatchingHeaders(String[] names) throws MessagingException {
+        ArrayList<String> matchingHeaders = new ArrayList<String>();
         for (int i = 0; i < names.length; i++) {
             String name = names[i];
             String value = getHeader(name, null);
@@ -356,12 +357,12 @@ public class FakeMimeMessage extends Mim
         return Collections.enumeration(matchingHeaders); 
     }
 
-    public Enumeration getNonMatchingHeaders(String[] names) throws MessagingException {
-        List existingHeaders = Arrays.asList(names);
+    public Enumeration<String> getNonMatchingHeaders(String[] names) throws MessagingException {
+        List<String> existingHeaders = Arrays.asList(names);
 
-        ArrayList nonMatchingHeaders = new ArrayList();
+        ArrayList<String> nonMatchingHeaders = new ArrayList<String>();
         
-        Iterator iterator = m_contentHeaders.keySet().iterator();
+        Iterator<String> iterator = m_contentHeaders.keySet().iterator();
         while (iterator.hasNext()) {
             String name = (String) iterator.next();
             if (existingHeaders.contains(name)) continue;
@@ -379,13 +380,13 @@ public class FakeMimeMessage extends Mim
         addHeader(headerLine.substring(0,separatorIndex), headerLine.substring(separatorIndex,headerLine.length()));
     }
 
-    public Enumeration getAllHeaderLines() throws MessagingException {
+    public Enumeration<String> getAllHeaderLines() throws MessagingException {
         return Collections.enumeration(getHeadersAsStrings(m_contentHeaders));
     }
 
-    private ArrayList getHeadersAsStrings(HashMap contentHeaders) {
-        ArrayList headerLines = new ArrayList();
-        Iterator iterator = contentHeaders.keySet().iterator();
+    private ArrayList<String> getHeadersAsStrings(HashMap<String, String> contentHeaders) {
+        ArrayList<String> headerLines = new ArrayList<String>();
+        Iterator<String> iterator = contentHeaders.keySet().iterator();
         while (iterator.hasNext()) {
             String key = (String) iterator.next();
             String value = (String) contentHeaders.get(key);
@@ -394,8 +395,8 @@ public class FakeMimeMessage extends Mim
         return headerLines;
     }
 
-    public Enumeration getMatchingHeaderLines(String[] names) throws MessagingException {
-        ArrayList matchingHeaders = new ArrayList();
+    public Enumeration<String> getMatchingHeaderLines(String[] names) throws MessagingException {
+        ArrayList<String> matchingHeaders = new ArrayList<String>();
         for (int i = 0; i < names.length; i++) {
             String name = names[i];
             String value = getHeader(name, null);
@@ -405,12 +406,12 @@ public class FakeMimeMessage extends Mim
         return Collections.enumeration(matchingHeaders); 
     }
 
-    public Enumeration getNonMatchingHeaderLines(String[] names) throws MessagingException {
-        List existingHeaders = names != null ? Arrays.asList(names) : null;
+    public Enumeration<String> getNonMatchingHeaderLines(String[] names) throws MessagingException {
+        List<String> existingHeaders = names != null ? Arrays.asList(names) : null;
 
-        ArrayList nonMatchingHeaders = new ArrayList();
+        ArrayList<String> nonMatchingHeaders = new ArrayList<String>();
         
-        Iterator iterator = m_contentHeaders.keySet().iterator();
+        Iterator<String> iterator = m_contentHeaders.keySet().iterator();
         while (iterator.hasNext()) {
             String name = (String) iterator.next();
             if (existingHeaders!=null && existingHeaders.contains(name)) continue;

Modified: james/mailet/crypto/trunk/pom.xml
URL: http://svn.apache.org/viewvc/james/mailet/crypto/trunk/pom.xml?rev=1089122&r1=1089121&r2=1089122&view=diff
==============================================================================
--- james/mailet/crypto/trunk/pom.xml (original)
+++ james/mailet/crypto/trunk/pom.xml Tue Apr  5 16:34:10 2011
@@ -80,13 +80,8 @@
     </dependency>
     <dependency>
       <groupId>org.apache.james</groupId>
-      <artifactId>apache-mailet</artifactId>
-      <version>2.4</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.james</groupId>
       <artifactId>apache-mailet-base</artifactId>
-      <version>1.0</version>
+      <version>1.2-SNAPSHOT</version>
     </dependency>
   </dependencies>
 

Modified: james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/KeyStoreHolder.java
URL: http://svn.apache.org/viewvc/james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/KeyStoreHolder.java?rev=1089122&r1=1089121&r2=1089122&view=diff
==============================================================================
--- james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/KeyStoreHolder.java (original)
+++ james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/KeyStoreHolder.java Tue Apr  5 16:34:10 2011
@@ -115,22 +115,22 @@ public class KeyStoreHolder {
      * @throws Exception
      * @throws MessagingException
      */
-    public List verifySignatures(SMIMESigned signed) throws Exception, MessagingException {
+    public List<SMIMESignerInfo> verifySignatures(SMIMESigned signed) throws Exception, MessagingException {
         CertStore certs = signed.getCertificatesAndCRLs("Collection", "BC");
         SignerInformationStore siginfo = signed.getSignerInfos();
-        Collection sigCol = siginfo.getSigners();
-        Iterator sigIterator = sigCol.iterator();
-        List result = new ArrayList(sigCol.size());
+        Collection<SignerInformation> sigCol = siginfo.getSigners();
+        Iterator<SignerInformation> sigIterator = sigCol.iterator();
+        List<SMIMESignerInfo> result = new ArrayList<SMIMESignerInfo>(sigCol.size());
         // I iterate over the signer collection 
         // checking if the signatures put
         // on the message are valid.
         for (int i=0;sigIterator.hasNext();i++) {
-            SignerInformation info = (SignerInformation) sigIterator.next();
+            SignerInformation info = sigIterator.next();
             // I get the signer's certificate
             Collection certCollection = certs.getCertificates(info.getSID());
-            Iterator certIter  =certCollection.iterator();
+            Iterator<X509Certificate> certIter = certCollection.iterator();
             if (certIter.hasNext()) {
-                X509Certificate signerCert = (X509Certificate) certIter.next();
+                X509Certificate signerCert = certIter.next();
                 // The issuer's certifcate is searched in the list of trusted certificate.
                 CertPath path = verifyCertificate(signerCert, certs, keyStore);
 

Modified: james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/SMIMEKeyHolder.java
URL: http://svn.apache.org/viewvc/james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/SMIMEKeyHolder.java?rev=1089122&r1=1089121&r2=1089122&view=diff
==============================================================================
--- james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/SMIMEKeyHolder.java (original)
+++ james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/SMIMEKeyHolder.java Tue Apr  5 16:34:10 2011
@@ -130,7 +130,7 @@ public class SMIMEKeyHolder implements K
         KeyStore keyStore = KeyStore.getInstance(keyStoreType);
         keyStore.load(new BufferedInputStream(new FileInputStream(keyStoreFileName)), keyStorePassword.toCharArray());
         
-        Enumeration aliases = keyStore.aliases();
+        Enumeration<String> aliases = keyStore.aliases();
         if (keyAlias == null) {
             if(aliases.hasMoreElements()) {
                 keyAlias = (String) aliases.nextElement();

Modified: james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/mailet/AbstractSign.java
URL: http://svn.apache.org/viewvc/james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/mailet/AbstractSign.java?rev=1089122&r1=1089121&r2=1089122&view=diff
==============================================================================
--- james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/mailet/AbstractSign.java (original)
+++ james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/mailet/AbstractSign.java Tue Apr  5 16:34:10 2011
@@ -116,7 +116,7 @@ public abstract class AbstractSign exten
     /**
      * Holds value of property keyHolderClass.
      */
-    private Class keyHolderClass;
+    private Class<?> keyHolderClass;
     
     /**
      * Holds value of property explanationText.
@@ -198,7 +198,7 @@ public abstract class AbstractSign exten
      * Getter for property keyHolderClass.
      * @return Value of property keyHolderClass.
      */
-    public Class getKeyHolderClass() {
+    public Class<?> getKeyHolderClass() {
         return this.keyHolderClass;
     }
     
@@ -206,7 +206,7 @@ public abstract class AbstractSign exten
      * Setter for property keyHolderClass.
      * @param keyHolderClass New value of property keyHolderClass.
      */
-    public void setKeyHolderClass(Class keyHolderClass) {
+    public void setKeyHolderClass(Class<?> keyHolderClass) {
         this.keyHolderClass = keyHolderClass;
     }
     
@@ -241,7 +241,7 @@ public abstract class AbstractSign exten
      * Initializer for property keyHolder.
      */
     protected void initKeyHolder() throws Exception {
-        Constructor keyHolderConstructor = null;
+        Constructor<?> keyHolderConstructor = null;
         try {
             keyHolderConstructor = keyHolderClass.getConstructor(new Class[] {String.class, String.class, String.class, String.class, String.class});
         } catch (NoSuchMethodException nsme) {

Modified: james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/mailet/SMIMECheckSignature.java
URL: http://svn.apache.org/viewvc/james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/mailet/SMIMECheckSignature.java?rev=1089122&r1=1089121&r2=1089122&view=diff
==============================================================================
--- james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/mailet/SMIMECheckSignature.java (original)
+++ james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/mailet/SMIMECheckSignature.java Tue Apr  5 16:34:10 2011
@@ -154,7 +154,7 @@ public class SMIMECheckSignature extends
         // strippedMessage will contain the signed content of the message 
         MimeBodyPart strippedMessage =null;
         
-        List signers=null;
+        List<SMIMESignerInfo> signers=null;
         
         try {
             Object obj = message.getContent();
@@ -165,7 +165,7 @@ public class SMIMECheckSignature extends
             else signed = null;
             
             if (signed != null) {
-                signers = trustedCertificateStore.verifySignatures(signed);
+                signers = (List<SMIMESignerInfo>)trustedCertificateStore.verifySignatures(signed);
                 strippedMessage = signed.getContent();
             } else log("Content not identified as signed");
             
@@ -191,9 +191,9 @@ public class SMIMECheckSignature extends
         // If at least one mail signer is found 
         // the mail attributes are set.
         if (signers != null) {
-            ArrayList signerinfolist = new ArrayList();
+            ArrayList<X509Certificate> signerinfolist = new ArrayList<X509Certificate>();
 
-            for (Iterator iter = signers.iterator(); iter.hasNext();) {
+            for (Iterator<SMIMESignerInfo> iter = signers.iterator(); iter.hasNext();) {
                 SMIMESignerInfo info = (SMIMESignerInfo) iter.next();
 
                 if (info.isSignValid()

Modified: james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/mailet/SMIMEDecrypt.java
URL: http://svn.apache.org/viewvc/james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/mailet/SMIMEDecrypt.java?rev=1089122&r1=1089121&r2=1089122&view=diff
==============================================================================
--- james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/mailet/SMIMEDecrypt.java (original)
+++ james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/mailet/SMIMEDecrypt.java Tue Apr  5 16:34:10 2011
@@ -23,6 +23,7 @@ package org.apache.james.mailet.crypto.m
 
 import java.io.IOException;
 import java.security.GeneralSecurityException;
+import java.security.cert.X509Certificate;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
@@ -112,8 +113,8 @@ public class SMIMEDecrypt extends Generi
         if (message.isMimeType("application/x-pkcs7-mime") || message.isMimeType("application/pkcs7-mime")) {
             try {
                 SMIMEEnveloped env = new SMIMEEnveloped(message);
-                Collection recipients = env.getRecipientInfos().getRecipients();
-                for (Iterator iter = recipients.iterator();iter.hasNext();) {
+                Collection<RecipientInformation> recipients = env.getRecipientInfos().getRecipients();
+                for (Iterator<RecipientInformation> iter = recipients.iterator();iter.hasNext();) {
                     RecipientInformation info = (RecipientInformation) iter.next();
                     RecipientId id = info.getRID();
                     if (id.match(keyHolder.getCertificate())) {
@@ -138,7 +139,7 @@ public class SMIMEDecrypt extends Generi
             // behavior of the SMIMEVerifySignature mailet. In that way
             // it is possible to reuse the same matchers to analyze
             // the result of the operation.
-            ArrayList list = new ArrayList(1);
+            ArrayList<X509Certificate> list = new ArrayList<X509Certificate>(1);
             list.add(keyHolder.getCertificate());
             mail.setAttribute(mailAttribute, list);
 

Modified: james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/matcher/IsSMIMEEncrypted.java
URL: http://svn.apache.org/viewvc/james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/matcher/IsSMIMEEncrypted.java?rev=1089122&r1=1089121&r2=1089122&view=diff
==============================================================================
--- james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/matcher/IsSMIMEEncrypted.java (original)
+++ james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/matcher/IsSMIMEEncrypted.java Tue Apr  5 16:34:10 2011
@@ -27,6 +27,7 @@ import javax.mail.internet.MimeMessage;
 
 import org.apache.mailet.base.GenericMatcher;
 import org.apache.mailet.Mail;
+import org.apache.mailet.MailAddress;
 
 /**
  * Checks if a mail is smime encrypted.
@@ -37,7 +38,7 @@ public class IsSMIMEEncrypted extends Ge
     /**
      * @see org.apache.mailet.Matcher#match(org.apache.mailet.Mail)
      */
-    public Collection match(Mail mail) throws MessagingException {
+    public Collection<MailAddress> match(Mail mail) throws MessagingException {
         if (mail == null) return null;
         
         MimeMessage message = mail.getMessage();

Modified: james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/matcher/IsSMIMESigned.java
URL: http://svn.apache.org/viewvc/james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/matcher/IsSMIMESigned.java?rev=1089122&r1=1089121&r2=1089122&view=diff
==============================================================================
--- james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/matcher/IsSMIMESigned.java (original)
+++ james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/matcher/IsSMIMESigned.java Tue Apr  5 16:34:10 2011
@@ -27,6 +27,7 @@ import javax.mail.internet.MimeMessage;
 
 import org.apache.mailet.base.GenericMatcher;
 import org.apache.mailet.Mail;
+import org.apache.mailet.MailAddress;
 
 /**
  * checks if a mail is smime signed. 
@@ -37,7 +38,7 @@ public class IsSMIMESigned extends Gener
     /**
      * @see org.apache.mailet.Matcher#match(org.apache.mailet.Mail)
      */
-    public Collection match(Mail mail) throws MessagingException {
+    public Collection<MailAddress> match(Mail mail) throws MessagingException {
         if (mail == null) return null;
         
         MimeMessage message = mail.getMessage();

Modified: james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/matcher/IsX509CertificateSubject.java
URL: http://svn.apache.org/viewvc/james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/matcher/IsX509CertificateSubject.java?rev=1089122&r1=1089121&r2=1089122&view=diff
==============================================================================
--- james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/matcher/IsX509CertificateSubject.java (original)
+++ james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/matcher/IsX509CertificateSubject.java Tue Apr  5 16:34:10 2011
@@ -32,6 +32,7 @@ import javax.mail.MessagingException;
 
 import org.apache.mailet.base.GenericMatcher;
 import org.apache.mailet.Mail;
+import org.apache.mailet.MailAddress;
 
 /**
  * <p>
@@ -62,21 +63,21 @@ public class IsX509CertificateSubject ex
         check = condition.substring(pos+1, condition.length());
     }
     
-    public Collection match(Mail mail) throws MessagingException {
-        List certificates;
+    public Collection<MailAddress> match(Mail mail) throws MessagingException {
+        List<X509Certificate> certificates;
         
         Object obj = mail.getAttribute(sourceAttribute);
         if (obj != null) {
             if (obj instanceof X509Certificate) {
-                certificates = Collections.singletonList(obj);
+                certificates = Collections.singletonList((X509Certificate)obj);
             } else {
-                certificates = (List) obj;
+                certificates = (List<X509Certificate>) obj;
             }
 
             boolean valid = false;
 
-            for (Iterator iter = certificates.iterator(); iter.hasNext();) {
-                X509Certificate cert = (X509Certificate) iter.next();
+            for (Iterator<X509Certificate> iter = certificates.iterator(); iter.hasNext();) {
+                X509Certificate cert = iter.next();
 
                 // Here I should use the method getSubjectX500Principal, but
                 // that would break the compatibility with jdk13.

Modified: james/mailet/maven-mailetdocs-plugin/trunk/pom.xml
URL: http://svn.apache.org/viewvc/james/mailet/maven-mailetdocs-plugin/trunk/pom.xml?rev=1089122&r1=1089121&r2=1089122&view=diff
==============================================================================
--- james/mailet/maven-mailetdocs-plugin/trunk/pom.xml (original)
+++ james/mailet/maven-mailetdocs-plugin/trunk/pom.xml Tue Apr  5 16:34:10 2011
@@ -92,7 +92,7 @@
     <dependency>
       <groupId>org.apache.james</groupId>
       <artifactId>apache-mailet</artifactId>
-      <version>2.4</version>
+      <version>2.5-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>javax.mail</groupId>

Modified: james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/DefaultDescriptorsExtractor.java
URL: http://svn.apache.org/viewvc/james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/DefaultDescriptorsExtractor.java?rev=1089122&r1=1089121&r2=1089122&view=diff
==============================================================================
--- james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/DefaultDescriptorsExtractor.java (original)
+++ james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/DefaultDescriptorsExtractor.java Tue Apr  5 16:34:10 2011
@@ -19,15 +19,6 @@
 
 package org.apache.james.mailet;
 
-import org.apache.mailet.Mailet;
-import org.apache.mailet.Matcher;
-import org.apache.maven.artifact.DependencyResolutionRequiredException;
-import org.apache.maven.plugin.logging.Log;
-import org.apache.maven.project.MavenProject;
-
-import com.thoughtworks.qdox.JavaDocBuilder;
-import com.thoughtworks.qdox.model.JavaClass;
-
 import java.io.File;
 import java.lang.reflect.InvocationTargetException;
 import java.net.MalformedURLException;
@@ -38,6 +29,15 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.Set;
 
+import org.apache.mailet.Mailet;
+import org.apache.mailet.Matcher;
+import org.apache.maven.artifact.DependencyResolutionRequiredException;
+import org.apache.maven.plugin.logging.Log;
+import org.apache.maven.project.MavenProject;
+
+import com.thoughtworks.qdox.JavaDocBuilder;
+import com.thoughtworks.qdox.model.JavaClass;
+
 /**
  * Finds implementations of Mailet and Matchers in the source trees.
  * Extracts javadocs using QDox. <code>MailetInfo</code> is obtained by instantiation.
@@ -47,14 +47,14 @@ public class DefaultDescriptorsExtractor
     /**
      * @see org.apache.james.mailet.DescriptorsExtractor#extractDescriptors(MavenProject, Log)
      */
-    public List extractDescriptors(MavenProject project, Log log) {
+    public List<MailetMatcherDescriptor> extractDescriptors(MavenProject project, Log log) {
 
-        List res = new LinkedList();
+        List<MailetMatcherDescriptor> res = new LinkedList<MailetMatcherDescriptor>();
 
         JavaDocBuilder builder = new JavaDocBuilder();
-        for (Iterator i = project.getCompileSourceRoots().iterator(); i
+        for (Iterator<String> i = project.getCompileSourceRoots().iterator(); i
                 .hasNext();) {
-            builder.addSourceTree(new File((String) i.next()));
+            builder.addSourceTree(new File(i.next()));
         }
         JavaClass[] classes = builder.getClasses();
 
@@ -62,11 +62,11 @@ public class DefaultDescriptorsExtractor
         URLClassLoader classLoader = null;
         try {
             try {
-                List cpes = project.getCompileClasspathElements();
+                List<String> cpes = project.getCompileClasspathElements();
                 urls = new URL[cpes.size()];
                 for (int k = 0; k < cpes.size(); k++) {
                     log.debug("CPE: " + cpes.get(k));
-                    urls[k] = new File((String) cpes.get(k)).toURI().toURL();
+                    urls[k] = new File(cpes.get(k)).toURI().toURL();
                 }
                 classLoader = new URLClassLoader(urls);
             } catch (DependencyResolutionRequiredException e1) {
@@ -87,15 +87,15 @@ public class DefaultDescriptorsExtractor
         for (int i = 0; i < classes.length; i++) {
             log.debug("Class: " + classes[i].getFullyQualifiedName());
             try {
-                Class klass = classLoader.loadClass(classes[i]
+                Class<?> klass = classLoader.loadClass(classes[i]
                         .getFullyQualifiedName());
 
                 log.debug("Constr: " + klass.getConstructor(null));
 
-                List zuper = getAllInterfaces(klass);
-                Class mailetClass = classLoader.loadClass(Mailet.class
+                List<Class<?>> zuper = getAllInterfaces(klass);
+                Class<?> mailetClass = classLoader.loadClass(Mailet.class
                         .getName());
-                Class matcherClass = classLoader.loadClass(Matcher.class
+                Class<?> matcherClass = classLoader.loadClass(Matcher.class
                         .getName());
                 if (zuper.contains(mailetClass)) {
                     Object m = klass.newInstance();
@@ -152,7 +152,7 @@ public class DefaultDescriptorsExtractor
                 log.error("ITE: " + e.getMessage());
             }
 
-            List implementedInterfaces = getAllInterfacesQdox(classes[i]);
+            List<JavaClass> implementedInterfaces = getAllInterfacesQdox(classes[i]);
             for (int k = 0; k < implementedInterfaces.size(); k++) {
                 log.info("I: " + implementedInterfaces.get(k));
             }
@@ -163,8 +163,8 @@ public class DefaultDescriptorsExtractor
     }
 
 
-    private List getAllInterfacesQdox(JavaClass javaClass) {
-        List res = new LinkedList();
+    private List<JavaClass> getAllInterfacesQdox(JavaClass javaClass) {
+        List<JavaClass> res = new LinkedList<JavaClass>();
         if (javaClass.getImplementedInterfaces() != null) {
             JavaClass[] interfaces = javaClass.getImplementedInterfaces();
             for (int n = 0; n < interfaces.length; n++) {
@@ -177,10 +177,10 @@ public class DefaultDescriptorsExtractor
         return res;
     }
 
-    private List getAllInterfaces(Class klass) {
-        List res = new LinkedList();
+    private List<Class<?>> getAllInterfaces(Class<?> klass) {
+        List<Class<?>> res = new LinkedList<Class<?>>();
         if (klass.getInterfaces() != null) {
-            Class[] interfaces = klass.getInterfaces();
+            Class<?>[] interfaces = klass.getInterfaces();
             for (int n = 0; n < interfaces.length; n++) {
                 res.add(interfaces[n]);
                 // add also interfaces extensions

Modified: james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/DescriptorsExtractor.java
URL: http://svn.apache.org/viewvc/james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/DescriptorsExtractor.java?rev=1089122&r1=1089121&r2=1089122&view=diff
==============================================================================
--- james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/DescriptorsExtractor.java (original)
+++ james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/DescriptorsExtractor.java Tue Apr  5 16:34:10 2011
@@ -19,11 +19,11 @@
 
 package org.apache.james.mailet;
 
+import java.util.List;
+
 import org.apache.maven.plugin.logging.Log;
 import org.apache.maven.project.MavenProject;
 
-import java.util.List;
-
 public interface DescriptorsExtractor {
 
     /**
@@ -31,6 +31,6 @@ public interface DescriptorsExtractor {
      * 
      * @return List of MailetMatcherDescriptor objects
      */
-    public abstract List extractDescriptors(MavenProject project, Log log);
+    public abstract List<MailetMatcherDescriptor> extractDescriptors(MavenProject project, Log log);
 
 }
\ No newline at end of file

Modified: james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/MailetdocsMojo.java
URL: http://svn.apache.org/viewvc/james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/MailetdocsMojo.java?rev=1089122&r1=1089121&r2=1089122&view=diff
==============================================================================
--- james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/MailetdocsMojo.java (original)
+++ james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/MailetdocsMojo.java Tue Apr  5 16:34:10 2011
@@ -85,13 +85,12 @@ public class MailetdocsMojo extends Abst
 
     protected void executeReport(Locale locale) throws MavenReportException {
         
-        List descriptors = new DefaultDescriptorsExtractor().extractDescriptors(project, getLog());
+        List<MailetMatcherDescriptor> descriptors = new DefaultDescriptorsExtractor().extractDescriptors(project, getLog());
 
-        Collections.sort(descriptors, new Comparator() {
+        Collections.sort(descriptors, new Comparator<MailetMatcherDescriptor>() {
 
-            public int compare(Object arg0, Object arg1) {
-                return ((MailetMatcherDescriptor) arg0).getName().compareTo(
-                        ((MailetMatcherDescriptor) arg1).getName());
+            public int compare(MailetMatcherDescriptor arg0, MailetMatcherDescriptor arg1) {
+                return arg0.getName().compareTo(arg1.getName());
             }
 
         });
@@ -106,9 +105,11 @@ public class MailetdocsMojo extends Abst
 
         getSink().body();
 
-        List matchers = (List) CollectionUtils.select(descriptors,
+        @SuppressWarnings("unchecked")
+        List<MailetMatcherDescriptor> matchers = (List<MailetMatcherDescriptor>) CollectionUtils.select(descriptors,
                 new TypePredicate(MailetMatcherDescriptor.TYPE_MATCHER));
-        List mailets = (List) CollectionUtils.select(descriptors,
+        @SuppressWarnings("unchecked")
+        List<MailetMatcherDescriptor> mailets = (List<MailetMatcherDescriptor>) CollectionUtils.select(descriptors,
                 new TypePredicate(MailetMatcherDescriptor.TYPE_MAILET));
         
         getSink().section1();
@@ -162,7 +163,7 @@ public class MailetdocsMojo extends Abst
 
     }
 
-    private void outputDescriptorIndex(List descriptors, String title) {
+    private void outputDescriptorIndex(List<MailetMatcherDescriptor> descriptors, String title) {
         
         getSink().section2();
         getSink().sectionTitle2();
@@ -172,9 +173,8 @@ public class MailetdocsMojo extends Abst
         getSink().list();
         for (int i = 0; i < descriptors.size(); i++) {
             getSink().listItem();
-            getSink().link("#"+((MailetMatcherDescriptor) descriptors.get(i)).getName());
-            getSink().text(
-                    ((MailetMatcherDescriptor) descriptors.get(i)).getName());
+            getSink().link("#"+descriptors.get(i).getName());
+            getSink().text(descriptors.get(i).getName());
             getSink().link_();
             getSink().listItem_();
         }
@@ -184,7 +184,7 @@ public class MailetdocsMojo extends Abst
 
     }
 
-    private void outputDescriptorList(List descriptors, String title) {
+    private void outputDescriptorList(List<MailetMatcherDescriptor> descriptors, String title) {
         
         getSink().section1();
         getSink().sectionTitle1();
@@ -195,33 +195,29 @@ public class MailetdocsMojo extends Abst
             getSink().section2();
 
             getSink().sectionTitle2();
-            getSink().anchor(((MailetMatcherDescriptor) descriptors.get(i)).getName());
-            getSink().text(
-                    ((MailetMatcherDescriptor) descriptors.get(i)).getName());
+            getSink().anchor(descriptors.get(i).getName());
+            getSink().text(descriptors.get(i).getName());
             getSink().anchor_();
             getSink().sectionTitle2_();
 
-            if (((MailetMatcherDescriptor) descriptors.get(i)).getInfo() != null) {
+            if (descriptors.get(i).getInfo() != null) {
               getSink().paragraph();
-	            if (((MailetMatcherDescriptor) descriptors.get(i)).getType() == MailetMatcherDescriptor.TYPE_MAILET) {
+	            if (descriptors.get(i).getType() == MailetMatcherDescriptor.TYPE_MAILET) {
 	                getSink().text("Mailet Info: ");
-	            } else if (((MailetMatcherDescriptor) descriptors.get(i)).getType() == MailetMatcherDescriptor.TYPE_MATCHER) {
+	            } else if (descriptors.get(i).getType() == MailetMatcherDescriptor.TYPE_MATCHER) {
 	                getSink().text("Matcher Info: ");
 	            } else {
 	                getSink().text("Info: ");
 	            }
 	            getSink().bold();
-	            getSink().text(
-	                    ((MailetMatcherDescriptor) descriptors.get(i)).getInfo());
+	            getSink().text(descriptors.get(i).getInfo());
 	            getSink().bold_();
 	            getSink().lineBreak();
 	            getSink().paragraph_();
             }
 
             getSink().paragraph();
-            getSink().rawText(
-                    ((MailetMatcherDescriptor) descriptors.get(i))
-                            .getClassDocs());
+            getSink().rawText(descriptors.get(i).getClassDocs());
             getSink().paragraph_();
 
             getSink().section2_();

Modified: james/mailet/standard/trunk/pom.xml
URL: http://svn.apache.org/viewvc/james/mailet/standard/trunk/pom.xml?rev=1089122&r1=1089121&r2=1089122&view=diff
==============================================================================
--- james/mailet/standard/trunk/pom.xml (original)
+++ james/mailet/standard/trunk/pom.xml Tue Apr  5 16:34:10 2011
@@ -77,19 +77,14 @@
     <dependency>
       <groupId>org.apache.james</groupId>
       <artifactId>apache-mailet-base</artifactId>
-      <version>1.0</version>
+      <version>1.2-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.apache.james</groupId>
       <artifactId>apache-mailet-base</artifactId>
       <type>test-jar</type>
       <scope>test</scope>
-      <version>1.0</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.james</groupId>
-      <artifactId>apache-mailet</artifactId>
-      <version>2.4</version>
+      <version>1.2-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>junit</groupId>

Modified: james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/ClamAVScan.java
URL: http://svn.apache.org/viewvc/james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/ClamAVScan.java?rev=1089122&r1=1089121&r2=1089122&view=diff
==============================================================================
--- james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/ClamAVScan.java (original)
+++ james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/ClamAVScan.java Tue Apr  5 16:34:10 2011
@@ -24,6 +24,7 @@ package org.apache.james.transport.maile
 import org.apache.mailet.base.RFC2822Headers;
 import org.apache.mailet.base.GenericMailet;
 import org.apache.mailet.Mail;
+import org.apache.mailet.MailAddress;
 
 import javax.mail.MessagingException;
 import javax.mail.internet.MimeMessage;
@@ -507,7 +508,7 @@ public class ClamAVScan extends GenericM
         
         InetAddress address = null;
         
-        Set usedAddresses = new HashSet(getAddressesCount());
+        Set<InetAddress> usedAddresses = new HashSet<InetAddress>(getAddressesCount());
         for (;;) {
             // this do-while loop is needed because other threads could in the meantime
             // calling getNextAddress(), and because of that the current thread may skip
@@ -900,7 +901,7 @@ public class ClamAVScan extends GenericM
         
         out.print("Mail details:");
         out.print(" MAIL FROM: " + mail.getSender());
-        Iterator rcptTo = mail.getRecipients().iterator();
+        Iterator<MailAddress> rcptTo = mail.getRecipients().iterator();
         out.print(", RCPT TO: " + rcptTo.next());
         while (rcptTo.hasNext()) {
             out.print(", " + rcptTo.next());

Modified: james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/MailAttributesToMimeHeaders.java
URL: http://svn.apache.org/viewvc/james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/MailAttributesToMimeHeaders.java?rev=1089122&r1=1089121&r2=1089122&view=diff
==============================================================================
--- james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/MailAttributesToMimeHeaders.java (original)
+++ james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/MailAttributesToMimeHeaders.java Tue Apr  5 16:34:10 2011
@@ -48,7 +48,7 @@ public class MailAttributesToMimeHeaders
     /**
      * HashMap which holds the attributeName and headerName
      */
-    private HashMap map = new HashMap();
+    private HashMap<String, String> map = new HashMap<String, String>();
 
     /*
      * (non-Javadoc)
@@ -87,12 +87,12 @@ public class MailAttributesToMimeHeaders
         try {
             message = mail.getMessage();
 
-            Iterator keys = map.keySet().iterator();
+            Iterator<String> keys = map.keySet().iterator();
 
             while (keys.hasNext()) {
-                String key = keys.next().toString();
+                String key = keys.next();
                 String value = (String) mail.getAttribute(key);
-                String headerName = map.get(key).toString();
+                String headerName = map.get(key);
 
                 // Check if we have all needed values
                 if (headerName != null && value != null) {

Modified: james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/OnlyText.java
URL: http://svn.apache.org/viewvc/james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/OnlyText.java?rev=1089122&r1=1089121&r2=1089122&view=diff
==============================================================================
--- james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/OnlyText.java (original)
+++ james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/OnlyText.java Tue Apr  5 16:34:10 2011
@@ -44,7 +44,7 @@ public class OnlyText extends GenericMai
     private static final String PARAMETER_NAME_NOTEXT_PROCESSOR = "NoTextProcessor";
     
     private String optionsNotextProcessor = null;
-    private final HashMap charMap = new HashMap();
+    private final HashMap<String, String> charMap = new HashMap<String, String>();
     
     /**
      * returns a String describing this mailet.

Modified: james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/PostmasterAlias.java
URL: http://svn.apache.org/viewvc/james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/PostmasterAlias.java?rev=1089122&r1=1089121&r2=1089122&view=diff
==============================================================================
--- james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/PostmasterAlias.java (original)
+++ james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/PostmasterAlias.java Tue Apr  5 16:34:10 2011
@@ -49,19 +49,19 @@ public class PostmasterAlias extends Gen
      * @throws MessagingException if an error is encountered while modifying the message
      */
     public void service(Mail mail) throws MessagingException {
-        Collection recipients = mail.getRecipients();
-        Collection recipientsToRemove = null;
+        Collection<MailAddress> recipients = mail.getRecipients();
+        Collection<MailAddress> recipientsToRemove = null;
         MailetContext mailetContext = getMailetContext();
         boolean postmasterAddressed = false;
 
-        for (Iterator i = recipients.iterator(); i.hasNext(); ) {
+        for (Iterator<MailAddress> i = recipients.iterator(); i.hasNext(); ) {
             MailAddress addr = (MailAddress)i.next();
             if (addr.getLocalPart().equalsIgnoreCase("postmaster") &&
                 mailetContext.isLocalServer(addr.getDomain())) {
                 //Should remove this address... we want to replace it with
                 //  the server's postmaster address
                 if (recipientsToRemove == null) {
-                    recipientsToRemove = new Vector();
+                    recipientsToRemove = new Vector<MailAddress>();
                 }
                 recipientsToRemove.add(addr);
                 //Flag this as having found the postmaster

Modified: james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/RecoverAttachment.java
URL: http://svn.apache.org/viewvc/james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/RecoverAttachment.java?rev=1089122&r1=1089121&r2=1089122&view=diff
==============================================================================
--- james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/RecoverAttachment.java (original)
+++ james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/RecoverAttachment.java Tue Apr  5 16:34:10 2011
@@ -88,7 +88,8 @@ public class RecoverAttachment extends G
      *             Thrown when an error situation is encountered.
      */
     public void service(Mail mail) throws MailetException {
-        Map attachments = (Map) mail.getAttribute(attributeName);
+        @SuppressWarnings("unchecked")
+        Map<String, byte[]> attachments = (Map<String, byte[]>) mail.getAttribute(attributeName);
         if (attachments != null) {
 
             MimeMessage message = null;
@@ -99,10 +100,10 @@ public class RecoverAttachment extends G
                         "Could not retrieve message from Mail object", e);
             }
 
-            Iterator i = attachments.values().iterator();
+            Iterator<byte[]> i = attachments.values().iterator();
             try {
                 while (i.hasNext()) {
-                    byte[] bytes = (byte[]) i.next();
+                    byte[] bytes = i.next();
                     InputStream is = new BufferedInputStream(
                             new ByteArrayInputStream(bytes));
                     MimeBodyPart p = new MimeBodyPart(is);

Modified: james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/RemoveMailAttribute.java
URL: http://svn.apache.org/viewvc/james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/RemoveMailAttribute.java?rev=1089122&r1=1089121&r2=1089122&view=diff
==============================================================================
--- james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/RemoveMailAttribute.java (original)
+++ james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/RemoveMailAttribute.java Tue Apr  5 16:34:10 2011
@@ -45,7 +45,7 @@ import javax.mail.MessagingException;
  */
 public class RemoveMailAttribute extends GenericMailet {
     
-    private ArrayList attributesToRemove = new ArrayList();
+    private ArrayList<String> attributesToRemove = new ArrayList<String>();
     
     /**
      * Return a string describing this mailet.
@@ -84,7 +84,7 @@ public class RemoveMailAttribute extends
      * @throws MessagingException in all cases
      */
     public void service(Mail mail) throws MessagingException {
-        Iterator iter = attributesToRemove.iterator();
+        Iterator<String> iter = attributesToRemove.iterator();
         while (iter.hasNext()) {
             String attribute_name = iter.next().toString();
             mail.removeAttribute (attribute_name);

Modified: james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/RemoveMimeHeader.java
URL: http://svn.apache.org/viewvc/james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/RemoveMimeHeader.java?rev=1089122&r1=1089121&r2=1089122&view=diff
==============================================================================
--- james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/RemoveMimeHeader.java (original)
+++ james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/RemoveMimeHeader.java Tue Apr  5 16:34:10 2011
@@ -49,7 +49,7 @@ public class RemoveMimeHeader extends Ge
     /**
      * Arraylist which holds the headers which should be removed
      */
-    ArrayList headers = new ArrayList();
+    ArrayList<String> headers = new ArrayList<String>();
 
     /*
      * (non-Javadoc)

Modified: james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/SetMailAttribute.java
URL: http://svn.apache.org/viewvc/james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/SetMailAttribute.java?rev=1089122&r1=1089121&r2=1089122&view=diff
==============================================================================
--- james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/SetMailAttribute.java (original)
+++ james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/SetMailAttribute.java Tue Apr  5 16:34:10 2011
@@ -21,16 +21,17 @@
 
 package org.apache.james.transport.mailets;
 
-import org.apache.mailet.base.GenericMailet;
-import org.apache.mailet.Mail;
-import org.apache.mailet.MailetException;
-import java.io.Serializable;
-import java.util.Iterator;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
+
 import javax.mail.MessagingException;
 
+import org.apache.mailet.Mail;
+import org.apache.mailet.MailetException;
+import org.apache.mailet.base.GenericMailet;
+
 /**
  * <p>This mailet sets attributes on the Mail.</p>
  * 
@@ -47,9 +48,9 @@ import javax.mail.MessagingException;
  */
 public class SetMailAttribute extends GenericMailet {
 
-    private HashMap attributesToSet = new HashMap(2);
+    private HashMap<String, String> attributesToSet = new HashMap<String, String>(2);
     
-    private Set entries;
+    private Set<Map.Entry<String, String>> entries;
     
     /**
      * Return a string describing this mailet.
@@ -67,7 +68,7 @@ public class SetMailAttribute extends Ge
      */
     public void init() throws MailetException
     {
-        Iterator iter = getInitParameterNames();
+        Iterator<String> iter = getInitParameterNames();
         while (iter.hasNext()) {
             String name = iter.next().toString();
             String value = getInitParameter (name);
@@ -85,10 +86,10 @@ public class SetMailAttribute extends Ge
      */
     public void service(Mail mail) throws MessagingException {
         if (entries != null) {
-            Iterator iter = entries.iterator();
+            Iterator<Map.Entry<String, String>> iter = entries.iterator();
             while (iter.hasNext()) {
-                Map.Entry entry = (Map.Entry)iter.next();
-                mail.setAttribute ((String)entry.getKey(),(Serializable)entry.getValue());
+                Map.Entry<String, String> entry = iter.next();
+                mail.setAttribute (entry.getKey(), entry.getValue());
             }
         }
     }

Modified: james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/StripAttachment.java
URL: http://svn.apache.org/viewvc/james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/StripAttachment.java?rev=1089122&r1=1089121&r2=1089122&view=diff
==============================================================================
--- james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/StripAttachment.java (original)
+++ james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/StripAttachment.java Tue Apr  5 16:34:10 2011
@@ -19,17 +19,6 @@
 
 package org.apache.james.transport.mailets;
 
-import org.apache.mailet.base.GenericMailet;
-import org.apache.mailet.Mail;
-import org.apache.mailet.MailetException;
-
-import javax.mail.Message;
-import javax.mail.MessagingException;
-import javax.mail.Multipart;
-import javax.mail.Part;
-import javax.mail.internet.MimeMessage;
-import javax.mail.internet.MimeUtility;
-
 import java.io.BufferedInputStream;
 import java.io.BufferedOutputStream;
 import java.io.ByteArrayOutputStream;
@@ -40,10 +29,20 @@ import java.io.OutputStream;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.LinkedHashMap;
-import java.util.List;
 import java.util.Map;
 import java.util.regex.Pattern;
 
+import javax.mail.Message;
+import javax.mail.MessagingException;
+import javax.mail.Multipart;
+import javax.mail.Part;
+import javax.mail.internet.MimeMessage;
+import javax.mail.internet.MimeUtility;
+
+import org.apache.mailet.Mail;
+import org.apache.mailet.MailetException;
+import org.apache.mailet.base.GenericMailet;
+
 /**
  * <p>
  * Remove attachments from a Message. Supports simple removal, storing to file,
@@ -311,21 +310,23 @@ public class StripAttachment extends Gen
                 if (directoryName != null) {
                     String filename = saveAttachmentToFile(part, fileName);
                     if (filename != null) {
-                        Collection c = (Collection) mail
+                        @SuppressWarnings("unchecked")
+                        Collection<String> c = (Collection<String>) mail
                                 .getAttribute(SAVED_ATTACHMENTS_ATTRIBUTE_KEY);
                         if (c == null) {
-                            c = new ArrayList();
+                            c = new ArrayList<String>();
                             mail.setAttribute(SAVED_ATTACHMENTS_ATTRIBUTE_KEY,
-                                    (ArrayList) c);
+                                    (ArrayList<String>) c);
                         }
                         c.add(filename);
                     }
                 }
                 if (attributeName != null) {
-                    Map m = (Map) mail.getAttribute(attributeName);
+                    @SuppressWarnings("unchecked")
+                    Map<String, byte[]> m = (Map<String, byte[]>) mail.getAttribute(attributeName);
                     if (m == null) {
-                        m = new LinkedHashMap();
-                        mail.setAttribute(attributeName, (LinkedHashMap) m);
+                        m = new LinkedHashMap<String, byte[]>();
+                        mail.setAttribute(attributeName, (LinkedHashMap<String, byte[]>) m);
                     }
                     ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
                     OutputStream os = new BufferedOutputStream(
@@ -341,12 +342,13 @@ public class StripAttachment extends Gen
                 ret = removeAttachments.equals(REMOVE_ALL);
             }
             if (ret) {
-                Collection c = (Collection) mail
+                @SuppressWarnings("unchecked")
+                Collection<String> c = (Collection<String>) mail
                         .getAttribute(REMOVED_ATTACHMENTS_ATTRIBUTE_KEY);
                 if (c == null) {
-                    c = new ArrayList();
+                    c = new ArrayList<String>();
                     mail.setAttribute(REMOVED_ATTACHMENTS_ATTRIBUTE_KEY,
-                            (ArrayList) c);
+                            (ArrayList<String>) c);
                 }
                 c.add(fileName);
             }

Modified: james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/UseHeaderRecipients.java
URL: http://svn.apache.org/viewvc/james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/UseHeaderRecipients.java?rev=1089122&r1=1089121&r2=1089122&view=diff
==============================================================================
--- james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/UseHeaderRecipients.java (original)
+++ james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/UseHeaderRecipients.java Tue Apr  5 16:34:10 2011
@@ -84,7 +84,7 @@ public class UseHeaderRecipients extends
         // ensure that no two entries are equal using the equality method
         // of the element objects.  MailAddress objects test equality based
         // on equivalent but not necessarily visually identical addresses.
-        Collection recipients = mail.getRecipients();
+        Collection<MailAddress> recipients = mail.getRecipients();
         // Wipe all the exist recipients
         recipients.clear();
         recipients.addAll(getHeaderMailAddresses(message, "Mail-For"));
@@ -120,7 +120,7 @@ public class UseHeaderRecipients extends
      * @param name the header name as a String
      * @return the collection of MailAddress objects.
      */
-    private Collection getHeaderMailAddresses(MimeMessage message, String name) throws MessagingException {
+    private Collection<MailAddress> getHeaderMailAddresses(MimeMessage message, String name) throws MessagingException {
 
         if (isDebug) {
             StringBuffer logBuffer =
@@ -130,7 +130,7 @@ public class UseHeaderRecipients extends
                         .append(" headers");
             log(logBuffer.toString());
         }
-        Collection addresses = new Vector();
+        Collection<MailAddress> addresses = new Vector<MailAddress>();
         String[] headers = message.getHeader(name);
         String addressString;
         InternetAddress iAddress;

Modified: james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/AbstractQuotaMatcher.java
URL: http://svn.apache.org/viewvc/james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/AbstractQuotaMatcher.java?rev=1089122&r1=1089121&r2=1089122&view=diff
==============================================================================
--- james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/AbstractQuotaMatcher.java (original)
+++ james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/AbstractQuotaMatcher.java Tue Apr  5 16:34:10 2011
@@ -48,12 +48,12 @@ abstract public class AbstractQuotaMatch
      *
      * @throws MessagingException if either <CODE>isSenderChecked</CODE> or isRecipientChecked throw an exception
      */    
-    public final Collection match(Mail mail) throws MessagingException {
-        Collection matching = null;
+    public final Collection<MailAddress> match(Mail mail) throws MessagingException {
+        Collection<MailAddress> matching = null;
         if (isSenderChecked(mail.getSender())) {
-            matching = new ArrayList();
-            for (Iterator i = mail.getRecipients().iterator(); i.hasNext(); ) {
-                MailAddress recipient = (MailAddress) i.next();
+            matching = new ArrayList<MailAddress>();
+            for (Iterator<MailAddress> i = mail.getRecipients().iterator(); i.hasNext(); ) {
+                MailAddress recipient = i.next();
                 if (isRecipientChecked(recipient) && isOverQuota(recipient, mail)) {
                     matching.add(recipient);
                 }

Modified: james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/All.java
URL: http://svn.apache.org/viewvc/james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/All.java?rev=1089122&r1=1089121&r2=1089122&view=diff
==============================================================================
--- james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/All.java (original)
+++ james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/All.java Tue Apr  5 16:34:10 2011
@@ -20,6 +20,7 @@ package org.apache.james.transport.match
 
 import org.apache.mailet.base.GenericMatcher;
 import org.apache.mailet.Mail;
+import org.apache.mailet.MailAddress;
 
 import java.util.Collection;
 
@@ -34,7 +35,7 @@ public class All extends GenericMatcher 
      * (non-Javadoc)
      * @see org.apache.mailet.base.GenericMatcher#match(org.apache.mailet.Mail)
      */
-    public Collection match(Mail mail) {
+    public Collection<MailAddress> match(Mail mail) {
         return mail.getRecipients();
     }
 }

Modified: james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/AttachmentFileNameIs.java
URL: http://svn.apache.org/viewvc/james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/AttachmentFileNameIs.java?rev=1089122&r1=1089121&r2=1089122&view=diff
==============================================================================
--- james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/AttachmentFileNameIs.java (original)
+++ james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/AttachmentFileNameIs.java Tue Apr  5 16:34:10 2011
@@ -23,6 +23,7 @@ package org.apache.james.transport.match
 
 import org.apache.mailet.base.GenericMatcher;
 import org.apache.mailet.Mail;
+import org.apache.mailet.MailAddress;
 
 import javax.mail.MessagingException;
 import javax.mail.Multipart;
@@ -94,7 +95,7 @@ public class AttachmentFileNameIs extend
         /* sets up fileNameMasks variable by parsing the condition */
         
         StringTokenizer st = new StringTokenizer(getCondition(), ", ", false);
-        ArrayList theMasks = new ArrayList(20);
+        ArrayList<Mask> theMasks = new ArrayList<Mask>(20);
         while (st.hasMoreTokens()) {
             String fileName = st.nextToken();
             
@@ -128,7 +129,7 @@ public class AttachmentFileNameIs extend
      * @param mail
      * @throws MessagingException if no matching attachment is found and at least one exception was thrown
      */
-    public Collection match(Mail mail) throws MessagingException {
+    public Collection<MailAddress> match(Mail mail) throws MessagingException {
         
         try {
             MimeMessage message = mail.getMessage();

Modified: james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/CompareNumericHeaderValue.java
URL: http://svn.apache.org/viewvc/james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/CompareNumericHeaderValue.java?rev=1089122&r1=1089121&r2=1089122&view=diff
==============================================================================
--- james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/CompareNumericHeaderValue.java (original)
+++ james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/CompareNumericHeaderValue.java Tue Apr  5 16:34:10 2011
@@ -23,6 +23,7 @@ package org.apache.james.transport.match
 
 import org.apache.mailet.base.GenericMatcher;
 import org.apache.mailet.Mail;
+import org.apache.mailet.MailAddress;
 
 import javax.mail.MessagingException;
 import javax.mail.internet.MimeMessage;
@@ -127,7 +128,7 @@ public class CompareNumericHeaderValue e
      * (non-Javadoc)
      * @see org.apache.mailet.base.GenericMatcher#match(org.apache.mailet.Mail)
      */
-    public Collection match(Mail mail) throws MessagingException {
+    public Collection<MailAddress> match(Mail mail) throws MessagingException {
         if (headerName == null) {
             // should never get here
             throw new IllegalStateException("Null headerName");

Modified: james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/FetchedFrom.java
URL: http://svn.apache.org/viewvc/james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/FetchedFrom.java?rev=1089122&r1=1089121&r2=1089122&view=diff
==============================================================================
--- james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/FetchedFrom.java (original)
+++ james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/FetchedFrom.java Tue Apr  5 16:34:10 2011
@@ -23,6 +23,7 @@ package org.apache.james.transport.match
 
 import org.apache.mailet.base.GenericMatcher;
 import org.apache.mailet.Mail;
+import org.apache.mailet.MailAddress;
 
 import javax.mail.internet.MimeMessage;
 import java.util.Collection;
@@ -43,7 +44,7 @@ public class FetchedFrom extends Generic
      * (non-Javadoc)
      * @see org.apache.mailet.base.GenericMatcher#match(org.apache.mailet.Mail)
      */
-    public Collection match(Mail mail) throws javax.mail.MessagingException {
+    public Collection<MailAddress> match(Mail mail) throws javax.mail.MessagingException {
         MimeMessage message = mail.getMessage();
         String fetch = message.getHeader("X-fetched-from", null);
         if (fetch != null && fetch.equals(getCondition())) {

Modified: james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/HasAttachment.java
URL: http://svn.apache.org/viewvc/james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/HasAttachment.java?rev=1089122&r1=1089121&r2=1089122&view=diff
==============================================================================
--- james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/HasAttachment.java (original)
+++ james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/HasAttachment.java Tue Apr  5 16:34:10 2011
@@ -23,6 +23,7 @@ package org.apache.james.transport.match
 
 import org.apache.mailet.base.GenericMatcher;
 import org.apache.mailet.Mail;
+import org.apache.mailet.MailAddress;
 
 import javax.mail.MessagingException;
 import javax.mail.Multipart;
@@ -41,7 +42,7 @@ public class HasAttachment extends Gener
      * Either every recipient is matching or neither of them.
      * @throws MessagingException if no attachment is found and at least one exception was thrown
      */
-    public Collection match(Mail mail) throws MessagingException {
+    public Collection<MailAddress> match(Mail mail) throws MessagingException {
         
         Exception anException = null;
         



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