From 3097f1a54dd0598d3ca33c859b68376734cb9fa6 Mon Sep 17 00:00:00 2001 From: Nishit Jain Date: Wed, 8 Jun 2016 12:54:37 +0900 Subject: [PATCH] 8047780: [Doc] Locale.LanguageRange() throws an undocumented IAE when range is ill-formed Reviewed-by: okutsu, peytoia --- jdk/src/java.base/share/classes/java/util/Locale.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/util/Locale.java b/jdk/src/java.base/share/classes/java/util/Locale.java index 23417394030..6567ab02bb4 100644 --- a/jdk/src/java.base/share/classes/java/util/Locale.java +++ b/jdk/src/java.base/share/classes/java/util/Locale.java @@ -2858,6 +2858,8 @@ public final class Locale implements Cloneable, Serializable { * @param range a language range * @throws NullPointerException if the given {@code range} is * {@code null} + * @throws IllegalArgumentException if the given {@code range} does not + * comply with the syntax of the language range mentioned in RFC 4647 */ public LanguageRange(String range) { this(range, MAX_WEIGHT); @@ -2873,8 +2875,10 @@ public final class Locale implements Cloneable, Serializable { * {@code MAX_WEIGHT} * @throws NullPointerException if the given {@code range} is * {@code null} - * @throws IllegalArgumentException if the given {@code weight} is less - * than {@code MIN_WEIGHT} or greater than {@code MAX_WEIGHT} + * @throws IllegalArgumentException if the given {@code range} does not + * comply with the syntax of the language range mentioned in RFC 4647 + * or if the given {@code weight} is less than {@code MIN_WEIGHT} + * or greater than {@code MAX_WEIGHT} */ public LanguageRange(String range, double weight) { if (range == null) {