summaryrefslogtreecommitdiffstats
path: root/libjava/java/nio
diff options
context:
space:
mode:
authormkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4>2005-02-18 07:44:59 +0000
committermkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4>2005-02-18 07:44:59 +0000
commit05532ed9ca51457352cf67f28f47d8cd29f2af5b (patch)
tree58c7af42ddc8365eb3bd16e7a28d7f05c77c820a /libjava/java/nio
parentd906592aed02fa82b7a3be7901dddd03f2653abd (diff)
downloadppe42-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.java17
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);
OpenPOWER on IntegriCloud