001    /*
002     * Licensed to the Apache Software Foundation (ASF) under one or more
003     * contributor license agreements.  See the NOTICE file distributed with
004     * this work for additional information regarding copyright ownership.
005     * The ASF licenses this file to You under the Apache License, Version 2.0
006     * (the "License"); you may not use this file except in compliance with
007     * the License.  You may obtain a copy of the License at
008     * 
009     *      http://www.apache.org/licenses/LICENSE-2.0
010     * 
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS,
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     * See the License for the specific language governing permissions and
015     * limitations under the License.
016     */
017    
018    package org.apache.commons.codec;
019    
020    /**
021     * Thrown when there is a failure condition during the encoding process. This exception is thrown when an Encoder
022     * encounters a encoding specific exception such as invalid data, inability to calculate a checksum, characters outside
023     * of the expected range.
024     * 
025     * @author Apache Software Foundation
026     * @version $Id: EncoderException.java 797804 2009-07-25 17:27:04Z ggregory $
027     */
028    public class EncoderException extends Exception {
029    
030        /**
031         * Declares the Serial Version Uid.
032         * 
033         * @see <a href="http://c2.com/cgi/wiki?AlwaysDeclareSerialVersionUid">Always Declare Serial Version Uid</a>
034         */
035        private static final long serialVersionUID = 1L;
036    
037        /**
038         * Constructs a new exception with <code>null</code> as its detail message. The cause is not initialized, and may
039         * subsequently be initialized by a call to {@link #initCause}.
040         * 
041         * @since 1.4
042         */
043        public EncoderException() {
044            super();
045        }
046    
047        /**
048         * Constructs a new exception with the specified detail message. The cause is not initialized, and may subsequently
049         * be initialized by a call to {@link #initCause}.
050         * 
051         * @param message
052         *            a useful message relating to the encoder specific error.
053         */
054        public EncoderException(String message) {
055            super(message);
056        }
057    
058        /**
059         * Constructs a new exception with the specified detail message and cause.
060         * 
061         * <p>
062         * Note that the detail message associated with <code>cause</code> is not automatically incorporated into this
063         * exception's detail message.
064         * </p>
065         * 
066         * @param message
067         *            The detail message which is saved for later retrieval by the {@link #getMessage()} method.
068         * @param cause
069         *            The cause which is saved for later retrieval by the {@link #getCause()} method. A <code>null</code>
070         *            value is permitted, and indicates that the cause is nonexistent or unknown.
071         * @since 1.4
072         */
073        public EncoderException(String message, Throwable cause) {
074            super(message, cause);
075        }
076    
077        /**
078         * Constructs a new exception with the specified cause and a detail message of <code>(cause==null ?
079         * null : cause.toString())</code> (which typically contains the class and detail message of <code>cause</code>).
080         * This constructor is useful for exceptions that are little more than wrappers for other throwables.
081         * 
082         * @param cause
083         *            The cause which is saved for later retrieval by the {@link #getCause()} method. A <code>null</code>
084         *            value is permitted, and indicates that the cause is nonexistent or unknown.
085         * @since 1.4
086         */
087        public EncoderException(Throwable cause) {
088            super(cause);
089        }
090    }