Merge change I2e354493

* changes:
  Update NIO and NIO char packages to Harmony 802921.
diff --git a/archive/src/main/java/java/util/jar/Attributes.java b/archive/src/main/java/java/util/jar/Attributes.java
index 4ee94df..159a0cd 100644
--- a/archive/src/main/java/java/util/jar/Attributes.java
+++ b/archive/src/main/java/java/util/jar/Attributes.java
@@ -437,7 +437,7 @@
         try {
             clone = (Attributes) super.clone();
         } catch (CloneNotSupportedException e) {
-            return null;
+            throw new AssertionError(e); // android-changed
         }
         clone.map = (Map<Object, Object>) ((HashMap) map).clone();
         return clone;
diff --git a/luni/src/main/java/java/util/BitSet.java b/luni/src/main/java/java/util/BitSet.java
index 4e01cbf..f88ca7d 100644
--- a/luni/src/main/java/java/util/BitSet.java
+++ b/luni/src/main/java/java/util/BitSet.java
@@ -131,7 +131,7 @@
             clone.bits = bits.clone();
             return clone;
         } catch (CloneNotSupportedException e) {
-            return null;
+            throw new AssertionError(e); // android-changed
         }
     }
 
diff --git a/luni/src/main/java/java/util/Calendar.java b/luni/src/main/java/java/util/Calendar.java
index 0ac574c..49a8c3f 100644
--- a/luni/src/main/java/java/util/Calendar.java
+++ b/luni/src/main/java/java/util/Calendar.java
@@ -790,7 +790,7 @@
             clone.zone = (TimeZone) zone.clone();
             return clone;
         } catch (CloneNotSupportedException e) {
-            return null;
+            throw new AssertionError(e); // android-changed
         }
     }
 
diff --git a/luni/src/main/java/java/util/Date.java b/luni/src/main/java/java/util/Date.java
index 80610d3..37f5b6a 100644
--- a/luni/src/main/java/java/util/Date.java
+++ b/luni/src/main/java/java/util/Date.java
@@ -193,7 +193,7 @@
         try {
             return super.clone();
         } catch (CloneNotSupportedException e) {
-            return null;
+            throw new AssertionError(e); // android-changed
         }
     }
 
diff --git a/luni/src/main/java/java/util/EnumMap.java b/luni/src/main/java/java/util/EnumMap.java
index 975fdad..2b33175 100644
--- a/luni/src/main/java/java/util/EnumMap.java
+++ b/luni/src/main/java/java/util/EnumMap.java
@@ -470,7 +470,7 @@
             enumMap.initialization(this);
             return enumMap;
         } catch (CloneNotSupportedException e) {
-            return null;
+            throw new AssertionError(e); // android-changed
         }
     }
 
diff --git a/luni/src/main/java/java/util/EnumSet.java b/luni/src/main/java/java/util/EnumSet.java
index d49d900..c2c3fc0 100644
--- a/luni/src/main/java/java/util/EnumSet.java
+++ b/luni/src/main/java/java/util/EnumSet.java
@@ -322,7 +322,7 @@
             Object set = super.clone();
             return (EnumSet<E>) set;
         } catch (CloneNotSupportedException e) {
-            return null;
+            throw new AssertionError(e); // android-changed
         }
     }
 
diff --git a/luni/src/main/java/java/util/HashSet.java b/luni/src/main/java/java/util/HashSet.java
index 4c97ca5..aa5c3fb 100644
--- a/luni/src/main/java/java/util/HashSet.java
+++ b/luni/src/main/java/java/util/HashSet.java
@@ -121,7 +121,7 @@
             clone.backingMap = (HashMap<E, HashSet<E>>) backingMap.clone();
             return clone;
         } catch (CloneNotSupportedException e) {
-            return null;
+            throw new AssertionError(e); // android-changed
         }
     }
 
