Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 53354 invoked from network); 15 Dec 2006 19:18:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 15 Dec 2006 19:18:18 -0000 Received: (qmail 74872 invoked by uid 500); 15 Dec 2006 19:18:25 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 74843 invoked by uid 500); 15 Dec 2006 19:18:25 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 74834 invoked by uid 99); 15 Dec 2006 19:18:25 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Dec 2006 11:18:25 -0800 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 60ABF7140D2 for ; Fri, 15 Dec 2006 11:17:27 -0800 (PST) Message-ID: <22113063.1166210247393.JavaMail.jira@brutus> Date: Fri, 15 Dec 2006 11:17:27 -0800 (PST) From: "Mikhail Markov (JIRA)" To: commits@harmony.apache.org Subject: [jira] Commented: (HARMONY-1967) [classlib][rmi] RMI runtime could not load class with null thread context classloader 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=comments#action_12458890 ] Mikhail Markov commented on HARMONY-1967: ----------------------------------------- Everything is fine. Thanks, Alexei! > [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 > Assigned To: Alexei Zakharov > Attachments: MarshalledObjectTest.patch, RMIObjectInputStream.patch, UnicastRef.patch, UnicastServerRef.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