Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/jdk/java/util/ResourceBundle/Bug6299235/Bug6299235Test.java
41153 views
1
/*
2
* Copyright (c) 2007, 2018, 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 6299235 8210408
27
* @summary test Bug 6299235 to make sure the third-party provided sun resources
28
* could be picked up.
29
* @modules java.desktop
30
* @library patches
31
* @build java.desktop/sun.awt.resources.awt_ru_RU
32
* @run main Bug6299235Test
33
*/
34
35
import java.awt.Toolkit;
36
import java.util.Locale;
37
38
/*
39
* After introducing CoreResourceBundleControl for Awt/Swing resources
40
* loading, non-existent resources won't be actually searched from
41
* bootclasspath and extension directory. But we should still fallback
42
* to the current behavior which allows the third-part to provide their
43
* own version of awt resources, for example even though we never claim
44
* we support it yet.
45
* Look into bug 6299235 for more details.
46
*/
47
48
public class Bug6299235Test {
49
private static final Locale ru_RU = new Locale("ru", "RU");
50
51
public static void main(String args[]) {
52
Locale locale = Locale.getDefault();
53
try {
54
Locale.setDefault(ru_RU);
55
// Get the value for the test key "foo"
56
String value = Toolkit.getProperty("foo", "undefined");
57
if (!value.equals("bar")) {
58
throw new RuntimeException("key = foo, value = " + value);
59
}
60
// Get the value for a valid key "AWT.enter"
61
value = Toolkit.getProperty("AWT.enter", "DO NOT ENTER");
62
if (value.equals("DO NOT ENTER")) {
63
throw new RuntimeException("AWT.enter undefined.");
64
}
65
} finally {
66
// Restore the default Locale
67
Locale.setDefault(locale);
68
}
69
System.out.println("Bug6299235Test passed");
70
}
71
}
72
73