Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 52298 invoked from network); 23 Jul 2007 03:49:53 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 23 Jul 2007 03:49:53 -0000 Received: (qmail 17921 invoked by uid 500); 23 Jul 2007 03:49:54 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 17904 invoked by uid 500); 23 Jul 2007 03:49:54 -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 17895 invoked by uid 99); 23 Jul 2007 03:49:54 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 22 Jul 2007 20:49:54 -0700 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; Sun, 22 Jul 2007 20:49:52 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 6FAC67141F3 for ; Sun, 22 Jul 2007 20:49:31 -0700 (PDT) Message-ID: <21250486.1185162571454.JavaMail.jira@brutus> Date: Sun, 22 Jul 2007 20:49:31 -0700 (PDT) From: "Tony Wu (JIRA)" To: commits@harmony.apache.org Subject: [jira] Assigned: (HARMONY-4505) [classlib][beans] Beans module needs a persistence delegate for java.util.Date class In-Reply-To: <21686341.1184917566686.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-4505?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Tony Wu reassigned HARMONY-4505: -------------------------------- Assignee: Tony Wu > [classlib][beans] Beans module needs a persistence delegate for java.util.Date class > ------------------------------------------------------------------------------------ > > Key: HARMONY-4505 > URL: https://issues.apache.org/jira/browse/HARMONY-4505 > Project: Harmony > Issue Type: Bug > Components: Classlib > Reporter: spark shen > Assignee: Tony Wu > Attachments: HY-4505.patch, HY-4505.sh > > > The following test case will fail on Harmony, but pass on RI. > public static class DummyBean { > private String value; > public DummyBean() { > } > public DummyBean(String s) { > value = s; > } > public String getDummyValue() { > return value; > } > public void setDummyValue(String s) { > value = s; > } > > public boolean equals(Object bean) { > if (!(bean instanceof DummyBean)) { > return false; > } > DummyBean aBean = (DummyBean) bean; > > if (aBean.value == null && value != null || value != null > && aBean.value == null) { > return false; > } else if(value != null && aBean.value != null){ > return value.equals(aBean.value); > } > return true; > } > } > public void test_writeExpression_writeObject() { > ByteArrayOutputStream output = new ByteArrayOutputStream(); > XMLEncoder encoder = new XMLEncoder( output ); > Date date = new Date(2007, 06, 26); > Expression expression = new Expression( date, "toString", null ); > String date_string = null; > try { > date_string = (String) expression.getValue(); > } catch (Exception e ) { > System.out.println("Failed to get the date value."); > e.printStackTrace(); > } > DummyBean bean = new DummyBean( date_string ); > // The expression knows about the date object. > encoder.writeExpression( expression ); > encoder.writeObject( date ); > // The value for the bean is already part of the expression > // so instead of writing the value we write a reference to > // the extpression. > encoder.writeObject( bean ); > encoder.flush(); > encoder.close(); > > DataInputStream stream = new DataInputStream(new ByteArrayInputStream( > output.toByteArray())); > XMLDecoder decoder = new XMLDecoder(stream); > Date aDate = (Date) decoder.readObject(); > assertEquals(date, aDate); > > DummyBean aBean = (DummyBean) decoder.readObject(); > assertEquals(bean, aBean); > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.