diff options
author | mkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-02-18 07:44:59 +0000 |
---|---|---|
committer | mkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-02-18 07:44:59 +0000 |
commit | 05532ed9ca51457352cf67f28f47d8cd29f2af5b (patch) | |
tree | 58c7af42ddc8365eb3bd16e7a28d7f05c77c820a /libjava/java/nio | |
parent | d906592aed02fa82b7a3be7901dddd03f2653abd (diff) | |
download | ppe42-gcc-05532ed9ca51457352cf67f28f47d8cd29f2af5b.tar.gz ppe42-gcc-05532ed9ca51457352cf67f28f47d8cd29f2af5b.zip |
2005-02-18 Robert Schuster <thebohemian@gmx.net>
* java/nio/charset/Charset.java (forName): Throws
IllegalArgumentException when argument is null
and added documentation.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@95218 138bc75d-0d04-0410-961f-82ee72b054a4
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); |