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