Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 94453 invoked from network); 5 Dec 2007 20:03:07 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 Dec 2007 20:03:07 -0000 Received: (qmail 77412 invoked by uid 500); 5 Dec 2007 20:02:55 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 77392 invoked by uid 500); 5 Dec 2007 20:02:55 -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 77383 invoked by uid 99); 5 Dec 2007 20:02:55 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Dec 2007 12:02:55 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED 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; Wed, 05 Dec 2007 20:03:04 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 13AB1714211 for ; Wed, 5 Dec 2007 12:02:43 -0800 (PST) Message-ID: <17106989.1196884963060.JavaMail.jira@brutus> Date: Wed, 5 Dec 2007 12:02:43 -0800 (PST) From: "Mikhail Markov (JIRA)" To: commits@harmony.apache.org Subject: [jira] Closed: (HARMONY-4996) [classlib][luni] Incorrect deserialization of Externalizable classes In-Reply-To: <8390820.1193071730552.JavaMail.jira@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 [ https://issues.apache.org/jira/browse/HARMONY-4996?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Mikhail Markov closed HARMONY-4996. ----------------------------------- Resolution: Fixed Fix Version/s: 5.0M4 Fix applied at r601490. > [classlib][luni] Incorrect deserialization of Externalizable classes > -------------------------------------------------------------------- > > Key: HARMONY-4996 > URL: https://issues.apache.org/jira/browse/HARMONY-4996 > Project: Harmony > Issue Type: Bug > Components: App-Oriented Bug Reports, Classlib > Environment: Win XP > Reporter: Mikhail Markov > Assignee: Mikhail Markov > Fix For: 5.0M4 > > Attachments: H-4996.patch > > > The testcase below passed on RI but failed on Harmony with the following stacktrace: > java.io.StreamCorruptedException: Wrong format: 0x0 > at java.io.ObjectInputStream.readNonPrimitiveContent(ObjectInputStream.java:842) > at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2128) > at java.io.ObjectInputStream.readObject(ObjectInputStream.java:283) > at Test.main(Test.java:18) > --------------------------- Test.java -------------------------------- > import java.io.*; > public class Test { > static ObjectStreamClass[] objs = new ObjectStreamClass[1000]; > static int pos = 0; > public static void main(String[] args) { > try { > PipedOutputStream pout = new PipedOutputStream(); > PipedInputStream pin = new PipedInputStream(pout); > ObjectOutputStream oout = new TestObjectOutputStream(pout); > oout.writeObject(new TestExtObject()); > oout.writeObject("test"); > oout.close(); > pos = 0; > ObjectInputStream oin = new TestObjectInputStream(pin); > oin.readObject(); > oin.readObject(); > System.out.println("Done."); > } catch (Exception ex) { > ex.printStackTrace(); > } > } > public static class TestExtObject implements Externalizable { > public void writeExternal(ObjectOutput out) throws IOException { > out.writeInt(10); > } > public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { > in.readInt(); > } > } > static class TestObjectOutputStream extends ObjectOutputStream { > public TestObjectOutputStream(OutputStream out) throws IOException { > super(out); > } > protected void writeClassDescriptor(ObjectStreamClass osc) throws IOException { > objs[pos++] = osc; } > } > static class TestObjectInputStream extends ObjectInputStream { > public TestObjectInputStream(InputStream in) throws IOException { > super(in); > } > protected ObjectStreamClass readClassDescriptor() throws IOException, ClassNotFoundException { > return (ObjectStreamClass) objs[pos++]; > } > } > } > ------------------------------------------------------------------------- > This test actually saves the incoming ObjectStreamClass-es in local array and does not write them to ObjectOutputStream (and takes them from this array in de-serialization). It seems like Externalizable class does not properly de-serialized as the exception occured during the next readObject() call. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.