harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tim Ellison (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (HARMONY-63) java.text.MessageFormat.parse(String): incorrect size of Object array parsed from the string
Date Fri, 17 Feb 2006 15:50:24 GMT
     [ http://issues.apache.org/jira/browse/HARMONY-63?page=all ]
     
Tim Ellison resolved HARMONY-63:
--------------------------------

    Resolution: Fixed

Tatyana/Nathan,

Patch looks good.

Fixed in TEXT module java.text.MessageFormat at repo revision 378550.

Please check this fully resolves your problem.


> 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
>     Assignee: Tim Ellison
>  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


Mime
View raw message