[ https://issues.apache.org/jira/browse/HARMONY-4135?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12505267
]
Mikhail Markov commented on HARMONY-4135:
-----------------------------------------
Generally this was not the problem in io, but in String.getBytes() method which called decode()
method of CharsetDecoder.
Here is the simplified test:
public final class Test {
public static void main(String[] args) throws Exception {
byte[] buf = "-".getBytes("UTF-16");
System.out.println("buf[0] = " + (buf[0] & 0xFF) + ", buf[1] = " + (buf[1] &
0xFF));
}
}
So, i think the regression test should be added to String2Test which tests this method. I'll
provide the patch for this test soon.
> [classlib][luni] InputStream handles UTF-16 incorrectly
> -------------------------------------------------------
>
> Key: HARMONY-4135
> URL: https://issues.apache.org/jira/browse/HARMONY-4135
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Reporter: Vasily Zakharov
>
> Here's the simple test demonstrating the problem:
> import java.io.*;
> public class Test {
> public static void main(String[] args) throws Throwable {
> InputStream input = new ByteArrayInputStream("-".getBytes("UTF-16"));
> int first = (input.read() & 0xFF);
> int second = (input.read() & 0xFF);
> System.out.println("" + first + " " + second);
> }
> }
> Output on RI:
> 254 255
> Output on Harmony (both IBM VM and DRL VM):
> 255 254
> This problem was discovered while investigating the HARMONY-3850 issue with Eclipse Unit
Test org.eclipse.core.tests.runtime.content.IContentTypeManagerTest.testContentDescription().
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
|