Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 45245 invoked from network); 6 May 2009 10:40:29 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 6 May 2009 10:40:29 -0000 Received: (qmail 37182 invoked by uid 500); 6 May 2009 10:40:29 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 37145 invoked by uid 500); 6 May 2009 10:40:29 -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 37136 invoked by uid 99); 6 May 2009 10:40:29 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 May 2009 10:40:29 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 May 2009 10:40:27 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 3E6E823889D5; Wed, 6 May 2009 10:40:06 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r772140 - /harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/SimpleDateFormat.java Date: Wed, 06 May 2009 10:40:06 -0000 To: commits@harmony.apache.org From: tellison@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090506104006.3E6E823889D5@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: tellison Date: Wed May 6 10:40:05 2009 New Revision: 772140 URL: http://svn.apache.org/viewvc?rev=772140&view=rev Log: Apply modified patch for HARMONY-6181 ([classlib][text] SimpleDateFormatTest.test_set2DigitYearStartLjava_util_Date would fail) Modified: harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/SimpleDateFormat.java Modified: harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/SimpleDateFormat.java URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/SimpleDateFormat.java?rev=772140&r1=772139&r2=772140&view=diff ============================================================================== --- harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/SimpleDateFormat.java (original) +++ harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/SimpleDateFormat.java Wed May 6 10:40:05 2009 @@ -265,16 +265,43 @@ * differently than Java." We need to do a trick here to follow Java * spec. */ - if (template.equals("y")) { - icuFormat.applyPattern("yy"); - pattern = "y"; - return; - } + String templateForICU = patternForICU(template); icuFormat.applyPattern(template); pattern = template; } /** + * Converts the Java-spec pattern into an equivalent pattern used by ICU. + * + * @param p + * the Java-spec style pattern. + * @return the ICU-style pattern. + */ + @SuppressWarnings("nls") + private String patternForICU(String p) { + String[] subPatterns = p.split("'"); + boolean quote = false; + boolean first = true; + StringBuilder result = new StringBuilder(); + for (String subPattern : subPatterns) { + if (!quote) { + // replace 'y' with 'yy' for ICU to follow Java spec + result.append((first ? "" : "'") + + subPattern.replaceAll("(?