blob: 677ff842352529888ef923f36edc2de6bd946b7e [file] [log] [blame]
duke6e45e102007-12-01 00:00:00 +00001/*
malenkova468fa82008-12-22 17:42:49 +03002 * Copyright 2005-2008 Sun Microsystems, Inc. All Rights Reserved.
duke6e45e102007-12-01 00:00:00 +00003 * 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 * @test
26 * @bug 6341798
27 * @summary Tests name generation for turkish locale
28 * @author Sergey Malenkov
29 */
30
31import java.beans.XMLDecoder;
32import java.io.ByteArrayInputStream;
33import java.util.Locale;
34
35import static java.util.Locale.ENGLISH;
36
37public class Test6341798 {
38 private static final Locale TURKISH = new Locale("tr");
39
40 private static final String DATA
41 = "<java>\n"
malenkova468fa82008-12-22 17:42:49 +030042 + " <object class=\"Test6341798$DataBean\">\n"
duke6e45e102007-12-01 00:00:00 +000043 + " <void property=\"illegal\">\n"
44 + " <boolean>true</boolean>\n"
45 + " </void>\n"
46 + " </object>\n"
47 + "</java> ";
48
49 public static void main(String[] args) {
50 test(ENGLISH, DATA.getBytes());
51 test(TURKISH, DATA.getBytes());
52 }
53
54 private static void test(Locale locale, byte[] data) {
55 Locale.setDefault(locale);
56 System.out.println("locale = " + locale);
57
58 XMLDecoder decoder = new XMLDecoder(new ByteArrayInputStream(data));
59 System.out.println("object = " + decoder.readObject());
60 decoder.close();
61 }
62
63 public static class DataBean {
64 private boolean illegal;
65
66 public boolean isIllegal() {
67 return this.illegal;
68 }
69
70 public void setIllegal(boolean illegal) {
71 this.illegal = illegal;
72 }
73
74 public String toString() {
75 if (this.illegal) {
76 return "property is set";
77 }
78 throw new Error("property is not set");
79 }
80 }
81}