diff -ru CVS/classpath/java/lang/Double.java updated/classpath/java/lang/Double.java
--- CVS/classpath/java/lang/Double.java	2010-06-27 19:51:48.000000000 +0400
+++ updated/classpath/java/lang/Double.java	2010-06-27 20:00:34.000000000 +0400
@@ -1,5 +1,5 @@
 /* Double.java -- object wrapper for double
-   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2010
    Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -485,7 +485,7 @@
   public int hashCode()
   {
     long v = doubleToLongBits(value);
-    return (int) (v ^ (v >>> 32));
+    return (int) (v >>> 32) ^ (int) v;
   }
 
   /**
diff -ru CVS/classpath/java/lang/ExceptionInInitializerError.java updated/classpath/java/lang/ExceptionInInitializerError.java
--- CVS/classpath/java/lang/ExceptionInInitializerError.java	2005-07-03 00:32:38.000000000 +0400
+++ updated/classpath/java/lang/ExceptionInInitializerError.java	2010-06-27 20:00:44.000000000 +0400
@@ -1,6 +1,7 @@
 /* ExceptionInInitializerError.java -- thrown when class initialization fails
    with an uncaught exception
-   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005  Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005, 2010
+   Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -84,6 +85,7 @@
   {
     super(s);
     exception = null;
+    initCause(null); // disallow subsequent initCause
   }
 
   /**
diff -ru CVS/classpath/java/lang/Integer.java updated/classpath/java/lang/Integer.java
--- CVS/classpath/java/lang/Integer.java	2010-06-27 19:54:24.000000000 +0400
+++ updated/classpath/java/lang/Integer.java	2010-06-27 20:01:24.000000000 +0400
@@ -1,5 +1,5 @@
 /* Integer.java -- object wrapper for int
-   Copyright (C) 1998, 1999, 2001, 2002, 2004, 2005
+   Copyright (C) 1998, 1999, 2001, 2002, 2004, 2005, 2010
    Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -776,12 +776,12 @@
   static int parseInt(String str, int radix, boolean decode)
   {
     if (! decode && str == null)
-      throw new NumberFormatException();
+      throw new NumberFormatException("null");
     int index = 0;
     int len = str.length();
     boolean isNeg = false;
     if (len == 0)
-      throw new NumberFormatException("string length is null");
+      throw new NumberFormatException("string length is 0");
     int ch = str.charAt(index);
     if (ch == '-')
       {
diff -ru CVS/classpath/java/lang/Long.java updated/classpath/java/lang/Long.java
--- CVS/classpath/java/lang/Long.java	2010-06-27 19:54:50.000000000 +0400
+++ updated/classpath/java/lang/Long.java	2010-06-27 20:03:16.000000000 +0400
@@ -1,5 +1,6 @@
 /* Long.java -- object wrapper for long
-   Copyright (C) 1998, 1999, 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2001, 2002, 2004, 2005, 2010
+   Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -486,7 +487,7 @@
    */
   public int hashCode()
   {
-    return (int) (value ^ (value >>> 32));
+    return (int) value ^ (int) (value >>> 32);
   }
 
   /**
@@ -594,7 +595,7 @@
     // Successively collapse alternating bit groups into a sum.
     x = ((x >> 1) & 0x5555555555555555L) + (x & 0x5555555555555555L);
     x = ((x >> 2) & 0x3333333333333333L) + (x & 0x3333333333333333L);
-    int v = (int) ((x >>> 32) + x);
+    int v = (int) (x >>> 32) + (int) x;
     v = ((v >> 4) & 0x0f0f0f0f) + (v & 0x0f0f0f0f);
     v = ((v >> 8) & 0x00ff00ff) + (v & 0x00ff00ff);
     return ((v >> 16) & 0x0000ffff) + (v & 0x0000ffff);
@@ -707,7 +708,7 @@
   {
     int hi = Integer.reverseBytes((int) val);
     int lo = Integer.reverseBytes((int) (val >>> 32));
-    return (((long) hi) << 32) | lo;
+    return (((long) hi) << 32) | (lo & 0xffffffffL);
   }
 
   /**
@@ -716,9 +717,9 @@
    */
   public static long reverse(long val)
   {
-    long hi = Integer.reverse((int) val) & 0xffffffffL;
-    long lo = Integer.reverse((int) (val >>> 32)) & 0xffffffffL;
-    return (hi << 32) | lo;
+    int hi = Integer.reverse((int) val);
+    int lo = Integer.reverse((int) (val >>> 32));
+    return (((long) hi) << 32) | (lo & 0xffffffffL);
   }
 
   /**
@@ -771,20 +772,26 @@
   private static long parseLong(String str, int radix, boolean decode)
   {
     if (! decode && str == null)
-      throw new NumberFormatException();
+      throw new NumberFormatException("null");
     int index = 0;
     int len = str.length();
     boolean isNeg = false;
     if (len == 0)
-      throw new NumberFormatException();
+      throw numberFormatExceptionForInputString(str);
     int ch = str.charAt(index);
     if (ch == '-')
       {
         if (len == 1)
-          throw new NumberFormatException();
+          throw numberFormatExceptionForInputString(str);
         isNeg = true;
         ch = str.charAt(++index);
       }
+    else if (ch == '+')
+      {
+        if (len == 1)
+          throw numberFormatExceptionForInputString(str);
+        ch = str.charAt(++index);
+      }
     if (decode)
       {
         if (ch == '0')
@@ -806,7 +813,7 @@
           }
       }
     if (index == len)
-      throw new NumberFormatException();
+      throw numberFormatExceptionForInputString(str);
 
     long max = MAX_VALUE / radix;
     // We can't directly write `max = (MAX_VALUE + 1) / radix'.
@@ -818,13 +825,19 @@
     while (index < len)
       {
         if (val < 0 || val > max)
-          throw new NumberFormatException();
+          throw numberFormatExceptionForInputString(str);
 
         ch = Character.digit(str.charAt(index++), radix);
         val = val * radix + ch;
         if (ch < 0 || (val < 0 && (! isNeg || val != MIN_VALUE)))
-          throw new NumberFormatException();
+          throw numberFormatExceptionForInputString(str);
       }
     return isNeg ? -val : val;
   }
+
+  private static NumberFormatException numberFormatExceptionForInputString(
+    String str)
+  {
+    return new NumberFormatException("for input string: \"" + str + "\"");
+  }
 }
diff -ru CVS/classpath/java/lang/StackTraceElement.java updated/classpath/java/lang/StackTraceElement.java
--- CVS/classpath/java/lang/StackTraceElement.java	2010-06-27 19:55:18.000000000 +0400
+++ updated/classpath/java/lang/StackTraceElement.java	2010-06-27 20:03:18.000000000 +0400
@@ -1,5 +1,6 @@
 /* StackTraceElement.java -- One function call or call stack element
-   Copyright (C) 2001, 2002, 2004, 2005, 2006  Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2004, 2005, 2006, 2010
+   Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -255,25 +256,25 @@
   }
 
   /**
-   * Compare two objects according to Collection semantics.
+   * Compare two strings according to Collection semantics.
    *
-   * @param o1 the first object
-   * @param o2 the second object
-   * @return o1 == null ? o2 == null : o1.equals(o2)
+   * @param s1 the first string
+   * @param s2 the second string
+   * @return s1 == null ? s2 == null : s1.equals(s2)
    */
