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 */ 017package org.apache.commons.lang3; 018 019/** 020 * Exception thrown when the Serialization process fails. 021 * 022 * <p> 023 * The original error is wrapped within this one. 024 * </p> 025 * 026 * <p> 027 * #NotThreadSafe# because Throwable is not thread-safe 028 * </p> 029 * 030 * @since 1.0 031 */ 032public class SerializationException extends RuntimeException { 033 034 /** 035 * Required for serialization support. 036 * 037 * @see java.io.Serializable 038 */ 039 private static final long serialVersionUID = 4029025366392702726L; 040 041 /** 042 * Constructs a new {@link SerializationException} without specified 043 * detail message. 044 */ 045 public SerializationException() { 046 } 047 048 /** 049 * Constructs a new {@link SerializationException} with specified 050 * detail message. 051 * 052 * @param msg The error message. 053 */ 054 public SerializationException(final String msg) { 055 super(msg); 056 } 057 058 /** 059 * Constructs a new {@link SerializationException} with specified 060 * detail message and nested {@link Throwable}. 061 * 062 * @param msg The error message. 063 * @param cause The {@link Exception} or {@link Error} 064 * that caused this exception to be thrown. 065 */ 066 public SerializationException(final String msg, final Throwable cause) { 067 super(msg, cause); 068 } 069 070 /** 071 * Constructs a new {@link SerializationException} with specified 072 * nested {@link Throwable}. 073 * 074 * @param cause The {@link Exception} or {@link Error} 075 * that caused this exception to be thrown. 076 */ 077 public SerializationException(final Throwable cause) { 078 super(cause); 079 } 080 081}