2
|
1 |
/*
|
|
2 |
* Copyright (c) 2007 Sun Microsystems, Inc. All Rights Reserved.
|
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 |
*
|
|
5 |
* This code is free software; you can redistribute it and/or modify it
|
|
6 |
* under the terms of the GNU General Public License version 2 only, as
|
|
7 |
* published by the Free Software Foundation.
|
|
8 |
*
|
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that
|
|
13 |
* accompanied this code).
|
|
14 |
*
|
|
15 |
* You should have received a copy of the GNU General Public License version
|
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
18 |
*
|
|
19 |
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
20 |
* CA 95054 USA or visit www.sun.com if you need additional information or
|
|
21 |
* have any questions.
|
|
22 |
*/
|
|
23 |
|
|
24 |
/*
|
|
25 |
*@test
|
|
26 |
*@bug 4395196 4930708 4900884 4890240
|
|
27 |
*@summary verify the ko DateFormat
|
|
28 |
*/
|
|
29 |
|
|
30 |
import java.io.*;
|
|
31 |
import java.text.*;
|
|
32 |
import java.util.*;
|
|
33 |
|
|
34 |
public class Bug4395196
|
|
35 |
{
|
|
36 |
public static void main(String[] arg)
|
|
37 |
{
|
|
38 |
int result = 0;
|
|
39 |
Locale loc = new Locale("ko","KR");
|
|
40 |
Date now = new Date(108, Calendar.APRIL, 9);
|
|
41 |
|
|
42 |
DateFormat df =
|
|
43 |
DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.SHORT,loc);
|
|
44 |
SimpleDateFormat sdf = new SimpleDateFormat("",loc);
|
|
45 |
sdf.applyPattern("yyyy. M. d a h:mm");
|
|
46 |
if( !sdf.format(now).equals(df.format(now))){
|
|
47 |
result++;
|
|
48 |
System.out.println("error at " + sdf.format(now));
|
|
49 |
}
|
|
50 |
df = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.MEDIUM,loc);
|
|
51 |
sdf.applyPattern("yyyy'\ub144' M'\uc6d4' d'\uc77c' '('EE')' a h:mm:ss");
|
|
52 |
if( !sdf.format(now).equals(df.format(now))){
|
|
53 |
result++;
|
|
54 |
System.out.println("error at " + sdf.format(now));
|
|
55 |
}
|
|
56 |
df = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.LONG,loc);
|
|
57 |
sdf.applyPattern("yyyy. M. d a h'\uc2dc' mm'\ubd84' ss'\ucd08'");
|
|
58 |
if( !sdf.format(now).equals(df.format(now))){
|
|
59 |
result++;
|
|
60 |
System.out.println("error at " + sdf.format(now));
|
|
61 |
}
|
|
62 |
df = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.FULL,loc);
|
|
63 |
sdf.applyPattern("yy. M. d a h'\uc2dc' mm'\ubd84' ss'\ucd08' z");
|
|
64 |
if( !sdf.format(now).equals(df.format(now))){
|
|
65 |
result++;
|
|
66 |
System.out.println("error at " + sdf.format(now));
|
|
67 |
}
|
|
68 |
|
|
69 |
if(result > 0) throw new RuntimeException();
|
|
70 |
}}
|