this patch adds support for the officially undocumented behavior of throwing an IllegalArgumentException in
java.nio.charset.Charset.forName(String charsetName) if charsetName is null.
A mauve testcase is already provided.
2005-02-18 Robert Schuster <[EMAIL PROTECTED]>
* java/nio/charset/Charset.java (forName): Throws IllegalArgumentException when argument is null and added documentation.
cu Robert
Index: java/nio/charset/Charset.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/nio/charset/Charset.java,v
retrieving revision 1.14
diff -u -r1.14 Charset.java
--- java/nio/charset/Charset.java 8 Jan 2005 11:48:28 -0000 1.14
+++ java/nio/charset/Charset.java 18 Feb 2005 01:28:38 -0000
@@ -127,9 +127,24 @@
{
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);
_______________________________________________ Classpath-patches mailing list [email protected] http://lists.gnu.org/mailman/listinfo/classpath-patches
