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 an encoding specific exception such as invalid data, inability to calculate a checksum, 023 * characters outside of the expected range. 024 */ 025public class EncoderException extends Exception { 026 027 /** 028 * Declares the Serial Version Uid. 029 * 030 * @see <a href="https://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} 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 EncoderException() { 041 } 042 043 /** 044 * Constructs a new exception with the specified detail message. The cause is not initialized, and may subsequently 045 * be initialized by a call to {@link #initCause}. 046 * 047 * @param message 048 * a useful message relating to the encoder specific error. 049 */ 050 public EncoderException(final String message) { 051 super(message); 052 } 053 054 /** 055 * Constructs a new exception with the specified detail message and cause. 056 * 057 * <p> 058 * Note that the detail message associated with {@code cause} is not automatically incorporated into this 059 * exception's detail message. 060 * </p> 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} 066 * value is permitted, and indicates that the cause is nonexistent or unknown. 067 * @since 1.4 068 */ 069 public EncoderException(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}). 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} 080 * value is permitted, and indicates that the cause is nonexistent or unknown. 081 * @since 1.4 082 */ 083 public EncoderException(final Throwable cause) { 084 super(cause); 085 } 086}