Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 82780 invoked from network); 8 Dec 2006 21:52:47 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 8 Dec 2006 21:52:47 -0000 Received: (qmail 5616 invoked by uid 500); 8 Dec 2006 21:52:54 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 5585 invoked by uid 500); 8 Dec 2006 21:52:54 -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 5395 invoked by uid 99); 8 Dec 2006 21:52:54 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 Dec 2006 13:52:53 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= 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, 08 Dec 2006 13:52:44 -0800 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 7AE537142F9 for ; Fri, 8 Dec 2006 13:52:24 -0800 (PST) Message-ID: <19455350.1165614744501.JavaMail.jira@brutus> Date: Fri, 8 Dec 2006 13:52:24 -0800 (PST) From: "Tim Ellison (JIRA)" To: commits@harmony.apache.org Subject: [jira] Resolved: (HARMONY-1875) [classlib][text] java.text.MessageFormat.format(Object) rerurns result different from RI MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ http://issues.apache.org/jira/browse/HARMONY-1875?page=all ] Tim Ellison resolved HARMONY-1875. ---------------------------------- Resolution: Fixed Thanks Svetlana / Andrey, Patch applied to TEXT module at repo revision r484807. Please check that it was applied as you expected. > [classlib][text] java.text.MessageFormat.format(Object) rerurns result different from RI > ---------------------------------------------------------------------------------------- > > Key: HARMONY-1875 > URL: http://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. - 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