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.MessagingException;
21 import javax.mail.internet.InternetAddress;
22
23 public class SMTPAddressFailedException extends MessagingException {
24
25 InternetAddress addr;
26
27
28 protected String cmd;
29
30
31 protected int rc;
32
33 /**
34 * Constructor for an SMTPAddressFailingException.
35 *
36 * @param addr
37 * The failing address.
38 * @param cmd
39 * The failing command string.
40 * @param rc
41 * The error code for the command.
42 * @param err
43 * An error message for the exception.
44 */
45 SMTPAddressFailedException(InternetAddress addr, java.lang.String cmd, int rc, java.lang.String err) {
46 super(err);
47 this.cmd = cmd;
48 this.rc = rc;
49 this.addr = addr;
50 }
51
52 /**
53 * Get the failing command string for the exception.
54 *
55 * @return The string value of the failing command.
56 */
57 public String getCommand() {
58 return cmd;
59 }
60
61 /**
62 * The failing command return code.
63 *
64 * @return The failure return code.
65 */
66 public int getReturnCode() {
67 return rc;
68 }
69
70 /**
71 * Retrieve the internet address associated with this exception.
72 *
73 * @return The provided InternetAddress object.
74 */
75 public InternetAddress getAddress() {
76 return addr;
77 }
78 }