Path: blob/master/test/jdk/sun/text/resources/Collator/Bug4248694.java
41152 views
/*1* Copyright (c) 2007, 2016, 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* @bug 424869426* @modules jdk.localedata27* @summary updating collation tables for icelandic28*/2930import java.text.Collator;31import java.util.Arrays;32import java.util.Locale;3334public class Bug4248694 {3536/********************************************************37*********************************************************/38public static void main (String[] args) {39Locale reservedLocale = Locale.getDefault();40try {41int errors=0;4243Locale loc = new Locale ("is", "is"); // Icelandic4445Locale.setDefault (loc);46Collator col = Collator.getInstance ();4748String[] data = {"\u00e6ard",49"Zard",50"aard",51"\u00feard",52"vird",53"\u00c6ard",54"Zerd",55"\u00deard"};5657String[] sortedData = {"aard",58"vird",59"Zard",60"Zerd",61"\u00feard",62"\u00deard",63"\u00e6ard",64"\u00c6ard"};6566Arrays.sort (data, col);6768System.out.println ("Using " + loc.getDisplayName());69for (int i = 0; i < data.length; i++) {70System.out.println(data[i] + " : " + sortedData[i]);71if (sortedData[i].compareTo(data[i]) != 0) {72errors++;73}74}//end for7576if (errors > 0)77throw new RuntimeException();78} finally {79// restore the reserved locale80Locale.setDefault(reservedLocale);81}82}//end main8384}//end class CollatorTest858687