DebugLog.log("SESSION " + key + " diconnected");
    static Session getSession(SVNRepositoryLocation location,            SVNSSHAuthentication credentials) throws SVNAuthenticationException {        if ("".equals(credentials.getUserName())                || credentials.getUserName() == null) {            throw new SVNAuthenticationException(                    "User name is required to establish svn+shh connection");        }        String key = credentials.getUserName() + ":" + location.getHost() + ":"                + location.getPort();        Session session = (Session) ourSessionsPool.get(key);        if (session != null && !session.isConnected()) {            ourSessionsPool.remove(key);            DebugLog.log("SESSION " + key + " disposed");            session = null;        }        try {            if (session == null) {                JSch jsch = new JSch();                String privateKey = null;                String passphrase = null;                if (credentials.getPrivateKeyFile() != null) {                    privateKey = credentials.getPrivateKeyFile().getAbsolutePath();                    passphrase = credentials.getPassphrase();                    if (privateKey != null && passphrase != null) {                        jsch.addIdentity(privateKey, passphrase);                    } else if (privateKey != null) {                        jsch.addIdentity(privateKey);                    }                }                session = jsch.getSession(credentials.getUserName(), location                        .getHost(), location.getPort());                UserInfo userInfo = new EmptyUserInfo(                        credentials.getPassword(), passphrase);                session.setUserInfo(userInfo);                session.setSocketFactory(new SimpleSocketFactory());                DebugLog.log("SESSION " + key + " created");                session.setTimeout(TIMEOUT);                session.connect();                session.setTimeout(0);                ourSessionsPool.put(key, session);                DebugLog.log("SESSION " + key + " connected");            } else {                DebugLog.log("SESSION " + key + " reused");            }            return session;        } catch (JSchException e) {            DebugLog.error(e);            if (session != null && session.isConnected()) {                session.disconnect();                DebugLog.log("DISCONNECTING: " + session);            }            DebugLog.log("SESSION " + key + " diconnected");            ourSessionsPool.remove(key);            DebugLog.log("SESSION " + key + " disposed");            throw new SVNAuthenticationException(e);        }    }