Skip to content

Commit

Permalink
mwiede#403 add a warning when Channel.getInputStream() or Channel.get…
Browse files Browse the repository at this point in the history
…ExtInputStream() is called after Channel.connect().
  • Loading branch information
norrisjeremy committed Nov 13, 2023
1 parent 063b5d0 commit d702bda
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/main/java/com/jcraft/jsch/Channel.java
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,11 @@ public void setExtOutputStream(OutputStream out, boolean dontclose) {
}

public InputStream getInputStream() throws IOException {
Session _session = this.session;
if (_session != null && isConnected() && _session.getLogger().isEnabled(Logger.WARN)) {
_session.getLogger().log(Logger.WARN, "getInputStream() should be called before connect()");
}

int max_input_buffer_size = 32 * 1024;
try {
max_input_buffer_size = Integer.parseInt(getSession().getConfig("max_input_buffer_size"));
Expand All @@ -221,6 +226,12 @@ public InputStream getInputStream() throws IOException {
}

public InputStream getExtInputStream() throws IOException {
Session _session = this.session;
if (_session != null && isConnected() && _session.getLogger().isEnabled(Logger.WARN)) {
_session.getLogger().log(Logger.WARN,
"getExtInputStream() should be called before connect()");
}

int max_input_buffer_size = 32 * 1024;
try {
max_input_buffer_size = Integer.parseInt(getSession().getConfig("max_input_buffer_size"));
Expand Down

0 comments on commit d702bda

Please sign in to comment.