0N/A/*
2362N/A * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/A/**
0N/A *
0N/A *
0N/A * This isn't the test case: ImmutableResourceTest.sh is.
0N/A * Refer to ImmutableResourceTest.sh when running this test.
0N/A *
0N/A * @bug 6287579
0N/A * @summary SubClasses of ListResourceBundle should fix getContents()
0N/A *
0N/A * @author Tim Bell
0N/A *
0N/A */
0N/Aimport java.util.ResourceBundle;
0N/A
0N/Apublic class ImmutableResourceTest {
0N/A
0N/A public static void main(String[] args) throws Exception {
0N/A /* Reach under the covers and get the message strings */
0N/A sun.tools.native2ascii.resources.MsgNative2ascii msgs =
0N/A new sun.tools.native2ascii.resources.MsgNative2ascii ();
0N/A Object [][] testData = msgs.getContents();
0N/A
0N/A /* Shred our copy of the message strings */
0N/A for (int ii = 0; ii < testData.length; ii++) {
0N/A testData[ii][0] = "T6287579";
0N/A testData[ii][1] = "yyy";
0N/A }
0N/A
0N/A /*
0N/A * Try to lookup the shredded key.
0N/A * If this is successful we have a problem.
0N/A */
0N/A String ss = null;
0N/A try {
0N/A ss = msgs.getString("T6287579");
0N/A } catch (java.util.MissingResourceException mre) {
0N/A /*
0N/A * Ignore the expected MissingResourceException since key
0N/A * "T6287579" is not in the canonical MsgNative2ascii.
0N/A */
0N/A }
0N/A if ("yyy".equals(ss)) {
0N/A throw new Exception ("SubClasses of ListResourceBundle should fix getContents()");
0N/A }
0N/A System.out.println("...Finished.");
0N/A }
0N/A}