diff --git a/luni/src/main/java/java/util/IdentityHashMap.java b/luni/src/main/java/java/util/IdentityHashMap.java
index 053de1d..8d0f036 100644
--- a/luni/src/main/java/java/util/IdentityHashMap.java
+++ b/luni/src/main/java/java/util/IdentityHashMap.java
@@ -758,7 +758,7 @@
                     elementData.length);
             return cloneHashMap;
         } catch (CloneNotSupportedException e) {
-            return null;
+            throw new AssertionError(e); // android-changed
         }
     }
 
diff --git a/luni/src/main/java/java/util/LinkedList.java b/luni/src/main/java/java/util/LinkedList.java
index 64326e3..7a7e81f 100644
--- a/luni/src/main/java/java/util/LinkedList.java
+++ b/luni/src/main/java/java/util/LinkedList.java
@@ -402,7 +402,7 @@
             l.addAll(this);
             return l;
         } catch (CloneNotSupportedException e) {
-            return null;
+            throw new AssertionError(e); // android-changed
         }
     }
 
diff --git a/luni/src/main/java/java/util/Locale.java b/luni/src/main/java/java/util/Locale.java
index 3d724d0..22cda76 100644
--- a/luni/src/main/java/java/util/Locale.java
+++ b/luni/src/main/java/java/util/Locale.java
@@ -277,7 +277,7 @@
         try {
             return super.clone();
         } catch (CloneNotSupportedException e) {
-            return null;
+            throw new AssertionError(e); // android-changed
         }
     }
 
diff --git a/luni/src/main/java/java/util/MapEntry.java b/luni/src/main/java/java/util/MapEntry.java
index 6a5bf0f..b84697b 100644
--- a/luni/src/main/java/java/util/MapEntry.java
+++ b/luni/src/main/java/java/util/MapEntry.java
@@ -43,7 +43,7 @@
         try {
             return super.clone();
         } catch (CloneNotSupportedException e) {
-            return null;
+            throw new AssertionError(e); // android-changed
         }
     }
 
diff --git a/luni/src/main/java/java/util/TimeZone.java b/luni/src/main/java/java/util/TimeZone.java
index b4878ca..09dcae2 100644
--- a/luni/src/main/java/java/util/TimeZone.java
+++ b/luni/src/main/java/java/util/TimeZone.java
@@ -149,7 +149,7 @@
             TimeZone zone = (TimeZone) super.clone();
             return zone;
         } catch (CloneNotSupportedException e) {
-            return null;
+            throw new AssertionError(e); // android-changed
         }
     }
 
diff --git a/luni/src/main/java/java/util/TreeMap.java b/luni/src/main/java/java/util/TreeMap.java
index b97821f..67b39e8 100644
--- a/luni/src/main/java/java/util/TreeMap.java
+++ b/luni/src/main/java/java/util/TreeMap.java
@@ -61,7 +61,7 @@
 	        try {
 	            return super.clone();
 	        } catch (CloneNotSupportedException e) {
-	            return null;
+                throw new AssertionError(e); // android-changed
 	        }
 	    }
 
@@ -1065,7 +1065,7 @@
             }
             return clone;
         } catch (CloneNotSupportedException e) {
-            return null;
+            throw new AssertionError(e); // android-changed
         }
     }
 
diff --git a/luni/src/main/java/java/util/TreeSet.java b/luni/src/main/java/java/util/TreeSet.java
index 375b9c8..fcd6224 100644
--- a/luni/src/main/java/java/util/TreeSet.java
+++ b/luni/src/main/java/java/util/TreeSet.java
@@ -160,7 +160,7 @@
             }
             return clone;
         } catch (CloneNotSupportedException e) {
-            return null;
+            throw new AssertionError(e); // android-changed
         }
     }
 
diff --git a/luni/src/main/java/java/util/Vector.java b/luni/src/main/java/java/util/Vector.java
index 6a4060a..9a1b81c 100644
--- a/luni/src/main/java/java/util/Vector.java
+++ b/luni/src/main/java/java/util/Vector.java
@@ -265,7 +265,7 @@
             vector.elementData = elementData.clone();
             return vector;
         } catch (CloneNotSupportedException e) {
-            return null;
+            throw new AssertionError(e); // android-changed
         }
     }
 
