harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r999795 - in /harmony/enhanced/java/branches/java6: ./ classlib/ classlib/depends/libs/ classlib/modules/luni/src/main/java/java/io/ classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/ drlvm/ jdktools/
Date Wed, 22 Sep 2010 08:15:40 GMT
Author: hindessm
Date: Wed Sep 22 08:15:39 2010
New Revision: 999795

URL: http://svn.apache.org/viewvc?rev=999795&view=rev
Log:
Merge change from /harmony/enhanced/java/trunk@999260:

  r999260 | regisxu | 2010-09-21 08:39:05 +0100 (Tue, 21 Sep 2010) | 1 line
  
  Apply patch for HARMONY-6636: [classlib][luni]PipedInputStream should not throw exception
after the write end close

  dry run merge /harmony/enhanced/java/trunk@999260:
    svn merge --dry-run --non-interactive -c 999260 https://svn.apache.org/repos/asf/harmony/enhanced/java/trunk


Modified:
    harmony/enhanced/java/branches/java6/   (props changed)
    harmony/enhanced/java/branches/java6/classlib/   (props changed)
    harmony/enhanced/java/branches/java6/classlib/depends/libs/   (props changed)
    harmony/enhanced/java/branches/java6/classlib/modules/luni/src/main/java/java/io/PipedInputStream.java
    harmony/enhanced/java/branches/java6/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/PipedInputStreamTest.java
    harmony/enhanced/java/branches/java6/drlvm/   (props changed)
    harmony/enhanced/java/branches/java6/jdktools/   (props changed)

Propchange: harmony/enhanced/java/branches/java6/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Sep 22 08:15:39 2010
@@ -1,4 +1,4 @@
 /harmony/enhanced/java/branches/mrh:935751-941490
-/harmony/enhanced/java/trunk:929253-997624,997759,997980,997986,998010,998030,998619,998628,998759,998804,998822
+/harmony/enhanced/java/trunk:929253-997624,997759,997980,997986,998010,998030,998619,998628,998759,998804,998822,999260
 /harmony/enhanced/trunk:476395-929252
 /incubator/harmony/enhanced/trunk:292550-476394

Propchange: harmony/enhanced/java/branches/java6/classlib/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Sep 22 08:15:39 2010
@@ -1,7 +1,7 @@
 /harmony/enhanced/classlib/trunk:713674-735919,765923-926091,926318-926838
 /harmony/enhanced/classlib/trunk/working_classlib:884014-884286
 /harmony/enhanced/java/branches/mrh/classlib:935751-941490
-/harmony/enhanced/java/trunk/classlib:929253-997624,997759,997980,997986,998010,998030,998619,998628,998759,998804,998822
+/harmony/enhanced/java/trunk/classlib:929253-997624,997759,997980,997986,998010,998030,998619,998628,998759,998804,998822,999260
 /harmony/enhanced/trunk/classlib:476395-929252
 /harmony/enhanced/trunk/working_classlib:476396-920147
 /incubator/harmony/enhanced/trunk/classlib:292550-476394

Propchange: harmony/enhanced/java/branches/java6/classlib/depends/libs/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Sep 22 08:15:39 2010
@@ -1,4 +1,4 @@
 /harmony/enhanced/classlib/trunk/depends/libs:544451-926091
-/harmony/enhanced/java/trunk/classlib/depends/libs:929253-997624,997759,997980,997986,998010,998030,998619,998628,998759,998804,998822
+/harmony/enhanced/java/trunk/classlib/depends/libs:929253-997624,997759,997980,997986,998010,998030,998619,998628,998759,998804,998822,999260
 /harmony/enhanced/trunk/classlib/depends/libs:476395-929252
 /incubator/harmony/enhanced/trunk/classlib/depends/libs:292550-476394

