001    /*
002     * Licensed to the Apache Software Foundation (ASF) under one
003     * or more contributor license agreements.  See the NOTICE file
004     * distributed with this work for additional information
005     * regarding copyright ownership.  The ASF licenses this file
006     * to you under the Apache License, Version 2.0 (the
007     * "License"); you may not use this file except in compliance
008     * with the License.  You may obtain a copy of the License at
009     *
010     *  http://www.apache.org/licenses/LICENSE-2.0
011     *
012     * Unless required by applicable law or agreed to in writing,
013     * software distributed under the License is distributed on an
014     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015     * KIND, either express or implied.  See the License for the
016     * specific language governing permissions and limitations
017     * under the License.
018     */
019    
020    package org.apache.geronimo.javamail.transport.smtp;
021    
022    import javax.mail.MessagingException;
023    import javax.mail.internet.InternetAddress;
024    
025    public class SMTPAddressSucceededException extends MessagingException {
026        // the succeeding address
027        InternetAddress addr;
028    
029        // the failing command
030        protected String cmd;
031    
032        // the error code for the failure
033        protected int rc;
034    
035        /**
036         * Constructor for an SMTPAddressSucceededException.
037         * 
038         * @param addr
039         *            The succeeding address.
040         * @param cmd
041         *            The succeeding command string.
042         * @param rc
043         *            The error code for the command.
044         * @param err
045         *            An error message for the exception.
046         */
047        SMTPAddressSucceededException(InternetAddress addr, java.lang.String cmd, int rc, java.lang.String err) {
048            super(err);
049            this.cmd = cmd;
050            this.rc = rc;
051            this.addr = addr;
052        }
053    
054        /**
055         * Get the failing command string for the exception.
056         * 
057         * @return The string value of the failing command.
058         */
059        public String getCommand() {
060            return cmd;
061        }
062    
063        /**
064         * The failing command return code.
065         * 
066         * @return The failure return code.
067         */
068        public int getReturnCode() {
069            return rc;
070        }
071    
072        /**
073         * Retrieve the internet address associated with this exception.
074         * 
075         * @return The provided InternetAddress object.
076         */
077        public InternetAddress getAddress() {
078            return addr;
079        }
080    }