harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Cornwall (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-4448) XMLEncoded Strings with \n are decoded incorrectly
Date Thu, 12 Jul 2007 17:44:04 GMT
XMLEncoded Strings with \n are decoded incorrectly
--------------------------------------------------

                 Key: HARMONY-4448
                 URL: https://issues.apache.org/jira/browse/HARMONY-4448
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
         Environment: M2 on Win x86
            Reporter: Andrew Cornwall


XMLEncoded Strings which have a \n in them (such as "hello\nthere") are decoded
incorrectly.

The following testcase demonstrates the issue:

public class Bug126404 {
    public static void main (String args[]) {
	Object object = null;
	String encodedString = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
	"<java version=\"1.5.0\" class=\"java.beans.XMLDecoder\">\n" +
	" <string>hello\n" +
	"there</string>\n" +
	"</java>\n";

	byte[] in = encodedString.getBytes();
	ByteArrayInputStream inputStream = new ByteArrayInputStream(in);
	XMLDecoder decoder = new XMLDecoder(inputStream, "CDS");
	try{
	    object = decoder.readObject();
	}
	catch (Exception ex) { 
	    ex.printStackTrace();
	}
	System.out.println(new String(object.toString()));
    }
}

On Sun JDK, this results in:
hello
there

On Harmony M2, this results in:
there



-- 
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