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