james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r526572 - in /james/jsieve/trunk/src/main/java/org/apache/jsieve: ./ commands/ commands/optional/
Date Sun, 08 Apr 2007 16:30:27 GMT
Author: rdonkin
Date: Sun Apr  8 09:30:22 2007
New Revision: 526572

URL: http://svn.apache.org/viewvc?view=rev&rev=526572
Log:
Added line and column information to command information.

Modified:
    james/jsieve/trunk/src/main/java/org/apache/jsieve/ScriptCoordinate.java
    james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/AbstractActionCommand.java
    james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/AbstractPrologCommand.java
    james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/Else.java
    james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/Elsif.java
    james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/If.java
    james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/optional/Reject.java

Modified: james/jsieve/trunk/src/main/java/org/apache/jsieve/ScriptCoordinate.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/src/main/java/org/apache/jsieve/ScriptCoordinate.java?view=diff&rev=526572&r1=526571&r2=526572
==============================================================================
--- james/jsieve/trunk/src/main/java/org/apache/jsieve/ScriptCoordinate.java (original)
+++ james/jsieve/trunk/src/main/java/org/apache/jsieve/ScriptCoordinate.java Sun Apr  8 09:30:22
2007
@@ -95,6 +95,27 @@
         return result;
     }
     
+    
+    /**
+     * Creates a command exception based on the given message
+     * containing details of the script position.
+     * The message should end with a full stop.
+     * @param message <code>CharSequence</code> containing the base message,
+     * not null
+     * @return <code>CommandException</code> with details of the script position
+     * appended to the message, not null
+     */
+    public CommandException commandException(CharSequence message) {
+        final Log logger = Logger.getLog();
+        if (logger.isWarnEnabled()) {
+            logger.warn(message);
+        }
+        logDiagnosticsInfo(logger);
+        final String fullMessage = addStartLineAndColumn(message);
+        final CommandException result = new CommandException(fullMessage);
+        return result;
+    }
+    
     /**
      * Appends a standard position phrase to the given message.
      * This message should end with a full stop.

Modified: james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/AbstractActionCommand.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/AbstractActionCommand.java?view=diff&rev=526572&r1=526571&r2=526572
==============================================================================
--- james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/AbstractActionCommand.java
(original)
+++ james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/AbstractActionCommand.java
Sun Apr  8 09:30:22 2007
@@ -60,7 +60,7 @@
     protected void validateState(SieveContext context) throws CommandException
     {
         if (CommandStateManager.getInstance().isRejected())
-            throw new CommandException("Cannot perform Actions on a rejected message.");
+            throw context.getCoordinate().commandException("Cannot perform Actions on a rejected
message.");
     }    
     
 }

Modified: james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/AbstractPrologCommand.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/AbstractPrologCommand.java?view=diff&rev=526572&r1=526571&r2=526572
==============================================================================
--- james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/AbstractPrologCommand.java
(original)
+++ james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/AbstractPrologCommand.java
Sun Apr  8 09:30:22 2007
@@ -51,7 +51,7 @@
         super.validateState(context);
         
         if (!(CommandStateManager.getInstance().isInProlog()))
-            throw new CommandException("Invalid state for a prolog command.");     
+            throw context.getCoordinate().commandException("Invalid state for a prolog command.");
    
     }
     
 

Modified: james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/Else.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/Else.java?view=diff&rev=526572&r1=526571&r2=526572
==============================================================================
--- james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/Else.java (original)
+++ james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/Else.java Sun Apr  8 09:30:22
2007
@@ -55,7 +55,7 @@
     {
         // Check Syntax
         if (!ConditionManager.getInstance().isElseAllowed())
-            throw new CommandException("Unexpected Command: \"else\".");
+            throw context.getCoordinate().commandException("Unexpected Command: \"else\".");
 
         // Check Runnable                
         if (!ConditionManager.getInstance().isElseRunnable())

Modified: james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/Elsif.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/Elsif.java?view=diff&rev=526572&r1=526571&r2=526572
==============================================================================
--- james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/Elsif.java (original)
+++ james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/Elsif.java Sun Apr  8 09:30:22
2007
@@ -54,7 +54,7 @@
     {
         // Check Syntax
         if (!ConditionManager.getInstance().isElsifAllowed())
-            throw new CommandException("Unexpected Command: \"elsif\".");         
+            throw context.getCoordinate().commandException("Unexpected Command: \"elsif\".");
        
 
         // Check Runnable                
         if (!ConditionManager.getInstance().isElsifRunnable())

Modified: james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/If.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/If.java?view=diff&rev=526572&r1=526571&r2=526572
==============================================================================
--- james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/If.java (original)
+++ james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/If.java Sun Apr  8 09:30:22
2007
@@ -53,7 +53,7 @@
     {
         // Check Syntax
         if (!ConditionManager.getInstance().isIfAllowed())
-            throw new CommandException(
+            throw context.getCoordinate().commandException(
                 "Unexpected Command: \"if\".");  
                 
         // Check Runnable                

Modified: james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/optional/Reject.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/optional/Reject.java?view=diff&rev=526572&r1=526571&r2=526572
==============================================================================
--- james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/optional/Reject.java (original)
+++ james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/optional/Reject.java Sun Apr
 8 09:30:22 2007
@@ -82,7 +82,7 @@
         super.validateState(context);
 
         if (CommandStateManager.getInstance().isHasActions())
-            throw new CommandException("The \"reject\" command is not allowed with other
Action Commands");
+            throw context.getCoordinate().commandException("The \"reject\" command is not
allowed with other Action Commands");
     }
     
     /**



---------------------------------------------------------------------
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