-  private static boolean equals(Object o1, Object o2)
+  private static boolean equals(String s1, String s2)
   {
-    return o1 == null ? o2 == null : o1.equals(o2);
+    return s1 == null ? s2 == null : s1.equals(s2);
   }
 
   /**
-   * Hash an object according to Collection semantics.
+   * Hash a string according to Collection semantics.
    *
-   * @param o the object to hash
-   * @return o1 == null ? 0 : o1.hashCode()
+   * @param s the string to hash
+   * @return s == null ? 0 : s.hashCode()
    */
-  private static int hashCode(Object o)
+  private static int hashCode(String s)
   {
-    return o == null ? 0 : o.hashCode();
+    return s == null ? 0 : s.hashCode();
   }
 }
diff -ru CVS/classpath/java/lang/String.java updated/classpath/java/lang/String.java
--- CVS/classpath/java/lang/String.java	2010-06-27 19:55:56.000000000 +0400
+++ updated/classpath/java/lang/String.java	2010-06-27 20:03:20.000000000 +0400
@@ -1,5 +1,5 @@
 /* String.java -- immutable character sequences; the object of string literals
-   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2010
    Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -359,13 +359,13 @@
       }
     catch(IllegalCharsetNameException e)
       {
-        throw new UnsupportedEncodingException("Encoding: "+encoding+
-                                               " not found.");
+        throw new UnsupportedEncodingException("Encoding not found: " +
+                                               encoding);
       }
     catch(UnsupportedCharsetException e)
       {
-        throw new UnsupportedEncodingException("Encoding: "+encoding+
-                                               " not found.");
+        throw new UnsupportedEncodingException("Encoding not found: " +
+                                               encoding);
       }
   }
 
diff -ru CVS/classpath/java/lang/System.java updated/classpath/java/lang/System.java
--- CVS/classpath/java/lang/System.java	2010-06-27 19:56:16.000000000 +0400
+++ updated/classpath/java/lang/System.java	2010-06-27 20:03:22.000000000 +0400
@@ -1,5 +1,5 @@
 /* System.java -- useful methods to interface with the system
-   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007
+   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2010
    Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -73,16 +73,17 @@
   // in vm/reference/java/lang/Runtime for implications of this fact.
 
   /**
-   * The standard InputStream. This is assigned at startup and starts its
-   * life perfectly valid. Although it is marked final, you can change it
-   * using {@link #setIn(InputStream)} through some hefty VM magic.
+   * The standard output PrintStream.  This is assigned at startup and
+   * starts its life perfectly valid. Although it is marked final, you can
+   * change it using {@link #setErr(PrintStream)} through some hefty VM magic.
    *
-   * <p>This corresponds to the C stdin and C++ cin variables, which
-   * typically input from the keyboard, but may be used to pipe input from
-   * other processes or files.  That should all be transparent to you,
-   * however.
+   * <p>This corresponds to the C stderr and C++ cerr variables, which
+   * typically output error messages to the screen, but may be used to pipe
+   * output to other processes or files.  That should all be transparent to
+   * you, however.
    */
