2362N/A * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. 637N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 637N/A * This code is free software; you can redistribute it and/or modify it 637N/A * under the terms of the GNU General Public License version 2 only, as 637N/A * published by the Free Software Foundation. 637N/A * This code is distributed in the hope that it will be useful, but WITHOUT 637N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 637N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 637N/A * version 2 for more details (a copy is included in the LICENSE file that 637N/A * accompanied this code). 637N/A * You should have received a copy of the GNU General Public License version 637N/A * 2 along with this work; if not, write to the Free Software Foundation, 637N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 637N/A * @summary Confirm that text which includes numbers with a trailing minus sign is parsed correctly. 637N/A "============================================================";
637N/A * I don't use static import here intentionally so that this test program 637N/A * can be run on JDK 1.4.2. 637N/A// private static int JAN = Calendar.JANUARY; 637N/A// private static int FEB = Calendar.FEBRUARY; 637N/A// private static int MAR = Calendar.MARCH; 637N/A// private static int AUG = Calendar.AUGUST; 637N/A// private static int SEP = Calendar.SEPTEMBER; 637N/A// private static int OCT = Calendar.OCTOBER; 637N/A// private static int NOV = Calendar.NOVEMBER; 637N/A// private static int DEC = Calendar.DECEMBER; 637N/A * Because 1-based HOUR_OF_DAY, 1-based HOUR, MONTH, and YEAR fields 637N/A * are parsed using different code from the code for other numeric 637N/A * fields, I prepared YEAR-preceding patterns and SECOND-preceding 637N/A // for Arabic formatter and modified English formatter 637N/A {
"--",
"-/",
"::",
":/",
"\uff0d\uff0d",
"\uff0d/"},
637N/A // for English formatter and modified Arabic formatter 637N/A {
"--",
"/-",
"::",
"/:",
"\uff0d\uff0d",
"/\uff0d"},
637N/A * +-------------------------------------------------------------------+ 637N/A * +---------------------+---------------------------------------------| 637N/A * | datesEG & datesUS | formattedDatesEG & formattedDatesUS | 637N/A * +-------------------------------------------------------------------+ 637N/A * +-------------------------------------------------------------------+ 637N/A * |---------------------+---------------------------------------------| 637N/A * | datesToParse | datesEG & datesUS | 637N/A * +-------------------------------------------------------------------+ 637N/A // "JUNE" and "JULY" are replaced with a localized month name later. 637N/A {
"2008 JULY 20 3 12 83",
637N/A "2008 JULY 20 3 12 83",
637N/A "2008 JULY 20 3 12 83"},
637N/A {
"2008 07 20 03 12 83",
637N/A "2008 07 20 03 12 83"},
637N/A {
"2008 JULY 20 3 13 23",
637N/A "2009 JULY 20 3 13 23",
637N/A {
"2008 07 20 03 13 23",
637N/A "2007 05 20 03 13 23"},
637N/A {
"2008 JULY 20 3 13 23",
637N/A "2008 JUNE 10 3 13 23"},
637N/A {
"2008 07 20 03 13 23",
637N/A "2008 06 10 03 13 23"},
637N/A * Test SimpleDateFormat.parse() and format() for original 637N/A * SimpleDateFormat instances 637N/A * Test SimpleDateFormat.parse() and format() for modified 637N/A * SimpleDateFormat instances using an original minus sign, 637N/A * pattern, and diffenrent month names in DecimalFormat 637N/A * Test SimpleDateFormat.parse() and format() for modified 637N/A * SimpleDateFormat instances using a fullwidth minus sign 637N/A * Just to confirm that regressions aren't introduced in 637N/A * DecimalFormat. This cannot happen, though. Because I didn't 637N/A * change DecimalFormat at all. 637N/A for (
int j =
0; j <=
1; j++) {
637N/A * modified ar_EG Date&Time formatter : 637N/A * month names: In Arabic 637N/A * modified en_US Date&Time formatter : 637N/A * pattern: "#,##0.###;#,##0.###-" 637N/A * month names: In English 637N/A for (
int j =
2; j <=
3; j++) {
637N/A * modified ar_EG Date&Time formatter : 637N/A * minus sign: '\uff0d' // fullwidth minus 637N/A * pattern: "#,##0.###;#,##0.###-" 637N/A * month names: In Arabic 637N/A * modified en_US Date&Time formatter : 637N/A * minus sign: '\uff0d' // fullwidth minus 637N/A * month names: In English 637N/A for (
int j =
4; j <=
5; j++) {