8047780: [Doc] Locale.LanguageRange() throws an undocumented IAE when range is ill-formed

Reviewed-by: okutsu, peytoia
This commit is contained in:
Nishit Jain 2016-06-08 12:54:37 +09:00
parent dcaf52adab
commit 3097f1a54d

View File

@ -2858,6 +2858,8 @@ public final class Locale implements Cloneable, Serializable {
* @param range a language range * @param range a language range
* @throws NullPointerException if the given {@code range} is * @throws NullPointerException if the given {@code range} is
* {@code null} * {@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) { public LanguageRange(String range) {
this(range, MAX_WEIGHT); this(range, MAX_WEIGHT);
@ -2873,8 +2875,10 @@ public final class Locale implements Cloneable, Serializable {
* {@code MAX_WEIGHT} * {@code MAX_WEIGHT}
* @throws NullPointerException if the given {@code range} is * @throws NullPointerException if the given {@code range} is
* {@code null} * {@code null}
* @throws IllegalArgumentException if the given {@code weight} is less * @throws IllegalArgumentException if the given {@code range} does not
* than {@code MIN_WEIGHT} or greater than {@code MAX_WEIGHT} * 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) { public LanguageRange(String range, double weight) {
if (range == null) { if (range == null) {