diff --git a/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/Header.java b/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/Header.java
index 24be092..bdd1d0a 100644
--- a/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/Header.java
+++ b/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/Header.java
@@ -88,7 +88,7 @@
             }
             return clone;
         } catch (CloneNotSupportedException e) {
-            return null;
+            throw new AssertionError(e); // android-changed
         }
     }
 
diff --git a/luni/src/main/native/org_apache_harmony_luni_util_fltparse.c b/luni/src/main/native/org_apache_harmony_luni_util_fltparse.c
index ebbd6de..80f2bee 100644
--- a/luni/src/main/native/org_apache_harmony_luni_util_fltparse.c
+++ b/luni/src/main/native/org_apache_harmony_luni_util_fltparse.c
@@ -229,7 +229,6 @@
   jfloat result;
 
   numBits = highestSetBitHighPrecision (f, length) + 1;
-  numBits -= lowestSetBitHighPrecision (f, length);
   if (numBits < 25 && e >= 0 && e < LOG5_OF_TWO_TO_THE_N)
     {
       return ((jfloat) LOW_I32_FROM_PTR (f)) * tenToTheE (e);
@@ -606,4 +605,3 @@
                "org/apache/harmony/luni/util/FloatingPointParser",
                 gMethods, NELEM(gMethods));
 }
-
diff --git a/luni/src/test/java/java/lang/AllTests.java b/luni/src/test/java/java/lang/AllTests.java
new file mode 100644
index 0000000..c37fb27
--- /dev/null
+++ b/luni/src/test/java/java/lang/AllTests.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.lang;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class AllTests {
+    public static final Test suite() {
+        TestSuite suite = tests.TestSuiteFactory.createTestSuite();
+        suite.addTestSuite(java.lang.FloatTest.class);
+        return suite;
+    }
+}
diff --git a/luni/src/test/java/java/lang/FloatTest.java b/luni/src/test/java/java/lang/FloatTest.java
new file mode 100644
index 0000000..bd8c197
--- /dev/null
+++ b/luni/src/test/java/java/lang/FloatTest.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.lang;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class FloatTest extends junit.framework.TestCase {
+    public void test_valueOf_String1() throws Exception {
+        // This threw OutOfMemoryException.
+        // http://code.google.com/p/android/issues/detail?id=4185
+        assertEquals(2358.166016f, Float.valueOf("2358.166016"));
+    }
+    public void test_valueOf_String2() throws Exception {
+        // This threw OutOfMemoryException.
+        // http://code.google.com/p/android/issues/detail?id=3156
+        assertEquals(-2.14748365E9f, Float.valueOf(String.valueOf(Integer.MIN_VALUE)));
+    }
+}
diff --git a/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/FloatTest.java b/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/FloatTest.java
index b1ad88a..6ffa471 100644
--- a/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/FloatTest.java
+++ b/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/FloatTest.java
@@ -999,6 +999,19 @@
     }
 
     /**
+     * @tests java.lang.Float#parseFloat(java.lang.String)
+     */
+    public void test_parseFloat_LString_Harmony6261() {
+        // Regression test for HARMONY-6261
+        float f = new Float("2147483648");
+        assertEquals("2.1474836E9", Float.toString(f));
+
+        doTestCompareRawBits("123456790528.000000000000000f", 0x51e5f4c9, "1.2345679E11");
+        doTestCompareRawBits("8589934592", 0x50000000, "8.5899346E9");
+        doTestCompareRawBits("8606711808", 0x50004000, "8.606712E9");
+    }
+    
+    /**
      * @tests java.lang.Float#shortValue()
      */
     @TestTargetNew(
diff --git a/luni/src/test/java/org/apache/harmony/luni/tests/java/util/AbstractMapTest.java b/luni/src/test/java/org/apache/harmony/luni/tests/java/util/AbstractMapTest.java
index e5e3c11..9bd09b4 100644
--- a/luni/src/test/java/org/apache/harmony/luni/tests/java/util/AbstractMapTest.java
+++ b/luni/src/test/java/org/apache/harmony/luni/tests/java/util/AbstractMapTest.java
@@ -212,7 +212,7 @@
                 try {
                     return super.clone();
                 } catch (CloneNotSupportedException e) {
-                    return null;
+                    throw new AssertionError(e); // android-changed
                 }
             }
         }
