You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by ma...@apache.org on 2016/01/04 10:40:20 UTC

svn commit: r1722812 [4/5] - in /james/project/trunk: backends-common/cassandra/ mailbox/api/src/test/java/org/apache/james/mailbox/manager/ mailbox/cassandra/ mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/modules/ mailbox/elastics...

Modified: james/project/trunk/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/Xor.java
URL: http://svn.apache.org/viewvc/james/project/trunk/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/Xor.java?rev=1722812&r1=1722811&r2=1722812&view=diff
==============================================================================
--- james/project/trunk/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/Xor.java (original)
+++ james/project/trunk/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/Xor.java Mon Jan  4 09:40:15 2016
@@ -38,15 +38,15 @@ public class Xor extends GenericComposit
      * @return Collection of Recipients from the Xor composition of the child
      *         matchers.
      */
-    public Collection match(Mail mail) throws MessagingException {
-        Collection finalResult = null;
+    public Collection<MailAddress> match(Mail mail) throws MessagingException {
+        Collection<MailAddress> finalResult = null;
         Matcher matcher;
         boolean first = true;
-        for (Iterator matcherIter = iterator(); matcherIter.hasNext();) {
-            matcher = (Matcher) (matcherIter.next());
-            Collection result = matcher.match(mail);
+        for (Iterator<Matcher> matcherIter = iterator(); matcherIter.hasNext();) {
+            matcher = matcherIter.next();
+            Collection<MailAddress> result = matcher.match(mail);
             if (result == null) {
-                result = new ArrayList(0);
+                result = new ArrayList<MailAddress>(0);
             }
             // log("Matching with " +
             // matcher.getMatcherConfig().getMatcherName() +

Modified: james/project/trunk/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateCompositeProcessor.java
URL: http://svn.apache.org/viewvc/james/project/trunk/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateCompositeProcessor.java?rev=1722812&r1=1722811&r2=1722812&view=diff
==============================================================================
--- james/project/trunk/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateCompositeProcessor.java (original)
+++ james/project/trunk/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateCompositeProcessor.java Mon Jan  4 09:40:15 2016
@@ -160,7 +160,6 @@ public abstract class AbstractStateCompo
         }
     }
 
-    @SuppressWarnings("unchecked")
     @PostConstruct
     public void init() throws Exception {
         List<HierarchicalConfiguration> processorConfs = config.configurationsAt("processor");

Modified: james/project/trunk/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateMailetProcessor.java
URL: http://svn.apache.org/viewvc/james/project/trunk/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateMailetProcessor.java?rev=1722812&r1=1722811&r2=1722812&view=diff
==============================================================================
--- james/project/trunk/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateMailetProcessor.java (original)
+++ james/project/trunk/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateMailetProcessor.java Mon Jan  4 09:40:15 2016
@@ -256,7 +256,6 @@ public abstract class AbstractStateMaile
      * @throws MessagingException
      * @throws NotCompliantMBeanException
      */
-    @SuppressWarnings("unchecked")
     private List<Matcher> loadCompositeMatchers(String state, Map<String, Matcher> compMap, List<HierarchicalConfiguration> compMatcherConfs) throws ConfigurationException, MessagingException {
         List<Matcher> matchers = new ArrayList<Matcher>();
 
@@ -305,7 +304,6 @@ public abstract class AbstractStateMaile
         return matchers;
     }
 
-    @SuppressWarnings("unchecked")
     private void parseConfiguration() throws MessagingException, ConfigurationException {
 
         // load composite matchers if there are any

Modified: james/project/trunk/server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/impl/matchers/AndTest.java
URL: http://svn.apache.org/viewvc/james/project/trunk/server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/impl/matchers/AndTest.java?rev=1722812&r1=1722811&r2=1722812&view=diff
==============================================================================
--- james/project/trunk/server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/impl/matchers/AndTest.java (original)
+++ james/project/trunk/server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/impl/matchers/AndTest.java Mon Jan  4 09:40:15 2016
@@ -43,7 +43,7 @@ public class AndTest extends BaseMatcher
         setupChild("RecipientIs=test@james.apache.org");
         setupChild("All");
 
-        Collection matchedRecipients = matcher.match(mockedMail);
+        Collection<MailAddress> matchedRecipients = matcher.match(mockedMail);
 
         assertNotNull(matchedRecipients);
         assertEquals(1, matchedRecipients.size());
@@ -56,7 +56,7 @@ public class AndTest extends BaseMatcher
         setupChild("RecipientIs=test@james.apache.org");
         setupChild("RecipientIs=test2@james.apache.org");
 
-        Collection matchedRecipients = matcher.match(mockedMail);
+        Collection<MailAddress> matchedRecipients = matcher.match(mockedMail);
 
         assertNotNull(matchedRecipients);
         assertEquals(0, matchedRecipients.size());

Modified: james/project/trunk/server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/impl/matchers/OrTest.java
URL: http://svn.apache.org/viewvc/james/project/trunk/server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/impl/matchers/OrTest.java?rev=1722812&r1=1722811&r2=1722812&view=diff
==============================================================================
--- james/project/trunk/server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/impl/matchers/OrTest.java (original)
+++ james/project/trunk/server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/impl/matchers/OrTest.java Mon Jan  4 09:40:15 2016
@@ -43,16 +43,16 @@ public class OrTest extends BaseMatchers
         setupChild("RecipientIsRegex=test@james.apache.org");
         setupChild("RecipientIsRegex=test2@james.apache.org");
 
-        Collection matchedRecipients = matcher.match(mockedMail);
+        Collection<MailAddress> matchedRecipients = matcher.match(mockedMail);
 
         assertNotNull(matchedRecipients);
         assertEquals(matchedRecipients.size(), mockedMail.getRecipients().size());
 
         // Now ensure they match the actual recipients
-        Iterator iterator = matchedRecipients.iterator();
-        MailAddress address = (MailAddress) iterator.next();
+        Iterator<MailAddress> iterator = matchedRecipients.iterator();
+        MailAddress address = iterator.next();
         assertEquals(address, "test@james.apache.org");
-        address = (MailAddress) iterator.next();
+        address = iterator.next();
         assertEquals(address, "test2@james.apache.org");
     }
 

Modified: james/project/trunk/server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/impl/matchers/XorTest.java
URL: http://svn.apache.org/viewvc/james/project/trunk/server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/impl/matchers/XorTest.java?rev=1722812&r1=1722811&r2=1722812&view=diff
==============================================================================
--- james/project/trunk/server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/impl/matchers/XorTest.java (original)
+++ james/project/trunk/server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/impl/matchers/XorTest.java Mon Jan  4 09:40:15 2016
@@ -43,7 +43,7 @@ public class XorTest extends BaseMatcher
         setupChild("RecipientIsRegex=test@james.apache.org");
         setupChild("RecipientIsRegex=test@james.apache.org");
 
-        Collection matchedRecipients = matcher.match(mockedMail);
+        Collection<MailAddress> matchedRecipients = matcher.match(mockedMail);
 
         assertNotNull(matchedRecipients);
         assertEquals(0, matchedRecipients.size());
@@ -54,12 +54,12 @@ public class XorTest extends BaseMatcher
         setupChild("RecipientIsRegex=test@james.apache.org");
         setupChild("RecipientIsRegex=test2@james.apache.org");
 
-        Collection matchedRecipients = matcher.match(mockedMail);
+        Collection<MailAddress> matchedRecipients = matcher.match(mockedMail);
 
         assertNotNull(matchedRecipients);
         assertEquals(2, matchedRecipients.size());
 
-        Iterator iterator = matchedRecipients.iterator();
+        Iterator<MailAddress> iterator = matchedRecipients.iterator();
         MailAddress address = (MailAddress) iterator.next();
         assertEquals(address, "test@james.apache.org");
         address = (MailAddress) iterator.next();

Modified: james/project/trunk/server/mailet/mailets/pom.xml
URL: http://svn.apache.org/viewvc/james/project/trunk/server/mailet/mailets/pom.xml?rev=1722812&r1=1722811&r2=1722812&view=diff
==============================================================================
--- james/project/trunk/server/mailet/mailets/pom.xml (original)
+++ james/project/trunk/server/mailet/mailets/pom.xml Mon Jan  4 09:40:15 2016
@@ -28,7 +28,6 @@
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
-    <groupId>org.apache.james</groupId>
     <artifactId>james-server-mailets</artifactId>
     <packaging>bundle</packaging>
 

Modified: james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/AbstractNotify.java
URL: http://svn.apache.org/viewvc/james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/AbstractNotify.java?rev=1722812&r1=1722811&r2=1722812&view=diff
==============================================================================
--- james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/AbstractNotify.java (original)
+++ james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/AbstractNotify.java Mon Jan  4 09:40:15 2016
@@ -142,7 +142,7 @@ public abstract class AbstractNotify ext
             out.println("  Sent date: " + message.getSentDate());
         }
         out.println("  MAIL FROM: " + originalMail.getSender());
-        Iterator rcptTo = originalMail.getRecipients().iterator();
+        Iterator<MailAddress> rcptTo = originalMail.getRecipients().iterator();
         out.println("  RCPT TO: " + rcptTo.next());
         while (rcptTo.hasNext()) {
             out.println("           " + rcptTo.next());
@@ -182,7 +182,7 @@ public abstract class AbstractNotify ext
 
     // All subclasses of AbstractNotify are expected to establish their own
     // recipients
-    abstract protected Collection getRecipients() throws MessagingException;
+    abstract protected Collection<MailAddress> getRecipients() throws MessagingException;
 
     /**
      * @return null

Modified: james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/AbstractRecipientRewriteTableMailet.java
URL: http://svn.apache.org/viewvc/james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/AbstractRecipientRewriteTableMailet.java?rev=1722812&r1=1722811&r2=1722812&view=diff
==============================================================================
--- james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/AbstractRecipientRewriteTableMailet.java (original)
+++ james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/AbstractRecipientRewriteTableMailet.java Mon Jan  4 09:40:15 2016
@@ -35,6 +35,7 @@ import org.apache.james.rrt.lib.Mapping;
 import org.apache.james.rrt.lib.Mappings;
 import org.apache.mailet.Mail;
 import org.apache.mailet.MailAddress;
+import org.apache.mailet.MailetContext.LogLevel;
 import org.apache.mailet.base.GenericMailet;
 import org.apache.mailet.base.RFC2822Headers;
 
@@ -84,7 +85,7 @@ public abstract class AbstractRecipientR
                 }
 
             } catch (Exception ex) {
-                getMailetContext().log("Error while storing mail.", ex);
+                getMailetContext().log(LogLevel.INFO, "Error while storing mail.", ex);
                 errors.add(recipient);
             }
         }
@@ -158,7 +159,7 @@ public abstract class AbstractRecipientR
                     if (j.hasNext())
                         logBuffer.append(", ");
                 }
-                getMailetContext().log(logBuffer.toString());
+                getMailetContext().log(LogLevel.INFO, logBuffer.toString());
             } catch (MessagingException me) {
                 StringBuilder logBuffer = new StringBuilder(128).append("Error forwarding mail to ");
                 for (Iterator<MailAddress> j = remoteRecipients.iterator(); j.hasNext();) {
@@ -168,7 +169,7 @@ public abstract class AbstractRecipientR
                 }
                 logBuffer.append("attempting local delivery");
 
-                getMailetContext().log(logBuffer.toString());
+                getMailetContext().log(LogLevel.INFO, logBuffer.toString());
                 throw me;
             }
         }

Modified: james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/AbstractRedirect.java
URL: http://svn.apache.org/viewvc/james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/AbstractRedirect.java?rev=1722812&r1=1722811&r2=1722812&view=diff
==============================================================================
--- james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/AbstractRedirect.java (original)
+++ james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/AbstractRedirect.java Mon Jan  4 09:40:15 2016
@@ -20,6 +20,7 @@
 package org.apache.james.transport.mailets;
 
 import com.google.common.base.Throwables;
+
 import org.apache.james.core.MailImpl;
 import org.apache.james.core.MimeMessageUtil;
 import org.apache.james.dnsservice.api.DNSService;
@@ -38,6 +39,7 @@ import javax.mail.internet.MimeBodyPart;
 import javax.mail.internet.MimeMessage;
 import javax.mail.internet.MimeMultipart;
 import javax.mail.internet.ParseException;
+
 import java.io.PrintWriter;
 import java.io.StringWriter;
 import java.net.UnknownHostException;
@@ -226,7 +228,7 @@ public abstract class AbstractRedirect e
     private int attachmentType = NONE;
     private int inLineType = BODY;
     private String messageText;
-    private Collection recipients;
+    private Collection<MailAddress> recipients;
     private MailAddress replyTo;
     private MailAddress reversePath;
     private MailAddress sender;
@@ -419,8 +421,8 @@ public abstract class AbstractRedirect e
      *         <code>SpecialAddress.RECIPIENTS</code> or <code>null</code> if
      *         missing
      */
-    protected Collection getRecipients() throws MessagingException {
-        Collection newRecipients = new HashSet();
+    protected Collection<MailAddress> getRecipients() throws MessagingException {
+        Collection<MailAddress> newRecipients = new HashSet<MailAddress>();
         String addressList = getInitParameter("recipients");
 
         // if nothing was specified, return <code>null</code> meaning no change
@@ -455,8 +457,8 @@ public abstract class AbstractRedirect e
      *
      * @return {@link #replaceMailAddresses} on {@link #getRecipients()},
      */
-    protected Collection getRecipients(Mail originalMail) throws MessagingException {
-        Collection recipients = (isStatic()) ? this.recipients : getRecipients();
+    protected Collection<MailAddress> getRecipients(Mail originalMail) throws MessagingException {
+        Collection<MailAddress> recipients = (isStatic()) ? this.recipients : getRecipients();
         if (recipients != null) {
             if (recipients.size() == 1 && (recipients.contains(SpecialAddress.UNALTERED) || recipients.contains(SpecialAddress.RECIPIENTS))) {
                 recipients = null;
@@ -471,7 +473,7 @@ public abstract class AbstractRedirect e
      * Sets the recipients of <i>newMail</i> to <i>recipients</i>. If the
      * requested value is null does nothing. Is a "setX(Mail, Tx, Mail)" method.
      */
-    protected void setRecipients(Mail newMail, Collection recipients, Mail originalMail) {
+    protected void setRecipients(Mail newMail, Collection<MailAddress> recipients, Mail originalMail) {
         if (recipients != null) {
             newMail.setRecipients(recipients);
             if (isDebug) {
@@ -534,15 +536,15 @@ public abstract class AbstractRedirect e
             if (apparentlyTo.length == 1 && (apparentlyTo[0].equals(SpecialAddress.UNALTERED.toInternetAddress()) || apparentlyTo[0].equals(SpecialAddress.TO.toInternetAddress()))) {
                 apparentlyTo = null;
             } else {
-                Collection toList = new ArrayList(apparentlyTo.length);
+                Collection<InternetAddress> toList = new ArrayList<InternetAddress>(apparentlyTo.length);
                 Collections.addAll(toList, apparentlyTo);
                 /*
                  * IMPORTANT: setTo() treats null differently from a zero length
                  * array, so it's ok to get a zero length array from
                  * replaceSpecialAddresses
                  */
-                Collection var = replaceInternetAddresses(originalMail, toList);
-                apparentlyTo = (InternetAddress[]) var.toArray(new InternetAddress[var.size()]);
+                Collection<InternetAddress> var = replaceInternetAddresses(originalMail, toList);
+                apparentlyTo = var.toArray(new InternetAddress[var.size()]);
             }
         }
 
@@ -1079,7 +1081,8 @@ public abstract class AbstractRedirect e
      * headers
      */
     protected String getMessageHeaders(MimeMessage message) throws MessagingException {
-        Enumeration heads = message.getAllHeaderLines();
+        @SuppressWarnings("unchecked")
+        Enumeration<String> heads = message.getAllHeaderLines();
         StringBuilder headBuffer = new StringBuilder(1024);
         while (heads.hasMoreElements()) {
             headBuffer.append(heads.nextElement().toString()).append("\r\n");
@@ -1109,7 +1112,8 @@ public abstract class AbstractRedirect e
 
         // Copy the relevant headers
         String[] relevantHeaderNames = {RFC2822Headers.DATE, RFC2822Headers.FROM, RFC2822Headers.REPLY_TO, RFC2822Headers.TO, RFC2822Headers.SUBJECT, RFC2822Headers.RETURN_PATH};
-        Enumeration headerEnum = originalMessage.getMatchingHeaderLines(relevantHeaderNames);
+        @SuppressWarnings("unchecked")
+        Enumeration<String> headerEnum = originalMessage.getMatchingHeaderLines(relevantHeaderNames);
         while (headerEnum.hasMoreElements()) {
             newMessage.addHeaderLine((String) headerEnum.nextElement());
         }
@@ -1431,8 +1435,8 @@ public abstract class AbstractRedirect e
      * <code>SpecialAddress.UNALTERED</code> are ignored.<br>
      * Any other address is not replaced.
      */
-    protected Collection replaceMailAddresses(Mail mail, Collection list) {
-        Collection newList = new HashSet(list.size());
+    protected Collection<MailAddress> replaceMailAddresses(Mail mail, Collection<MailAddress> list) {
+        Collection<MailAddress> newList = new HashSet<MailAddress>(list.size());
         for (Object aList : list) {
             MailAddress mailAddress = (MailAddress) aList;
             if (!mailAddress.getDomain().equalsIgnoreCase("address.marker")) {
@@ -1501,10 +1505,9 @@ public abstract class AbstractRedirect e
      * <code>SpecialAddress.UNALTERED</code> is ignored.<br>
      * Any other address is not replaced.<br>
      */
-    protected Collection replaceInternetAddresses(Mail mail, Collection list) throws MessagingException {
-        Collection newList = new HashSet(list.size());
-        for (Object aList : list) {
-            InternetAddress internetAddress = (InternetAddress) aList;
+    protected Collection<InternetAddress> replaceInternetAddresses(Mail mail, Collection<InternetAddress> list) throws MessagingException {
+        Collection<InternetAddress> newList = new HashSet<InternetAddress>(list.size());
+        for (InternetAddress internetAddress : list) {
             MailAddress mailAddress = new MailAddress(internetAddress);
             if (!mailAddress.getDomain().equalsIgnoreCase("address.marker")) {
                 newList.add(internetAddress);

Modified: james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/BayesianAnalysisFeeder.java
URL: http://svn.apache.org/viewvc/james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/BayesianAnalysisFeeder.java?rev=1722812&r1=1722811&r2=1722812&view=diff
==============================================================================
--- james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/BayesianAnalysisFeeder.java (original)
+++ james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/BayesianAnalysisFeeder.java Mon Jan  4 09:40:15 2016
@@ -330,10 +330,11 @@ public class BayesianAnalysisFeeder exte
     }
 
     private void clearAllHeaders(MimeMessage message) throws javax.mail.MessagingException {
-        Enumeration headers = message.getAllHeaders();
+        @SuppressWarnings("unchecked")
+        Enumeration<Header> headers = message.getAllHeaders();
 
         while (headers.hasMoreElements()) {
-            Header header = (Header) headers.nextElement();
+            Header header = headers.nextElement();
             try {
                 message.removeHeader(header.getName());
             } catch (javax.mail.MessagingException me) {

Modified: james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Bounce.java
URL: http://svn.apache.org/viewvc/james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Bounce.java?rev=1722812&r1=1722811&r2=1722812&view=diff
==============================================================================
--- james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Bounce.java (original)
+++ james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Bounce.java Mon Jan  4 09:40:15 2016
@@ -127,8 +127,8 @@ public class Bounce extends AbstractNoti
      * @return <code>SpecialAddress.REVERSE_PATH</code>
      */
     @Override
-    protected Collection getRecipients() {
-        Collection newRecipients = new HashSet();
+    protected Collection<MailAddress> getRecipients() {
+        Collection<MailAddress> newRecipients = new HashSet<MailAddress>();
         newRecipients.add(SpecialAddress.REVERSE_PATH);
         return newRecipients;
     }

Modified: james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Forward.java
URL: http://svn.apache.org/viewvc/james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Forward.java?rev=1722812&r1=1722811&r2=1722812&view=diff
==============================================================================
--- james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Forward.java (original)
+++ james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Forward.java Mon Jan  4 09:40:15 2016
@@ -113,8 +113,8 @@ public class Forward extends AbstractRed
     /**
      * @return the <code>recipients</code> init parameter or null if missing
      */
-    protected Collection getRecipients() throws MessagingException {
-        Collection newRecipients = new HashSet();
+    protected Collection<MailAddress> getRecipients() throws MessagingException {
+        Collection<MailAddress> newRecipients = new HashSet<MailAddress>();
         String addressList = getInitParameter("forwardto", getInitParameter("forwardTo"));
 
         // if nothing was specified, throw an exception

Modified: james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/FromRepository.java
URL: http://svn.apache.org/viewvc/james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/FromRepository.java?rev=1722812&r1=1722811&r2=1722812&view=diff
==============================================================================
--- james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/FromRepository.java (original)
+++ james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/FromRepository.java Mon Jan  4 09:40:15 2016
@@ -19,6 +19,8 @@
 
 package org.apache.james.transport.mailets;
 
+import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Iterator;
 
 import javax.inject.Inject;
@@ -91,8 +93,8 @@ public class FromRepository extends Gene
      */
     public void service(Mail trigger) throws MessagingException {
         trigger.setState(Mail.GHOST);
-        java.util.Collection processed = new java.util.ArrayList();
-        Iterator list = repository.list();
+        Collection<String> processed = new ArrayList<String>();
+        Iterator<String> list = repository.list();
         while (list.hasNext()) {
             String key = (String) list.next();
             try {

Modified: james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/LocalDelivery.java
URL: http://svn.apache.org/viewvc/james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/LocalDelivery.java?rev=1722812&r1=1722811&r2=1722812&view=diff
==============================================================================
--- james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/LocalDelivery.java (original)
+++ james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/LocalDelivery.java Mon Jan  4 09:40:15 2016
@@ -19,17 +19,13 @@
 
 package org.apache.james.transport.mailets;
 
-import java.util.ArrayList;
-import java.util.Collection;
 import java.util.Iterator;
 
 import javax.inject.Inject;
 import javax.inject.Named;
 import javax.mail.MessagingException;
 
-import org.apache.commons.collections.iterators.IteratorChain;
 import org.apache.james.domainlist.api.DomainList;
-import org.apache.james.filesystem.api.FileSystem;
 import org.apache.james.mailbox.MailboxManager;
 import org.apache.james.sieverepository.api.SieveRepository;
 import org.apache.james.user.api.UsersRepository;
@@ -38,6 +34,9 @@ import org.apache.mailet.MailetConfig;
 import org.apache.mailet.MailetContext;
 import org.apache.mailet.base.GenericMailet;
 
+import com.google.common.collect.Iterators;
+import com.google.common.collect.Lists;
+
 /**
  * Receives a Mail from the Queue and takes care of delivery of the
  * message to local inboxes.
@@ -130,15 +129,11 @@ public class LocalDelivery extends Gener
             }
 
             public Iterator<String> getInitParameterNames() {
-                IteratorChain c = new IteratorChain();
-                Collection<String> h = new ArrayList<String>();
-                h.add("addDeliveryHeader");
-                h.add("resetReturnPath");
-                c.addIterator(getMailetConfig().getInitParameterNames());
-                c.addIterator(h.iterator());
-                return c;
+                return Iterators.concat(
+                        getMailetConfig().getInitParameterNames(), 
+                        Lists.newArrayList("addDeliveryHeader", "resetReturnPath").iterator());
             }
-
+            
             public MailetContext getMailetContext() {
                 return getMailetConfig().getMailetContext();
             }

Modified: james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/RemoteDelivery.java
URL: http://svn.apache.org/viewvc/james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/RemoteDelivery.java?rev=1722812&r1=1722811&r2=1722812&view=diff
==============================================================================
--- james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/RemoteDelivery.java (original)
+++ james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/RemoteDelivery.java Mon Jan  4 09:40:15 2016
@@ -42,7 +42,6 @@ import java.util.concurrent.TimeUnit;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-import javax.annotation.Resource;
 import javax.inject.Inject;
 import javax.mail.Address;
 import javax.mail.MessagingException;
@@ -1334,8 +1333,8 @@ public class RemoteDelivery extends Gene
      */
     private Object invokeGetter(Object target, String getter) {
         try {
-            Method getAddress = target.getClass().getMethod(getter, null);
-            return getAddress.invoke(target, null);
+            Method getAddress = target.getClass().getMethod(getter);
+            return getAddress.invoke(target);
         } catch (NoSuchMethodException nsme) {
             // An SMTPAddressFailedException with no getAddress method.
         } catch (IllegalAccessException iae) {

Modified: james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/ResourceLocatorImpl.java
URL: http://svn.apache.org/viewvc/james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/ResourceLocatorImpl.java?rev=1722812&r1=1722811&r2=1722812&view=diff
==============================================================================
--- james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/ResourceLocatorImpl.java (original)
+++ james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/ResourceLocatorImpl.java Mon Jan  4 09:40:15 2016
@@ -19,19 +19,12 @@
 
 package org.apache.james.transport.mailets;
 
+import java.io.InputStream;
+
 import org.apache.james.sieverepository.api.SieveRepository;
-import org.apache.james.sieverepository.api.exception.ScriptNotFoundException;
 import org.apache.james.sieverepository.api.exception.SieveRepositoryException;
-import org.apache.james.sieverepository.api.exception.StorageException;
-import org.apache.james.sieverepository.api.exception.UserNotFoundException;
 import org.apache.jsieve.mailet.ResourceLocator;
 
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Named;
-import java.io.IOException;
-import java.io.InputStream;
-
 public class ResourceLocatorImpl implements ResourceLocator {
 
     private final boolean virtualHosting;

Modified: james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/ToRecipientFolder.java
URL: http://svn.apache.org/viewvc/james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/ToRecipientFolder.java?rev=1722812&r1=1722811&r2=1722812&view=diff
==============================================================================
--- james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/ToRecipientFolder.java (original)
+++ james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/ToRecipientFolder.java Mon Jan  4 09:40:15 2016
@@ -18,16 +18,13 @@
  ****************************************************************/
 package org.apache.james.transport.mailets;
 
-import java.util.ArrayList;
-import java.util.Collection;
+import java.util.Arrays;
 import java.util.Iterator;
 
 import javax.inject.Inject;
 import javax.inject.Named;
 import javax.mail.MessagingException;
 
-import org.apache.commons.collections.iterators.IteratorChain;
-import org.apache.james.filesystem.api.FileSystem;
 import org.apache.james.mailbox.MailboxManager;
 import org.apache.james.sieverepository.api.SieveRepository;
 import org.apache.james.user.api.UsersRepository;
@@ -36,6 +33,8 @@ import org.apache.mailet.MailetConfig;
 import org.apache.mailet.MailetContext;
 import org.apache.mailet.base.GenericMailet;
 
+import com.google.common.collect.Iterators;
+
 /**
  * Receives a Mail from the Queue and takes care to deliver the message
  * to a defined folder of the recipient(s).
@@ -87,17 +86,13 @@ public class ToRecipientFolder extends G
         }
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.mailet.base.GenericMailet#init()
-     */
     @Override
     public void init() throws MessagingException {
         super.init();
         sieveMailet = new SieveMailet(usersRepository, mailboxManager, sieveRepository, "INBOX");
         sieveMailet.init(new MailetConfig() {
-            /*
-             * @see org.apache.mailet.MailetConfig#getInitParameter(java.lang.String)
-             */
+            
+            @Override
             public String getInitParameter(String name) {
                 if ("addDeliveryHeader".equals(name)) {
                     return "Delivered-To";
@@ -107,27 +102,20 @@ public class ToRecipientFolder extends G
                     return getMailetConfig().getInitParameter(name);
                 }
             }
-            /*
-             * @see org.apache.mailet.MailetConfig#getInitParameterNames()
-             */
+            
+
+            @Override
             public Iterator<String> getInitParameterNames() {
-                IteratorChain c = new IteratorChain();
-                Collection<String> h = new ArrayList<String>();
-                h.add("addDeliveryHeader");
-                h.add("resetReturnPath");
-                c.addIterator(getMailetConfig().getInitParameterNames());
-                c.addIterator(h.iterator());
-                return c;
+                return Iterators.concat(getMailetConfig().getInitParameterNames(),
+                        Arrays.asList("addDeliveryHeader", "resetReturnPath").iterator());
             }
-            /*
-             * @see org.apache.mailet.MailetConfig#getMailetContext()
-             */
+            
+            @Override
             public MailetContext getMailetContext() {
                 return getMailetConfig().getMailetContext();
             }
-            /*
-             * @see org.apache.mailet.MailetConfig#getMailetName()
-             */
+
+            @Override
             public String getMailetName() {
                 return getMailetConfig().getMailetName();
             }
@@ -137,9 +125,6 @@ public class ToRecipientFolder extends G
         sieveMailet.setQuiet(getInitParameter("quiet", true));
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.mailet.base.GenericMailet#getMailetInfo()
-     */
     @Override
     public String getMailetInfo() {
         return ToRecipientFolder.class.getName() + " Mailet";

Modified: james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/XMLRecipientRewriteTable.java
URL: http://svn.apache.org/viewvc/james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/XMLRecipientRewriteTable.java?rev=1722812&r1=1722811&r2=1722812&view=diff
==============================================================================
--- james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/XMLRecipientRewriteTable.java (original)
+++ james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/XMLRecipientRewriteTable.java Mon Jan  4 09:40:15 2016
@@ -76,7 +76,7 @@ public class XMLRecipientRewriteTable ex
     /**
      * Holds the configured mappings
      */
-    private Map mappings = new HashMap();
+    private Map<String, String> mappings = new HashMap<String, String>();
 
     /**
      * Initialize the mailet

Modified: james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/managesieve/ManageSieveMailet.java
URL: http://svn.apache.org/viewvc/james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/managesieve/ManageSieveMailet.java?rev=1722812&r1=1722811&r2=1722812&view=diff
==============================================================================
--- james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/managesieve/ManageSieveMailet.java (original)
+++ james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/managesieve/ManageSieveMailet.java Mon Jan  4 09:40:15 2016
@@ -29,8 +29,7 @@ import java.util.Scanner;
 import javax.inject.Inject;
 import javax.mail.MessagingException;
 
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.collect.Lists;
+import org.apache.commons.io.IOUtils;
 import org.apache.james.managesieve.api.Session;
 import org.apache.james.managesieve.api.SieveParser;
 import org.apache.james.managesieve.core.CoreProcessor;
@@ -41,10 +40,13 @@ import org.apache.james.sieverepository.
 import org.apache.james.transport.mailets.managesieve.transcode.MessageToCoreToMessage;
 import org.apache.james.user.api.UsersRepository;
 import org.apache.mailet.Mail;
-import org.apache.mailet.MailAddress;
 import org.apache.mailet.MailetContext;
+import org.apache.mailet.MailetContext.LogLevel;
 import org.apache.mailet.base.GenericMailet;
 
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.collect.Lists;
+
 /**
  * <code>ManageSieveMailet</code> interprets mail from a local sender as
  * commands to manage Sieve scripts stored on the mail server. The commands are
@@ -125,7 +127,7 @@ public class ManageSieveMailet extends G
             return;
         }
         if (!getMailetContext().isLocalServer(mail.getSender().getDomain().toLowerCase())) {
-            getMailetContext().log(MailetContext.LogLevel.ERROR, "Sender not local");
+            getMailetContext().log(LogLevel.ERROR, "Sender not local");
             return;
         }
 
@@ -188,20 +190,17 @@ public class ManageSieveMailet extends G
 
     private String computeHelp() throws MessagingException {
         InputStream stream = null;
+        Scanner scanner = null;
         try {
             stream = helpURL.openStream();
-            return new Scanner(stream, "UTF-8").useDelimiter("\\A").next();
+            scanner = new Scanner(stream, "UTF-8");
+            return scanner.useDelimiter("\\A").next();
         } catch (IOException ex) {
             throw new MessagingException("Unable to access help URL: " + helpURL.toExternalForm(), ex);
         }
         finally {
-            if (stream != null) {
-                try {
-                    stream.close();
-                } catch (IOException ex) {
-                    // no op
-                }
-            }
+            IOUtils.closeQuietly(scanner);
+            IOUtils.closeQuietly(stream);
         }
     }
 

Modified: james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/managesieve/transcode/MessageToCoreToMessage.java
URL: http://svn.apache.org/viewvc/james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/managesieve/transcode/MessageToCoreToMessage.java?rev=1722812&r1=1722811&r2=1722812&view=diff
==============================================================================
--- james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/managesieve/transcode/MessageToCoreToMessage.java (original)
+++ james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/managesieve/transcode/MessageToCoreToMessage.java Mon Jan  4 09:40:15 2016
@@ -65,7 +65,8 @@ public class MessageToCoreToMessage {
                     InputStream is = (InputStream) part.getContent();
                     Scanner scanner = null;
                     try {
-                        scanner = new Scanner(is, "UTF-8").useDelimiter("\\A");
+                        scanner = new Scanner(is, "UTF-8");
+                        scanner.useDelimiter("\\A");
                         if (scanner.hasNext()) {
                             result = scanner.next();
                         }

Modified: james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/matchers/AbstractSQLWhitelistMatcher.java
URL: http://svn.apache.org/viewvc/james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/matchers/AbstractSQLWhitelistMatcher.java?rev=1722812&r1=1722811&r2=1722812&view=diff
==============================================================================
--- james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/matchers/AbstractSQLWhitelistMatcher.java (original)
+++ james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/matchers/AbstractSQLWhitelistMatcher.java Mon Jan  4 09:40:15 2016
@@ -53,10 +53,12 @@ public abstract class AbstractSQLWhiteli
     private UsersRepository localusers;
 
     protected DataSource datasource;
+    protected JDBCUtil jdbcUtil;
 
     /** Holds value of property sqlParameters. */
     private final Map<String, String> sqlParameters = new HashMap<String, String>();
 
+
     @Inject
     public void setDataSource(DataSource datasource) {
         this.datasource = datasource;
@@ -66,6 +68,11 @@ public abstract class AbstractSQLWhiteli
     public void setUsersRepository(UsersRepository localusers) {
         this.localusers = localusers;
     }
+    
+    @Inject
+    public void setJdbcUtil(JDBCUtil jdbcUtil) {
+        this.jdbcUtil = jdbcUtil;
+    }
 
     /**
      * Getter for property sqlParameters.

Modified: james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/matchers/IsInWhiteList.java
URL: http://svn.apache.org/viewvc/james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/matchers/IsInWhiteList.java?rev=1722812&r1=1722811&r2=1722812&view=diff
==============================================================================
--- james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/matchers/IsInWhiteList.java (original)
+++ james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/matchers/IsInWhiteList.java Mon Jan  4 09:40:15 2016
@@ -93,62 +93,81 @@ public class IsInWhiteList extends Abstr
                 conn = datasource.getConnection();
             }
 
-            if (selectStmt == null) {
+            try {
+                if (selectStmt == null) {
+                    selectStmt = conn.prepareStatement(selectByPK);
+                }
+                selectStmt.setString(1, recipientUser);
+                selectStmt.setString(2, recipientHost);
+                selectStmt.setString(3, senderUser);
+                selectStmt.setString(4, senderHost);
+                selectRS = selectStmt.executeQuery();
+                if (selectRS.next()) {
+                    // This address was already in the list
+                    return true;
+                }
+            } finally {
+                jdbcUtil.closeJDBCResultSet(selectRS);
+                jdbcUtil.closeJDBCStatement(selectStmt);
+            }
+            
+            try {
+                // check for wildcard domain entries
                 selectStmt = conn.prepareStatement(selectByPK);
-            }
-            selectStmt.setString(1, recipientUser);
-            selectStmt.setString(2, recipientHost);
-            selectStmt.setString(3, senderUser);
-            selectStmt.setString(4, senderHost);
-            selectRS = selectStmt.executeQuery();
-            if (selectRS.next()) {
-                // This address was already in the list
-                return true;
-            }
-
-            // check for wildcard domain entries
-            selectStmt = conn.prepareStatement(selectByPK);
-
-            selectStmt.setString(1, recipientUser);
-            selectStmt.setString(2, recipientHost);
-            selectStmt.setString(3, "*");
-            selectStmt.setString(4, senderHost);
-            selectRS = selectStmt.executeQuery();
-            if (selectRS.next()) {
-                // This address was already in the list
-                return true;
+    
+                selectStmt.setString(1, recipientUser);
+                selectStmt.setString(2, recipientHost);
+                selectStmt.setString(3, "*");
+                selectStmt.setString(4, senderHost);
+                selectRS = selectStmt.executeQuery();
+                if (selectRS.next()) {
+                    // This address was already in the list
+                    return true;
+                }
+            } finally {
+                jdbcUtil.closeJDBCResultSet(selectRS);
+                jdbcUtil.closeJDBCStatement(selectStmt);
             }
 
-            // check for wildcard recipient domain entries
-            selectStmt = conn.prepareStatement(selectByPK);
-
-            selectStmt.setString(1, "*");
-            selectStmt.setString(2, recipientHost);
-            selectStmt.setString(3, senderUser);
-            selectStmt.setString(4, senderHost);
-            selectRS = selectStmt.executeQuery();
-            if (selectRS.next()) {
-                // This address was already in the list
-                return true;
+            try {
+                // check for wildcard recipient domain entries
+                selectStmt = conn.prepareStatement(selectByPK);
+    
+                selectStmt.setString(1, "*");
+                selectStmt.setString(2, recipientHost);
+                selectStmt.setString(3, senderUser);
+                selectStmt.setString(4, senderHost);
+                selectRS = selectStmt.executeQuery();
+                if (selectRS.next()) {
+                    // This address was already in the list
+                    return true;
+                }
+            } finally {
+                jdbcUtil.closeJDBCResultSet(selectRS);
+                jdbcUtil.closeJDBCStatement(selectStmt);
             }
-            // check for wildcard domain entries on both
-            selectStmt = conn.prepareStatement(selectByPK);
 
-            selectStmt.setString(1, "*");
-            selectStmt.setString(2, recipientHost);
-            selectStmt.setString(3, "*");
-            selectStmt.setString(4, senderHost);
-            selectRS = selectStmt.executeQuery();
-            if (selectRS.next()) {
-                // This address was already in the list
-                return true;
+            try {
+                    // check for wildcard domain entries on both
+                selectStmt = conn.prepareStatement(selectByPK);
+    
+                selectStmt.setString(1, "*");
+                selectStmt.setString(2, recipientHost);
+                selectStmt.setString(3, "*");
+                selectStmt.setString(4, senderHost);
+                selectRS = selectStmt.executeQuery();
+                if (selectRS.next()) {
+                    // This address was already in the list
+                    return true;
+                }
+            } finally {
+                jdbcUtil.closeJDBCResultSet(selectRS);
+                jdbcUtil.closeJDBCStatement(selectStmt);
             }
         } catch (SQLException sqle) {
             log("Error accessing database", sqle);
             throw new MessagingException("Exception thrown", sqle);
         } finally {
-            theJDBCUtil.closeJDBCResultSet(selectRS);
-            theJDBCUtil.closeJDBCStatement(selectStmt);
             theJDBCUtil.closeJDBCConnection(conn);
         }
         return false;

Modified: james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/matchers/NetworkIsInWhitelist.java
URL: http://svn.apache.org/viewvc/james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/matchers/NetworkIsInWhitelist.java?rev=1722812&r1=1722811&r2=1722812&view=diff
==============================================================================
--- james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/matchers/NetworkIsInWhitelist.java (original)
+++ james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/matchers/NetworkIsInWhitelist.java Mon Jan  4 09:40:15 2016
@@ -91,27 +91,37 @@ public class NetworkIsInWhitelist extend
                 conn = datasource.getConnection();
             }
 
-            if (selectStmt == null) {
-                selectStmt = conn.prepareStatement(selectNetworks);
-            }
-            selectStmt.setString(1, recipientUser);
-            selectStmt.setString(2, recipientHost);
-            selectRS = selectStmt.executeQuery();
             List<String> nets = new ArrayList<String>();
-            while (selectRS.next()) {
-                nets.add(selectRS.getString(1));
+            try {
+                if (selectStmt == null) {
+                    selectStmt = conn.prepareStatement(selectNetworks);
+                }
+                selectStmt.setString(1, recipientUser);
+                selectStmt.setString(2, recipientHost);
+                selectRS = selectStmt.executeQuery();
+                while (selectRS.next()) {
+                    nets.add(selectRS.getString(1));
+                }
+            } finally {
+                jdbcUtil.closeJDBCResultSet(selectRS);
+                jdbcUtil.closeJDBCStatement(selectStmt);
             }
             NetMatcher matcher = new NetMatcher(nets, dns);
             boolean matched = matcher.matchInetNetwork(mail.getRemoteAddr());
 
             if (!matched) {
-                selectStmt = conn.prepareStatement(selectNetworks);
-                selectStmt.setString(1, "*");
-                selectStmt.setString(2, recipientHost);
-                selectRS = selectStmt.executeQuery();
-                nets = new ArrayList<String>();
-                while (selectRS.next()) {
-                    nets.add(selectRS.getString(1));
+                try {
+                    selectStmt = conn.prepareStatement(selectNetworks);
+                    selectStmt.setString(1, "*");
+                    selectStmt.setString(2, recipientHost);
+                    selectRS = selectStmt.executeQuery();
+                    nets = new ArrayList<String>();
+                    while (selectRS.next()) {
+                        nets.add(selectRS.getString(1));
+                    }
+                } finally {
+                    jdbcUtil.closeJDBCResultSet(selectRS);
+                    jdbcUtil.closeJDBCStatement(selectStmt);
                 }
                 matcher = new NetMatcher(nets, dns);
                 matched = matcher.matchInetNetwork(mail.getRemoteAddr());
@@ -121,8 +131,6 @@ public class NetworkIsInWhitelist extend
             log("Error accessing database", sqle);
             throw new MessagingException("Exception thrown", sqle);
         } finally {
-            theJDBCUtil.closeJDBCResultSet(selectRS);
-            theJDBCUtil.closeJDBCStatement(selectStmt);
             theJDBCUtil.closeJDBCConnection(conn);
         }
     }

Modified: james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/util/MailetContextLog.java
URL: http://svn.apache.org/viewvc/james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/util/MailetContextLog.java?rev=1722812&r1=1722811&r2=1722812&view=diff
==============================================================================
--- james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/util/MailetContextLog.java (original)
+++ james/project/trunk/server/mailet/mailets/src/main/java/org/apache/james/transport/util/MailetContextLog.java Mon Jan  4 09:40:15 2016
@@ -178,7 +178,7 @@ public class MailetContextLog implements
     /**
      * Do nothing
      */
-    public void trace(String format, Object[] argArray) {
+    public void trace(String format, Object... argArray) {
     }
 
     /**
@@ -215,7 +215,7 @@ public class MailetContextLog implements
     /**
      * Do nothing
      */
-    public void trace(Marker marker, String format, Object[] argArray) {
+    public void trace(Marker marker, String format, Object... argArray) {
     }
 
     /**
@@ -246,7 +246,7 @@ public class MailetContextLog implements
     /**
      * @see org.slf4j.Logger#debug(java.lang.String, java.lang.Object[])
      */
-    public void debug(String format, Object[] argArray) {
+    public void debug(String format, Object... argArray) {
         if (isDebug) {
             debugLog(format, argArray);
         }
@@ -292,7 +292,7 @@ public class MailetContextLog implements
      * @see org.slf4j.Logger#debug(org.slf4j.Marker, java.lang.String,
      * java.lang.Object[])
      */
-    public void debug(Marker marker, String format, Object[] argArray) {
+    public void debug(Marker marker, String format, Object... argArray) {
         if (isDebug) {
             debugLog(marker, format, argArray);
         }
@@ -326,7 +326,7 @@ public class MailetContextLog implements
     /**
      * @see org.slf4j.Logger#info(java.lang.String, java.lang.Object[])
      */
-    public void info(String format, Object[] argArray) {
+    public void info(String format, Object... argArray) {
         infoLog(format, argArray);
     }
 
@@ -364,7 +364,7 @@ public class MailetContextLog implements
      * @see org.slf4j.Logger#info(org.slf4j.Marker, java.lang.String,
      * java.lang.Object[])
      */
-    public void info(Marker marker, String format, Object[] argArray) {
+    public void info(Marker marker, String format, Object... argArray) {
         infoLog(marker, format, argArray);
     }
 
@@ -386,7 +386,7 @@ public class MailetContextLog implements
     /**
      * @see org.slf4j.Logger#warn(java.lang.String, java.lang.Object[])
      */
-    public void warn(String format, Object[] argArray) {
+    public void warn(String format, Object... argArray) {
         warnLog(format, argArray);
     }
 
@@ -432,7 +432,7 @@ public class MailetContextLog implements
      * @see org.slf4j.Logger#warn(org.slf4j.Marker, java.lang.String,
      * java.lang.Object[])
      */
-    public void warn(Marker marker, String format, Object[] argArray) {
+    public void warn(Marker marker, String format, Object... argArray) {
         warnLog(marker, format, argArray);
     }
 
@@ -462,7 +462,7 @@ public class MailetContextLog implements
     /**
      * @see org.slf4j.Logger#error(java.lang.String, java.lang.Object[])
      */
-    public void error(String format, Object[] argArray) {
+    public void error(String format, Object... argArray) {
         errorLog(format, argArray);
     }
 
@@ -500,7 +500,7 @@ public class MailetContextLog implements
      * @see org.slf4j.Logger#error(org.slf4j.Marker, java.lang.String,
      * java.lang.Object[])
      */
-    public void error(Marker marker, String format, Object[] argArray) {
+    public void error(Marker marker, String format, Object... argArray) {
         errorLog(marker, format, argArray);
     }
 
@@ -534,13 +534,9 @@ public class MailetContextLog implements
             s.append("]");
         }
         if (t != null) {
-            // TODO Use with apache-mailet-2.5
-            // context.log(MailetContext.LogLevel.DEBUG, s.toString(), t);
-            context.log(s.toString(), t);
+            context.log(MailetContext.LogLevel.DEBUG, s.toString(), t);
         } else {
-            // TODO Use with apache-mailet-2.5
-            // context.log(MailetContext.LogLevel.DEBUG, s.toString());
-            context.log(s.toString());
+            context.log(MailetContext.LogLevel.DEBUG, s.toString());
         }
     }
 
@@ -565,13 +561,9 @@ public class MailetContextLog implements
             s.append("]");
         }
         if (t != null) {
-            // TODO Use with apache-mailet-2.5
-            // context.log(MailetContext.LogLevel.DEBUG, s.toString(), t);
-            context.log(s.toString(), t);
+             context.log(MailetContext.LogLevel.DEBUG, s.toString(), t);
         } else {
-            // TODO Use with apache-mailet-2.5
-            // context.log(MailetContext.LogLevel.DEBUG, s.toString());
-            context.log(s.toString());
+            context.log(MailetContext.LogLevel.DEBUG, s.toString());
         }
     }
 
@@ -597,13 +589,9 @@ public class MailetContextLog implements
             s.append("]");
         }
         if (t != null) {
-            // TODO Use with apache-mailet-2.5
-            // context.log(MailetContext.LogLevel.ERROR, s.toString(), t);
-            context.log(s.toString(), t);
+            context.log(MailetContext.LogLevel.ERROR, s.toString(), t);
         } else {
-            // TODO Use with apache-mailet-2.5
-            // context.log(MailetContext.LogLevel.ERROR, s.toString());
-            context.log(s.toString());
+            context.log(MailetContext.LogLevel.ERROR, s.toString());
         }
     }
 
@@ -628,13 +616,9 @@ public class MailetContextLog implements
             s.append("]");
         }
         if (t != null) {
-            // TODO Use with apache-mailet-2.5
-            // context.log(MailetContext.LogLevel.ERROR, s.toString(), t);
-            context.log(s.toString(), t);
+            context.log(MailetContext.LogLevel.ERROR, s.toString(), t);
         } else {
-            // TODO Use with apache-mailet-2.5
-            // context.log(MailetContext.LogLevel.ERROR, s.toString());
-            context.log(s.toString());
+            context.log(MailetContext.LogLevel.ERROR, s.toString());
         }
     }
 
@@ -660,13 +644,9 @@ public class MailetContextLog implements
             s.append("]");
         }
         if (t != null) {
-            // TODO Use with apache-mailet-2.5
-            // context.log(MailetContext.LogLevel.INFO, s.toString(), t);
-            context.log(s.toString(), t);
+            context.log(MailetContext.LogLevel.INFO, s.toString(), t);
         } else {
-            // TODO Use with apache-mailet-2.5
-            // context.log(MailetContext.LogLevel.INFO, s.toString());
-            context.log(s.toString());
+            context.log(MailetContext.LogLevel.INFO, s.toString());
         }
     }
 
@@ -691,13 +671,9 @@ public class MailetContextLog implements
             s.append("]");
         }
         if (t != null) {
-            // TODO Use with apache-mailet-2.5
-            // context.log(MailetContext.LogLevel.INFO, s.toString(), t);
-            context.log(s.toString(), t);
+            context.log(MailetContext.LogLevel.INFO, s.toString(), t);
         } else {
-            // TODO Use with apache-mailet-2.5
-            // context.log(MailetContext.LogLevel.INFO, s.toString());
-            context.log(s.toString());
+            context.log(MailetContext.LogLevel.INFO, s.toString());
         }
     }
 
@@ -723,13 +699,9 @@ public class MailetContextLog implements
             s.append("]");
         }
         if (t != null) {
-            // TODO Use with apache-mailet-2.5
-            // context.log(MailetContext.LogLevel.WARN, s.toString(), t);
-            context.log(s.toString(), t);
+            context.log(MailetContext.LogLevel.WARN, s.toString(), t);
         } else {
-            // TODO Use with apache-mailet-2.5
-            // context.log(MailetContext.LogLevel.WARN, s.toString());
-            context.log(s.toString());
+            context.log(MailetContext.LogLevel.WARN, s.toString());
         }
     }
 
@@ -754,13 +726,9 @@ public class MailetContextLog implements
             s.append("]");
         }
         if (t != null) {
-            // TODO Use with apache-mailet-2.5
-            // context.log(MailetContext.LogLevel.WARN, s.toString(), t);
-            context.log(s.toString(), t);
+            context.log(MailetContext.LogLevel.WARN, s.toString(), t);
         } else {
-            // TODO Use with apache-mailet-2.5
-            // context.log(MailetContext.LogLevel.WARN, s.toString());
-            context.log(s.toString());
+            context.log(MailetContext.LogLevel.WARN, s.toString());
         }
     }
 }

Modified: james/project/trunk/server/mailet/mailets/src/test/java/org/apache/james/samples/mailets/HelloWorldMailet.java
URL: http://svn.apache.org/viewvc/james/project/trunk/server/mailet/mailets/src/test/java/org/apache/james/samples/mailets/HelloWorldMailet.java?rev=1722812&r1=1722811&r2=1722812&view=diff
==============================================================================
--- james/project/trunk/server/mailet/mailets/src/test/java/org/apache/james/samples/mailets/HelloWorldMailet.java (original)
+++ james/project/trunk/server/mailet/mailets/src/test/java/org/apache/james/samples/mailets/HelloWorldMailet.java Mon Jan  4 09:40:15 2016
@@ -19,10 +19,12 @@
 package org.apache.james.samples.mailets;
 
 import javax.mail.MessagingException;
+
 import org.apache.mailet.Mail;
 import org.apache.mailet.Mailet;
 import org.apache.mailet.MailetConfig;
 import org.apache.mailet.MailetContext;
+import org.apache.mailet.MailetContext.LogLevel;
 
 /**
  * Simply logs a message.
@@ -53,7 +55,7 @@ public class HelloWorldMailet implements
     @Override
     public void service(Mail mail) throws MessagingException {
         MailetContext context = config.getMailetContext();
-        context.log("Hello, World!");
-        context.log("You have mail from " + mail.getSender().getLocalPart());
+        context.log(LogLevel.INFO, "Hello, World!");
+        context.log(LogLevel.INFO, "You have mail from " + mail.getSender().getLocalPart());
     }
 }

Modified: james/project/trunk/server/mailet/mailets/src/test/java/org/apache/james/samples/mailets/InstrumentationMailet.java
URL: http://svn.apache.org/viewvc/james/project/trunk/server/mailet/mailets/src/test/java/org/apache/james/samples/mailets/InstrumentationMailet.java?rev=1722812&r1=1722811&r2=1722812&view=diff
==============================================================================
--- james/project/trunk/server/mailet/mailets/src/test/java/org/apache/james/samples/mailets/InstrumentationMailet.java (original)
+++ james/project/trunk/server/mailet/mailets/src/test/java/org/apache/james/samples/mailets/InstrumentationMailet.java Mon Jan  4 09:40:15 2016
@@ -22,6 +22,7 @@ import java.io.IOException;
 import java.util.Collection;
 import java.util.Enumeration;
 import java.util.Iterator;
+
 import javax.mail.Address;
 import javax.mail.Flags;
 import javax.mail.Flags.Flag;
@@ -31,7 +32,9 @@ import javax.mail.internet.InternetAddre
 import javax.mail.internet.MimeMessage;
 import javax.mail.internet.MimeMessage.RecipientType;
 import javax.mail.internet.NewsAddress;
+
 import org.apache.mailet.*;
+import org.apache.mailet.MailetContext.LogLevel;
 
 /**
  * Mailet just prints out the details of a message. Sometimes Useful for
@@ -63,44 +66,46 @@ public class InstrumentationMailet imple
     @Override
     public void service(Mail mail) throws MessagingException {
         MailetContext context = config.getMailetContext();
-        context.log("######## MAIL STARTS");
-        context.log("");
+        context.log(LogLevel.INFO, "######## MAIL STARTS");
+        context.log(LogLevel.INFO, "");
 
         MimeMessage message = mail.getMessage();
 
-        context.log("Mail named: " + mail.getName());
+        context.log(LogLevel.INFO, "Mail named: " + mail.getName());
 
-        for (Iterator it = mail.getAttributeNames(); it.hasNext();) {
-            String attributeName = (String) it.next();
-            context.log("Attribute " + attributeName);
-        }
-        context.log("Message size: " + mail.getMessageSize());
-        context.log("Last updated: " + mail.getLastUpdated());
-        context.log("Remote Address: " + mail.getRemoteAddr());
-        context.log("Remote Host: " + mail.getRemoteHost());
-        context.log("State: " + mail.getState());
-        context.log("Sender host: " + mail.getSender().getDomain());
-        context.log("Sender user: " + mail.getSender().getLocalPart());
+        for (Iterator<String> it = mail.getAttributeNames(); it.hasNext();) {
+            String attributeName = it.next();
+            context.log(LogLevel.INFO, "Attribute " + attributeName);
+        }
+        context.log(LogLevel.INFO, "Message size: " + mail.getMessageSize());
+        context.log(LogLevel.INFO, "Last updated: " + mail.getLastUpdated());
+        context.log(LogLevel.INFO, "Remote Address: " + mail.getRemoteAddr());
+        context.log(LogLevel.INFO, "Remote Host: " + mail.getRemoteHost());
+        context.log(LogLevel.INFO, "State: " + mail.getState());
+        context.log(LogLevel.INFO, "Sender host: " + mail.getSender().getDomain());
+        context.log(LogLevel.INFO, "Sender user: " + mail.getSender().getLocalPart());
         Collection<MailAddress> recipients = mail.getRecipients();
         for (MailAddress address : recipients) {
-            context.log("Recipient: " + address.getLocalPart() + "@" + address.getDomain());
+            context.log(LogLevel.INFO, "Recipient: " + address.getLocalPart() + "@" + address.getDomain());
         }
 
-        context.log("Subject: " + message.getSubject());
-        context.log("MessageID: " + message.getMessageID());
-        context.log("Received: " + message.getReceivedDate());
-        context.log("Sent: " + message.getSentDate());
+        context.log(LogLevel.INFO, "Subject: " + message.getSubject());
+        context.log(LogLevel.INFO, "MessageID: " + message.getMessageID());
+        context.log(LogLevel.INFO, "Received: " + message.getReceivedDate());
+        context.log(LogLevel.INFO, "Sent: " + message.getSentDate());
 
-        Enumeration allHeadersLines = message.getAllHeaderLines();
+        @SuppressWarnings("unchecked")
+        Enumeration<String> allHeadersLines = message.getAllHeaderLines();
         while (allHeadersLines.hasMoreElements()) {
             String header = (String) allHeadersLines.nextElement();
-            context.log("Header Line:= " + header);
+            context.log(LogLevel.INFO, "Header Line:= " + header);
         }
 
-        Enumeration allHeadersEnumeration = message.getAllHeaders();
+        @SuppressWarnings("unchecked")
+        Enumeration<Header> allHeadersEnumeration = message.getAllHeaders();
         while (allHeadersEnumeration.hasMoreElements()) {
             Header header = (Header) allHeadersEnumeration.nextElement();
-            context.log("Header: " + header.getName() + "=" + header.getValue());
+            context.log(LogLevel.INFO, "Header: " + header.getName() + "=" + header.getValue());
         }
 
         Address[] to = message.getRecipients(RecipientType.TO);
@@ -113,27 +118,27 @@ public class InstrumentationMailet imple
         Flags flags = message.getFlags();
         Flag[] systemFlags = flags.getSystemFlags();
         for (Flag systemFlag : systemFlags) {
-            context.log("System Flag:" + systemFlag);
+            context.log(LogLevel.INFO, "System Flag:" + systemFlag);
         }
         String[] userFlags = flags.getUserFlags();
         for (String userFlag : userFlags) {
-            context.log("User flag: " + userFlag);
+            context.log(LogLevel.INFO, "User flag: " + userFlag);
         }
 
         String mimeType = message.getContentType();
-        context.log("Mime type: " + mimeType);
+        context.log(LogLevel.INFO, "Mime type: " + mimeType);
         if ("text/plain".equals(mimeType)) {
             try {
                 Object content = message.getContent();
-                context.log("Content: " + content);
+                context.log(LogLevel.INFO, "Content: " + content);
             } catch (IOException e) {
                 e.printStackTrace();
             }
 
         }
 
-        context.log("");
-        context.log("######## MAIL ENDS");
+        context.log(LogLevel.INFO, "");
+        context.log(LogLevel.INFO, "######## MAIL ENDS");
     }
 
     private void printAddresses(Address[] addresses, String prefix) {
@@ -141,10 +146,10 @@ public class InstrumentationMailet imple
         for (Address address1 : addresses) {
             if (address1 instanceof InternetAddress) {
                 InternetAddress address = (InternetAddress) address1;
-                context.log(prefix + address.getPersonal() + "@" + address.getAddress());
+                context.log(LogLevel.INFO, prefix + address.getPersonal() + "@" + address.getAddress());
             } else if (address1 instanceof NewsAddress) {
                 NewsAddress address = (NewsAddress) address1;
-                context.log(prefix + address.getNewsgroup() + "@" + address.getHost());
+                context.log(LogLevel.INFO, prefix + address.getNewsgroup() + "@" + address.getHost());
             }
         }
     }

Modified: james/project/trunk/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/RecordingMailContext.java
URL: http://svn.apache.org/viewvc/james/project/trunk/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/RecordingMailContext.java?rev=1722812&r1=1722811&r2=1722812&view=diff
==============================================================================
--- james/project/trunk/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/RecordingMailContext.java (original)
+++ james/project/trunk/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/RecordingMailContext.java Mon Jan  4 09:40:15 2016
@@ -51,12 +51,12 @@ public class RecordingMailContext extend
     }
 
     @Override
-    public void sendMail(MailAddress sender, Collection recipients, MimeMessage msg) throws MessagingException {
+    public void sendMail(MailAddress sender, Collection<MailAddress> recipients, MimeMessage msg) throws MessagingException {
         sendmails.add(new SendMailEvent(msg, sender, recipients));
     }
 
     @Override
-    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 {
         sendmails.add(new SendMailEvent(msg, sender, recipients, state));
     }
 

Modified: james/project/trunk/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/managesieve/ManageSieveMailetTestCase.java
URL: http://svn.apache.org/viewvc/james/project/trunk/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/managesieve/ManageSieveMailetTestCase.java?rev=1722812&r1=1722811&r2=1722812&view=diff
==============================================================================
--- james/project/trunk/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/managesieve/ManageSieveMailetTestCase.java (original)
+++ james/project/trunk/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/managesieve/ManageSieveMailetTestCase.java Mon Jan  4 09:40:15 2016
@@ -25,7 +25,20 @@ import static org.mockito.Mockito.doThro
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
-import com.google.common.collect.Lists;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.util.Properties;
+
+import javax.activation.DataHandler;
+import javax.mail.MessagingException;
+import javax.mail.Session;
+import javax.mail.internet.InternetAddress;
+import javax.mail.internet.MimeBodyPart;
+import javax.mail.internet.MimeMessage;
+import javax.mail.internet.MimeMessage.RecipientType;
+import javax.mail.internet.MimeMultipart;
+import javax.mail.util.ByteArrayDataSource;
+
 import org.apache.commons.io.IOUtils;
 import org.apache.james.managesieve.api.SieveParser;
 import org.apache.james.managesieve.api.SyntaxException;
@@ -41,18 +54,7 @@ import org.apache.mailet.base.test.FakeM
 import org.junit.Before;
 import org.junit.Test;
 
-import javax.activation.DataHandler;
-import javax.mail.MessagingException;
-import javax.mail.Session;
-import javax.mail.internet.InternetAddress;
-import javax.mail.internet.MimeBodyPart;
-import javax.mail.internet.MimeMessage;
-import javax.mail.internet.MimeMessage.RecipientType;
-import javax.mail.internet.MimeMultipart;
-import javax.mail.util.ByteArrayDataSource;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.util.Properties;
+import com.google.common.collect.Lists;
 
 public class ManageSieveMailetTestCase {
 

Modified: james/project/trunk/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/AbstractRemoteAddrInNetworkTest.java
URL: http://svn.apache.org/viewvc/james/project/trunk/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/AbstractRemoteAddrInNetworkTest.java?rev=1722812&r1=1722811&r2=1722812&view=diff
==============================================================================
--- james/project/trunk/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/AbstractRemoteAddrInNetworkTest.java (original)
+++ james/project/trunk/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/AbstractRemoteAddrInNetworkTest.java Mon Jan  4 09:40:15 2016
@@ -75,7 +75,7 @@ public abstract class AbstractRemoteAddr
             }
 
             @Override
-            public void setRecipients(Collection recipients) {
+            public void setRecipients(Collection<MailAddress> recipients) {
                 throw new UnsupportedOperationException("Unimplemented mock service");
             }
 
@@ -125,7 +125,7 @@ public abstract class AbstractRemoteAddr
             }
 
             @Override
-            public Iterator getAttributeNames() {
+            public Iterator<String> getAttributeNames() {
                 throw new UnsupportedOperationException("Unimplemented mock service");
             }
 

Modified: james/project/trunk/server/protocols/fetchmail/pom.xml
URL: http://svn.apache.org/viewvc/james/project/trunk/server/protocols/fetchmail/pom.xml?rev=1722812&r1=1722811&r2=1722812&view=diff
==============================================================================
--- james/project/trunk/server/protocols/fetchmail/pom.xml (original)
+++ james/project/trunk/server/protocols/fetchmail/pom.xml Mon Jan  4 09:40:15 2016
@@ -28,7 +28,6 @@
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
-    <groupId>org.apache.james</groupId>
     <artifactId>james-server-fetchmail</artifactId>
     <packaging>bundle</packaging>
 

Modified: james/project/trunk/server/protocols/fetchmail/src/main/java/org/apache/james/fetchmail/FetchMail.java
URL: http://svn.apache.org/viewvc/james/project/trunk/server/protocols/fetchmail/src/main/java/org/apache/james/fetchmail/FetchMail.java?rev=1722812&r1=1722811&r2=1722812&view=diff
==============================================================================
--- james/project/trunk/server/protocols/fetchmail/src/main/java/org/apache/james/fetchmail/FetchMail.java (original)
+++ james/project/trunk/server/protocols/fetchmail/src/main/java/org/apache/james/fetchmail/FetchMail.java Mon Jan  4 09:40:15 2016
@@ -404,7 +404,6 @@ public class FetchMail implements Runnab
      *
      * @see org.apache.james.lifecycle.api.Configurable#configure(HierarchicalConfiguration)
      */
-    @SuppressWarnings("unchecked")
     public void configure(HierarchicalConfiguration configuration) throws ConfigurationException {
         // Set any Session parameters passed in the Configuration
         setSessionParameters(configuration);
@@ -506,14 +505,13 @@ public class FetchMail implements Runnab
         }
     }
 
-    @SuppressWarnings("unchecked")
     private void logJavaMailProperties() {
         // if debugging, list the JavaMail property key/value pairs
         // for this Session
         if (logger.isDebugEnabled()) {
             logger.debug("Session properties:");
             Properties properties = getSession().getProperties();
-            Enumeration e = properties.keys();
+            Enumeration<Object> e = properties.keys();
             while (e.hasMoreElements()) {
                 String key = (String) e.nextElement();
                 String val = (String) properties.get(key);
@@ -849,7 +847,6 @@ public class FetchMail implements Runnab
      * @param configuration The configuration containing the parameters
      * @throws ConfigurationException
      */
-    @SuppressWarnings("unchecked")
     protected void setSessionParameters(HierarchicalConfiguration configuration) {
 
         if (configuration.getKeys("javaMailProperties.property").hasNext()) {

Modified: james/project/trunk/server/protocols/fetchmail/src/main/java/org/apache/james/fetchmail/FetchScheduler.java
URL: http://svn.apache.org/viewvc/james/project/trunk/server/protocols/fetchmail/src/main/java/org/apache/james/fetchmail/FetchScheduler.java?rev=1722812&r1=1722811&r2=1722812&view=diff
==============================================================================
--- james/project/trunk/server/protocols/fetchmail/src/main/java/org/apache/james/fetchmail/FetchScheduler.java (original)
+++ james/project/trunk/server/protocols/fetchmail/src/main/java/org/apache/james/fetchmail/FetchScheduler.java Mon Jan  4 09:40:15 2016
@@ -27,7 +27,6 @@ import java.util.concurrent.TimeUnit;
 
 import javax.annotation.PostConstruct;
 import javax.annotation.PreDestroy;
-import javax.annotation.Resource;
 import javax.inject.Inject;
 
 import org.apache.commons.configuration.ConfigurationException;
@@ -104,7 +103,6 @@ public class FetchScheduler implements F
         this.conf = config;
     }
 
-    @SuppressWarnings("unchecked")
     @PostConstruct
     public void init() throws Exception {
         enabled = conf.getBoolean("[@enabled]", false);

Modified: james/project/trunk/server/protocols/fetchmail/src/main/java/org/apache/james/fetchmail/MessageProcessor.java
URL: http://svn.apache.org/viewvc/james/project/trunk/server/protocols/fetchmail/src/main/java/org/apache/james/fetchmail/MessageProcessor.java?rev=1722812&r1=1722811&r2=1722812&view=diff
==============================================================================
--- james/project/trunk/server/protocols/fetchmail/src/main/java/org/apache/james/fetchmail/MessageProcessor.java (original)
+++ james/project/trunk/server/protocols/fetchmail/src/main/java/org/apache/james/fetchmail/MessageProcessor.java Mon Jan  4 09:40:15 2016
@@ -32,6 +32,7 @@ import javax.mail.MessagingException;
 import javax.mail.internet.InternetAddress;
 import javax.mail.internet.MimeMessage;
 import javax.mail.internet.ParseException;
+
 import java.net.UnknownHostException;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -561,15 +562,15 @@ public class MessageProcessor extends Pr
      * @return MimeMessage
      * @throws MessagingException
      */
-    @SuppressWarnings("unchecked")
     protected MimeMessage createEmptyMessage() throws MessagingException {
         // Create an empty messsage
         MimeMessage messageOut = new MimeMessage(getSession());
 
         // Propogate the headers and subject
-        Enumeration headersInEnum = getMessageIn().getAllHeaderLines();
+        @SuppressWarnings("unchecked")
+        Enumeration<String> headersInEnum = getMessageIn().getAllHeaderLines();
         while (headersInEnum.hasMoreElements())
-            messageOut.addHeaderLine((String) headersInEnum.nextElement());
+            messageOut.addHeaderLine(headersInEnum.nextElement());
         messageOut.setSubject(getMessageIn().getSubject());
 
         // Add empty text
@@ -618,7 +619,6 @@ public class MessageProcessor extends Pr
         return mail;
     }
 
-    @SuppressWarnings("unchecked")
     private void logMailCreation(MailImpl mail) {
         if (getLogger().isDebugEnabled()) {
             StringBuilder messageBuffer = new StringBuilder("Created mail with name: ");
@@ -876,12 +876,12 @@ public class MessageProcessor extends Pr
      *
      * @return boolean
      */
-    @SuppressWarnings("unchecked")
     protected boolean isBouncing() throws MessagingException {
-        Enumeration enumeration = getMessageIn().getMatchingHeaderLines(new String[]{"X-fetched-from"});
+        @SuppressWarnings("unchecked")
+        Enumeration<String> enumeration = getMessageIn().getMatchingHeaderLines(new String[]{"X-fetched-from"});
         int count = 0;
         while (enumeration.hasMoreElements()) {
-            String header = (String) enumeration.nextElement();
+            String header = enumeration.nextElement();
             if (header.equals(getFetchTaskName()))
                 count++;
         }
@@ -894,7 +894,6 @@ public class MessageProcessor extends Pr
      * @param mail
      * @throws MessagingException
      */
-    @SuppressWarnings("unchecked")
     protected void sendMail(Mail mail) throws MessagingException {
         // queue the mail
         getMailQueue().enQueue(mail);
@@ -927,7 +926,6 @@ public class MessageProcessor extends Pr
      * @return String
      */
 
-    @SuppressWarnings("unchecked")
     protected String getEnvelopeRecipient(MimeMessage msg) throws MessagingException {
         String res = getCustomRecipientHeader();
         if (res != null && res.length() > 0) {
@@ -940,9 +938,10 @@ public class MessageProcessor extends Pr
             }
         } else {
             try {
-                Enumeration enumeration = msg.getMatchingHeaderLines(new String[]{"Received"});
+                @SuppressWarnings("unchecked")
+                Enumeration<String> enumeration = msg.getMatchingHeaderLines(new String[]{"Received"});
                 while (enumeration.hasMoreElements()) {
-                    String received = (String) enumeration.nextElement();
+                    String received = enumeration.nextElement();
 
                     int nextSearchAt = 0;
                     int i = 0;

Modified: james/project/trunk/server/protocols/jmap-integration-testing/pom.xml
URL: http://svn.apache.org/viewvc/james/project/trunk/server/protocols/jmap-integration-testing/pom.xml?rev=1722812&r1=1722811&r2=1722812&view=diff
==============================================================================
--- james/project/trunk/server/protocols/jmap-integration-testing/pom.xml (original)
+++ james/project/trunk/server/protocols/jmap-integration-testing/pom.xml Mon Jan  4 09:40:15 2016
@@ -28,7 +28,6 @@
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
-    <groupId>org.apache.james</groupId>
     <artifactId>james-server-jmap-integration-testing</artifactId>
     <packaging>jar</packaging>
 

Modified: james/project/trunk/server/protocols/jmap/pom.xml
URL: http://svn.apache.org/viewvc/james/project/trunk/server/protocols/jmap/pom.xml?rev=1722812&r1=1722811&r2=1722812&view=diff
==============================================================================
--- james/project/trunk/server/protocols/jmap/pom.xml (original)
+++ james/project/trunk/server/protocols/jmap/pom.xml Mon Jan  4 09:40:15 2016
@@ -28,7 +28,6 @@
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
-    <groupId>org.apache.james</groupId>
     <artifactId>james-server-jmap</artifactId>
     <packaging>jar</packaging>
 

Modified: james/project/trunk/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/GetMessageListMethod.java
URL: http://svn.apache.org/viewvc/james/project/trunk/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/GetMessageListMethod.java?rev=1722812&r1=1722811&r2=1722812&view=diff
==============================================================================
--- james/project/trunk/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/GetMessageListMethod.java (original)
+++ james/project/trunk/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/GetMessageListMethod.java Mon Jan  4 09:40:15 2016
@@ -28,7 +28,6 @@ import java.util.stream.Stream;
 import javax.inject.Inject;
 import javax.inject.Named;
 
-import org.apache.james.jmap.methods.Method.Response.Name;
 import org.apache.james.jmap.model.FilterCondition;
 import org.apache.james.jmap.model.GetMessageListRequest;
 import org.apache.james.jmap.model.GetMessageListResponse;

Modified: james/project/trunk/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/GetMessagesMethod.java
URL: http://svn.apache.org/viewvc/james/project/trunk/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/GetMessagesMethod.java?rev=1722812&r1=1722811&r2=1722812&view=diff
==============================================================================
--- james/project/trunk/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/GetMessagesMethod.java (original)
+++ james/project/trunk/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/GetMessagesMethod.java Mon Jan  4 09:40:15 2016
@@ -29,13 +29,10 @@ import java.util.stream.StreamSupport;
 import javax.inject.Inject;
 
 import org.apache.commons.lang.NotImplementedException;
-import org.apache.james.jmap.methods.Method.Response.Name;
 import org.apache.james.jmap.model.GetMessagesRequest;
 import org.apache.james.jmap.model.GetMessagesResponse;
 import org.apache.james.jmap.model.Message;
-import org.apache.james.jmap.model.Message.Builder;
 import org.apache.james.jmap.model.MessageId;
-import org.apache.james.jmap.model.Property;
 import org.apache.james.mailbox.MailboxSession;
 import org.apache.james.mailbox.model.MailboxPath;
 import org.apache.james.mailbox.model.MessageRange;
@@ -47,11 +44,8 @@ import org.apache.james.mailbox.store.ma
 import org.javatuples.Pair;
 
 import com.github.fge.lambdas.Throwing;
-import com.github.fge.lambdas.functions.ThrowingBiFunction;
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
 
 public class GetMessagesMethod<Id extends MailboxId> implements Method {
 
@@ -94,12 +88,10 @@ public class GetMessagesMethod<Id extend
         
         Function<MessageId, Stream<Pair<org.apache.james.mailbox.store.mail.model.Message<Id>, MailboxPath>>> loadMessages = loadMessage(mailboxSession);
         Function<Pair<org.apache.james.mailbox.store.mail.model.Message<Id>, MailboxPath>, Message> convertToJmapMessage = toJmapMessage(mailboxSession);
-        Function<Message, Message> filterFields = new JmapMessageFactory(getMessagesRequest);
         
         List<Message> result = getMessagesRequest.getIds().stream()
             .flatMap(loadMessages)
             .map(convertToJmapMessage)
-//            .map(filterFields)
             .collect(Collectors.toList());
 
         return GetMessagesResponse.builder().messages(result).expectedMessageIds(getMessagesRequest.getIds()).build();
@@ -143,34 +135,4 @@ public class GetMessagesMethod<Id extend
         MailboxPath mailboxPath = value.getValue1();
         return targetStream.map(x -> Pair.with(x, mailboxPath));
     }
-
-    private static class JmapMessageFactory implements Function<Message, Message> {
-        
-        public ImmutableMap<Property, ThrowingBiFunction<Message, Message.Builder, Message.Builder>> fieldCopiers = 
-                ImmutableMap.of(
-                        Property.id, (message, builder) -> builder.id(message.getId()),
-                        Property.subject, (message, builder) -> builder.subject(message.getSubject())
-                        );
-        
-        private final ImmutableList<Property> selectedProperties;
-        
-        public JmapMessageFactory(GetMessagesRequest messagesRequest) {
-            this.selectedProperties = messagesRequest.getProperties().orElse(Property.all());
-        }
-
-        @Override
-        public Message apply(Message input) {
-            Message.Builder builder = Message.builder();
-            
-            selectCopiers().forEach(f -> f.apply(input, builder));
-            
-            return builder.build();
-        }
-
-        private Stream<ThrowingBiFunction<Message, Builder, Builder>> selectCopiers() {
-            return Stream.concat(selectedProperties.stream(), Stream.of(Property.id))
-                .filter(fieldCopiers::containsKey)
-                .map(fieldCopiers::get);
-        }   
-    }
 }




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