Bug4165815Test.java revision 2362
2N/A/*
2N/A * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
2N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2N/A *
2N/A * This code is free software; you can redistribute it and/or modify it
2N/A * under the terms of the GNU General Public License version 2 only, as
2N/A * published by the Free Software Foundation.
2N/A *
2N/A * This code is distributed in the hope that it will be useful, but WITHOUT
2N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2N/A * version 2 for more details (a copy is included in the LICENSE file that
2N/A * accompanied this code).
2N/A *
2N/A * You should have received a copy of the GNU General Public License version
2N/A * 2 along with this work; if not, write to the Free Software Foundation,
2N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2N/A *
2N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2N/A * or visit www.oracle.com if you need additional information or have any
2N/A * questions.
2N/A */
2N/A/*
2N/A The fix for 4165815 has been backed out because of compatibility issues.
2N/A Disabled this test temporarily until a better fix is found by removing
2N/A the at-signs.
2N/A test
2N/A summary test Bug 4165815
2N/A run main Bug4165815Test
2N/A bug 4165815
2N/A*/
2N/A/*
2N/A *
2N/A *
2N/A * (C) Copyright IBM Corp. 1999 - All Rights Reserved
2N/A *
2N/A * The original version of this source code and documentation is
2N/A * copyrighted and owned by IBM. These materials are provided
2N/A * under terms of a License Agreement between IBM and Sun.
2N/A * This technology is protected by multiple US and International
2N/A * patents. This notice and attribution to IBM may not be removed.
2N/A *
2N/A */
2N/A
2N/Aimport java.util.Locale;
2N/Aimport java.util.ResourceBundle;
2N/Aimport java.util.MissingResourceException;
2N/A
2N/A/**
2N/A * This is a regression test for the following bug:
2N/A * "If the path specified by the baseName argument to
2N/A * ResourceBundle.getBundle() begins with a leading slash, then the bundle
2N/A * is not found relative to the classpath.
2N/A *
2N/A * Clearly, the leading slash was inappropriate, however this did work
2N/A * previously (pre 1.2) and should continue to work in the same fashion."
2N/A *
2N/A * A Bundle base name should never contain a "/" and thus an
2N/A * IllegalArgumentException should be thrown.
2N/A */
2N/Apublic class Bug4165815Test extends RBTestFmwk {
2N/A public static void main(String[] args) throws Exception {
2N/A new Bug4165815Test().run(args);
2N/A }
2N/A
2N/A private static final String bundleName = "/Bug4165815Bundle";
2N/A public void testIt() throws Exception {
2N/A try {
2N/A ResourceBundle bundle = ResourceBundle.getBundle(bundleName, new Locale("en", "US"));
2N/A errln("ResourceBundle returned a bundle when it should not have.");
2N/A } catch (IllegalArgumentException e) {
2N/A //This is what we should get when the base name contains a "/" character.
2N/A } catch (MissingResourceException e) {
2N/A errln("ResourceBundle threw a MissingResourceException when it should have thrown an IllegalArgumentException.");
2N/A }
2N/A }
2N/A}
2N/A