You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by hi...@apache.org on 2010/02/16 18:47:59 UTC

svn commit: r910618 - in /harmony/enhanced/classlib/branches/java6: ./ depends/libs/ make/ modules/applet/src/main/java/org/apache/harmony/applet/ modules/applet/src/main/java/org/apache/harmony/applet/internal/nls/ modules/archive/src/main/java/java/u...

Author: hindessm
Date: Tue Feb 16 17:47:52 2010
New Revision: 910618

URL: http://svn.apache.org/viewvc?rev=910618&view=rev
Log:
Merge updates from classlib trunk@910508

Modified:
    harmony/enhanced/classlib/branches/java6/   (props changed)
    harmony/enhanced/classlib/branches/java6/depends/libs/   (props changed)
    harmony/enhanced/classlib/branches/java6/make/depends-common.xml   (props changed)
    harmony/enhanced/classlib/branches/java6/modules/applet/src/main/java/org/apache/harmony/applet/AppletThread.java
    harmony/enhanced/classlib/branches/java6/modules/applet/src/main/java/org/apache/harmony/applet/Connection.java
    harmony/enhanced/classlib/branches/java6/modules/applet/src/main/java/org/apache/harmony/applet/Proxy.java
    harmony/enhanced/classlib/branches/java6/modules/applet/src/main/java/org/apache/harmony/applet/internal/nls/messages.properties
    harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/zip/ZipFile.java
    harmony/enhanced/classlib/branches/java6/modules/concurrent/src/main/java/java/util/concurrent/atomic/   (props changed)
    harmony/enhanced/classlib/branches/java6/modules/concurrent/src/main/java/java/util/concurrent/locks/   (props changed)
    harmony/enhanced/classlib/branches/java6/modules/jmx/META-INF/   (props changed)
    harmony/enhanced/classlib/branches/java6/modules/lang-management/src/test/api/java/org/apache/harmony/lang/management/tests/java/util/logging/   (props changed)
    harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/BufferedOutputStream.java
    harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/fdlibm.h   (props changed)
    harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/gp.h   (props changed)
    harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/hymagic.h   (props changed)
    harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/hysocket.h   (props changed)
    harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/hyvmls.h   (props changed)
    harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/jni.h   (props changed)
    harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/jni_types.h   (props changed)
    harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/jvmpi.h   (props changed)
    harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/jvmri.h   (props changed)
    harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/jvmti.h   (props changed)
    harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/jvmti_types.h   (props changed)
    harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/vmi.h   (props changed)
    harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/vmizip.h   (props changed)
    harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/BufferedOutputStreamTest.java
    harmony/enhanced/classlib/branches/java6/modules/luni/src/test/resources/net.resources/   (props changed)
    harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/Division.java
    harmony/enhanced/classlib/branches/java6/modules/pack200/depends/manifests/asm-3.1/   (props changed)
    harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java5/org/apache/harmony/pack200/Pack200Adapter.java   (props changed)
    harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java5/org/apache/harmony/pack200/Pack200PackerAdapter.java   (props changed)
    harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/html/parser/DTD.java
    harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/BasicSwingTestCase.java   (props changed)
    harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/SwingTestCase.java   (props changed)
    harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/text/parser/   (props changed)

Propchange: harmony/enhanced/classlib/branches/java6/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 16 17:47:52 2010
@@ -1,2 +1,2 @@
-/harmony/enhanced/classlib/trunk:713674-735919,765923-909814
+/harmony/enhanced/classlib/trunk:713674-735919,765923-910508
 /harmony/enhanced/classlib/trunk/working_classlib:884014-884286

Propchange: harmony/enhanced/classlib/branches/java6/depends/libs/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 16 17:47:52 2010
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/depends/libs:544451-909814
+/harmony/enhanced/classlib/trunk/depends/libs:544451-910508

Propchange: harmony/enhanced/classlib/branches/java6/make/depends-common.xml
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 16 17:47:52 2010
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/make/depends-common.xml:768152-909814
+/harmony/enhanced/classlib/trunk/make/depends-common.xml:768152-910508

