Author: gnodet
Date: Mon Mar 21 16:59:28 2016
New Revision: 1736053
URL: http://svn.apache.org/viewvc?rev=1736053&view=rev
Log:
Avoid possible exceptions with isTty
Modified:
felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Pipe.java
Modified:
felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Pipe.java
URL:
http://svn.apache.org/viewvc/felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Pipe.java?rev=1736053&r1=1736052&r2=1736053&view=diff
==============================================================================
---
felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Pipe.java
(original)
+++
felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Pipe.java
Mon Mar 21 16:59:28 2016
@@ -203,7 +203,10 @@ public class Pipe implements Callable<Re
public boolean isTty(int fd) {
// TODO: this assumes that the session is always created with
input/output tty streams
- return !toclose[fd];
+ if (fd < 0 || fd > streams.length) {
+ return false;
+ }
+ return streams[fd] != null && !toclose[fd];
}
public void error(int error) {