Commit 99f3cc67 authored by Quxl's avatar Quxl

x

parent 143c4c75
Pipeline #119 canceled with stages
...@@ -17,32 +17,22 @@ public class LinuxConnect { ...@@ -17,32 +17,22 @@ public class LinuxConnect {
} }
} }
public Boolean login(String username, String password) { public Boolean login(String username, String password) throws IOException {
try { connection.connect();
connection.connect(); boolean isLoginSuccess = connection.authenticateWithPassword(username, password);
boolean isLoginSuccess = connection.authenticateWithPassword(username, password); if (!isLoginSuccess) {
if (!isLoginSuccess) { connection.close();
connection.close();
}
return isLoginSuccess;
} catch (Exception e) {
e.printStackTrace();
return false;
} }
return isLoginSuccess;
} }
public Boolean loginByFileKey(String username, String publicKey, String keyPassword) { public Boolean loginByFileKey(String username, String publicKey, String keyPassword) throws IOException {
try { connection.connect();
connection.connect(); boolean isLoginSuccess = connection.authenticateWithPublicKey(username, publicKey.toCharArray(), keyPassword);
boolean isLoginSuccess = connection.authenticateWithPublicKey(username, publicKey.toCharArray(), keyPassword); if (!isLoginSuccess) {
if (!isLoginSuccess) { connection.close();
connection.close();
}
return isLoginSuccess;
} catch (Exception e) {
e.printStackTrace();
return false;
} }
return isLoginSuccess;
} }
public void close() { public void close() {
......
...@@ -164,7 +164,6 @@ public class HttpController { ...@@ -164,7 +164,6 @@ public class HttpController {
} catch (XRException e) { } catch (XRException e) {
throw e; throw e;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace();
throw new XRException(e.getMessage(), e); throw new XRException(e.getMessage(), e);
} finally { } finally {
connect.close(); connect.close();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment