1   /****************************************************************
2    * Licensed to the Apache Software Foundation (ASF) under one   *
3    * or more contributor license agreements.  See the NOTICE file *
4    * distributed with this work for additional information        *
5    * regarding copyright ownership.  The ASF licenses this file   *
6    * to you under the Apache License, Version 2.0 (the            *
7    * "License"); you may not use this file except in compliance   *
8    * with the License.  You may obtain a copy of the License at   *
9    *                                                              *
10   *   http://www.apache.org/licenses/LICENSE-2.0                 *
11   *                                                              *
12   * Unless required by applicable law or agreed to in writing,   *
13   * software distributed under the License is distributed on an  *
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
15   * KIND, either express or implied.  See the License for the    *
16   * specific language governing permissions and limitations      *
17   * under the License.                                           *
18   ****************************************************************/
19  
20  package org.apache.jsieve.commands;
21  
22  import org.apache.jsieve.Arguments;
23  import org.apache.jsieve.Block;
24  import org.apache.jsieve.ExecutableCommand;
25  import org.apache.jsieve.SieveContext;
26  import org.apache.jsieve.exception.SieveException;
27  import org.apache.jsieve.mail.MailAdapter;
28  
29  /**
30   * Class ThrowTestException implements a Sieve Command to throw a TestException.
31   */
32  public class ThrowTestException implements ExecutableCommand {
33  
34      /**
35       * Class TestException
36       */
37      public class TestException extends SieveException {
38  
39          /**
40           * Constructor for TestException.
41           */
42          public TestException() {
43              super();
44          }
45  
46          /**
47           * Constructor for TestException.
48           * 
49           * @param message
50           */
51          public TestException(String message) {
52              super(message);
53          }
54  
55          /**
56           * Constructor for TestException.
57           * 
58           * @param message
59           * @param cause
60           */
61          public TestException(String message, Throwable cause) {
62              super(message, cause);
63          }
64  
65          /**
66           * Constructor for TestException.
67           * 
68           * @param cause
69           */
70          public TestException(Throwable cause) {
71              super(cause);
72          }
73  
74      }
75  
76      /**
77       * Constructor for ThrowTestException.
78       */
79      public ThrowTestException() {
80          super();
81      }
82  
83      /**
84       * @see org.apache.jsieve.ExecutableCommand#execute(MailAdapter, Arguments,
85       *      Block, SieveContext)
86       */
87      public Object execute(MailAdapter mail, Arguments arguments, Block block,
88              SieveContext context) throws SieveException {
89          throw new TestException();
90      }
91  
92  }