Return-Path: Delivered-To: apmail-incubator-harmony-commits-archive@www.apache.org Received: (qmail 36190 invoked from network); 26 Oct 2006 01:00:00 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 26 Oct 2006 01:00:00 -0000 Received: (qmail 29642 invoked by uid 500); 25 Oct 2006 17:53:31 -0000 Delivered-To: apmail-incubator-harmony-commits-archive@incubator.apache.org Received: (qmail 29614 invoked by uid 500); 25 Oct 2006 17:53:31 -0000 Mailing-List: contact harmony-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: harmony-dev@incubator.apache.org Delivered-To: mailing list harmony-commits@incubator.apache.org Received: (qmail 29599 invoked by uid 99); 25 Oct 2006 17:53:31 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Oct 2006 10:53:31 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Oct 2006 10:53:19 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id E49BE7142C3 for ; Wed, 25 Oct 2006 10:52:18 -0700 (PDT) Message-ID: <26979376.1161798738933.JavaMail.root@brutus> Date: Wed, 25 Oct 2006 10:52:18 -0700 (PDT) From: "Mikhail Markov (JIRA)" To: harmony-commits@incubator.apache.org Subject: [jira] Updated: (HARMONY-1967) [classlib][rmi] RMI runtime could not load class with null thread context classloader In-Reply-To: <17041604.1161798376593.JavaMail.root@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ http://issues.apache.org/jira/browse/HARMONY-1967?page=all ] Mikhail Markov updated HARMONY-1967: ------------------------------------ Attachment: RMIObjectInputStream.patch Patch consist of fixes for 3 files: org.apache.harmony.rmi.transport.RMIObjectInputStream (attached) org.apache.harmony.rmi.remoteref.UnicastRef org.apache.harmony.rmi.remoteref.UnicasServertRef > [classlib][rmi] RMI runtime could not load class with null thread context classloader > ------------------------------------------------------------------------------------- > > Key: HARMONY-1967 > URL: http://issues.apache.org/jira/browse/HARMONY-1967 > Project: Harmony > Issue Type: Bug > Components: Classlib > Environment: IA32, WinXP > Reporter: Mikhail Markov > Attachments: RMIObjectInputStream.patch > > > The test is doing the following steps: > 1) tries to restore the serialized object with thread context classloader equal to system classloader > 2) tries to restore the serialized object with thread context classloader equal to null > It is expected that both cases should pass because RMI internal ObjectInputStream should be able to access non-null classloader up in the execution stack (as normal java.io.ObjectInputStream does). > Output on RI: > 1-st get passed. > 2-nd get passed. > Output on Harmony: > 1-st get passed. > 2-nd get failed: > java.lang.ClassNotFoundException: Test$TestClass > at java.lang.Class.forName(Unknown Source) > at org.apache.harmony.rmi.DefaultRMIClassLoaderSpi.loadClass(DefaultRMIClassLoaderSpi.java:325) > at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:91) > at org.apache.harmony.rmi.transport.RMIObjectInputStream.resolveClass(RMIObjectInputStream.java:122) > at java.io.ObjectInputStream.readNewClassDesc(ObjectInputStream.java:1668) > at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:701) > at java.io.ObjectInputStream.readNewObject(ObjectInputStream.java:1986) > at java.io.ObjectInputStream.readNonPrimitiveContent(ObjectInputStream.java:805) > at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2096) > at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2051) > at java.rmi.MarshalledObject.get(MarshalledObject.java:68) > at Test.main(Test.java:26) > -----------------Test.java------------------------- > import java.rmi.MarshalledObject; > import java.io.Serializable; > public class Test { > public static void main(String[] args) throws Exception { > ClassLoader cl = ClassLoader.getSystemClassLoader(); > MarshalledObject mo = new MarshalledObject(new TestClass()); > Object obj = null; > // 1-st get: thread context classloader is equal to system classloader > try { > obj = mo.get(); > if (obj.getClass().getClassLoader() != cl) { > System.out.println("1-st get failed: loaded through: " > + obj.getClass().getClassLoader() + ", expected: " + cl); > } else { > System.out.println("1-st get passed."); > } > } catch (Exception ex) { > System.out.println("1-st get failed:"); > ex.printStackTrace(); > } > // 2-nd get: thread context classloader is equal to null > Thread.currentThread().setContextClassLoader(null); > try { > obj = mo.get(); > if (obj.getClass().getClassLoader() != cl) { > System.out.println("2-nd get failed: loaded through: " > + obj.getClass().getClassLoader() + ", expected: " + cl); > } else { > System.out.println("2-nd get passed."); > } > } catch (Exception ex) { > System.out.println("2-nd get failed:"); > ex.printStackTrace(); > } > } > static class TestClass implements Serializable { > } > } > ------------------------------------------- -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira