harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leo Li (JIRA)" <j...@apache.org>
Subject [jira] Assigned: (HARMONY-4447) XMLEncoder.flush() should not always flush
Date Fri, 13 Jul 2007 07:56:05 GMT

     [ https://issues.apache.org/jira/browse/HARMONY-4447?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Leo Li reassigned HARMONY-4447:
-------------------------------

    Assignee: Leo Li

> 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:
> <?xml version="1.0" encoding="UTF-8"?>
> <java version="1.5.0_04" class="java.beans.XMLDecoder">
>  <string>hello</string>
> </java>
> 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.


Mime
View raw message