Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 30812 invoked from network); 23 Jul 2007 08:19:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 23 Jul 2007 08:19:52 -0000 Received: (qmail 28551 invoked by uid 500); 23 Jul 2007 08:19:54 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 28464 invoked by uid 500); 23 Jul 2007 08:19:53 -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 28455 invoked by uid 99); 23 Jul 2007 08:19:53 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 23 Jul 2007 01:19:53 -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; Mon, 23 Jul 2007 01:19:51 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 5AF8B7141F1 for ; Mon, 23 Jul 2007 01:19:31 -0700 (PDT) Message-ID: <13163784.1185178771368.JavaMail.jira@brutus> Date: Mon, 23 Jul 2007 01:19:31 -0700 (PDT) From: "Leo Li (JIRA)" To: commits@harmony.apache.org Subject: [jira] Resolved: (HARMONY-4447) XMLEncoder.flush() should not always flush In-Reply-To: <10734991.1184260864701.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-4447?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Leo Li resolved HARMONY-4447. ----------------------------- Resolution: Fixed Fixed at r558606. > XMLEncoder.flush() should not always flush > ------------------------------------------ > > Key: HARMONY-4447 > URL: https://issues.apache.org/jira/browse/HARMONY-4447 > Project: Harmony > Issue Type: Bug > Environment: M2 on Win x86. > Reporter: Andrew Cornwall > Assignee: Leo Li > Priority: Minor > > The flush() method in XMLEncoder doesn't take into account the fact that data may have already been written. Consequently, calling XMLEncoder.flush() may result in the same data being written twice. > Here's a testcase: > import java.beans.XMLEncoder; > import java.io.ByteArrayOutputStream; > public class Bugzilla125927 { > public static void main (String args[]) { > Object object = "hello"; > byte[] out = null; > ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); > XMLEncoder encoder = new XMLEncoder(outputStream); > try{ > encoder.writeObject(object); > encoder.flush(); > encoder.close(); > outputStream.close(); > } > catch (Exception ex) { > ex.printStackTrace(); > } > System.out.println(new String(outputStream.toByteArray())); > } > } > On the Sun JDK, this results in the following output: > > > hello > > On Harmony, you get the following: -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.