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 no...@apache.org on 2010/07/01 22:07:00 UTC

svn commit: r959763 - /james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/fastfail/JDBCGreylistHandler.java

Author: norman
Date: Thu Jul  1 20:07:00 2010
New Revision: 959763

URL: http://svn.apache.org/viewvc?rev=959763&view=rev
Log:
Correctly parse the whitelistedNetworks config (JAMES-1024)

Modified:
    james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/fastfail/JDBCGreylistHandler.java

Modified: james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/fastfail/JDBCGreylistHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/fastfail/JDBCGreylistHandler.java?rev=959763&r1=959762&r2=959763&view=diff
==============================================================================
--- james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/fastfail/JDBCGreylistHandler.java (original)
+++ james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/fastfail/JDBCGreylistHandler.java Thu Jul  1 20:07:00 2010
@@ -30,6 +30,7 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 
 import javax.annotation.PostConstruct;
@@ -207,7 +208,6 @@ public class JDBCGreylistHandler extends
     /**
      * @see org.apache.james.protocols.smtp.core.fastfail.AbstractGreylistHandler#configure(org.apache.commons.configuration.Configuration)
      */
-    @SuppressWarnings("unchecked")
 	public void configure(HierarchicalConfiguration handlerConfiguration) throws ConfigurationException {
 	    try {
             setTempBlockTime(handlerConfiguration.getString("tempBlockTime"));
@@ -229,13 +229,16 @@ public class JDBCGreylistHandler extends
         } catch (NumberFormatException e) {
             throw new ConfigurationException(e.getMessage());
         }
-        Collection<String> nets  = handlerConfiguration.getList("whitelistedNetworks");
+        String nets  = handlerConfiguration.getString("whitelistedNetworks");
         if (nets != null) {
-
-            if (nets != null) {
-                setWhiteListedNetworks( new NetMatcher(nets ,dnsService));
-                serviceLog.info("Whitelisted addresses: " + getWhiteListedNetworks().toString());
+            String[] whitelistArray = nets.split(",");
+            List<String> wList = new ArrayList<String>(whitelistArray.length);
+            for (int i = 0 ; i< whitelistArray.length; i++) {
+                wList.add(whitelistArray[i].trim());
             }
+            setWhiteListedNetworks( new NetMatcher(wList ,dnsService));
+            serviceLog.info("Whitelisted addresses: " + getWhiteListedNetworks().toString());
+            
         }    	
         String configRepositoryPath = handlerConfiguration.getString("repositoryPath", null);
         if (configRepositoryPath != null) {



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