    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 */
    026public class EncoderException 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 EncoderException() {
    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     *            a useful message relating to the encoder specific error.
    051     */
    052    public EncoderException(final String message) {
    053        super(message);
    054    }
    055
    056    /**
    057     * Constructs a new exception with the specified detail message and cause.
    058     *
    059     * <p>
    060     * Note that the detail message associated with <code>cause</code> is not automatically incorporated into this
    061     * exception's detail message.
    062     * </p>
    063     *
    064     * @param message
    065     *            The detail message which is saved for later retrieval by the {@link #getMessage()} method.
    066     * @param cause
    067     *            The cause which is saved for later retrieval by the {@link #getCause()} method. A <code>null</code>
    068     *            value is permitted, and indicates that the cause is nonexistent or unknown.
    069     * @since 1.4
    070     */
    071    public EncoderException(final String message, final Throwable cause) {
    072        super(message, cause);
    073    }
    074
    075    /**
    076     * Constructs a new exception with the specified cause and a detail message of <code>(cause==null ?
    077     * null : cause.toString())</code> (which typically contains the class and detail message of <code>cause</code>).
    078     * This constructor is useful for exceptions that are little more than wrappers for other throwables.
    079     *
    080     * @param cause
    081     *            The cause which is saved for later retrieval by the {@link #getCause()} method. A <code>null</code>
    082     *            value is permitted, and indicates that the cause is nonexistent or unknown.
    083     * @since 1.4
    084     */
    085    public EncoderException(final Throwable cause) {
    086        super(cause);
    087    }
    088}