KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > polyglot > types > BadSerializationException


1 package polyglot.types;
2
3 import polyglot.util.Position;
4
5 /**
6  * Signals an error in the class resolver system. This exception is thrown
7  * when a <code>ClassResolver</code> finds a class file that contains encoded
8  * Polyglot type information, but is unable to read in the serialized class
9  * information. The most likely cause of this exception is that the compiler
10  * (or compiler extension) has been modified since the class file was created,
11  * resulting in incompatible serializations. The solution is to delete the class
12  * file, and recompile it from the source.
13  */

14 public class BadSerializationException extends SemanticException {
15     private String JavaDoc className;
16     
17     private static String JavaDoc message(String JavaDoc className) {
18         className = className.replace('/', '.');
19         return "Could not decode Polyglot type information for \"" +
20                 className + "\". The most likely cause is " +
21                 "that the compiler has " +
22                 "been modified since the class file was created. " +
23                 "Please delete " +
24                 "the class file for \"" + className +
25                 "\", and recompile from source.";
26     }
27     public BadSerializationException(String JavaDoc className) {
28         super(message(className));
29         this.className = className;
30     }
31     
32     public BadSerializationException(String JavaDoc className, Position position) {
33         super(message(className), position);
34         this.className = className;
35     }
36     
37     public String JavaDoc getClassName() {
38         return className;
39     }
40 }
41
Popular Tags