home *** CD-ROM | disk | FTP | other *** search
/ Java 1.2 How-To / JavaHowTo.iso / 3rdParty / jbuilder / unsupported / JDK1.2beta3 / SOURCE / SRC.ZIP / java / io / InvalidClassException.java < prev    next >
Encoding:
Java Source  |  1998-03-20  |  1.5 KB  |  58 lines

  1. /*
  2.  * @(#)InvalidClassException.java    1.9 98/03/18
  3.  *
  4.  * Copyright 1996, 1997 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  *
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. package java.io;
  16.  
  17. /**
  18.  * Raised when the Serialization runtime detects a problem with a Class.
  19.  * The class may: <UL>
  20.  * <LI> not match the serial version of the class in the stream
  21.  * <LI> the class contains unknown datatypes
  22.  * <LI> the class does not have an accessible no-arg constructor
  23.  * </UL>
  24.  *
  25.  * @author  unascribed
  26.  * @version 1.9, 03/18/98
  27.  * @since   JDK1.1
  28.  */
  29. public class InvalidClassException extends ObjectStreamException {
  30.     /**
  31.      */
  32.     public String classname;
  33.  
  34.     /**
  35.      * Report a InvalidClassException for the specified reason.
  36.      */
  37.     public InvalidClassException(String reason) {
  38.     super(reason);
  39.     }
  40.  
  41.     /**
  42.      */
  43.     public InvalidClassException(String cname, String reason) {
  44.     super(reason);
  45.     classname = cname;
  46.     }
  47.  
  48.     /**
  49.      * Produce the message, include the classname if present.
  50.      */
  51.     public String getMessage() {
  52.     if (classname == null) 
  53.         return super.getMessage();
  54.     else
  55.         return classname + "; " + super.getMessage();
  56.     }
  57. }
  58.