Return-Path: Delivered-To: apmail-incubator-harmony-commits-archive@www.apache.org Received: (qmail 50527 invoked from network); 25 Jul 2006 05:38:36 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 25 Jul 2006 05:38:36 -0000 Received: (qmail 95112 invoked by uid 500); 25 Jul 2006 05:38:35 -0000 Delivered-To: apmail-incubator-harmony-commits-archive@incubator.apache.org Received: (qmail 95077 invoked by uid 500); 25 Jul 2006 05:38:35 -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 95066 invoked by uid 99); 25 Jul 2006 05:38:35 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Jul 2006 22:38:35 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [209.237.227.198] (HELO brutus.apache.org) (209.237.227.198) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Jul 2006 22:38:34 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 851E77141F1 for ; Tue, 25 Jul 2006 05:36:15 +0000 (GMT) Message-ID: <695382.1153805775542.JavaMail.jira@brutus> Date: Mon, 24 Jul 2006 22:36:15 -0700 (PDT) From: "Paulex Yang (JIRA)" To: harmony-commits@incubator.apache.org Subject: [jira] Assigned: (HARMONY-969) java.util.TreeMap throws NotSerializableException In-Reply-To: <19374174.1153800973914.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 X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/HARMONY-969?page=all ] Paulex Yang reassigned HARMONY-969: ----------------------------------- Assignee: Paulex Yang > java.util.TreeMap throws NotSerializableException > ------------------------------------------------- > > Key: HARMONY-969 > URL: http://issues.apache.org/jira/browse/HARMONY-969 > Project: Harmony > Issue Type: Bug > Components: Classlib > Reporter: Vasily Zakharov > Assigned To: Paulex Yang > Attachments: SerializationTreeMap.patch > > > NotSerializableException occurs when trying to serialize a java.util.TreeMap object that has entrySet() method called before. > The cause for this is TreeMap class is serialized by defaultWriteObject(), and it contains a non-transient field, entrySet, that is initialized in entrySet() method by an instance of AbstractSet class that is not Serializable. > Suggested fix: make entrySet field transient. > Here's the code to reproduce the bug: > import java.io.*; > import java.util.*; > public class SerializationTreeMapTest { > public static void main(String[] args) { > try { > TreeMap map = new TreeMap(); > map.entrySet(); > ByteArrayOutputStream bOut = new ByteArrayOutputStream(); > ObjectOutputStream oOut = new ObjectOutputStream(bOut); > oOut.writeObject(map); > System.out.println("SUCCESS"); > } catch (Exception e) { > e.printStackTrace(); > } > } > } > and here's the output: > C:\> java SerializationTreeMapTest > java.io.NotSerializableException: java.util.TreeMap$1 > at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1624) > at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1932) > at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1768) > at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1732) > at java.io.ObjectOutputStream.writeFieldValues(ObjectOutputStream.java:1241) > at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:327) > at java.util.TreeMap.writeObject(TreeMap.java:1422) > at java.lang.reflect.VMReflection.invokeMethod(VMReflection.java) > at java.lang.reflect.Method.invoke(Method.java:183) > at java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1318) > at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1658) > at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1932) > at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1768) > at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1732) > at SerializationTreeMapTest.main(SerializationTreeMapTest.java:11) -- 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