harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lian...@apache.org
Subject svn commit: r514632 - in /harmony/enhanced/classlib/trunk/modules/luni: make/exclude.common src/main/java/java/io/InputStreamReader.java
Date Mon, 05 Mar 2007 10:09:04 GMT
Author: liangyx
Date: Mon Mar  5 02:09:02 2007
New Revision: 514632

URL: http://svn.apache.org/viewvc?view=rev&rev=514632
Log:
Apply patch for HARMONY-3238([classlib][luni] InputStreamReader allocates fixed space internal
buffer)

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/make/exclude.common
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/InputStreamReader.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/make/exclude.common
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/make/exclude.common?view=diff&rev=514632&r1=514631&r2=514632
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/make/exclude.common (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/make/exclude.common Mon Mar  5 02:09:02 2007
@@ -1,4 +1,3 @@
-tests/api/java/io/OutputStreamWriterTest.java
 tests/api/java/lang/ProcessTest.java
 tests/api/java/net/HttpURLConnectionTest.java
 tests/api/java/net/MulticastSocketTest.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/InputStreamReader.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/InputStreamReader.java?view=diff&rev=514632&r1=514631&r2=514632
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/InputStreamReader.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/InputStreamReader.java
Mon Mar  5 02:09:02 2007
@@ -385,7 +385,14 @@
             if (length == 0) {
                 return 0;
             }
-
+            
+            // allocate enough space for bytes if the default length is
+            // inadequate
+            int availableLen = in.available();     
+            if (Math.min(availableLen, length) > bytes.capacity()) {
+                bytes = ByteBuffer.allocate(availableLen);
+            }
+            
             CharBuffer out = CharBuffer.wrap(buf, offset, length);
             CoderResult result = CoderResult.UNDERFLOW;
             byte[] a = bytes.array();
@@ -498,7 +505,7 @@
                 throw new IOException(Msg.getString("K0070")); //$NON-NLS-1$
             }
             try {
-                return bytes.limit() != BUFFER_SIZE || in.available() > 0;
+                return bytes.limit() != bytes.capacity() || in.available() > 0;
             } catch (IOException e) {
                 return false;
             }



Mime
View raw message