// Path: src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritDefaultValues.java
// public final class GerritDefaultValues {
// 
//     /**
//      * Default private constructor to hinder instantiation.
//      */
//     private GerritDefaultValues() {
// 
//     }
//     /**
//      * The default gerrit name.
//      */
//     public static final String DEFAULT_GERRIT_NAME = "";
//     /**
//      * The default gerrit hostname.
//      */
//     public static final String DEFAULT_GERRIT_HOSTNAME = "";
//     /**
//      * The default gerrit front end url.
//      */
//     public static final String DEFAULT_GERRIT_FRONT_END_URL = "";
//     /**
//      * The default ssh port for the gerrit server.
//      */
//     public static final int DEFAULT_GERRIT_SSH_PORT = 29418;
//     /**
//      * The default scheme for the gerrit server.
//      */
//     public static final String DEFAULT_GERRIT_SCHEME = "ssh";
//     /**
//      * The default gerrit proxy.
//      */
//     public static final String DEFAULT_GERRIT_PROXY = "";
//     /**
//      * The default gerrit ssh connection timeout.
//      */
//     public static final int DEFAULT_GERRIT_SSH_CONNECTION_TIMEOUT = 0;
// 
//     /**
//      * The default key-file to use when authenticating to the gerrit server.
//      */
//     public static final File DEFAULT_GERRIT_AUTH_KEY_FILE = new File(new File(System.getProperty("user.home"), ".ssh"),
//                                                               "id_rsa");
//     /**
//      * The default password for the private key-file.
//      */
//     public static final String DEFAULT_GERRIT_AUTH_KEY_FILE_PASSWORD = null;
//     /**
//      * The default username to use when authenticating to the gerrit server.
//      */
//     public static final String DEFAULT_GERRIT_USERNAME = "";
//     /**
//      * The default nr of event worker threads.
//      */
//     public static final int DEFAULT_NR_OF_RECEIVING_WORKER_THREADS = 3;
//     /**
//      * The default keep alive time for receiving threads in seconds.
//      */
//     public static final int DEFAULT_RECEIVE_THREAD_KEEP_ALIVE_TIME = 1200;
//     /**
//      * The minimum keep alive time for receiving threads in seconds.
//      */
//     public static final int MIN_RECEIVE_THREAD_KEEP_ALIVE_TIME = 10;
//     /**
//      * The default nr of worker threads that sends approvals/review commands.
//      */
//     public static final int DEFAULT_NR_OF_SENDING_WORKER_THREADS = 1;
//     /**
//      * The default build schedule delay.
//      */
//     public static final int DEFAULT_BUILD_SCHEDULE_DELAY = 3;
//     /**
//      * The default refresh interval for the Dynamic Trigger Configuration.
//      */
//     public static final int DEFAULT_DYNAMIC_CONFIG_REFRESH_INTERVAL = 30;
// 
//     /**
//      * The minimum refresh interval for dynamic configuration.
//      */
//     public static final int MINIMUM_DYNAMIC_CONFIG_REFRESH_INTERVAL = 5;
// }


