Commit d5323b99 by Warren Levy Committed by Warren Levy

StringBuffer.java (insert(int,char[])): Avoid NullPointerException so proper…

StringBuffer.java (insert(int,char[])): Avoid NullPointerException so proper check of offset can be done.

	* java/lang/StringBuffer.java (insert(int,char[])): Avoid
	NullPointerException so proper check of offset can be done.

From-SVN: r38132
parent be17b0fc
2000-12-08 Warren Levy <warrenl@redhat.com>
* java/lang/StringBuffer.java (insert(int,char[])): Avoid
NullPointerException so proper check of offset can be done.
2000-12-08 Warren Levy <warrenl@redhat.com>
* java/io/FileInputStream.java (close): Check if the fd is valid.
* java/io/RandomAccessFile.java (close): Ditto.
* java/net/PlainDatagramSocketImpl.java (close): Ditto.
......
......@@ -454,7 +454,9 @@ public final class StringBuffer implements Serializable
*/
public StringBuffer insert (int offset, char[] data)
{
return insert (offset, data, 0, data.length);
// One could check if offset is invalid here instead of making sure that
// data isn't null before dereferencing, but this works just as well.
return insert (offset, data, 0, data == null ? 0 : data.length);
}
/** Insert the <code>char[]</code> argument into this
......
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