001/* 002 * Copyright 2023 the original author or authors. 003 * <p> 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * <p> 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * <p> 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package de.cuioss.tools.codec; 017 018/** 019 * Thrown when there is a failure condition during the encoding process. This 020 * exception is thrown when an Encoder encounters an encoding specific exception 021 * such as invalid data, inability to calculate a checksum, characters outside 022 * the expected range. 023 * 024 * @author https://github.com/apache/commons-codec/blob/master/src/main/java/org/apache/commons/codec/EncoderException.java 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 032 * Declare Serial Version Uid</a> 033 */ 034 private static final long serialVersionUID = 1L; 035 036 /** 037 * Constructs a new exception with {@code null} as its detail message. The cause 038 * is not initialized, and may subsequently be initialized by a call to 039 * {@link #initCause}. 040 */ 041 public EncoderException() { 042 } 043 044 /** 045 * Constructs a new exception with the specified detail message. The cause is 046 * not initialized, and may subsequently be initialized by a call to 047 * {@link #initCause}. 048 * 049 * @param message a useful message relating to the encoder specific error. 050 */ 051 public EncoderException(final String message) { 052 super(message); 053 } 054 055 /** 056 * Constructs a new exception with the specified detail message and cause. 057 * 058 * <p> 059 * Note that the detail message associated with {@code cause} is not 060 * automatically incorporated into this exception's detail message. 061 * </p> 062 * 063 * @param message The detail message which is saved for later retrieval by the 064 * {@link #getMessage()} method. 065 * @param cause The cause which is saved for later retrieval by the 066 * {@link #getCause()} method. A {@code null} value is permitted, 067 * and indicates that the cause is nonexistent or unknown. 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 075 * <code>(cause==null ? 076 * null : cause.toString())</code> (which typically contains the class and 077 * detail message of {@code cause}). This constructor is useful for exceptions 078 * that are little more than wrappers for other throwables. 079 * 080 * @param cause The cause which is saved for later retrieval by the 081 * {@link #getCause()} method. A {@code null} value is permitted, 082 * and indicates that the cause is nonexistent or unknown. 083 */ 084 public EncoderException(final Throwable cause) { 085 super(cause); 086 } 087}