From 0c38e196c5a3730b923cd23bca38dd6b8b700608 Mon Sep 17 00:00:00 2001 From: Alain Magloire Date: Fri, 13 Dec 2002 16:33:21 +0000 Subject: [PATCH] Remove workaround for J9 --- .../org/eclipse/cdt/core/CommandLauncher.java | 45 ++++--------------- 1 file changed, 8 insertions(+), 37 deletions(-) diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CommandLauncher.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CommandLauncher.java index 1d89411ea8b..7971cc39329 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CommandLauncher.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CommandLauncher.java @@ -134,40 +134,8 @@ public class CommandLauncher { PipedOutputStream outputPipe = new PipedOutputStream(); PipedInputStream errInPipe, inputPipe; try { - errInPipe = new PipedInputStream(errOutPipe) { - /** - * FIXME: To remove when j9 is fix. - * The overloading here corrects a bug in J9 - * When the ring buffer when full it returns 0 . - */ - public synchronized int available() throws IOException { - if(in < 0 || buffer == null) - return 0; - else if(in == out) - return buffer.length; - else if (in > out) - return in - out; - else - return in + buffer.length - out; - } - }; - inputPipe = new PipedInputStream(outputPipe) { - /** - * FIXME: To remove when j9 is fix. - * The overloading here corrects a bug in J9 - * When the ring buffer when full returns 0. - */ - public synchronized int available() throws IOException { - if(in < 0 || buffer == null) - return 0; - else if(in == out) - return buffer.length; - else if (in > out) - return in - out; - else - return in + buffer.length - out; - } - }; + errInPipe = new PipedInputStream(errOutPipe); + inputPipe = new PipedInputStream(outputPipe); } catch( IOException e ) { setErrorMessage("Command canceled"); return COMMAND_CANCELED; @@ -178,6 +146,7 @@ public class CommandLauncher { byte buffer[] = new byte[1024]; int nbytes; while (!monitor.isCanceled() && closure.isAlive()) { + nbytes = 0; try { if ( errInPipe.available() > 0 ) { nbytes = errInPipe.read(buffer); @@ -192,9 +161,11 @@ public class CommandLauncher { } catch( IOException e) { } monitor.worked(0); - try { - Thread.sleep(DELAY); - } catch (InterruptedException ie) { + if (nbytes == 0) { + try { + Thread.sleep(DELAY); + } catch (InterruptedException ie) { + } } }