2
|
1 |
/*
|
|
2 |
* Copyright 2005-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 |
* @test
|
|
26 |
* @bug 6341798
|
|
27 |
* @summary Tests name generation for turkish locale
|
|
28 |
* @author Sergey Malenkov
|
|
29 |
*/
|
|
30 |
|
|
31 |
import java.beans.XMLDecoder;
|
|
32 |
import java.io.ByteArrayInputStream;
|
|
33 |
import java.util.Locale;
|
|
34 |
|
|
35 |
import static java.util.Locale.ENGLISH;
|
|
36 |
|
|
37 |
public class Test6341798 {
|
|
38 |
private static final Locale TURKISH = new Locale("tr");
|
|
39 |
|
|
40 |
private static final String DATA
|
|
41 |
= "<java>\n"
|
|
42 |
+ " <object class=\"TestTurkishLocale$DataBean\">\n"
|
|
43 |
+ " <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 |
}
|