View Javadoc

1   /**
2    *
3    * Copyright 2003-2005 The Apache Software Foundation
4    *
5    *  Licensed under the Apache License, Version 2.0 (the "License");
6    *  you may not use this file except in compliance with the License.
7    *  You may obtain a copy of the License at
8    *
9    *     http://www.apache.org/licenses/LICENSE-2.0
10   *
11   *  Unless required by applicable law or agreed to in writing, software
12   *  distributed under the License is distributed on an "AS IS" BASIS,
13   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   *  See the License for the specific language governing permissions and
15   *  limitations under the License.
16   */
17  
18  package org.apache.geronimo.javamail.transport.smtp;
19  
20  import javax.mail.Address;
21  import javax.mail.SendFailedException;
22  
23  public class SMTPSendFailedException extends SendFailedException {
24      // the failing command
25      protected String cmd;
26  
27      // the error code for the failure
28      protected int rc;
29  
30      /**
31       * Constructor for an SMTPSendFaileException.
32       * 
33       * @param cmd
34       *            The failing command string.
35       * @param rc
36       *            The error code for the failing command.
37       * @param err
38       *            An error message for the exception.
39       * @param ex
40       *            Any associated nested exception.
41       * @param vs
42       *            An array of valid, sent addresses.
43       * @param vus
44       *            An array of addresses that were valid, but were unsent.
45       * @param inv
46       *            An array of addresses deemed invalid.
47       */
48      SMTPSendFailedException(java.lang.String cmd, int rc, java.lang.String err, java.lang.Exception ex, Address[] vs,
49              Address[] vus, Address[] inv) {
50          super(err, ex, vs, vus, inv);
51          this.cmd = cmd;
52          this.rc = rc;
53      }
54  
55      /**
56       * Get the failing command string for the exception.
57       * 
58       * @return The string value of the failing command.
59       */
60      public String getCommand() {
61          return cmd;
62      }
63  
64      /**
65       * The failing command return code.
66       * 
67       * @return The failure return code.
68       */
69      public int getReturnCode() {
70          return rc;
71      }
72  }