J. Duke | 319a3b9 | 2007-12-01 00:00:00 +0000 | [diff] [blame^] | 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 | */ |
| 26 | import java.io.File; |
| 27 | import java.util.Locale; |
| 28 | import java.util.ResourceBundle; |
| 29 | import sun.util.CoreResourceBundleControl; |
| 30 | |
| 31 | /* |
| 32 | * After introducing CoreResourceBundleControl for Awt/Swing resources |
| 33 | * loading, non-existent resources won't be actually searched from |
| 34 | * bootclasspath and extension directory. But we should still fallback |
| 35 | * to the current behavior which allows the third-part to provide their |
| 36 | * own version of awt resources, for example even though we never claim |
| 37 | * we support it yet. |
| 38 | * Look into bug 6299235 for more details. |
| 39 | */ |
| 40 | |
| 41 | public class Bug6299235Test { |
| 42 | |
| 43 | public static void main(String args[]) throws Exception { |
| 44 | /* Try to load "sun.awt.resources.awt_ru_RU.properties which |
| 45 | * is in awtres.jar. |
| 46 | */ |
| 47 | ResourceBundle russionAwtRes = ResourceBundle.getBundle("sun.awt.resources.awt", |
| 48 | new Locale("ru", "RU"), |
| 49 | CoreResourceBundleControl.getRBControlInstance()); |
| 50 | |
| 51 | /* If this call throws MissingResourceException, the test fails. */ |
| 52 | if (russionAwtRes != null) { |
| 53 | String result = russionAwtRes.getString("foo"); |
| 54 | if (result.equals("bar")) { |
| 55 | System.out.println("Bug6299235Test passed"); |
| 56 | } else { |
| 57 | System.err.println("Bug6299235Test failed"); |
| 58 | throw new Exception("Resource found, but value of key foo is not correct\n"); |
| 59 | } |
| 60 | } |
| 61 | } |
| 62 | } |