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.Address;
023    import javax.mail.SendFailedException;
024    
025    public class SMTPSendFailedException extends SendFailedException {
026        // the failing command
027        protected String cmd;
028    
029        // the error code for the failure
030        protected int rc;
031    
032        /**
033         * Constructor for an SMTPSendFaileException.
034         * 
035         * @param cmd
036         *            The failing command string.
037         * @param rc
038         *            The error code for the failing command.
039         * @param err
040         *            An error message for the exception.
041         * @param ex
042         *            Any associated nested exception.
043         * @param vs
044         *            An array of valid, sent addresses.
045         * @param vus
046         *            An array of addresses that were valid, but were unsent.
047         * @param inv
048         *            An array of addresses deemed invalid.
049         */
050        SMTPSendFailedException(java.lang.String cmd, int rc, java.lang.String err, java.lang.Exception ex, Address[] vs,
051                Address[] vus, Address[] inv) {
052            super(err, ex, vs, vus, inv);
053            this.cmd = cmd;
054            this.rc = rc;
055        }
056    
057        /**
058         * Get the failing command string for the exception.
059         * 
060         * @return The string value of the failing command.
061         */
062        public String getCommand() {
063            return cmd;
064        }
065    
066        /**
067         * The failing command return code.
068         * 
069         * @return The failure return code.
070         */
071        public int getReturnCode() {
072            return rc;
073        }
074    }