diff options
Diffstat (limited to 'libjava/java/nio')
-rw-r--r-- | libjava/java/nio/charset/Charset.java | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/libjava/java/nio/charset/Charset.java b/libjava/java/nio/charset/Charset.java index 5bb78f63ca9..67e4fb146ff 100644 --- a/libjava/java/nio/charset/Charset.java +++ b/libjava/java/nio/charset/Charset.java @@ -117,9 +117,24 @@ public abstract class Charset implements Comparable { return charsetForName (charsetName) != null; } - + + /** + * Returns the Charset instance for the charset of the given name. + * + * @param charsetName + * @return + * @throws UnsupportedCharsetException if this VM does not support + * the charset of the given name. + * @throws IllegalCharsetNameException if the given charset name is + * legal. + * @throws IllegalArgumentException if <code>charsetName</code> is null. + */ public static Charset forName (String charsetName) { + // Throws IllegalArgumentException as the JDK does. + if(charsetName == null) + throw new IllegalArgumentException("Charset name must not be null."); + Charset cs = charsetForName (charsetName); if (cs == null) throw new UnsupportedCharsetException (charsetName); |