Modified: harmony/enhanced/classlib/branches/java6/modules/applet/src/main/java/org/apache/harmony/applet/AppletThread.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/applet/src/main/java/org/apache/harmony/applet/AppletThread.java?rev=910618&r1=910617&r2=910618&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/applet/src/main/java/org/apache/harmony/applet/AppletThread.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/applet/src/main/java/org/apache/harmony/applet/AppletThread.java Tue Feb 16 17:47:52 2010
@@ -22,6 +22,7 @@
 import java.util.List;
 import java.util.Collections;
 import java.util.LinkedList;
+import org.apache.harmony.applet.internal.nls.Messages;
 
 
 /**
@@ -79,7 +80,7 @@
     
     void exit() {
         if (Thread.currentThread() != this) {
-            throw new InternalError("Attempt to stop applet main thread outside of that thread");
+            throw new InternalError(Messages.getString("applet.01"));
         }
         synchronized(monitor) {
             doExit = true;

Modified: harmony/enhanced/classlib/branches/java6/modules/applet/src/main/java/org/apache/harmony/applet/Connection.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/applet/src/main/java/org/apache/harmony/applet/Connection.java?rev=910618&r1=910617&r2=910618&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/applet/src/main/java/org/apache/harmony/applet/Connection.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/applet/src/main/java/org/apache/harmony/applet/Connection.java Tue Feb 16 17:47:52 2010
@@ -27,6 +27,7 @@
 import java.util.HashMap;
 import java.util.Map;
 import org.apache.harmony.awt.ContextStorage;
+import org.apache.harmony.applet.internal.nls.Messages;
 
 
 /**
@@ -50,7 +51,7 @@
         try {
             port = Integer.parseInt(args[0]);
         } catch (Exception e) {
-            throw new IllegalArgumentException("Invalid port");
+            throw new IllegalArgumentException(Messages.getString("applet.02"));
         }
         
         Connection c = new Connection(port);

Modified: harmony/enhanced/classlib/branches/java6/modules/applet/src/main/java/org/apache/harmony/applet/Proxy.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/applet/src/main/java/org/apache/harmony/applet/Proxy.java?rev=910618&r1=910617&r2=910618&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/applet/src/main/java/org/apache/harmony/applet/Proxy.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/applet/src/main/java/org/apache/harmony/applet/Proxy.java Tue Feb 16 17:47:52 2010
@@ -28,6 +28,7 @@
 import java.net.URL;
 
 import org.apache.harmony.awt.ComponentInternals;
+import org.apache.harmony.applet.internal.nls.Messages;
 
 
 /**
@@ -73,7 +74,7 @@
     private void createImpl() {
         Toolkit toolkit = Toolkit.getDefaultToolkit();
         if (toolkit == null) {
-            throw new InternalError("Toolkit is null");
+            throw new InternalError(Messages.getString("applet.03"));
         }
         
         if ((params.container != null) && (params.container instanceof Container)) { 

Modified: harmony/enhanced/classlib/branches/java6/modules/applet/src/main/java/org/apache/harmony/applet/internal/nls/messages.properties
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/applet/src/main/java/org/apache/harmony/applet/internal/nls/messages.properties?rev=910618&r1=910617&r2=910618&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/applet/src/main/java/org/apache/harmony/applet/internal/nls/messages.properties (original)
+++ harmony/enhanced/classlib/branches/java6/modules/applet/src/main/java/org/apache/harmony/applet/internal/nls/messages.properties Tue Feb 16 17:47:52 2010
@@ -15,3 +15,6 @@
 # 
 
 # messages for EN locale
+applet.01=Attempt to stop applet main thread outside of that thread
+applet.02=Invalid port
+applet.03=Toolkit is null

Modified: harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/zip/ZipFile.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/zip/ZipFile.java?rev=910618&r1=910617&r2=910618&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/zip/ZipFile.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/archive/src/main/java/java/util/zip/ZipFile.java Tue Feb 16 17:47:52 2010
@@ -377,7 +377,15 @@
 
         @Override
         public int available() throws IOException {
-            return (mOffset < mLength ? 1 : 0);
+            if (mLength > mOffset) {
+                if (mLength - mOffset < Integer.MAX_VALUE) {
+                    return (int)(mLength - mOffset);
+                } else {
+                    return Integer.MAX_VALUE;
+                }
+            } else {
+                return 0;
+            }
         }
 
         @Override

Propchange: harmony/enhanced/classlib/branches/java6/modules/concurrent/src/main/java/java/util/concurrent/atomic/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 16 17:47:52 2010
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/concurrent/src/main/java/java/util/concurrent/atomic:765923-909814
+/harmony/enhanced/classlib/trunk/modules/concurrent/src/main/java/java/util/concurrent/atomic:765923-910508

Propchange: harmony/enhanced/classlib/branches/java6/modules/concurrent/src/main/java/java/util/concurrent/locks/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 16 17:47:52 2010
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/concurrent/src/main/java/java/util/concurrent/locks:765923-909814
+/harmony/enhanced/classlib/trunk/modules/concurrent/src/main/java/java/util/concurrent/locks:765923-910508

Propchange: harmony/enhanced/classlib/branches/java6/modules/jmx/META-INF/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 16 17:47:52 2010
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/jmx/META-INF:768152-909814
+/harmony/enhanced/classlib/trunk/modules/jmx/META-INF:768152-910508

Propchange: harmony/enhanced/classlib/branches/java6/modules/lang-management/src/test/api/java/org/apache/harmony/lang/management/tests/java/util/logging/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 16 17:47:52 2010
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/lang-management/src/test/api/java/org/apache/harmony/lang/management/tests/java/util/logging:768152-909814
+/harmony/enhanced/classlib/trunk/modules/lang-management/src/test/api/java/org/apache/harmony/lang/management/tests/java/util/logging:768152-910508

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/BufferedOutputStream.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/BufferedOutputStream.java?rev=910618&r1=910617&r2=910618&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/BufferedOutputStream.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/BufferedOutputStream.java Tue Feb 16 17:47:52 2010
@@ -88,10 +88,6 @@
      */
     @Override
     public synchronized void flush() throws IOException {
-        if (buf == null) {
-            throw new IOException(Messages.getString("luni.24")); //$NON-NLS-1$
-        }
-
         flushInternal();
         out.flush();
     }

