public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgcj/21785] New: [regression] ClassNotFound during deserialization
@ 2005-05-27 15:05 bonniot at users dot sf dot net
  2005-05-27 15:16 ` [Bug libgcj/21785] " bonniot at users dot sf dot net
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: bonniot at users dot sf dot net @ 2005-05-27 15:05 UTC (permalink / raw)
  To: gcc-bugs

This very simple serialization/deserialization test fails. This is a regression.

////////////////////////////////////
import java.io.*;

public class Enum implements Serializable
{
  public static void main(String[] args)
  {
    try {
      ByteArrayOutputStream outb = new ByteArrayOutputStream();
      ObjectOutputStream outs = new ObjectOutputStream(outb);
      outs.writeObject(new Enum());
      byte[] store = outb.toByteArray();

      ByteArrayInputStream inb = new ByteArrayInputStream(store);
      ObjectInputStream ins = new ObjectInputStream(inb);
      ins.readObject();
    }
    catch (Throwable e) {
      throw new Error(e);
    }
  }
}
///////////////////////////////

sauternes /tmp /usr/local/src/gcc-cvs/install/bin/gcj -C Enum.java             
                                [04:54 27/05/05]
sauternes /tmp /usr/local/src/gcc-cvs/install/bin/gij Enum                     
                                [04:54 27/05/05]
Exception in thread "main" java.lang.Error: java.lang.ClassNotFoundException: Enum
   at Enum.main (Enum.java:17)
Caused by: java.lang.ClassNotFoundException: Enum
   at java.lang.Class.forName (natClass.cc:91)
   at java.io.ObjectInputStream.resolveClass (ObjectInputStream.java:782)
   at java.io.ObjectInputStream.readClassDescriptor (ObjectInputStream.java:534)
   at java.io.ObjectInputStream.readObject (ObjectInputStream.java:228)
   at java.io.ObjectInputStream.readObject (ObjectInputStream.java:275)
   at Enum.main (Enum.java:15)
sauternes /tmp kaffe Enum                                                      
                                [04:54 27/05/05]
sauternes /tmp java Enum
sauternes /tmp

gij (GNU libgcj) version 4.1.0 20050527 (experimental)


Note: this bug looks similar to a bug I reported against jamvm:
https://sourceforge.net/tracker/?func=detail&atid=543058&aid=1155738&group_id=75148

I paste here the evaluation Robert sent me privately after he fixed it, as it
MIGHT be relevant to gcj too (being a change in classpath).
"
P.S.  It was the recent changes made to Classpath. 
VMSecurityManager.currentClassLoader() now returns "null" if
checkPermissions(AllPermissions) passes.  ObjectInputStream uses this
to resolve a class, and ends up trying to resolve it using the
bootstrap class loader (which fails).  By luck SableVM works, because
it doesn't have a complete implementation of VMAccessController, so
checkPermissions(AllPermissions) fails, and currentClassLoader returns
the same as before.  I'll report a Classpath/SableVM bug.
"

-- 
           Summary: [regression] ClassNotFound during deserialization
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libgcj
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bonniot at users dot sf dot net
                CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu
                    dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21785


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-06-01 20:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-27 15:05 [Bug libgcj/21785] New: [regression] ClassNotFound during deserialization bonniot at users dot sf dot net
2005-05-27 15:16 ` [Bug libgcj/21785] " bonniot at users dot sf dot net
2005-05-27 17:24 ` [Bug libgcj/21785] [4.1 regression] " pinskia at gcc dot gnu dot org
2005-06-01 17:15 ` tromey at gcc dot gnu dot org
2005-06-01 19:58 ` cvs-commit at gcc dot gnu dot org
2005-06-01 20:01 ` tromey at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).