diff --git a/luni/src/test/java/tests/AllTests.java b/luni/src/test/java/tests/AllTests.java
index 7533eea..7d12bcc 100644
--- a/luni/src/test/java/tests/AllTests.java
+++ b/luni/src/test/java/tests/AllTests.java
@@ -57,6 +57,7 @@
         
         // Android-written test suites.
         suite.addTest(com.ibm.icu4jni.util.AllTests.suite());
+        suite.addTest(java.lang.AllTests.suite());
         suite.addTest(java.lang.reflect.AllTests.suite());
         suite.addTest(org.apache.harmony.luni.platform.AllTests.suite());
         suite.addTest(tests.api.org.apache.harmony.kernel.dalvik.AllTests.suite());
diff --git a/luni/src/test/java/tests/api/java/util/AbstractMapTest.java b/luni/src/test/java/tests/api/java/util/AbstractMapTest.java
index c6a612c..7feb001 100644
--- a/luni/src/test/java/tests/api/java/util/AbstractMapTest.java
+++ b/luni/src/test/java/tests/api/java/util/AbstractMapTest.java
@@ -211,7 +211,7 @@
                 try {
                     return super.clone();
                 } catch (CloneNotSupportedException e) {
-                    return null;
+                    throw new AssertionError(e); // android-changed
                 }
             }
         }
diff --git a/math/src/test/java/tests/api/java/math/BigIntegerTest.java b/math/src/test/java/tests/api/java/math/BigIntegerTest.java
index d04f742..b84aa17 100644
--- a/math/src/test/java/tests/api/java/math/BigIntegerTest.java
+++ b/math/src/test/java/tests/api/java/math/BigIntegerTest.java
@@ -1299,7 +1299,7 @@
             try {
                 return super.clone();
             } catch (CloneNotSupportedException e) {
-                return null;
+                throw new AssertionError(e); // android-changed
             }
         }
     }
diff --git a/security/src/main/java/java/security/cert/PKIXCertPathChecker.java b/security/src/main/java/java/security/cert/PKIXCertPathChecker.java
index 710ac11..5eaac74 100644
--- a/security/src/main/java/java/security/cert/PKIXCertPathChecker.java
+++ b/security/src/main/java/java/security/cert/PKIXCertPathChecker.java
@@ -55,7 +55,7 @@
         try {
             return super.clone();
         } catch (CloneNotSupportedException e) {
-            throw new Error(e);
+            throw new AssertionError(e); // android-changed
         }
     }
 
diff --git a/security/src/main/java/java/security/cert/PKIXCertPathValidatorResult.java b/security/src/main/java/java/security/cert/PKIXCertPathValidatorResult.java
index 7d80ae5..d82c699 100644
--- a/security/src/main/java/java/security/cert/PKIXCertPathValidatorResult.java
+++ b/security/src/main/java/java/security/cert/PKIXCertPathValidatorResult.java
@@ -99,8 +99,7 @@
         try {
             return super.clone();
         } catch (CloneNotSupportedException e) {
-            // Actually, the exception will not be thrown out.
-            throw new Error(e);
+            throw new AssertionError(e); // android-changed
         }
     }
 
diff --git a/security/src/main/java/java/security/cert/PKIXParameters.java b/security/src/main/java/java/security/cert/PKIXParameters.java
index 4034d21..79d3d5e 100644
--- a/security/src/main/java/java/security/cert/PKIXParameters.java
+++ b/security/src/main/java/java/security/cert/PKIXParameters.java
@@ -554,7 +554,7 @@
             }
             return ret;
         } catch (CloneNotSupportedException e) {
-            throw new Error(e);
+            throw new AssertionError(e); // android-changed
         }
     }
 
