Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/jdk/sun/text/resources/Format/Bug4395196.java
41154 views
1
/*
2
* Copyright (c) 2007, 2016, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*/
23
24
/*
25
* @test
26
* @bug 4395196 4930708 4900884 4890240 8008577
27
* @modules jdk.localedata
28
* @summary verify the ko DateFormat
29
* @run main/othervm -Djava.locale.providers=JRE,SPI Bug4395196
30
*/
31
32
import java.text.DateFormat;
33
import java.text.SimpleDateFormat;
34
import java.util.Calendar;
35
import java.util.Date;
36
import java.util.Locale;
37
38
public class Bug4395196
39
{
40
public static void main(String[] arg)
41
{
42
int result = 0;
43
Locale loc = new Locale("ko","KR");
44
Date now = new Date(108, Calendar.APRIL, 9);
45
46
DateFormat df =
47
DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.SHORT,loc);
48
SimpleDateFormat sdf = new SimpleDateFormat("",loc);
49
sdf.applyPattern("yyyy. M. d a h:mm");
50
if( !sdf.format(now).equals(df.format(now))){
51
result++;
52
System.out.println("error at " + sdf.format(now));
53
}
54
df = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.MEDIUM,loc);
55
sdf.applyPattern("yyyy'\ub144' M'\uc6d4' d'\uc77c' '('EE')' a h:mm:ss");
56
if( !sdf.format(now).equals(df.format(now))){
57
result++;
58
System.out.println("error at " + sdf.format(now));
59
}
60
df = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.LONG,loc);
61
sdf.applyPattern("yyyy. M. d a h'\uc2dc' mm'\ubd84' ss'\ucd08'");
62
if( !sdf.format(now).equals(df.format(now))){
63
result++;
64
System.out.println("error at " + sdf.format(now));
65
}
66
df = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.FULL,loc);
67
sdf.applyPattern("yy. M. d a h'\uc2dc' mm'\ubd84' ss'\ucd08' z");
68
if( !sdf.format(now).equals(df.format(now))){
69
result++;
70
System.out.println("error at " + sdf.format(now));
71
}
72
73
if(result > 0) throw new RuntimeException();
74
}}
75
76