Modified: harmony/enhanced/java/branches/java6/classlib/modules/luni/src/main/java/java/io/PipedInputStream.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/luni/src/main/java/java/io/PipedInputStream.java?rev=999795&r1=999794&r2=999795&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/luni/src/main/java/java/io/PipedInputStream.java
(original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/luni/src/main/java/java/io/PipedInputStream.java
Wed Sep 22 08:15:39 2010
@@ -197,6 +197,11 @@ public class PipedInputStream extends In
             throw new IOException(Messages.getString("luni.CC")); //$NON-NLS-1$
         }
 
+        if (isClosed && in == -1) {
+            // write end closed and no more need to read
+            return -1;
+        }
+
         if (lastWriter != null && !lastWriter.isAlive() && (in < 0)) {
             // luni.CD=Write end dead
             throw new IOException(Messages.getString("luni.CD")); //$NON-NLS-1$
@@ -285,6 +290,11 @@ public class PipedInputStream extends In
             return 0;
         }
 
+        if (isClosed && in == -1) {
+            // write end closed and no more need to read
+            return -1;
+        }
+
         if (!isConnected) {
             // luni.CB=Not connected
             throw new IOException(Messages.getString("luni.CB")); //$NON-NLS-1$

Modified: harmony/enhanced/java/branches/java6/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/PipedInputStreamTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/PipedInputStreamTest.java?rev=999795&r1=999794&r2=999795&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/PipedInputStreamTest.java
(original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/PipedInputStreamTest.java
Wed Sep 22 08:15:39 2010
@@ -363,6 +363,40 @@ public class PipedInputStreamTest extend
                 myRun.pass);
     }
 
+    static class Worker extends Thread {
+        PipedOutputStream out;
+
+        Worker(PipedOutputStream pos) {
+            this.out = pos;
+        }
+
+        public void run() {
+            try {
+                out.write(20);
+                out.close();
+                Thread.sleep(5000);
+            } catch (Exception e) {
+            }
+        }
+    }
+
+    public void test_read_after_write_close() throws Exception{
+        PipedInputStream in = new PipedInputStream();
+        PipedOutputStream out = new PipedOutputStream();
+        in.connect(out);
+        Thread worker = new Worker(out);
+        worker.start();
+        Thread.sleep(2000);
+        assertEquals("Should read 20.", 20, in.read());
+        worker.join();
+        assertEquals("Write end is closed, should return -1", -1, in.read());
+        byte[] buf = new byte[1];
+        assertEquals("Write end is closed, should return -1", -1, in.read(buf, 0, 1));
+        assertEquals("Buf len 0 should return first", 0, in.read(buf, 0, 0));
+        in.close();
+        out.close();
+    }
+
 	/**
 	 * Tears down the fixture, for example, close a network connection. This
 	 * method is called after a test is executed.

Propchange: harmony/enhanced/java/branches/java6/drlvm/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Sep 22 08:15:39 2010
@@ -1,5 +1,5 @@
 /harmony/enhanced/java/branches/mrh/drlvm:935751-941490
-/harmony/enhanced/java/trunk/drlvm:929253-997624,997759,997980,997986,998010,998030,998619,998628,998759,998804,998822
+/harmony/enhanced/java/trunk/drlvm:929253-997624,997759,997980,997986,998010,998030,998619,998628,998759,998804,998822,999260
 /harmony/enhanced/trunk/drlvm:476395-929252
 /harmony/enhanced/trunk/working_vm:476396-920147
 /incubator/harmony/enhanced/trunk/drlvm:292550-476394

Propchange: harmony/enhanced/java/branches/java6/jdktools/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Sep 22 08:15:39 2010
@@ -1,4 +1,4 @@
-/harmony/enhanced/java/trunk/jdktools:929253-997624,997759,997980,997986,998010,998030,998619,998628,998759,998804,998822
+/harmony/enhanced/java/trunk/jdktools:929253-997624,997759,997980,997986,998010,998030,998619,998628,998759,998804,998822,999260
 /harmony/enhanced/jdktools/trunk:630107-925933
 /harmony/enhanced/trunk/jdktools:476395-929252
 /harmony/enhanced/trunk/working_jdktools:476396-920147



Mime
View raw message