From: Robert Schuster Date: Fri, 18 Feb 2005 07:44:59 +0000 (+0000) Subject: Charset.java (forName): Throws IllegalArgumentException when argument is null and... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=82214ae9ccf71a869b4b22a171de7815dbbaa03e;p=gcc.git Charset.java (forName): Throws IllegalArgumentException when argument is null and added documentation. 2005-02-18 Robert Schuster * java/nio/charset/Charset.java (forName): Throws IllegalArgumentException when argument is null and added documentation. From-SVN: r95218 --- diff --git a/libjava/ChangeLog b/libjava/ChangeLog index cb0e02463e2..d6c781ea634 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,9 @@ +2005-02-18 Robert Schuster + + * java/nio/charset/Charset.java (forName): Throws + IllegalArgumentException when argument is null + and added documentation. + 2005-02-17 Ito Kazumitsu * 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 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 charsetName 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);