Bug 545326 - [tests] ProcessTests.testAlreadyTerminatedProcess blocks on
Windows with Java 11

The test failed on Windows with Java 11 does not write to stdout but to
stderr and the read blocks endless.

Change-Id: Ie72bc3b18b9d9ee04f22e7109d42e4561a7311f0
Signed-off-by: Paul Pazderski <paul-eclipse@ppazderski.de>
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ProcessTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ProcessTests.java
index 796ddb5..0618ccf 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ProcessTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ProcessTests.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
  *
  * This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License 2.0
@@ -72,7 +72,14 @@
 				value = process.exitValue();
 				terminated = true;
 			} catch (IllegalThreadStateException e) {
-				process.getInputStream().read(new byte[1000], 0, 1000);
+				int n = process.getInputStream().available();
+				if (n > 0) { // avoid reading if nothing available to prevent Bug 545326
+					process.getInputStream().skip(n);
+				}
+				n = process.getErrorStream().available();
+				if (n > 0) {
+					process.getErrorStream().skip(n);
+				}
 				Thread.sleep(500);
 			}
 		}