Program: 63267
Project: 63267
Buggy source:
public SSHClientOutput execCommand(String command,int timeoutSeconds) throws Exception {
  try {
    System.out.println("String_Node_Str" + username + "String_Node_Str"+ hostname+ "String_Node_Str"+ command);
    StringBuffer text=new StringBuffer();
    int exitCode=-1;
    Session session=newJSchSession();
    session.connect();
    Channel channel=session.openChannel("String_Node_Str");
    ((ChannelExec)channel).setCommand(command);
    channel.setInputStream(null);
    ((ChannelExec)channel).setErrStream(System.err);
    InputStream in=channel.getInputStream();
    InputStream err=((ChannelExec)channel).getErrStream();
    channel.connect();
    int timeout=timeoutSeconds;
    byte[] tmp=new byte[1024];
    while (true) {
      timeout--;
      while (in.available() > 0) {
        int i=in.read(tmp,0,1024);
        if (i < 0)         break;
        String line=new String(tmp,0,i);
        text.append(line);
        if (this.sshLogger != null) {
          this.sshLogger.log(line);
        }
      }
      while (err.available() > 0) {
        int i=err.read(tmp,0,1024);
        if (i < 0)         break;
        String line=new String(tmp,0,i);
        text.append(line);
        if (this.sshLogger != null) {
          this.sshLogger.log(line);
        }
      }
      if (channel.isClosed()) {
        if (in.available() > 0)         continue;
        exitCode=channel.getExitStatus();
        System.out.println("String_Node_Str" + username + "String_Node_Str"+ hostname+ "String_Node_Str"+ exitCode);
        break;
      }
      try {
        Thread.sleep(1000);
      }
 catch (      Exception ee) {
        throw ee;
      }
      if (timeout < 0)       throw new Exception("String_Node_Str" + timeoutSeconds + "String_Node_Str");
    }
    channel.disconnect();
    session.disconnect();
    return new SSHClientOutput(exitCode,text.toString());
  }
 catch (  Exception e) {
    throw e;
  }
}

Fixed version (ground truth):
public SSHClientOutput execCommand(String command,int timeoutSeconds,Logger logAppender) throws Exception {
  try {
    System.out.println("String_Node_Str" + username + "String_Node_Str"+ hostname+ "String_Node_Str"+ command);
    StringBuffer text=new StringBuffer();
    int exitCode=-1;
    Session session=newJSchSession();
    session.connect();
    Channel channel=session.openChannel("String_Node_Str");
    ((ChannelExec)channel).setCommand(command);
    channel.setInputStream(null);
    ((ChannelExec)channel).setErrStream(System.err);
    InputStream in=channel.getInputStream();
    InputStream err=((ChannelExec)channel).getErrStream();
    channel.connect();
    int timeout=timeoutSeconds;
    byte[] tmp=new byte[1024];
    while (true) {
      timeout--;
      while (in.available() > 0) {
        int i=in.read(tmp,0,1024);
        if (i < 0)         break;
        String line=new String(tmp,0,i);
        text.append(line);
        if (logAppender != null) {
          logAppender.log(line);
        }
      }
      while (err.available() > 0) {
        int i=err.read(tmp,0,1024);
        if (i < 0)         break;
        String line=new String(tmp,0,i);
        text.append(line);
        if (logAppender != null) {
          logAppender.log(line);
        }
      }
      if (channel.isClosed()) {
        if (in.available() > 0)         continue;
        exitCode=channel.getExitStatus();
        System.out.println("String_Node_Str" + username + "String_Node_Str"+ hostname+ "String_Node_Str"+ exitCode);
        break;
      }
      try {
        Thread.sleep(1000);
      }
 catch (      Exception ee) {
        throw ee;
      }
      if (timeout < 0)       throw new Exception("String_Node_Str" + timeoutSeconds + "String_Node_Str");
    }
    channel.disconnect();
    session.disconnect();
    return new SSHClientOutput(exitCode,text.toString());
  }
 catch (  Exception e) {
    throw e;
  }
}