6967533: Epoch bug: ExceptionInInitializerError on systems with uninitialized clock
authormartin
Fri, 09 Jul 2010 18:55:25 -0700
changeset 6001 8d781af24b23
parent 6000 b794e7305478
child 6002 4df5b9bcf842
6967533: Epoch bug: ExceptionInInitializerError on systems with uninitialized clock Summary: Remove (hopefully!) unnecessary check of currentTimeMillis Reviewed-by: dholmes Contributed-by: Jon VanAlten <jon.vanalten@redhat.com>
jdk/src/share/classes/java/lang/System.java
--- a/jdk/src/share/classes/java/lang/System.java	Fri Jul 09 09:54:10 2010 -0700
+++ b/jdk/src/share/classes/java/lang/System.java	Fri Jul 09 18:55:25 2010 -0700
@@ -69,7 +69,7 @@
      * corresponds to keyboard input or another input source specified by
      * the host environment or user.
      */
-    public final static InputStream in = nullInputStream();
+    public final static InputStream in = null;
 
     /**
      * The "standard" output stream. This stream is already
@@ -96,7 +96,7 @@
      * @see     java.io.PrintStream#println(java.lang.Object)
      * @see     java.io.PrintStream#println(java.lang.String)
      */
-    public final static PrintStream out = nullPrintStream();
+    public final static PrintStream out = null;
 
     /**
      * The "standard" error output stream. This stream is already
@@ -110,7 +110,7 @@
      * variable <code>out</code>, has been redirected to a file or other
      * destination that is typically not continuously monitored.
      */
-    public final static PrintStream err = nullPrintStream();
+    public final static PrintStream err = null;
 
     /* The security manager for the system.
      */
@@ -1093,26 +1093,6 @@
     public static native String mapLibraryName(String libname);
 
     /**
-     * The following two methods exist because in, out, and err must be
-     * initialized to null.  The compiler, however, cannot be permitted to
-     * inline access to them, since they are later set to more sensible values
-     * by initializeSystemClass().
-     */
-    private static InputStream nullInputStream() throws NullPointerException {
-        if (currentTimeMillis() > 0) {
-            return null;
-        }
-        throw new NullPointerException();
-    }
-
-    private static PrintStream nullPrintStream() throws NullPointerException {
-        if (currentTimeMillis() > 0) {
-            return null;
-        }
-        throw new NullPointerException();
-    }
-
-    /**
      * Initialize the system class.  Called after thread initialization.
      */
     private static void initializeSystemClass() {