public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
From: "bonniot at users dot sf dot net" <gcc-bugzilla@gcc.gnu.org>
To: java-prs@gcc.gnu.org
Subject: [Bug libgcj/21785] New: [regression] ClassNotFound during deserialization
Date: Fri, 27 May 2005 15:02:00 -0000	[thread overview]
Message-ID: <20050527150214.21785.bonniot@users.sf.net> (raw)

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


             reply	other threads:[~2005-05-27 15:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-27 15:02 bonniot at users dot sf dot net [this message]
2005-05-27 15:05 ` [Bug libgcj/21785] " bonniot at users dot sf dot net
2005-05-27 17:14 ` [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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050527150214.21785.bonniot@users.sf.net \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=java-prs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).