Propchange: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/fdlibm.h
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 16 17:47:52 2010
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/fdlibm.h:803062-909814
+/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/fdlibm.h:803062-910508

Propchange: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/gp.h
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 16 17:47:52 2010
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/gp.h:803062-909814
+/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/gp.h:803062-910508

Propchange: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/hymagic.h
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 16 17:47:52 2010
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/hymagic.h:803062-909814
+/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/hymagic.h:803062-910508

Propchange: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/hysocket.h
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 16 17:47:52 2010
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/hysocket.h:803062-909814
+/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/hysocket.h:803062-910508

Propchange: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/hyvmls.h
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 16 17:47:52 2010
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/hyvmls.h:803062-909814
+/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/hyvmls.h:803062-910508

Propchange: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/jni.h
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 16 17:47:52 2010
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/jni.h:803062-909814
+/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/jni.h:803062-910508

Propchange: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/jni_types.h
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 16 17:47:52 2010
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/jni_types.h:803062-909814
+/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/jni_types.h:803062-910508

Propchange: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/jvmpi.h
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 16 17:47:52 2010
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/jvmpi.h:803062-909814
+/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/jvmpi.h:803062-910508

Propchange: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/jvmri.h
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 16 17:47:52 2010
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/jvmri.h:803062-909814
+/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/jvmri.h:803062-910508

Propchange: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/jvmti.h
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 16 17:47:52 2010
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/jvmti.h:803062-909814
+/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/jvmti.h:803062-910508

Propchange: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/jvmti_types.h
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 16 17:47:52 2010
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/jvmti_types.h:803062-909814
+/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/jvmti_types.h:803062-910508

Propchange: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/vmi.h
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 16 17:47:52 2010
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/vmi.h:803062-909814
+/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/vmi.h:803062-910508

