Failure to find int.class on de-serialization

XMLWordPrintable

    • Type: Bug
    • Resolution: Duplicate
    • Priority: P5
    • None
    • Affects Version/s: 1.1.3
    • Component/s: core-libs
    • None

      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();
            }
        }

      }

            Assignee:
            Naveen Sanjeeva (Inactive)
            Reporter:
            J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: