OSDN Git Service

1999-07-01 Bryce McKinlay <bryce@albatross.co.nz>
authorbryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 1 Jul 1999 19:58:04 +0000 (19:58 +0000)
committerbryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 1 Jul 1999 19:58:04 +0000 (19:58 +0000)
        * java/lang/String.java (toString): Check for this == null and throw
        NullPointerException.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@27895 138bc75d-0d04-0410-961f-82ee72b054a4

libjava/ChangeLog
libjava/java/lang/String.java

index 247da09..892665f 100644 (file)
@@ -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
index 55cc9cd..c1c7c18 100644 (file)
@@ -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;
   }