Source code
Description: source: package: org.apache.commons.codec, class: DecoderException

    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 *      https://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 */
    024public class DecoderException extends Exception {
    025
    026    /**
    027     * Declares the Serial Version Uid.
    028     *
    029     * @see <a href="https://c2.com/cgi/wiki?AlwaysDeclareSerialVersionUid">Always Declare Serial Version Uid</a>
    030     */
    031    private static final long serialVersionUID = 1L;
    032
    033    /**
    034     * Constructs a new exception with {@code null} as its detail message. The cause is not initialized, and may
    035     * subsequently be initialized by a call to {@link #initCause}.
    036     *
    037     * @since 1.4
    038     */
    039    public DecoderException() {
    040    }
    041
    042    /**
    043     * Constructs a new exception with the specified detail message. The cause is not initialized, and may subsequently
    044     * be initialized by a call to {@link #initCause}.
    045     *
    046     * @param message
    047     *            The detail message which is saved for later retrieval by the {@link #getMessage()} method.
    048     */
    049    public DecoderException(final String message) {
    050        super(message);
    051    }
    052
    053    /**
    054     * Constructs a new exception with the specified detail message. The cause is not initialized, and may subsequently be initialized by a call to
    055     * {@link #initCause}.
    056     *
    057     * @param message The format message which is saved for later retrieval by the {@link #getMessage()} method.
    058     * @param args    The format arguments to use.
    059     *
    060     * @see String#format(String, Object...)
    061     * @since 1.20.0
    062     */
    063    public DecoderException(final String message, final Object... args) {
    064        super(String.format(message, args));
    065    }
    066
    067    /**
    068     * Constructs a new exception with the specified detail message and cause.
    069     * <p>
    070     * Note that the detail message associated with {@code cause} is not automatically incorporated into this
    071     * exception's detail message.
    072     * </p>
    073     *
    074     * @param message
    075     *            The detail message which is saved for later retrieval by the {@link #getMessage()} method.
    076     * @param cause
    077     *            The cause which is saved for later retrieval by the {@link #getCause()} method. A {@code null}
    078     *            value is permitted, and indicates that the cause is nonexistent or unknown.
    079     * @since 1.4
    080     */
    081    public DecoderException(final String message, final Throwable cause) {
    082        super(message, cause);
    083    }
    084
    085    /**
    086     * Constructs a new exception with the specified cause and a detail message of {@code (cause==null ?
    087     * null : cause.toString())} (which typically contains the class and detail message of {@code cause}).
    088     * This constructor is useful for exceptions that are little more than wrappers for other throwables.
    089     *
    090     * @param cause
    091     *            The cause which is saved for later retrieval by the {@link #getCause()} method. A {@code null}
    092     *            value is permitted, and indicates that the cause is nonexistent or unknown.
    093     * @since 1.4
    094     */
    095    public DecoderException(final Throwable cause) {
    096        super(cause);
    097    }
    098}