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
018package org.apache.commons.codec;
019
020/**
021 * Thrown when there is a failure condition during the encoding process. This exception is thrown when an
022 * {@link Encoder} encounters a encoding specific exception such as invalid data, inability to calculate a checksum,
023 * characters outside of the expected range.
024 *
025 * @version $Id: EncoderException.html 891688 2013-12-24 20:49:46Z ggregory $
026 */
027public class EncoderException extends Exception {
028
029    /**
030     * Declares the Serial Version Uid.
031     *
032     * @see <a href="http://c2.com/cgi/wiki?AlwaysDeclareSerialVersionUid">Always Declare Serial Version Uid</a>
033     */
034    private static final long serialVersionUID = 1L;
035
036    /**
037     * Constructs a new exception with {@code null} as its detail message. The cause is not initialized, and may
038     * subsequently be initialized by a call to {@link #initCause}.
039     *
040     * @since 1.4
041     */
042    public EncoderException() {
043        super();
044    }
045
046    /**
047     * Constructs a new exception with the specified detail message. The cause is not initialized, and may subsequently
048     * be initialized by a call to {@link #initCause}.
049     *
050     * @param message
051     *            a useful message relating to the encoder specific error.
052     */
053    public EncoderException(final String message) {
054        super(message);
055    }
056
057    /**
058     * Constructs a new exception with the specified detail message and cause.
059     *
060     * <p>
061     * Note that the detail message associated with <code>cause</code> is not automatically incorporated into this
062     * exception's detail message.
063     * </p>
064     *
065     * @param message
066     *            The detail message which is saved for later retrieval by the {@link #getMessage()} method.
067     * @param cause
068     *            The cause which is saved for later retrieval by the {@link #getCause()} method. A {@code null}
069     *            value is permitted, and indicates that the cause is nonexistent or unknown.
070     * @since 1.4
071     */
072    public EncoderException(final String message, final Throwable cause) {
073        super(message, cause);
074    }
075
076    /**
077     * Constructs a new exception with the specified cause and a detail message of <code>(cause==null ?
078     * null : cause.toString())</code> (which typically contains the class and detail message of <code>cause</code>).
079     * This constructor is useful for exceptions that are little more than wrappers for other throwables.
080     *
081     * @param cause
082     *            The cause which is saved for later retrieval by the {@link #getCause()} method. A {@code null}
083     *            value is permitted, and indicates that the cause is nonexistent or unknown.
084     * @since 1.4
085     */
086    public EncoderException(final Throwable cause) {
087        super(cause);
088    }
089}