提交 b407173f 编写于 作者: P peytoia

8042360: Subtag syntax check is incomplete in Locale.LanguageRange

Reviewed-by: naoto, okutsu
上级 77d81452
...@@ -2905,8 +2905,8 @@ public final class Locale implements Cloneable, Serializable { ...@@ -2905,8 +2905,8 @@ public final class Locale implements Cloneable, Serializable {
for (int i = 1; i < subtags.length; i++) { for (int i = 1; i < subtags.length; i++) {
if (isSubtagIllFormed(subtags[i], false)) { if (isSubtagIllFormed(subtags[i], false)) {
isIllFormed = true; isIllFormed = true;
break;
} }
break;
} }
} }
if (isIllFormed) { if (isIllFormed) {
......
/* /*
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 7069824 * @bug 7069824 8042360
* @summary Verify implementation for Locale matching. * @summary Verify implementation for Locale matching.
* @run main Bug7069824 * @run main Bug7069824
*/ */
...@@ -91,6 +91,17 @@ public class Bug7069824 { ...@@ -91,6 +91,17 @@ public class Bug7069824 {
String range; String range;
double weight; double weight;
// Testcase for 8042360
range = "en-Latn-1234567890";
try {
lr = new LanguageRange(range);
error = true;
System.err.println(" IAE should be thrown for LanguageRange("
+ range + ").");
}
catch (IllegalArgumentException ex) {
}
range = null; range = null;
try { try {
lr = new LanguageRange(range); lr = new LanguageRange(range);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册