Path: blob/master/test/jdk/java/util/ResourceBundle/Bug6299235/Bug6299235Test.java
41153 views
/*1* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/*24* @test25* @bug 6299235 821040826* @summary test Bug 6299235 to make sure the third-party provided sun resources27* could be picked up.28* @modules java.desktop29* @library patches30* @build java.desktop/sun.awt.resources.awt_ru_RU31* @run main Bug6299235Test32*/3334import java.awt.Toolkit;35import java.util.Locale;3637/*38* After introducing CoreResourceBundleControl for Awt/Swing resources39* loading, non-existent resources won't be actually searched from40* bootclasspath and extension directory. But we should still fallback41* to the current behavior which allows the third-part to provide their42* own version of awt resources, for example even though we never claim43* we support it yet.44* Look into bug 6299235 for more details.45*/4647public class Bug6299235Test {48private static final Locale ru_RU = new Locale("ru", "RU");4950public static void main(String args[]) {51Locale locale = Locale.getDefault();52try {53Locale.setDefault(ru_RU);54// Get the value for the test key "foo"55String value = Toolkit.getProperty("foo", "undefined");56if (!value.equals("bar")) {57throw new RuntimeException("key = foo, value = " + value);58}59// Get the value for a valid key "AWT.enter"60value = Toolkit.getProperty("AWT.enter", "DO NOT ENTER");61if (value.equals("DO NOT ENTER")) {62throw new RuntimeException("AWT.enter undefined.");63}64} finally {65// Restore the default Locale66Locale.setDefault(locale);67}68System.out.println("Bug6299235Test passed");69}70}717273