james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r800743 - in /james/jsieve/trunk/main/src/main/java/org/apache/jsieve: Arguments.java TestList.java commands/If.java
Date Tue, 04 Aug 2009 12:15:01 GMT
Author: rdonkin
Date: Tue Aug  4 12:15:00 2009
New Revision: 800743

URL: http://svn.apache.org/viewvc?rev=800743&view=rev
Log:
JSIEVE-71 Improve readability by factoring methods directly into subjects https://issues.apache.org/jira/browse/JSIEVE-71

Modified:
    james/jsieve/trunk/main/src/main/java/org/apache/jsieve/Arguments.java
    james/jsieve/trunk/main/src/main/java/org/apache/jsieve/TestList.java
    james/jsieve/trunk/main/src/main/java/org/apache/jsieve/commands/If.java

Modified: james/jsieve/trunk/main/src/main/java/org/apache/jsieve/Arguments.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/main/src/main/java/org/apache/jsieve/Arguments.java?rev=800743&r1=800742&r2=800743&view=diff
==============================================================================
--- james/jsieve/trunk/main/src/main/java/org/apache/jsieve/Arguments.java (original)
+++ james/jsieve/trunk/main/src/main/java/org/apache/jsieve/Arguments.java Tue Aug  4 12:15:00
2009
@@ -95,7 +95,7 @@
      */
     public boolean hasTests() {
         TestList testList = getTestListBasic();
-        return null != testList && testList.getTests().size() == 0;
+        return null != testList && !testList.isEmpty();
     }
 
     /**

Modified: james/jsieve/trunk/main/src/main/java/org/apache/jsieve/TestList.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/main/src/main/java/org/apache/jsieve/TestList.java?rev=800743&r1=800742&r2=800743&view=diff
==============================================================================
--- james/jsieve/trunk/main/src/main/java/org/apache/jsieve/TestList.java (original)
+++ james/jsieve/trunk/main/src/main/java/org/apache/jsieve/TestList.java Tue Aug  4 12:15:00
2009
@@ -140,4 +140,13 @@
         return "TEST LIST: " + fieldTests;
     }
 
+    /**
+     * Is this test list empty?
+     * @return true when empty,
+     * false when tests exist
+     */
+    public boolean isEmpty() {
+        return fieldTests.isEmpty();
+    }
+
 }

Modified: james/jsieve/trunk/main/src/main/java/org/apache/jsieve/commands/If.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/main/src/main/java/org/apache/jsieve/commands/If.java?rev=800743&r1=800742&r2=800743&view=diff
==============================================================================
--- james/jsieve/trunk/main/src/main/java/org/apache/jsieve/commands/If.java (original)
+++ james/jsieve/trunk/main/src/main/java/org/apache/jsieve/commands/If.java Tue Aug  4 12:15:00
2009
@@ -22,7 +22,6 @@
 import org.apache.jsieve.Arguments;
 import org.apache.jsieve.Block;
 import org.apache.jsieve.SieveContext;
-import org.apache.jsieve.TestList;
 import org.apache.jsieve.exception.SieveException;
 import org.apache.jsieve.mail.MailAdapter;
 
@@ -61,16 +60,14 @@
             return Boolean.FALSE;
 
         // Run the tests
-        Boolean isTestPassed = (Boolean) arguments.getTestList().execute(mail,
-                context);
+        final boolean isTestPassed = arguments.getTestList().allTestsPass(mail,context);
 
         // If the tests answered TRUE, execute the Block
-        if (isTestPassed.booleanValue())
+        if (isTestPassed)
             execute(mail, block, context);
 
         // Update the ConditionManager
-        context.getConditionManager().setIfTestResult(
-                isTestPassed.booleanValue());
+        context.getConditionManager().setIfTestResult(isTestPassed);
 
         // Return the result
         return isTestPassed;
@@ -82,8 +79,7 @@
      */
     protected void validateArguments(Arguments arguments, SieveContext context)
             throws SieveException {
-        TestList testList = arguments.getTestList();
-        if (null == testList || testList.getTests().isEmpty())
+        if (!arguments.hasTests())
             throw context.getCoordinate().syntaxException("Expecting a Test");
     }
 



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


Mime
View raw message