8306927: Collator treats "v" and "w" as the same letter for Swedish language locale.

Reviewed-by: jlu, iris, joehw
This commit is contained in:
Naoto Sato 2023-04-27 18:12:41 +00:00
parent 80fae514b1
commit 6983d05b73
2 changed files with 46 additions and 5 deletions
src/jdk.localedata/share/classes/sun/text/resources/ext
test/jdk/sun/text/resources/Collator

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -23,9 +23,6 @@
* questions.
*/
/*
*/
/*
* (C) Copyright Taligent, Inc. 1996, 1997 - All Rights Reserved
* (C) Copyright IBM Corp. 1996 - 1998 - All Rights Reserved
@ -55,7 +52,6 @@ public class CollationData_sv extends ListResourceBundle {
"< \u00e6 , \u00c6 " + // ae ligature
"< o\u0308 , O\u0308 " + // o-umlaut
"< o\u030b , O\u030b ; \u00f8 , \u00d8 " + // o-double-acute < o-stroke
"& V ; w , W" +
"& Y, u\u0308 , U\u0308" + // u-double-acute
"; u\u030b, U\u030b "
}

@ -0,0 +1,45 @@
/*
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8306927
* @modules jdk.localedata
* @summary Tests Swedish collation involving 'v' and 'w'.
*/
import java.text.Collator;
import java.util.Arrays;
import java.util.Locale;
public class SwedishTest {
private static final String[] src = {"wb", "va", "vc"};
private static final String[] expected = {"va", "vc", "wb"};
public static void main (String[] args) {
Arrays.sort(src, Collator.getInstance(Locale.of("sv")));
if (!Arrays.equals(src, expected)) {
throw new RuntimeException("Swedish collation failed");
}
}
}