OSDN Git Service

Jumbo patch:
[pf3gnuchains/gcc-fork.git] / libjava / java / io / InvalidClassException.java
1 /* InvalidClassException.java -- An I/O operation was interrupted.
2    Copyright (C) 1998 Free Software Foundation, Inc.
3
4 This file is part of GNU Classpath.
5
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10  
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING.  If not, write to the
18 Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19 02111-1307 USA.
20
21 As a special exception, if you link this library with other files to
22 produce an executable, this library does not by itself cause the
23 resulting executable to be covered by the GNU General Public License.
24 This exception does not however invalidate any other reasons why the
25 executable file might be covered by the GNU General Public License. */
26
27
28 package java.io;
29
30 /**
31   * This exception is thrown when there is some sort of problem with a
32   * class during a serialization operation.  This could be that the
33   * versions don't match, that there are unknown datatypes in the class
34   * or that the class doesn't have a default no-arg constructor.
35   * <p>
36   * The field <code>classname</code> will contain the name of the
37   * class that caused the problem if known.  The getMessage() method
38   * for this exception will always include the name of that class
39   * if known.
40   *
41   * @version 0.0
42   *
43   * @author Aaron M. Renn (arenn@urbanophile.com)
44   */
45 public class InvalidClassException extends ObjectStreamException
46 {
47
48 /*
49  * Instance Variables
50  */
51
52 /**
53   * The name of the class which encountered the error.
54   */
55 public String classname;
56
57 /*************************************************************************/
58
59 /*
60  * Constructors
61  */
62
63 /**
64   * Create a new InvalidClassException with a descriptive error message String
65   *
66   * @param message The descriptive error message
67   */
68 public
69 InvalidClassException(String message)
70 {
71   super(message);
72 }
73
74 /*************************************************************************/
75
76 /**
77   * Create a new InvalidClassException with a descriptive error message 
78   * String, and the name of the class that caused the problem.
79   * 
80   * @param classname The number of bytes tranferred before the interruption
81   * @param message The descriptive error message
82   */
83 public
84 InvalidClassException(String classname, String message)
85 {
86   super(message);
87   this.classname = classname;
88 }
89
90 /*************************************************************************/
91
92 /*
93  * Instance Methods
94  */
95
96 /**
97   * Returns the descriptive error message for this exception.  It will
98   * include the class name that caused the problem if known.  This method
99   * overrides Throwable.getMessage()
100   *
101   * @return A descriptive error message
102   */
103 public String
104 getMessage()
105 {
106   return(super.getMessage() + ": " + classname);
107 }
108
109 } // class InvalidClassException
110