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 /libjava/java/lang/String.java | |
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
Diffstat (limited to 'libjava/java/lang/String.java')
-rw-r--r-- | libjava/java/lang/String.java | 3 |
1 files changed, 3 insertions, 0 deletions
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; } |