Propchange: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/vmizip.h
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 16 17:47:52 2010
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/vmizip.h:803062-909814
+/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/vmizip.h:803062-910508

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/BufferedOutputStreamTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/BufferedOutputStreamTest.java?rev=910618&r1=910617&r2=910618&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/BufferedOutputStreamTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/BufferedOutputStreamTest.java Tue Feb 16 17:47:52 2010
@@ -807,6 +807,15 @@
         }
     }
 
+    // Regression test for flush on closed stream
+    public void test_flush_on_closed_stream() throws IOException {
+        BufferedOutputStream bos =
+            new BufferedOutputStream(
+                new ByteArrayOutputStream());
+        bos.close();
+        bos.flush(); // RI does not throw exception
+    }
+
     /**
      * Tears down the fixture, for example, close a network connection. This
      * method is called after a test is executed.

Propchange: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/resources/net.resources/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 16 17:47:52 2010
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/net.resources:790472-909814
+/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/net.resources:790472-910508

Modified: harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/Division.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/Division.java?rev=910618&r1=910617&r2=910618&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/Division.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/Division.java Tue Feb 16 17:47:52 2010
@@ -488,7 +488,7 @@
         
         if (!p.testBit(0)){
             // montgomery inverse require even modulo
-            return modInverseLorencz(a, p);
+            return modInverseHars(a, p);
         }
         
         int m = p.numberLength * 32;
@@ -583,156 +583,87 @@
         return (int)(n2 & 0xFFFFFFFFL);
     }
 
-    /**
-     * @return bi == abs(2^exp)
-     */
-    private static boolean isPowerOfTwo(BigInteger bi, int exp) {
-        boolean result = false;
-        result = ( exp >> 5 == bi.numberLength - 1 )
-        && ( bi.digits[bi.numberLength - 1] == 1 << ( exp & 31 ) );
-        if (result) {
-            for (int i = 0; result && i < bi.numberLength - 1; i++) {
-                result = bi.digits[i] == 0;
+    static BigInteger squareAndMultiply(BigInteger x2, BigInteger a2, BigInteger exponent,BigInteger modulus, int n2  ){
+        BigInteger res = x2;
+        for (int i = exponent.bitLength() - 1; i >= 0; i--) {
+            res = monPro(res,res,modulus, n2);
+            if (BitLevel.testBit(exponent, i)) {
+                res = monPro(res, a2, modulus, n2);
             }
         }
-        return result;
+        return res;
     }
-    
+
     /**
-     * Calculate how many iteration of Lorencz's algorithm would perform the
-     * same operation
-     *
-     * @param bi
-     * @param n
-     * @return
-     */
-    private static int howManyIterations(BigInteger bi, int n) {
-        int i = n - 1;
-        if (bi.sign > 0) {
-            while (!bi.testBit(i))
-                i--;
-            return n - 1 - i;
+     * Implements the "Shifting Euclidean modular inverse algorithm".
+     * "Laszlo Hars - Modular Inverse Algorithms Without Multiplications
+     * for Cryptographic Applications"
+     * 
+     * @see BigInteger#modInverse(BigInteger)
+     * @param a
+     *            a positive number
+     * @param m
+     *            a positive modulus
+     */
+    static BigInteger modInverseHars(BigInteger a, BigInteger m) {
+        // PRE: (a > 0) and (m > 0)
+        BigInteger u, v, r, s, temp;
+        // u = MAX(a,m), v = MIN(a,m)
+        if (a.compareTo(m) == BigInteger.LESS) {
+            u = m;
+            v = a;
+            r = BigInteger.ZERO;
+            s = BigInteger.ONE;
         } else {
-            while (bi.testBit(i))
-                i--;
-            return n - 1 - Math.max(i, bi.getLowestSetBit());
-        }
-        
-    }
-    
-    /**
-     *
-     * Based on "New Algorithm for Classical Modular Inverse" Róbert Lórencz.
-     * LNCS 2523 (2002)
-     *
-     * @return a^(-1) mod m
-     */
-    static BigInteger modInverseLorencz(BigInteger a, BigInteger modulo) {
-        // PRE: a is coprime with modulo, a < modulo
-        
-        int max = Math.max(a.numberLength, modulo.numberLength);
-        int uDigits[] = new int[max + 1]; // enough place to make all the inplace operation
-        int vDigits[] = new int[max + 1];
-        System.arraycopy(modulo.digits, 0, uDigits, 0, modulo.numberLength);
-        System.arraycopy(a.digits, 0, vDigits, 0, a.numberLength);
-        BigInteger u = new BigInteger(modulo.sign, modulo.numberLength,
-                uDigits);
-        BigInteger v = new BigInteger(a.sign, a.numberLength, vDigits);
-        
-        BigInteger r = new BigInteger(0, 1, new int[max + 1]); // BigInteger.ZERO;
-        BigInteger s = new BigInteger(1, 1, new int[max + 1]);
-        s.digits[0] = 1;
-        // r == 0 && s == 1, but with enough place
-        
-        int coefU = 0, coefV = 0;
-        int n = modulo.bitLength();
-        int k;
-        while (!isPowerOfTwo(u, coefU) && !isPowerOfTwo(v, coefV)) {
-            
-            // modification of original algorithm: I calculate how many times the algorithm will enter in the same branch of if
-            k = howManyIterations(u, n);
-            
-            if (k != 0) {
-                BitLevel.inplaceShiftLeft(u, k);
-                if (coefU >= coefV) {
-                    BitLevel.inplaceShiftLeft(r, k);
-                } else {
-                    BitLevel.inplaceShiftRight(s, Math.min(coefV - coefU, k));
-                    if (k - ( coefV - coefU ) > 0) {
-                        BitLevel.inplaceShiftLeft(r, k - coefV + coefU);
-                    }
-                }
-                coefU += k;
-            }
-            
-            k = howManyIterations(v, n);
-            if (k != 0) {
-                BitLevel.inplaceShiftLeft(v, k);
-                if (coefV >= coefU) {
-                    BitLevel.inplaceShiftLeft(s, k);
-                } else {
-                    BitLevel.inplaceShiftRight(r, Math.min(coefU - coefV, k));
-                    if (k - ( coefU - coefV ) > 0) {
-                        BitLevel.inplaceShiftLeft(s, k - coefU + coefV);
-                    }
-                }
-                coefV += k;
-                
-            }
-            
-            if (u.signum() == v.signum()) {
-                if (coefU <= coefV) {
-                    Elementary.completeInPlaceSubtract(u, v);
-                    Elementary.completeInPlaceSubtract(r, s);
-                } else {
-                    Elementary.completeInPlaceSubtract(v, u);
-                    Elementary.completeInPlaceSubtract(s, r);
-                }
-            } else {
-                if (coefU <= coefV) {
-                    Elementary.completeInPlaceAdd(u, v);
-                    Elementary.completeInPlaceAdd(r, s);
-                } else {
-                    Elementary.completeInPlaceAdd(v, u);
-                    Elementary.completeInPlaceAdd(s, r);
-                }
-            }
-            if (v.signum() == 0 || u.signum() == 0){
-                // math.19: BigInteger not invertible
-                throw new ArithmeticException(Messages.getString("math.19"));
-            }
-        }
-        
-        if (isPowerOfTwo(v, coefV)) {
-            r = s;
-            if (v.signum() != u.signum())
-                u = u.negate();
-        }
-        if (u.testBit(n)) {
-            if (r.signum() < 0) {
-                r = r.negate();
+            v = m;
+            u = a;
+            s = BigInteger.ZERO;
+            r = BigInteger.ONE;
+        }
+        int uLen = u.bitLength();
+        int vLen = v.bitLength();
+        int f = uLen - vLen;
+
+        while (vLen > 1) {
+            if (u.sign == v.sign) {
+                u = u.subtract(v.shiftLeft(f));
+                r = r.subtract(s.shiftLeft(f));
             } else {
-                r = modulo.subtract(r);
+                u = u.add(v.shiftLeft(f));
+                r = r.add(s.shiftLeft(f));
             }
+            uLen = u.abs().bitLength();
+            vLen = v.abs().bitLength();
+            f = uLen - vLen;
+            if (f < 0) {
+                // SWAP(u,v)
+                temp = u;
+                u = v;
+                v = temp;
+                // SWAP(r,s)
+                temp = r;
+                r = s;
+                s = temp;
+
+                f = -f;
+                vLen = uLen;
+            }
+        }
+        if (v.sign == 0) {
+            return BigInteger.ZERO;
+        }
+        if (v.sign < 0) {
+            s = s.negate();
         }
-        if (r.signum() < 0) {
-            r = r.add(modulo);
+        if (s.compareTo(m) == BigInteger.GREATER) {
+            return s.subtract(m);
         }
-        
-        return r;
-    }
-    
-    static BigInteger squareAndMultiply(BigInteger x2, BigInteger a2, BigInteger exponent,BigInteger modulus, int n2  ){
-        BigInteger res = x2;
-        for (int i = exponent.bitLength() - 1; i >= 0; i--) {
-            res = monPro(res,res,modulus, n2);
-            if (BitLevel.testBit(exponent, i)) {
-                res = monPro(res, a2, modulus, n2);
-            }
+        if (s.sign < 0) {
+            return s.add(m);
         }
-        return res;
+        return s; // a^(-1) mod m
     }
-    
+
     /*Implements the Montgomery modular exponentiation based in <i>The sliding windows algorithm and the Mongomery
      *Reduction</i>.
      *@ar.org.fitc.ref "A. Menezes,P. van Oorschot, S. Vanstone - Handbook of Applied Cryptography";

Propchange: harmony/enhanced/classlib/branches/java6/modules/pack200/depends/manifests/asm-3.1/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 16 17:47:52 2010
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/pack200/depends/manifests/asm-3.1:785554-909814
+/harmony/enhanced/classlib/trunk/modules/pack200/depends/manifests/asm-3.1:785554-910508

Propchange: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java5/org/apache/harmony/pack200/Pack200Adapter.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 16 17:47:52 2010
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java5/org/apache/harmony/pack200/Pack200Adapter.java:782694-909814
+/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java5/org/apache/harmony/pack200/Pack200Adapter.java:782694-910508

Propchange: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java5/org/apache/harmony/pack200/Pack200PackerAdapter.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 16 17:47:52 2010
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java5/org/apache/harmony/pack200/Pack200PackerAdapter.java:782694-909814
+/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java5/org/apache/harmony/pack200/Pack200PackerAdapter.java:782694-910508

Modified: harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/html/parser/DTD.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/html/parser/DTD.java?rev=910618&r1=910617&r2=910618&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/html/parser/DTD.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/html/parser/DTD.java Tue Feb 16 17:47:52 2010
@@ -16,6 +16,7 @@
  */
 package javax.swing.text.html.parser;
 
+import java.io.ByteArrayOutputStream;
 import java.io.DataInputStream;
 import java.io.IOException;
 import java.util.BitSet;
@@ -142,8 +143,17 @@
 
     public void read(final DataInputStream stream) throws IOException {
         // converts from DataInputStream into a byte array
-        byte[] enc = new byte[stream.available()];
-        stream.read(enc);
+        byte[] enc = new byte[1024];
+        ByteArrayOutputStream bs = new ByteArrayOutputStream();
+
+        int iRead = 0;
+        while (iRead != -1) {
+            iRead = stream.read(enc, 0, enc.length);
+            if (iRead > 0) {
+                bs.write(enc, 0, iRead);
+            }
+        }
+        enc = bs.toByteArray();
 
         // decode the byte array
         Asn1Dtd asn1 = new Asn1Dtd(enc);

Propchange: harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/BasicSwingTestCase.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 16 17:47:52 2010
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/BasicSwingTestCase.java:768152-909814
+/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/BasicSwingTestCase.java:768152-910508

Propchange: harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/SwingTestCase.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 16 17:47:52 2010
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/SwingTestCase.java:768152-909814
+/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/SwingTestCase.java:768152-910508

Propchange: harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/text/parser/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 16 17:47:52 2010
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/text/parser:768152-909814
+/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/text/parser:768152-910508