aboutsummaryrefslogtreecommitdiff
path: root/libjava
diff options
context:
space:
mode:
authorRobert Schuster <thebohemian@gmx.net>2005-02-18 07:44:59 +0000
committerMichael Koch <mkoch@gcc.gnu.org>2005-02-18 07:44:59 +0000
commit82214ae9ccf71a869b4b22a171de7815dbbaa03e (patch)
tree58c7af42ddc8365eb3bd16e7a28d7f05c77c820a /libjava
parent3a96c3b9d8cb8983c666c367fd7f9e5c278315df (diff)
downloadgcc-82214ae9ccf71a869b4b22a171de7815dbbaa03e.zip
gcc-82214ae9ccf71a869b4b22a171de7815dbbaa03e.tar.gz
gcc-82214ae9ccf71a869b4b22a171de7815dbbaa03e.tar.bz2
Charset.java (forName): Throws IllegalArgumentException when argument is null and added documentation.
2005-02-18 Robert Schuster <thebohemian@gmx.net> * java/nio/charset/Charset.java (forName): Throws IllegalArgumentException when argument is null and added documentation. From-SVN: r95218
Diffstat (limited to 'libjava')
-rw-r--r--libjava/ChangeLog6
-rw-r--r--libjava/java/nio/charset/Charset.java17
2 files changed, 22 insertions, 1 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index cb0e024..d6c781e 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,9 @@
+2005-02-18 Robert Schuster <thebohemian@gmx.net>
+
+ * java/nio/charset/Charset.java (forName): Throws
+ IllegalArgumentException when argument is null
+ and added documentation.
+
2005-02-17 Ito Kazumitsu <kaz@maczuka.gcd.org>
* gnu/java/nio/channels/FileChannelImpl.java (write(ByteBuffer)):
diff --git a/libjava/java/nio/charset/Charset.java b/libjava/java/nio/charset/Charset.java
index 5bb78f6..67e4fb1 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);