Commit 82214ae9 by Robert Schuster Committed by Michael Koch

Charset.java (forName): Throws IllegalArgumentException when argument is null…

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
parent 3a96c3b9
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> 2005-02-17 Ito Kazumitsu <kaz@maczuka.gcd.org>
* gnu/java/nio/channels/FileChannelImpl.java (write(ByteBuffer)): * gnu/java/nio/channels/FileChannelImpl.java (write(ByteBuffer)):
......
...@@ -117,9 +117,24 @@ public abstract class Charset implements Comparable ...@@ -117,9 +117,24 @@ public abstract class Charset implements Comparable
{ {
return charsetForName (charsetName) != null; 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) 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); Charset cs = charsetForName (charsetName);
if (cs == null) if (cs == null)
throw new UnsupportedCharsetException (charsetName); throw new UnsupportedCharsetException (charsetName);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment