Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 59677 invoked from network); 9 Sep 2008 08:14:35 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 9 Sep 2008 08:14:35 -0000 Received: (qmail 89651 invoked by uid 500); 9 Sep 2008 08:14:32 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 89631 invoked by uid 500); 9 Sep 2008 08:14:32 -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 89622 invoked by uid 99); 9 Sep 2008 08:14:32 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Sep 2008 01:14:32 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Sep 2008 08:13:43 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id A4915234C1D4 for ; Tue, 9 Sep 2008 01:13:44 -0700 (PDT) Message-ID: <1270174260.1220948024672.JavaMail.jira@brutus> Date: Tue, 9 Sep 2008 01:13:44 -0700 (PDT) From: "Kevin Zhou (JIRA)" To: commits@harmony.apache.org Subject: [jira] Created: (HARMONY-5975) [classlib] [beans] XMLEncoder encodes the static field with customized persistence delegate MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [classlib] [beans] XMLEncoder encodes the static field with customized persistence delegate ------------------------------------------------------------------------------------------- Key: HARMONY-5975 URL: https://issues.apache.org/jira/browse/HARMONY-5975 Project: Harmony Issue Type: Bug Components: Classlib Affects Versions: 5.0M7 Reporter: Kevin Zhou Fix For: 5.0M8 Consider test case [1], RI and Harmony's beans will generate different results [2] [3]. Using the given MockObjectPersistenceDelegate, RI will write the "inst" instance of MockObject as a field, while current Harmony's beans will write this instance by using reflection method Class.getField(...). This is due to the missing condition in the XMLEncoder.flushStatField(...) method. [1] public class XMLEncoderTest extends TestCase { public void test_WriteObject_StaticField() { ByteArrayOutputStream bos = new ByteArrayOutputStream(); XMLEncoder xmlEncoder = new XMLEncoder(bos); xmlEncoder.setPersistenceDelegate(MockObject.class, new MockObjectPersistenceDelegate()); xmlEncoder.writeObject(MockObject.inst); xmlEncoder.close(); System.out.println(bos.toString()); } public static class MockObject { public static MockObject inst = new MockObject(); } public static class MockObjectPersistenceDelegate extends PersistenceDelegate { protected Expression instantiate(Object oldInstance, Encoder enc) { Expression exp = null; try { exp = new Expression(MockObject.class.getField("inst"), "get", new Object[] { null }); } catch (Exception e) { e.printStackTrace(); } return exp; } } } [2] RI's XML: [3] Harmony's XML inst -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.