jaroslav@601: /* jaroslav@601: * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved. jaroslav@601: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. jaroslav@601: * jaroslav@601: * This code is free software; you can redistribute it and/or modify it jaroslav@601: * under the terms of the GNU General Public License version 2 only, as jaroslav@601: * published by the Free Software Foundation. Oracle designates this jaroslav@601: * particular file as subject to the "Classpath" exception as provided jaroslav@601: * by Oracle in the LICENSE file that accompanied this code. jaroslav@601: * jaroslav@601: * This code is distributed in the hope that it will be useful, but WITHOUT jaroslav@601: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or jaroslav@601: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License jaroslav@601: * version 2 for more details (a copy is included in the LICENSE file that jaroslav@601: * accompanied this code). jaroslav@601: * jaroslav@601: * You should have received a copy of the GNU General Public License version jaroslav@601: * 2 along with this work; if not, write to the Free Software Foundation, jaroslav@601: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. jaroslav@601: * jaroslav@601: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA jaroslav@601: * or visit www.oracle.com if you need additional information or have any jaroslav@601: * questions. jaroslav@601: */ jaroslav@601: jaroslav@601: package java.io; jaroslav@601: jaroslav@601: /** jaroslav@601: * Thrown when the Serialization runtime detects one of the following jaroslav@601: * problems with a Class. jaroslav@601: * jaroslav@601: * jaroslav@601: * @author unascribed jaroslav@601: * @since JDK1.1 jaroslav@601: */ jaroslav@601: public class InvalidClassException extends ObjectStreamException { jaroslav@601: jaroslav@601: private static final long serialVersionUID = -4333316296251054416L; jaroslav@601: jaroslav@601: /** jaroslav@601: * Name of the invalid class. jaroslav@601: * jaroslav@601: * @serial Name of the invalid class. jaroslav@601: */ jaroslav@601: public String classname; jaroslav@601: jaroslav@601: /** jaroslav@601: * Report an InvalidClassException for the reason specified. jaroslav@601: * jaroslav@601: * @param reason String describing the reason for the exception. jaroslav@601: */ jaroslav@601: public InvalidClassException(String reason) { jaroslav@601: super(reason); jaroslav@601: } jaroslav@601: jaroslav@601: /** jaroslav@601: * Constructs an InvalidClassException object. jaroslav@601: * jaroslav@601: * @param cname a String naming the invalid class. jaroslav@601: * @param reason a String describing the reason for the exception. jaroslav@601: */ jaroslav@601: public InvalidClassException(String cname, String reason) { jaroslav@601: super(reason); jaroslav@601: classname = cname; jaroslav@601: } jaroslav@601: jaroslav@601: /** jaroslav@601: * Produce the message and include the classname, if present. jaroslav@601: */ jaroslav@601: public String getMessage() { jaroslav@601: if (classname == null) jaroslav@601: return super.getMessage(); jaroslav@601: else jaroslav@601: return classname + "; " + super.getMessage(); jaroslav@601: } jaroslav@601: }