From 101b0c3b0eefaf89c445cbb93d1013ec465b72c8 Mon Sep 17 00:00:00 2001 From: Eric Scharff Date: Thu, 27 Sep 2007 15:05:55 -0600 Subject: [PATCH] Support printing of null references --- classpath/java/io/PrintStream.java | 2 +- classpath/java/lang/String.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/classpath/java/io/PrintStream.java b/classpath/java/io/PrintStream.java index 1e21d86ed3..37c141bb03 100644 --- a/classpath/java/io/PrintStream.java +++ b/classpath/java/io/PrintStream.java @@ -23,7 +23,7 @@ public class PrintStream extends OutputStream { } public void print(Object o) { - print(o.toString()); + print(String.valueOf(o)); } public void print(char c) { diff --git a/classpath/java/lang/String.java b/classpath/java/lang/String.java index 3c72ee92e3..283e4b7248 100644 --- a/classpath/java/lang/String.java +++ b/classpath/java/lang/String.java @@ -379,7 +379,7 @@ public final class String implements Comparable { public native String intern(); public static String valueOf(Object s) { - return s.toString(); + return s == null ? "null" : s.toString(); } public static String valueOf(boolean v) {