harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From odea...@apache.org
Subject svn commit: r910508 - in /harmony/enhanced/classlib/trunk/modules: archive/src/main/java/java/util/zip/ZipFile.java swing/src/main/java/common/javax/swing/text/html/parser/DTD.java
Date Tue, 16 Feb 2010 13:02:06 GMT
Author: odeakin
Date: Tue Feb 16 13:02:05 2010
New Revision: 910508

URL: http://svn.apache.org/viewvc?rev=910508&view=rev
Log:
Apply fix for HARMONY-6392 ([classlib][swing] Test failures in javax.swing.text.html.HTMLDocument_Reader_ActionsTest)
- implement RAFStream.available() and alter DTD.read() so it no longer relies on the return
value of available().

Modified:
    harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/ZipFile.java
    harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/DTD.java

Modified: harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/ZipFile.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/ZipFile.java?rev=910508&r1=910507&r2=910508&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/ZipFile.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/ZipFile.java
Tue Feb 16 13:02:05 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

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/DTD.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/DTD.java?rev=910508&r1=910507&r2=910508&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/DTD.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/parser/DTD.java
Tue Feb 16 13:02:05 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);



Mime
View raw message