Bug6530694.java revision 4440:cea7c749f805
119370Spst/*
2130803Smarcel * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
3130803Smarcel * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4130803Smarcel *
5130803Smarcel * This code is free software; you can redistribute it and/or modify it
619370Spst * under the terms of the GNU General Public License version 2 only, as
719370Spst * published by the Free Software Foundation.
898944Sobrien *
946283Sdfr * This code is distributed in the hope that it will be useful, but WITHOUT
1098944Sobrien * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1119370Spst * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1298944Sobrien * version 2 for more details (a copy is included in the LICENSE file that
1398944Sobrien * accompanied this code).
1498944Sobrien *
1598944Sobrien * You should have received a copy of the GNU General Public License version
1619370Spst * 2 along with this work; if not, write to the Free Software Foundation,
1798944Sobrien * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1898944Sobrien *
1998944Sobrien * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2098944Sobrien * or visit www.oracle.com if you need additional information or have any
2119370Spst * questions.
2298944Sobrien *
2398944Sobrien * @test
2498944Sobrien * @bug 6530694
2598944Sobrien * @summary Checks that sun.util.CoreResourceBundleControl does not apply
2619370Spst *     to the application provided Swing resources.
2719370Spst * @run main/othervm Bug6530694
2898944Sobrien */
2919370Spst
3019370Spstimport java.util.Locale;
3119370Spstimport javax.swing.UIDefaults;
3219370Spstimport javax.swing.UIManager;
3346283Sdfr
3419370Spstpublic class Bug6530694 {
3519370Spst    Bug6530694() {
3619370Spst        Locale.setDefault(Locale.GERMANY);
3719370Spst        UIDefaults defs = UIManager.getDefaults();
3898944Sobrien        defs.addResourceBundle("Bug6530694");
39130803Smarcel        String str = defs.getString("testkey");
4046283Sdfr        if (!"testvalue".equals(str)) {
4198944Sobrien            throw new RuntimeException("Could not load the resource for de_DE locale");
4298944Sobrien        }
4398944Sobrien    }
4446283Sdfr
4598944Sobrien    public static void main(String[] args) {
4698944Sobrien        Locale reservedLocale = Locale.getDefault();
4746283Sdfr        try {
4898944Sobrien            new Bug6530694();
4946283Sdfr        } finally {
5098944Sobrien            // restore the reserved locale
5146283Sdfr            Locale.setDefault(reservedLocale);
5219370Spst        }
5398944Sobrien    }
5419370Spst}
5519370Spst