-  public static final InputStream in = VMSystem.makeStandardInputStream();
+  public static final PrintStream err = VMSystem.makeStandardErrorStream();
+  // System.err is initialized first (before System.out and System.in).
 
   /**
    * The standard output PrintStream.  This is assigned at startup and
@@ -97,16 +98,16 @@
   public static final PrintStream out = VMSystem.makeStandardOutputStream();
 
   /**
-   * The standard output PrintStream.  This is assigned at startup and
-   * starts its life perfectly valid. Although it is marked final, you can
-   * change it using {@link #setErr(PrintStream)} through some hefty VM magic.
+   * The standard InputStream. This is assigned at startup and starts its
+   * life perfectly valid. Although it is marked final, you can change it
+   * using {@link #setIn(InputStream)} through some hefty VM magic.
    *
-   * <p>This corresponds to the C stderr and C++ cerr variables, which
-   * typically output error messages to the screen, but may be used to pipe
-   * output to other processes or files.  That should all be transparent to
-   * you, however.
+   * <p>This corresponds to the C stdin and C++ cin variables, which
+   * typically input from the keyboard, but may be used to pipe input from
+   * other processes or files.  That should all be transparent to you,
+   * however.
    */
-  public static final PrintStream err = VMSystem.makeStandardErrorStream();
+  public static final InputStream in = VMSystem.makeStandardInputStream();
 
   /**
    * A cached copy of the environment variable map.
diff -ru CVS/classpath/java/lang/Thread.java updated/classpath/java/lang/Thread.java
--- CVS/classpath/java/lang/Thread.java	2010-06-27 19:56:38.000000000 +0400
+++ updated/classpath/java/lang/Thread.java	2010-06-27 20:03:24.000000000 +0400
@@ -1,6 +1,6 @@
 /* Thread -- an independent thread of executable code
-   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
-   Free Software Foundation
+   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2010
+   Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -349,6 +349,9 @@
    */
   public Thread(ThreadGroup group, Runnable target, String name, long size)
   {
+    if (name == null)
+      throw new NullPointerException();
+
     // Bypass System.getSecurityManager, for bootstrap efficiency.
     SecurityManager sm = SecurityManager.current;
     Thread current = currentThread();
@@ -363,8 +366,7 @@
       sm.checkAccess(group);
 
     this.group = group;
-    // Use toString hack to detect null.
-    this.name = name.toString();
+    this.name = name;
     this.runnable = target;
     this.stacksize = size;
     this.locals = new ThreadLocalMap();
@@ -855,7 +857,7 @@
    * are no guarantees which thread will be next to run, but most VMs will
    * choose the highest priority thread that has been waiting longest.
    *
-   * @param ms the number of milliseconds to sleep, or 0 for forever
+   * @param ms the number of milliseconds to sleep
    * @throws InterruptedException if the Thread is (or was) interrupted;
    *         it's <i>interrupted status</i> will be cleared
    * @throws IllegalArgumentException if ms is negative
@@ -881,7 +883,7 @@
    * immediately when time expires, because some other thread may be
    * active.  So don't expect real-time performance.
    *
-   * @param ms the number of milliseconds to sleep, or 0 for forever
+   * @param ms the number of milliseconds to sleep
    * @param ns the number of extra nanoseconds to sleep (0-999999)
    * @throws InterruptedException if the Thread is (or was) interrupted;
    *         it's <i>interrupted status</i> will be cleared
@@ -1037,7 +1039,7 @@
     checkAccess();
     if (priority < MIN_PRIORITY || priority > MAX_PRIORITY)
       throw new IllegalArgumentException("Invalid thread priority value "
-                                         + priority + ".");
+                                         + priority);
     priority = Math.min(priority, group.getMaxPriority());
     VMThread t = vmThread;
     if (t != null)
diff -ru CVS/classpath/java/lang/Throwable.java updated/classpath/java/lang/Throwable.java
--- CVS/classpath/java/lang/Throwable.java	2010-06-27 19:56:56.000000000 +0400
+++ updated/classpath/java/lang/Throwable.java	2010-06-27 20:03:30.000000000 +0400
@@ -1,5 +1,6 @@
 /* java.lang.Throwable -- Root class for all Exceptions and Errors
-   Copyright (C) 1998, 1999, 2002, 2004, 2005  Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2002, 2004, 2005, 2010
+   Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -41,6 +42,8 @@
 
 import gnu.java.lang.CPStringBuilder;
 
+import java.io.IOException;
+import java.io.ObjectOutputStream;
 import java.io.PrintStream;
 import java.io.PrintWriter;
 import java.io.Serializable;
@@ -556,6 +559,12 @@
     this.stackTrace = st;
   }
 
+  private void writeObject(ObjectOutputStream out) throws IOException
+  {
+    getStackTrace();
+    out.defaultWriteObject();
+  }
+
   /**
    * VM state when fillInStackTrace was called.
    * Used by getStackTrace() to get an array of StackTraceElements.
