Skip to content

Package: SMTPAddressFailedException

SMTPAddressFailedException

nameinstructionbranchcomplexitylinemethod
SMTPAddressFailedException(InternetAddress, String, int, String)
M: 13 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
getAddress()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getCommand()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getReturnCode()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

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.SendFailedException;
20: import jakarta.mail.internet.InternetAddress;
21:
22: /**
23: * This exception is thrown when the message cannot be sent. <p>
24: *
25: * The exception includes the address to which the message could not be
26: * sent. This will usually appear in a chained list of exceptions,
27: * one per address, attached to a top level SendFailedException that
28: * aggregates all the addresses.
29: *
30: * @since JavaMail 1.3.2
31: */
32:
33: public class SMTPAddressFailedException extends SendFailedException {
34: protected InternetAddress addr;        // address that failed
35: protected String cmd;                // command issued to server
36: protected int rc;                        // return code from SMTP server
37:
38: private static final long serialVersionUID = 804831199768630097L;
39:
40: /**
41: * Constructs an SMTPAddressFailedException with the specified
42: * address, return code, and error string.
43: *
44: * @param addr        the address that failed
45: * @param cmd        the command that was sent to the SMTP server
46: * @param rc        the SMTP return code indicating the failure
47: * @param err        the error string from the SMTP server
48: */
49: public SMTPAddressFailedException(InternetAddress addr, String cmd, int rc,
50:                                 String err) {
51:         super(err);
52:         this.addr = addr;
53:         this.cmd = cmd;
54:         this.rc = rc;
55: }
56:
57: /**
58: * Return the address that failed.
59: *
60: * @return        the address
61: */
62: public InternetAddress getAddress() {
63:         return addr;
64: }
65:
66: /**
67: * Return the command that failed.
68: *
69: * @return        the command
70: */
71: public String getCommand() {
72:         return cmd;
73: }
74:
75:
76: /**
77: * Return the return code from the SMTP server that indicates the
78: * reason for the failure. See
79: * <A HREF="http://www.ietf.org/rfc/rfc821.txt">RFC 821</A>
80: * for interpretation of the return code.
81: *
82: * @return        the return code
83: */
84: public int getReturnCode() {
85:         return rc;
86: }
87: }