Author: norman
Date: Sat May 27 11:23:51 2006
New Revision: 409853

URL: http://svn.apache.org/viewvc?rev=409853&view=rev
Log:
-Code cleanup
-Add more javadocs

Modified:
    james/jspf/trunk/src/main/java/org/apache/james/jspf/SPF.java
    james/jspf/trunk/src/main/java/org/apache/james/jspf/core/SPF1Data.java
    james/jspf/trunk/src/main/java/org/apache/james/jspf/macro/MacroExpand.java
    james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/AMechanism.java
    
james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/ExistsMechanism.java
    james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/MXMechanism.java
    james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/PTRMechanism.java

Modified: james/jspf/trunk/src/main/java/org/apache/james/jspf/SPF.java
URL: 
http://svn.apache.org/viewvc/james/jspf/trunk/src/main/java/org/apache/james/jspf/SPF.java?rev=409853&r1=409852&r2=409853&view=diff
==============================================================================
--- james/jspf/trunk/src/main/java/org/apache/james/jspf/SPF.java (original)
+++ james/jspf/trunk/src/main/java/org/apache/james/jspf/SPF.java Sat May 27 
11:23:51 2006
@@ -74,8 +74,8 @@
      *            The mailFrom which was provided
      * @param hostName
      *            The hostname which was provided as HELO/EHLO
