Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Pazderski2019-11-06 13:38:58 +0000
committerPaul Pazderski2019-11-06 13:38:58 +0000
commitcb886eecb5f665d6955c50857c164d50abc2cf88 (patch)
treec0b0b262a220d4327a2a81c6212ffc1c9f752d67
parent9e03af46ae0a1ebfe21bb555b7d8a29f88ff95b9 (diff)
downloadeclipse.platform.debug-cb886eecb5f665d6955c50857c164d50abc2cf88.tar.gz
eclipse.platform.debug-cb886eecb5f665d6955c50857c164d50abc2cf88.tar.xz
eclipse.platform.debug-cb886eecb5f665d6955c50857c164d50abc2cf88.zip
Bug 552015 - Check stream closed before trying to read
Change-Id: I7a626dd99a75a481a48d07aff24ff665a98df6d1 Signed-off-by: Paul Pazderski <paul-eclipse@ppazderski.de>
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsole.java9
1 files changed, 5 insertions, 4 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsole.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsole.java
index fa46e9bd9..bfb739aab 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsole.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsole.java
@@ -122,7 +122,7 @@ public class ProcessConsole extends IOConsole implements IConsole, IDebugEventSe
private boolean fAllocateConsole = true;
private String fStdInFile = null;
- private boolean fStreamsClosed = false;
+ private volatile boolean fStreamsClosed = false;
/**
* Create process console with default encoding.
@@ -443,7 +443,7 @@ public class ProcessConsole extends IOConsole implements IConsole, IDebugEventSe
} catch (IOException e) {
}
}
- fStreamsClosed = true;
+ fStreamsClosed = true;
}
/**
@@ -456,6 +456,7 @@ public class ProcessConsole extends IOConsole implements IConsole, IDebugEventSe
}
fFileOutputStream = null;
fInput = null;
+ fUserInput = null;
}
/**
@@ -765,7 +766,7 @@ public class ProcessConsole extends IOConsole implements IConsole, IDebugEventSe
@Override
protected IStatus run(IProgressMonitor monitor) {
- if (fInput == null) {
+ if (fInput == null || fStreamsClosed) {
return monitor.isCanceled() ? Status.CANCEL_STATUS : Status.OK_STATUS;
}
Charset encoding = getCharset();
@@ -776,7 +777,7 @@ public class ProcessConsole extends IOConsole implements IConsole, IDebugEventSe
char[] cbuf = new char[1024];
int charRead = 0;
while (charRead >= 0 && !monitor.isCanceled()) {
- if (fInput == null) {
+ if (fInput == null || fStreamsClosed) {
break;
}
if (fInput != readingStream) {

Back to the top