Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 57229 invoked from network); 15 Jun 2007 15:23:48 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 15 Jun 2007 15:23:48 -0000 Received: (qmail 66256 invoked by uid 500); 15 Jun 2007 15:23:50 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 66228 invoked by uid 500); 15 Jun 2007 15:23:50 -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 66206 invoked by uid 99); 15 Jun 2007 15:23:50 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Jun 2007 08:23:50 -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; Fri, 15 Jun 2007 08:23:46 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 74FF57141E0 for ; Fri, 15 Jun 2007 08:23:26 -0700 (PDT) Message-ID: <6254150.1181921006471.JavaMail.jira@brutus> Date: Fri, 15 Jun 2007 08:23:26 -0700 (PDT) From: "Mikhail Markov (JIRA)" To: commits@harmony.apache.org Subject: [jira] Commented: (HARMONY-4135) [classlib][luni] InputStream handles UTF-16 incorrectly In-Reply-To: <9834617.1181700506152.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-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.