KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > mail > SendFailedException


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the "License"). You may not use this file except
5  * in compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * glassfish/bootstrap/legal/CDDLv1.0.txt or
9  * https://glassfish.dev.java.net/public/CDDLv1.0.html.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * HEADER in each file and include the License file at
15  * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
16  * add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your
18  * own identifying information: Portions Copyright [yyyy]
19  * [name of copyright owner]
20  */

21
22 /*
23  * @(#)SendFailedException.java 1.10 05/08/29
24  *
25  * Copyright 1997-2005 Sun Microsystems, Inc. All Rights Reserved.
26  */

27
28 package javax.mail;
29
30 /**
31  * This exception is thrown when the message cannot be sent.<p>
32  *
33  * The exception includes those addresses to which the message could not be
34  * sent as well as the valid addresses to which the message was sent and
35  * valid addresses to which the message was not sent.
36  *
37  * @see javax.mail.Transport#send
38  * @see javax.mail.Transport#sendMessage
39  * @see javax.mail.event.TransportEvent
40  *
41  * @author John Mani
42  * @author Max Spivak
43  */

44
45 public class SendFailedException extends MessagingException JavaDoc {
46     transient protected Address JavaDoc[] invalid;
47     transient protected Address JavaDoc[] validSent;
48     transient protected Address JavaDoc[] validUnsent;
49
50     private static final long serialVersionUID = -6457531621682372913L;
51
52     /**
53      * Constructs a SendFailedException with no detail message.
54      */

55     public SendFailedException() {
56     super();
57     }
58
59     /**
60      * Constructs a SendFailedException with the specified detail message.
61      * @param s the detail message
62      */

63     public SendFailedException(String JavaDoc s) {
64     super(s);
65     }
66
67     /**
68      * Constructs a SendFailedException with the specified
69      * Exception and detail message. The specified exception is chained
70      * to this exception.
71      * @param s the detail message
72      * @param e the embedded exception
73      * @see #getNextException
74      * @see #setNextException
75      */

76     public SendFailedException(String JavaDoc s, Exception JavaDoc e) {
77     super(s, e);
78     }
79
80
81     /**
82      * Constructs a SendFailedException with the specified string
83      * and the specified address objects.
84      *
85      * @param msg the detail message
86      * @param ex the embedded exception
87      * @param validSent valid addresses to which message was sent
88      * @param validUnsent valid addresses to which message was not sent
89      * @param invalid the invalid addresses
90      * @see #getNextException
91      * @see #setNextException
92      */

93     public SendFailedException(String JavaDoc msg, Exception JavaDoc ex, Address JavaDoc[] validSent,
94                    Address JavaDoc[] validUnsent, Address JavaDoc[] invalid) {
95     super(msg, ex);
96     this.validSent = validSent;
97     this.validUnsent = validUnsent;
98     this.invalid = invalid;
99     }
100
101     /**
102      * Return the addresses to which this message was sent succesfully.
103      * @return Addresses to which the message was sent successfully or null
104      */

105     public Address JavaDoc[] getValidSentAddresses() {
106     return validSent;
107     }
108
109     /**
110      * Return the addresses that are valid but to which this message
111      * was not sent.
112      * @return Addresses that are valid but to which the message was
113      * not sent successfully or null
114      */

115     public Address JavaDoc[] getValidUnsentAddresses() {
116     return validUnsent;
117     }
118
119     /**
120      * Return the addresses to which this message could not be sent.
121      *
122      * @return Addresses to which the message sending failed or null;
123      */

124     public Address JavaDoc[] getInvalidAddresses() {
125     return invalid;
126     }
127 }
128
Popular Tags