Path: blob/master/test/jdk/java/lang/Character/Bug4404588.java
41149 views
/*1* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/*24* @test25* @summary The characters FFFE and FFFF should not be in a UnicodeBlock. They26* should be in a null block.27* @bug 440458828* @author John O'Conner29*/3031public class Bug4404588 {3233public Bug4404588() {34// do nothing35}3637public static void main(String[] args) {38Bug4404588 test = new Bug4404588();39test.run();40}4142/**43* Test the correct data against what Character reports.44*/45void run() {46Character ch;47Character.UnicodeBlock block;4849for(int x=0; x < charData.length; x++) {50ch = (Character)charData[x][0];51block = (Character.UnicodeBlock)charData[x][1];5253if (Character.UnicodeBlock.of(ch.charValue()) != block) {54System.err.println("Error: block = " + block);55System.err.println("Character.UnicodeBlock.of(" +56Integer.toHexString(ch.charValue()) +") = " +57Character.UnicodeBlock.of(ch.charValue()));58throw new RuntimeException("Blocks aren't equal.");59}60}61System.out.println("Passed.");62}6364/**65* Contains the character data to test. The first object is the character.66* The next object is the UnicodeBlock to which it should belong.67*/68Object[][] charData = {69{ new Character('\uFFFE'), Character.UnicodeBlock.SPECIALS },70{ new Character('\uFFFF'), Character.UnicodeBlock.SPECIALS },71};72}737475