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