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