diff --git a/support/src/test/java/org/apache/harmony/security/tests/support/cert/MyCertStoreParameters.java b/support/src/test/java/org/apache/harmony/security/tests/support/cert/MyCertStoreParameters.java
index 6518c6f..1166b41 100644
--- a/support/src/test/java/org/apache/harmony/security/tests/support/cert/MyCertStoreParameters.java
+++ b/support/src/test/java/org/apache/harmony/security/tests/support/cert/MyCertStoreParameters.java
@@ -37,7 +37,7 @@
         try {
             return super.clone();
         } catch (CloneNotSupportedException e) {
-            return null;
+            throw new AssertionError(e); // android-changed
         }
     }
 }
diff --git a/text/src/main/java/java/text/AttributedString.java b/text/src/main/java/java/text/AttributedString.java
index 77bbf78..fe7aa0c 100644
--- a/text/src/main/java/java/text/AttributedString.java
+++ b/text/src/main/java/java/text/AttributedString.java
@@ -107,7 +107,7 @@
                 }
                 return clone;
             } catch (CloneNotSupportedException e) {
-                return null;
+                throw new AssertionError(e); // android-changed
             }
         }
 
diff --git a/text/src/main/java/java/text/BreakIterator.java b/text/src/main/java/java/text/BreakIterator.java
index 3a08427..78870f0 100644
--- a/text/src/main/java/java/text/BreakIterator.java
+++ b/text/src/main/java/java/text/BreakIterator.java
@@ -524,7 +524,7 @@
             cloned.wrapped = (com.ibm.icu4jni.text.BreakIterator) wrapped.clone();
             return cloned;
         } catch (CloneNotSupportedException e) {
-            throw new InternalError(e.getMessage());
+            throw new AssertionError(e); // android-changed
         }
     }
 
diff --git a/text/src/main/java/java/text/Collator.java b/text/src/main/java/java/text/Collator.java
index 71ebb94..e954b8b 100644
--- a/text/src/main/java/java/text/Collator.java
+++ b/text/src/main/java/java/text/Collator.java
@@ -211,7 +211,7 @@
             clone.icuColl = (com.ibm.icu4jni.text.Collator) this.icuColl.clone();
             return clone;
         } catch (CloneNotSupportedException e) {
-            return null;
+            throw new AssertionError(e); // android-changed
         }
     }
 
diff --git a/text/src/main/java/java/text/DecimalFormatSymbols.java b/text/src/main/java/java/text/DecimalFormatSymbols.java
index a71a4c6..46849ef 100644
--- a/text/src/main/java/java/text/DecimalFormatSymbols.java
+++ b/text/src/main/java/java/text/DecimalFormatSymbols.java
@@ -115,7 +115,7 @@
             symbols.patternChars = patternChars.clone();
             return symbols;
         } catch (CloneNotSupportedException e) {
-            return null;
+            throw new AssertionError(e); // android-changed
         }
     }
 
diff --git a/text/src/main/java/java/text/Format.java b/text/src/main/java/java/text/Format.java
index 3a6e49d..8abe605 100644
--- a/text/src/main/java/java/text/Format.java
+++ b/text/src/main/java/java/text/Format.java
@@ -84,7 +84,7 @@
         try {
             return super.clone();
         } catch (CloneNotSupportedException e) {
-            return null;
+            throw new AssertionError(e); // android-changed
         }
     }
 
diff --git a/text/src/main/java/java/text/StringCharacterIterator.java b/text/src/main/java/java/text/StringCharacterIterator.java
index 8ef0341..ea60180 100644
--- a/text/src/main/java/java/text/StringCharacterIterator.java
+++ b/text/src/main/java/java/text/StringCharacterIterator.java
@@ -105,7 +105,7 @@
         try {
             return super.clone();
         } catch (CloneNotSupportedException e) {
-            return null;
+            throw new AssertionError(e); // android-changed
         }
     }