import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.net.MalformedURLException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.jcraft.jsch.Channel;
import com.jcraft.jsch.ChannelExec;
import com.jcraft.jsch.HostKey;
import com.jcraft.jsch.HostKeyRepository;
import com.jcraft.jsch.JSch;
import com.jcraft.jsch.JSchException;
import com.jcraft.jsch.ProxyHTTP;
import com.jcraft.jsch.ProxySOCKS5;
import com.jcraft.jsch.Session;
import com.jcraft.jsch.UserInfo;
import com.sonymobile.tools.gerrit.gerritevents.GerritDefaultValues;
            StringBuilder commandOutput = new StringBuilder();
            while ((incomingLine = bufferedReader.readLine()) != null) {
                commandOutput.append(incomingLine);
                commandOutput.append('\n');
                logger.trace("Incoming line: {}", incomingLine);
            }
            logger.trace("Closing reader.");
            bufferedReader.close();

            // Exit code is only available if channel is closed, so wait a bit for it.
            // Channel.disconnect(), however, must not have been called yet.
            // See http://stackoverflow.com/questions/3154940/jsch-error-return-codes-not-consistent.
            waitForChannelClosure(channel, CLOSURE_WAIT_TIMEOUT);
            int exitCode = channel.getExitStatus();
            if (exitCode > 0) {
               String error = errOut.toString();
               if (error != null && error.trim().length() > 0) {
                   throw new SshException(error.trim() + " (" + String.valueOf(exitCode) + ")");
               } else {
                   throw new SshException(String.valueOf(exitCode));
               }
            }

            return commandOutput.toString();
        } catch (SshException ex) {
            throw ex;
        } catch (JSchException ex) {
            throw new SshException(ex);
        } catch (IOException ex) {
            throw new SshException(ex);
// Path: src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritDefaultValues.java
// public final class GerritDefaultValues {
// 
//     /**
//      * Default private constructor to hinder instantiation.
//      */
//     private GerritDefaultValues() {
// 
//     }
//     /**
//      * The default gerrit name.
//      */
//     public static final String DEFAULT_GERRIT_NAME = "";
//     /**
//      * The default gerrit hostname.
//      */
//     public static final String DEFAULT_GERRIT_HOSTNAME = "";
//     /**
//      * The default gerrit front end url.
//      */
//     public static final String DEFAULT_GERRIT_FRONT_END_URL = "";
//     /**
//      * The default ssh port for the gerrit server.
//      */
//     public static final int DEFAULT_GERRIT_SSH_PORT = 29418;
//     /**
//      * The default scheme for the gerrit server.
//      */
//     public static final String DEFAULT_GERRIT_SCHEME = "ssh";
//     /**
//      * The default gerrit proxy.
//      */
//     public static final String DEFAULT_GERRIT_PROXY = "";
//     /**
//      * The default gerrit ssh connection timeout.
//      */
//     public static final int DEFAULT_GERRIT_SSH_CONNECTION_TIMEOUT = 0;
// 
//     /**
//      * The default key-file to use when authenticating to the gerrit server.
//      */
//     public static final File DEFAULT_GERRIT_AUTH_KEY_FILE = new File(new File(System.getProperty("user.home"), ".ssh"),
//                                                               "id_rsa");
//     /**
//      * The default password for the private key-file.
//      */
//     public static final String DEFAULT_GERRIT_AUTH_KEY_FILE_PASSWORD = null;
//     /**
//      * The default username to use when authenticating to the gerrit server.
//      */
//     public static final String DEFAULT_GERRIT_USERNAME = "";
//     /**
//      * The default nr of event worker threads.
//      */
//     public static final int DEFAULT_NR_OF_RECEIVING_WORKER_THREADS = 3;
//     /**
//      * The default keep alive time for receiving threads in seconds.
//      */
//     public static final int DEFAULT_RECEIVE_THREAD_KEEP_ALIVE_TIME = 1200;
//     /**
//      * The minimum keep alive time for receiving threads in seconds.
//      */
//     public static final int MIN_RECEIVE_THREAD_KEEP_ALIVE_TIME = 10;
//     /**
//      * The default nr of worker threads that sends approvals/review commands.
//      */
//     public static final int DEFAULT_NR_OF_SENDING_WORKER_THREADS = 1;
//     /**
//      * The default build schedule delay.
//      */
//     public static final int DEFAULT_BUILD_SCHEDULE_DELAY = 3;
//     /**
//      * The default refresh interval for the Dynamic Trigger Configuration.
//      */
//     public static final int DEFAULT_DYNAMIC_CONFIG_REFRESH_INTERVAL = 30;
// 
//     /**
//      * The minimum refresh interval for dynamic configuration.
//      */
//     public static final int MINIMUM_DYNAMIC_CONFIG_REFRESH_INTERVAL = 5;
// }


// Path: src/main/java/com/sonymobile/tools/gerrit/gerritevents/ssh/SshConnectionImpl.java
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.net.MalformedURLException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.jcraft.jsch.Channel;
import com.jcraft.jsch.ChannelExec;
import com.jcraft.jsch.HostKey;
import com.jcraft.jsch.HostKeyRepository;
import com.jcraft.jsch.JSch;
import com.jcraft.jsch.JSchException;
import com.jcraft.jsch.ProxyHTTP;
import com.jcraft.jsch.ProxySOCKS5;
import com.jcraft.jsch.Session;
import com.jcraft.jsch.UserInfo;
import com.sonymobile.tools.gerrit.gerritevents.GerritDefaultValues;

            StringBuilder commandOutput = new StringBuilder();
            while ((incomingLine = bufferedReader.readLine()) != null) {
                commandOutput.append(incomingLine);
                commandOutput.append('\n');
                logger.trace("Incoming line: {}", incomingLine);
            }
            logger.trace("Closing reader.");
            bufferedReader.close();

            // Exit code is only available if channel is closed, so wait a bit for it.
            // Channel.disconnect(), however, must not have been called yet.
            // See http://stackoverflow.com/questions/3154940/jsch-error-return-codes-not-consistent.
            waitForChannelClosure(channel, CLOSURE_WAIT_TIMEOUT);
            int exitCode = channel.getExitStatus();
            if (exitCode > 0) {
               String error = errOut.toString();
               if (error != null && error.trim().length() > 0) {
                   throw new SshException(error.trim() + " (" + String.valueOf(exitCode) + ")");
               } else {
                   throw new SshException(String.valueOf(exitCode));
               }
            }

            return commandOutput.toString();
        } catch (SshException ex) {
            throw ex;
        } catch (JSchException ex) {
            throw new SshException(ex);
        } catch (IOException ex) {
            throw new SshException(ex);
        } finally {