JDK-4339184 : Failure to find int.class on de-serialization
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.io:serialization
  • Affected Version: 1.1.3
  • Priority: P5
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_nt
  • CPU: x86
  • Submitted: 2000-05-18
  • Updated: 2000-05-30
  • Resolved: 2000-05-30
Related Reports
Duplicate :  
Description
The following code throws a "ClassNotFoundException: int"  exception:

import java.io.*;
public class Primtest extends Object {

  /** Creates new Primtest */
  public Primtest() {
  }
  
  /**
  * @param args the command line arguments
  */
  public static void main (String args[]) {
      try {
        ByteArrayOutputStream o = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(o);
        Class c = int.class;
        oos.writeObject(c);
        oos.close();
        o.close();
        ByteArrayInputStream i = new ByteArrayInputStream(o.toByteArray());
        ObjectInputStream ois = new ObjectInputStream(i);
        c = (Class)ois.readObject();
      } catch (Exception e){
        e.printStackTrace();
      }
  }

}