-     * @return result. Possible results are: pass, neutral, fail, deny,
-     *         softfail, error,temperror none
+     * @return result. Possible results are: pass, neutral, fail,
+     *         softfail, error,temperror, none
      */
     public SPFResult checkSPF(String ipAddress, String mailFrom, String 
hostName) {
         SPF1Data spfData = null;

Modified: 
james/jspf/trunk/src/main/java/org/apache/james/jspf/core/SPF1Data.java
URL: 
http://svn.apache.org/viewvc/james/jspf/trunk/src/main/java/org/apache/james/jspf/core/SPF1Data.java?rev=409853&r1=409852&r2=409853&view=diff
==============================================================================
--- james/jspf/trunk/src/main/java/org/apache/james/jspf/core/SPF1Data.java 
(original)
+++ james/jspf/trunk/src/main/java/org/apache/james/jspf/core/SPF1Data.java Sat 
May 27 11:23:51 2006
@@ -208,6 +208,7 @@
 
     /**
      * Get the ipAddress which was used to connect
+     * 
      * @return ipAddres 
      */
     public String getIpAddress() {
@@ -268,18 +269,20 @@
     }
 
     /**
-     * Get currentDepth
+     * Get currentDepth 
      * 
-     * @return currentDepth
+     * @return currentDepth The currentDeph
      */
     public int getCurrentDepth() {
         return currentDepth;
     }
 
     /**
-     * Set currentDepth
+     * Set currentDepth which is just processed. This will called from
+     * modifiers/mechanismn
      * 
      * @param currentDepth
+     *            The currentDepth
      */
     public void setCurrentDepth(int currentDepth) {
         this.currentDepth = currentDepth;
@@ -288,7 +291,8 @@
     /**
      * Get the maxDepth
      * 
-     * @return maxDepth
+     * @return maxDepth The maximum mechanismn/modifier which are allowed to
+     *         proccessed
      */
     public int getMaxDepth() {
         return MAX_DEPTH;
@@ -297,16 +301,26 @@
     /**
      * Set the currentDomain
      * 
-     * @param domain
+     * @param domain The current used domain
      */
     public void setCurrentDomain(String domain) {
         this.currentDomain = domain;
     }
 
+    /**
+     * Get the used DNSService
+     * 
+     * @return dnsProbe The DNSService
+     */
     public DNSService getDnsProbe() {
         return dnsProbe;
     }
 
+    /**
+     * Set the DNSService which will be used
+     * 
+     * @param dnsProbe The DNSService
+     */
     public void setDnsProbe(DNSService dnsProbe) {
         this.dnsProbe = dnsProbe;
     }
@@ -370,6 +384,7 @@
     
     /**
      * Get set to true if the explanation should be ignored
+     * 
      * @param ignoreExplanation
      */
     public void setIgnoreExplanation(boolean ignoreExplanation) {
@@ -378,6 +393,7 @@
     
     /**
      * Return true if the explanation should be ignored
+     * 
      * @return true of false
      */
     public boolean ignoreExplanation() {

Modified: 
james/jspf/trunk/src/main/java/org/apache/james/jspf/macro/MacroExpand.java
URL: 
http://svn.apache.org/viewvc/james/jspf/trunk/src/main/java/org/apache/james/jspf/macro/MacroExpand.java?rev=409853&r1=409852&r2=409853&view=diff
==============================================================================
--- james/jspf/trunk/src/main/java/org/apache/james/jspf/macro/MacroExpand.java 
(original)
+++ james/jspf/trunk/src/main/java/org/apache/james/jspf/macro/MacroExpand.java 
Sat May 27 11:23:51 2006
@@ -311,10 +311,20 @@
         return reversed;
     }
 
+    /**
+     * @see #subset(ArrayList, int)
+     */
     private String subset(ArrayList data) {
         return subset(data, data.size());
     }
 
+    /**
+     * Convert a ArrayList to a String which holds the entries seperated by 
dots
+     * 
+     * @param data The ArrayList which should be converted
+     * @param length The ArrayLength
+     * @return A String which holds all entries seperated by dots
+     */
     private String subset(ArrayList data, int length) {
 
         StringBuffer buildString = new StringBuffer();

Modified: 
james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/AMechanism.java
URL: 
http://svn.apache.org/viewvc/james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/AMechanism.java?rev=409853&r1=409852&r2=409853&view=diff
==============================================================================
--- james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/AMechanism.java 
(original)
+++ james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/AMechanism.java 
Sat May 27 11:23:51 2006
@@ -74,8 +74,6 @@
                     if (checkAddressList(checkAddress, addressList)) {
                         return true;
                     }
-                } catch (TempErrorException e) {
-                    throw new TempErrorException(e.getMessage());
                 } catch (Exception e) {
                     // no a records just return null
                     return false;
@@ -90,10 +88,8 @@
                     if (checkAddressList(checkAddress, addressList)) {
                         return true;
                     }
-                } catch (TempErrorException e) {
-                    throw new TempErrorException(e.getMessage());
                 } catch (Exception e) {
-                    // no a records just return null
+                    // no aaaa records just return null
                     return false;
                 }
 

Modified: 
james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/ExistsMechanism.java
URL: 
http://svn.apache.org/viewvc/james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/ExistsMechanism.java?rev=409853&r1=409852&r2=409853&view=diff
==============================================================================
--- 
james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/ExistsMechanism.java 
(original)
+++ 
james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/ExistsMechanism.java 
Sat May 27 11:23:51 2006
@@ -59,11 +59,10 @@
 
         try {
             aRecords = spfData.getDnsProbe().getARecords(host, 32);
-        } catch (TempErrorException e) {
-            throw new TempErrorException(e.getMessage());
         } catch (Exception e) {
             return false;
         }
+        
         if (aRecords.size() > 0) {
             return true;
         }

Modified: 
james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/MXMechanism.java
URL: 
http://svn.apache.org/viewvc/james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/MXMechanism.java?rev=409853&r1=409852&r2=409853&view=diff
==============================================================================
--- james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/MXMechanism.java 
(original)
+++ james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/MXMechanism.java 
Sat May 27 11:23:51 2006
@@ -64,8 +64,6 @@
                 if (checkAddressList(checkAddress, addressList)) {
                     return true;
                 }
-            } catch (TempErrorException e) {
-                throw new TempErrorException(e.getMessage());
             } catch (Exception e) {
                 // no a records just return null
                 return false;

Modified: 
james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/PTRMechanism.java
URL: 
http://svn.apache.org/viewvc/james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/PTRMechanism.java?rev=409853&r1=409852&r2=409853&view=diff
==============================================================================
--- 
james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/PTRMechanism.java 
(original)
+++ 
james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/PTRMechanism.java 
Sat May 27 11:23:51 2006
@@ -56,34 +56,32 @@
         // Get the right host.
         String host = expandHost(spfData);
 
-        try {
-            // Get PTR Records for the ipAddress which is provided by SPF1Data
-            List domainList = spfData.getDnsProbe().getPTRRecords(
-                    spfData.getIpAddress());
-            for (int i = 0; i < domainList.size(); i++) {
+        
+        // Get PTR Records for the ipAddress which is provided by SPF1Data
+        List domainList = spfData.getDnsProbe().getPTRRecords(
+                spfData.getIpAddress());
+        for (int i = 0; i < domainList.size(); i++) {
 
-                // Get a record for this
-                List aList = spfData.getDnsProbe().getARecords(
-                        (String) domainList.get(i), 32);
-                for (int j = 0; j < aList.size(); j++) {
-                    compareIP = (IPAddr) aList.get(j);
-                    if (compareIP.toString().equals(spfData.getIpAddress())) {
-                        validatedHosts.add(domainList.get(i));
-                    }
+            // Get a record for this
+            List aList = spfData.getDnsProbe().getARecords(
+                    (String) domainList.get(i), 32);
+            for (int j = 0; j < aList.size(); j++) {
+                compareIP = (IPAddr) aList.get(j);
+                if (compareIP.toString().equals(spfData.getIpAddress())) {
+                    validatedHosts.add(domainList.get(i));
                 }
             }
+        }
 
-            // Check if we match one of this ptr!
-            for (int j = 0; j < validatedHosts.size(); j++) {
-                compareDomain = (String) validatedHosts.get(j);
-                if (compareDomain.equals(host)
-                        || compareDomain.endsWith("." + host)) {
-                    return true;
-                }
+        // Check if we match one of this ptr!
+        for (int j = 0; j < validatedHosts.size(); j++) {
+            compareDomain = (String) validatedHosts.get(j);
+            if (compareDomain.equals(host)
+                    || compareDomain.endsWith("." + host)) {
+                return true;
             }
-        } catch (TempErrorException e) {
-            throw new TempErrorException(e.getMessage());
         }
+        
 
         return false;
 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to