Package: SMTPAddressSucceededException
SMTPAddressSucceededException
name | instruction | branch | complexity | line | method | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
SMTPAddressSucceededException(InternetAddress, String, int, String) |
|
|
|
|
|
||||||||||||||||||||
getAddress() |
|
|
|
|
|
||||||||||||||||||||
getCommand() |
|
|
|
|
|
||||||||||||||||||||
getReturnCode() |
|
|
|
|
|
Coverage
1: /*
2: * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved.
3: *
4: * This program and the accompanying materials are made available under the
5: * terms of the Eclipse Public License v. 2.0, which is available at
6: * http://www.eclipse.org/legal/epl-2.0.
7: *
8: * This Source Code may also be made available under the following Secondary
9: * Licenses when the conditions for such availability set forth in the
10: * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
11: * version 2 with the GNU Classpath Exception, which is available at
12: * https://www.gnu.org/software/classpath/license.html.
13: *
14: * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15: */
16:
17: package org.eclipse.angus.mail.smtp;
18:
19: import jakarta.mail.MessagingException;
20: import jakarta.mail.internet.InternetAddress;
21:
22: /**
23: * This exception is chained off a SendFailedException when the
24: * <code>mail.smtp.reportsuccess</code> property is true. It
25: * indicates an address to which the message was sent. The command
26: * will be an SMTP RCPT command and the return code will be the
27: * return code from that command.
28: *
29: * @since JavaMail 1.3.2
30: */
31:
32: public class SMTPAddressSucceededException extends MessagingException {
33: protected InternetAddress addr;        // address that succeeded
34: protected String cmd;                // command issued to server
35: protected int rc;                        // return code from SMTP server
36:
37: private static final long serialVersionUID = -1168335848623096749L;
38:
39: /**
40: * Constructs an SMTPAddressSucceededException with the specified
41: * address, return code, and error string.
42: *
43: * @param addr        the address that succeeded
44: * @param cmd        the command that was sent to the SMTP server
45: * @param rc        the SMTP return code indicating the success
46: * @param err        the error string from the SMTP server
47: */
48: public SMTPAddressSucceededException(InternetAddress addr,
49:                                 String cmd, int rc, String err) {
50:         super(err);
51:         this.addr = addr;
52:         this.cmd = cmd;
53:         this.rc = rc;
54: }
55:
56: /**
57: * Return the address that succeeded.
58: *
59: * @return        the address
60: */
61: public InternetAddress getAddress() {
62:         return addr;
63: }
64:
65: /**
66: * Return the command that succeeded.
67: *
68: * @return        the command
69: */
70: public String getCommand() {
71:         return cmd;
72: }
73:
74:
75: /**
76: * Return the return code from the SMTP server that indicates the
77: * reason for the success. See
78: * <A HREF="http://www.ietf.org/rfc/rfc821.txt">RFC 821</A>
79: * for interpretation of the return code.
80: *
81: * @return        the return code
82: */
83: public int getReturnCode() {
84:         return rc;
85: }
86: }