|
1 /* |
|
2 * Copyright (c) 2018, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 * or visit www.oracle.com if you need additional information or have any |
|
21 * questions. |
|
22 */ |
|
23 |
|
24 /* |
|
25 * @test |
|
26 * @summary The characters FFFE and FFFF should not be in a UnicodeBlock. They |
|
27 * should be in a null block. |
|
28 * @bug 4404588 |
|
29 * @author John O'Conner |
|
30 */ |
|
31 |
|
32 public class Bug4404588 { |
|
33 |
|
34 public Bug4404588() { |
|
35 // do nothing |
|
36 } |
|
37 |
|
38 public static void main(String[] args) { |
|
39 Bug4404588 test = new Bug4404588(); |
|
40 test.run(); |
|
41 } |
|
42 |
|
43 /** |
|
44 * Test the correct data against what Character reports. |
|
45 */ |
|
46 void run() { |
|
47 Character ch; |
|
48 Character.UnicodeBlock block; |
|
49 |
|
50 for(int x=0; x < charData.length; x++) { |
|
51 ch = (Character)charData[x][0]; |
|
52 block = (Character.UnicodeBlock)charData[x][1]; |
|
53 |
|
54 if (Character.UnicodeBlock.of(ch.charValue()) != block) { |
|
55 System.err.println("Error: block = " + block); |
|
56 System.err.println("Character.UnicodeBlock.of(" + |
|
57 Integer.toHexString(ch.charValue()) +") = " + |
|
58 Character.UnicodeBlock.of(ch.charValue())); |
|
59 throw new RuntimeException("Blocks aren't equal."); |
|
60 } |
|
61 } |
|
62 System.out.println("Passed."); |
|
63 } |
|
64 |
|
65 /** |
|
66 * Contains the character data to test. The first object is the character. |
|
67 * The next object is the UnicodeBlock to which it should belong. |
|
68 */ |
|
69 Object[][] charData = { |
|
70 { new Character('\uFFFE'), Character.UnicodeBlock.SPECIALS }, |
|
71 { new Character('\uFFFF'), Character.UnicodeBlock.SPECIALS }, |
|
72 }; |
|
73 } |