X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fnetconf-util%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Futil%2Fhandler%2Fssh%2Fclient%2FSshClient.java;fp=opendaylight%2Fnetconf%2Fnetconf-util%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Futil%2Fhandler%2Fssh%2Fclient%2FSshClient.java;h=7beee649abfe0501e60850fda0db79dd96c7bb86;hp=3cb608db6a87c3ef121cc6a4edf0f0676fab9912;hb=b925756421ea8565637d8575d8143dbf46db5a86;hpb=81387f0ae5898b196a54493f9bf4305993f39d1c diff --git a/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/ssh/client/SshClient.java b/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/ssh/client/SshClient.java index 3cb608db6a..7beee649ab 100644 --- a/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/ssh/client/SshClient.java +++ b/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/ssh/client/SshClient.java @@ -23,7 +23,7 @@ import java.util.Map; */ public class SshClient { private final VirtualSocket socket; - private final Map openSessions = new HashMap(); + private final Map openSessions = new HashMap<>(); private final AuthenticationHandler authenticationHandler; private Connection connection; @@ -33,8 +33,9 @@ public class SshClient { } public SshSession openSession() throws IOException { - if (connection == null) + if (connection == null) { connect(); + } Session session = connection.openSession(); SshSession sshSession = new SshSession(session); @@ -52,7 +53,7 @@ public class SshClient { public void closeSession(SshSession session) { if (session.getState() == Channel.STATE_OPEN || session.getState() == Channel.STATE_OPENING) { - session.session.close(); + session.close(); } } @@ -62,7 +63,8 @@ public class SshClient { openSessions.clear(); - if (connection != null) + if (connection != null) { connection.close(); + } } }