Projects >> jsch-documentation >>6ce063f34ca5216a3cc87d8e8edbe41959fd533e

Chunk
Conflicting content
import javax.swing.*;
import java.io.InputStream;

<<<<<<< HEAD
/**
 *  This program will demonstrate the stream forwarding. The given Java
 *  I/O streams will be forwarded to the given remote host and port on
 *  the remote side.  It is similar to the -L option of ssh command,
 *  but you don't have to assign and open a local TCP port.
 * 
 *  You will be asked username, hostname,  passwd and host:hostport.
 *  If everything works fine, System.in and System.out streams will be
 *  forwarded to remote port and you can send messages from command line.
 */
=======
>>>>>>> 965aa3c7c4ae3853b59515d02030530c10dea8f5
public class StreamForwarding{
  public static void main(String[] arg)
    throws Exception
Solution content
import javax.swing.*;
import java.io.InputStream;

/**
 *  This program will demonstrate the stream forwarding. The given Java
 *  I/O streams will be forwarded to the given remote host and port on
 *  the remote side.  It is similar to the -L option of ssh command,
 *  but you don't have to assign and open a local TCP port.
 * 
 *  You will be asked username, hostname,  passwd and host:hostport.
 *  If everything works fine, System.in and System.out streams will be
 *  forwarded to remote port and you can send messages from command line.
 */
public class StreamForwarding{
  public static void main(String[] arg)
    throws Exception
File
StreamForwarding.java
Developer's decision
Version 1
Kind of conflict
Comment
Chunk
Conflicting content
  {
    int port;

<<<<<<< HEAD
    JSch.setLogger(new Logger.MyLogger());
    JSch jsch=new JSch();
=======
    try{
      JSch.setLogger(new Logger.MyLogger());
      JSch jsch=new JSch();

      String host=null;
      if(arg.length>0){
        host=arg[0];
      }
      else{
        host=JOptionPane.showInputDialog("Enter username@hostname",
                                         System.getProperty("user.name")+
                                         "@localhost"); 
      }
      String user=host.substring(0, host.indexOf('@'));
      host=host.substring(host.indexOf('@')+1);

      Session session=jsch.getSession(user, host, 22);

      // username and password will be given via UserInfo interface.
      UserInfo ui=new MyUserInfo();
      session.setUserInfo(ui);
      session.connect();
>>>>>>> 965aa3c7c4ae3853b59515d02030530c10dea8f5

    String host=null;
    if(arg.length>0){
Solution content
  {
    int port;

    JSch.setLogger(new Logger.MyLogger());
    JSch jsch=new JSch();

    String host=null;
    if(arg.length>0){
File
StreamForwarding.java
Developer's decision
Version 1
Kind of conflict
Comment
If statement
Method invocation
Try statement
Variable
Chunk
Conflicting content
            if(_session.jsch.getLogger().isEnabled(Logger.DEBUG)) {
              _session.jsch.getLogger().log(Logger.DEBUG, "waiting max. "+t+" ms for channel reply ...");
            }
<<<<<<< HEAD
=======
            this.notifyme=1;
>>>>>>> 965aa3c7c4ae3853b59515d02030530c10dea8f5
            wait(t);
          }
          catch(java.lang.InterruptedException e){ 
Solution content
            if(_session.jsch.getLogger().isEnabled(Logger.DEBUG)) {
              _session.jsch.getLogger().log(Logger.DEBUG, "waiting max. "+t+" ms for channel reply ...");
            }
            this.notifyme=1;
            wait(t);
          }
          catch(java.lang.InterruptedException e){ 
File
ChannelDirectTCPIP.java
Developer's decision
Version 2
Kind of conflict
Other