diff options
author | Bryce McKinlay <bryce@albatross.co.nz> | 1999-07-01 19:58:04 +0000 |
---|---|---|
committer | Bryce McKinlay <bryce@gcc.gnu.org> | 1999-07-01 20:58:04 +0100 |
commit | 659c26fc492ecf35fd18859a9e9c75df956c4275 (patch) | |
tree | e4609122ac1443def4350c521293ac70290ace43 | |
parent | cb1902adbf904ff5b63d0a9ceed558783b0c875a (diff) | |
download | gcc-659c26fc492ecf35fd18859a9e9c75df956c4275.zip gcc-659c26fc492ecf35fd18859a9e9c75df956c4275.tar.gz gcc-659c26fc492ecf35fd18859a9e9c75df956c4275.tar.bz2 |
String.java (toString): Check for this == null and throw NullPointerException.
1999-07-01 Bryce McKinlay <bryce@albatross.co.nz>
* java/lang/String.java (toString): Check for this == null and throw
NullPointerException.
From-SVN: r27895
-rw-r--r-- | libjava/ChangeLog | 5 | ||||
-rw-r--r-- | libjava/java/lang/String.java | 3 |
2 files changed, 8 insertions, 0 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 247da09..892665f 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,8 @@ +1999-07-01 Bryce McKinlay <bryce@albatross.co.nz> + + * java/lang/String.java (toString): Check for this == null and throw + NullPointerException. + 1999-07-01 Warren Levy <warrenl@cygnus.com> * gnu/gcj/convert/BytesToUnicode.java (read): Changed outlength diff --git a/libjava/java/lang/String.java b/libjava/java/lang/String.java index 55cc9cd..c1c7c18 100644 --- a/libjava/java/lang/String.java +++ b/libjava/java/lang/String.java @@ -115,6 +115,9 @@ public final class String public String toString () { + // because String is final, we actually get this far on a null reference + if (this == null) + throw new NullPointerException(); return this; } |