-
Bug
-
Resolution: Duplicate
-
P5
-
None
-
1.1.3
-
None
-
x86
-
windows_nt
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();
}
}
}
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();
}
}
}
- duplicates
-
JDK-4171142 Deserialization fails for Class object of primitive type
-
- Closed
-