Author: rdonkin
Date: Tue Sep 15 13:34:09 2009
New Revision: 815324
URL: http://svn.apache.org/viewvc?rev=815324&view=rev
Log:
Generification
Modified:
james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/TLDLookup.java
james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/URIScanner.java
Modified:
james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/TLDLookup.java
URL:
http://svn.apache.org/viewvc/james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/TLDLookup.java?rev=815324&r1=815323&r2=815324&view=diff
==============================================================================
---
james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/TLDLookup.java
(original)
+++
james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/TLDLookup.java
Tue Sep 15 13:34:09 2009
@@ -45,10 +45,10 @@
static private final String[] multiPartTLDs = initMultiPartTLDs();
/** A set of all known two-part TLDs */
- static private final HashSet twoPartTLDs = initTwoPartTLDs();
+ static private final HashSet<String> twoPartTLDs = initTwoPartTLDs();
/** A set of all known three-part TLDs */
- static private final HashSet threePartTLDs = initThreePartTLDs();
+ static private final HashSet<String> threePartTLDs = initThreePartTLDs();
/** controls testing/debug output */
static private boolean testing = false;
@@ -80,8 +80,8 @@
*
* @return a HashSet containing all known two-part TLDs
*/
- static private HashSet initTwoPartTLDs() {
- HashSet set = new HashSet(900);
+ static private HashSet<String> initTwoPartTLDs() {
+ HashSet<String> set = new HashSet<String>(900);
for (int i=0; i<multiPartTLDs.length; i++) {
try {
if (multiPartTLDs[i].matches("^"+tld2+"$")) {
@@ -101,8 +101,8 @@
*
* @return a HashSet containing all known three-part TLDs
*/
- static private HashSet initThreePartTLDs() {
- HashSet set = new HashSet();
+ static private HashSet<String> initThreePartTLDs() {
+ HashSet<String> set = new HashSet<String>();
for (int i=0; i<multiPartTLDs.length; i++) {
try {
if (multiPartTLDs[i].matches("^"+tld3+"$")) {
Modified:
james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/URIScanner.java
URL:
http://svn.apache.org/viewvc/james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/URIScanner.java?rev=815324&r1=815323&r2=815324&view=diff
==============================================================================
---
james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/URIScanner.java
(original)
+++
james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/URIScanner.java
Tue Sep 15 13:34:09 2009
@@ -22,11 +22,11 @@
package org.apache.james.smtpserver.core.filter.fastfail;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.regex.*;
import java.net.URI;
import java.net.URISyntaxException;
+import java.util.HashSet;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
public class URIScanner {
@@ -184,11 +184,11 @@
* @param content a character sequence to be scanned for URIs
* @return newDomains the domains which were extracted
*/
- static public HashSet scanContentForDomains(HashSet domains, CharSequence
content) {
- HashSet newDomains = new HashSet();
- HashSet hosts = scanContentForHosts(content);
- for (Iterator i = hosts.iterator(); i.hasNext();) {
- String domain = domainFromHost((String) i.next());
+ static public HashSet<String> scanContentForDomains(HashSet<String>
domains, CharSequence content) {
+ HashSet<String> newDomains = new HashSet<String>();
+ HashSet<String> hosts = scanContentForHosts(content);
+ for (final String host:hosts) {
+ final String domain = domainFromHost(host);
if (null != domain) {
if (false == domains.contains(domain)) {
@@ -206,8 +206,8 @@
* @param content a character sequence to be scanned for URIs
* @return a HashSet containing host strings
*/
- static protected HashSet scanContentForHosts(CharSequence content) {
- HashSet set = new HashSet();
+ static protected HashSet<String> scanContentForHosts(CharSequence content)
{
+ HashSet<String> set = new HashSet<String>();
// look for URIs
Matcher mat = uriPattern.matcher(content);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]