]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
StringBuffer.java (StringBuffer): Don't special case null argument.
authorAnthony Green <green@cygnus.com>
Mon, 17 Jan 2000 00:00:43 +0000 (00:00 +0000)
committerAnthony Green <green@gcc.gnu.org>
Mon, 17 Jan 2000 00:00:43 +0000 (00:00 +0000)
2000-01-16  Anthony Green  <green@cygnus.com>

* java/lang/StringBuffer.java (StringBuffer): Don't special case
null argument.

From-SVN: r31451

libjava/ChangeLog
libjava/java/lang/StringBuffer.java

index d126cd18d9b4d6e1dc365ce833d91d200d1162ba..8db6f2fd7db7961e224f043ea2dff3e0f7e47905 100644 (file)
@@ -1,3 +1,8 @@
+2000-01-16  Anthony Green  <green@cygnus.com>
+
+       * java/lang/StringBuffer.java (StringBuffer): Don't special case
+       null argument.
+
 2000-01-16  Jeff Sturm  <jsturm@sigma6.com>
 
        * java/io/StreamTokenizer.java (nextToken): Avoid unread(TT_EOF).
index 70f78fbf8e599f98eb4d46a018ed71db5bf7aa6e..7f6e42ec9c9400d5143555218a98b4f3f9d20b4a 100644 (file)
@@ -1,6 +1,6 @@
 // StringBuffer.java - Growable strings.
 
-/* Copyright (C) 1998, 1999  Cygnus Solutions
+/* Copyright (C) 1998, 1999, 2000  Red Hat
 
    This file is part of libgcj.
 
@@ -241,12 +241,9 @@ public final class StringBuffer implements Serializable
 
   public StringBuffer (String str)
     {
-      // Note: nowhere does it say that we should handle a null
-      // argument here.  In fact, the JCL implies that we should not.
-      // But this leads to an asymmetry: `null + ""' will fail, while
-      // `"" + null' will work.
-      if (str == null)
-       str = "null";
+      // The documentation is not clear, but experimentation with
+      // other implementations indicates that StringBuffer(null)
+      // should throw a NullPointerException.
       count = str.length();
       // JLS: The initial capacity of the string buffer is 16 plus the
       // length of the argument string.