harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tim Ellison (JIRA)" <j...@apache.org>
Subject [jira] Closed: (HARMONY-1875) [classlib][text] java.text.MessageFormat.format(Object) rerurns result different from RI
Date Tue, 24 Apr 2007 15:47:17 GMT

     [ https://issues.apache.org/jira/browse/HARMONY-1875?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Tim Ellison closed HARMONY-1875.
--------------------------------


No response, assuming ok.


> [classlib][text] java.text.MessageFormat.format(Object) rerurns result different from
RI
> ----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-1875
>                 URL: https://issues.apache.org/jira/browse/HARMONY-1875
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Svetlana Samoilenko
>         Assigned To: Tim Ellison
>            Priority: Minor
>         Attachments: H-1875-MessageFormatTest.patch, SimpleDateFormat.patch, SimpleDateFormatTest.patch
>
>
> Description:
> MessageFormat for format type "date" and  format style "subformat pattern" creates subformat
as SimpleDateFormat(subformatPattern, getLocale()).
> According to the SimpleDateFormat specification  for year formatting if the number of
pattern letters is 2, the year is truncated to 2 digits; otherwise it is interpreted as a
number.
> For formatting number: the number of pattern letters is the minimum number of digits,
and shorter numbers are zero-padded to this amount.
> Harmony does not add 0 before year if it is necessary while RI does.
> Test for reproducing:
> import junit.framework.TestCase; 
> import java.text.*;
> import java.util.*;
> public class test extends TestCase {
>     public void testFormat() {
>         Locale.setDefault(Locale.CANADA);
>         TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
>         String pat="text here {0, date, yyyyyyyyy } and here";
>         String etalon="text here  000002006  and here";           
>         MessageFormat obj = new MessageFormat(pat); 
>         assertEquals(etalon, obj.format(new Object[]{new Date((new Date().getTime()))}));
        
>     }
> }
> HARMONY output:
> ==============
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or
its licensors, as applicable.
> java version "1.5.0"
> pre-alpha : not complete or compatible
> svn = r453981, (Oct  9 2006), Windows/ia32/msvc 1310, release build http://incubator.apache.org/harmony
> F
> Time: 0.328
> There was 1 failure:
> 1) testFormat(test)junit.framework.ComparisonFailure: expected:<...00000...> but
was:<......>
>         at test.testFormat(test.java:14)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
> FAILURES!!!
> Tests run: 1,  Failures: 1,  Errors: 0
> SUN output:
> ==========
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> .
> Time: 0.047
> OK (1 test)

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