private void ensureSession() throws FileSystemException {
if ( this.session == null || !this.session.isConnected() ) {
this.doCloseCommunicationLink();
UserAuthenticationData authData = null;
Session session;
try {
GenericFileName e = (GenericFileName) this.getRootName();
authData = UserAuthenticatorUtils.authenticate( this.getFileSystemOptions(), SftpFileProvider.AUTHENTICATOR_TYPES );
session = SftpClientFactory.createConnection( e.getHostName(), e.getPort(), UserAuthenticatorUtils.getData( authData, UserAuthenticationData.USERNAME,
UserAuthenticatorUtils.toChar( e.getUserName() ) ), UserAuthenticatorUtils.getData( authData, UserAuthenticationData.PASSWORD,
UserAuthenticatorUtils.toChar( e.getPassword() ) ), this.getFileSystemOptions() );
} catch ( Exception var7 ) {
throw new FileSystemException( "vfs.provider.sftp/connect.error", this.getRootName(), var7 );
} finally {
UserAuthenticatorUtils.cleanup( authData );
}
this.session = session;
}
}