Return-Path: Delivered-To: apmail-incubator-harmony-dev-archive@www.apache.org Received: (qmail 55437 invoked from network); 11 Feb 2006 04:41:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 11 Feb 2006 04:41:54 -0000 Received: (qmail 81981 invoked by uid 500); 11 Feb 2006 04:41:51 -0000 Delivered-To: apmail-incubator-harmony-dev-archive@incubator.apache.org Received: (qmail 81909 invoked by uid 500); 11 Feb 2006 04:41:51 -0000 Mailing-List: contact harmony-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: harmony-dev@incubator.apache.org Delivered-To: mailing list harmony-dev@incubator.apache.org Received: (qmail 81898 invoked by uid 99); 11 Feb 2006 04:41:51 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [192.87.106.226] (HELO ajax.apache.org) (192.87.106.226) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Feb 2006 20:41:48 -0800 Received: from ajax.apache.org (ajax.apache.org [127.0.0.1]) by ajax.apache.org (Postfix) with ESMTP id 486CADC for ; Sat, 11 Feb 2006 05:41:27 +0100 (CET) Message-ID: <1390955019.1139632887016.JavaMail.jira@ajax.apache.org> Date: Sat, 11 Feb 2006 05:41:26 +0100 (CET) From: "Nathan Beyer (JIRA)" To: harmony-dev@incubator.apache.org Subject: [jira] Updated: (HARMONY-63) java.text.MessageFormat.parse(String): incorrect size of Object array parsed from the string In-Reply-To: <548308290.1138776183822.JavaMail.jira@ajax.apache.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/HARMONY-63?page=all ] Nathan Beyer updated HARMONY-63: -------------------------------- Attachment: MessageFormat_patch.txt Try this patch out. It should resolve the issue and update the test case with a regression test, as proposed by the reporter. It seems like the MessageFormat and other related format classes need some serious testing done, so we may need to just write a full test case to make sure this little fix and others aren't introducing new issues. > java.text.MessageFormat.parse(String): incorrect size of Object array parsed from the string > -------------------------------------------------------------------------------------------- > > Key: HARMONY-63 > URL: http://issues.apache.org/jira/browse/HARMONY-63 > Project: Harmony > Type: Bug > Components: Classlib > Reporter: tatyana doubtsova > Attachments: MessageFormat_patch.txt > > Problem details: > Method java.text.MessageFormat.parse(String) returns the array of 10 elements when parsing string "1,00,00' using pattern "{0,number,#,####}". It should return array of 1 element. > Code for reproducing Test.java: > import java.text.MessageFormat; > import java.util.Locale; > public class Test { > public static void main(String[] args) { > try { > MessageFormat mf = new MessageFormat("{0,number,#,####}", Locale.US); > Object[] res = mf.parse("1,00,00"); > System.out.println("result's length: " + res.length); > for (int i = 0; i < res.length; i++) { > System.out.println("result is: " + res[0]); > } > } catch (Exception e) { > e.printStackTrace(); > } > } > } > Steps to Reproduce: > 1. Build Harmony (check-out on 2006-01-30) j2se subset as described in README.txt. > 2. Compile Test.java using BEA 1.4 javac > > javac -d . Test.java > 3. Run java using compatible VM (J9) > > java -showversion Test > Output: > java version 1.4.2 (subset) > (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable. > result's length: 10 > result is: 10000 > result is: 10000 > result is: 10000 > result is: 10000 > result is: 10000 > result is: 10000 > result is: 10000 > result is: 10000 > result is: 10000 > result is: 10000 > Output on BEA 1.4.2 to compare with: > result's length: 1 > result is: 10000 > Suggested junit test case: > package org.apache.harmony.tests.java.text; > import java.text.MessageFormat; > import java.util.Locale; > import junit.framework.TestCase; > public class MessageFormatTest extends TestCase { > public static void main(String[] args) { > junit.textui.TestRunner.run(MessageFormatTest.class); > } > public void test_parse() { > try { > MessageFormat mf = new MessageFormat("{0,number,#,####}", Locale.US); > Object[] res = mf.parse("1,00,00"); > assertEquals("Assert 0: incorrect size of parsed data ", 1, res.length); > } catch (Exception e) { > fail("Assert 0: Unexpected exception " + e); > } > } > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira