< prev index next >

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

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

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -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,15 @@
                                 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").
+                                unexpected(ioe);
+                            }
                         } catch (Throwable t) { unexpected(t); }}};
 
                 thread.start();
                 latch.await();
                 Thread.sleep(10);
< prev index next >