# HG changeset patch # User jlahoda # Date 1476181779 -7200 # Node ID 8fd0057d88f340162892cd1768ec7d4bbc223963 # Parent ae82072ecfa78de19b0f393c459692688acdf776 8166890: JShell: locks forever when input is piped Summary: StopDetectingInputStream.setState must not override the state if the stream is closed. Reviewed-by: rfield, shinyafox diff -r ae82072ecfa7 -r 8fd0057d88f3 langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/StopDetectingInputStream.java --- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/StopDetectingInputStream.java Tue Oct 11 10:56:09 2016 +0100 +++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/StopDetectingInputStream.java Tue Oct 11 12:29:39 2016 +0200 @@ -77,9 +77,7 @@ } catch (IOException ex) { errorHandler.accept(ex); } finally { - synchronized (StopDetectingInputStream.this) { - state = StopDetectingInputStream.State.CLOSED; - } + shutdown(); } } }; @@ -140,8 +138,10 @@ } public synchronized void setState(State state) { - this.state = state; - notifyAll(); + if (this.state != State.CLOSED) { + this.state = state; + notifyAll(); + } } private synchronized State waitInputNeeded() {