< prev index next >

test/jdk/java/lang/ProcessBuilder/Basic.java

Print this page
rev 52699 : 8171426: java/lang/ProcessBuilder/Basic.java failed Stream closed

@@ -2082,11 +2082,11 @@
             }
         } catch (Throwable t) { unexpected(t); }
 
         //----------------------------------------------------------------
         // Check that reads which are pending when Process.destroy is
-        // called, get EOF, not IOException("Stream closed").
+        // called, get EOF, or IOException("Stream closed").
         //----------------------------------------------------------------
         try {
             final int cases = 4;
             for (int i = 0; i < cases; i++) {
                 final int action = i;

@@ -2110,10 +2110,17 @@
                                 case 0: r = s.read(); break;
                                 case 2: r = s.read(bytes); break;
                                 default: throw new Error();
                             }
                             equal(-1, r);
+                        } catch (IOException ioe) {
+                            if (!ioe.getMessage().equals("Stream closed")) {
+                                // BufferedInputStream may throw IOE("Stream closed") in the case
+                                // where there are some bytes in its buffer and close is called.
+                                // The test is modified allow the current implementation.
+                                unexpected(ioe);
+                            }
                         } catch (Throwable t) { unexpected(t); }}};
 
                 thread.start();
                 latch.await();
                 Thread.sleep(10);
< prev index next >