Fix unused field warnings 57/5357/2
authorRobert Varga <rovarga@cisco.com>
Sun, 16 Feb 2014 11:22:03 +0000 (12:22 +0100)
committerGerrit Code Review <gerrit@opendaylight.org>
Mon, 17 Feb 2014 11:23:26 +0000 (11:23 +0000)
Removes affected fields, add @Override annotations and make constant
fields final.

Change-Id: I393151af1459e31eeded0786cf32223068635172
Signed-off-by: Robert Varga <rovarga@cisco.com>
opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/threads/IOThread.java
opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/threads/SocketThread.java

index b9c9c17..c53a625 100644 (file)
@@ -7,25 +7,27 @@
  */
 package org.opendaylight.controller.netconf.ssh.threads;
 
-import ch.ethz.ssh2.ServerConnection;
-import ch.ethz.ssh2.ServerSession;
 import java.io.InputStream;
 import java.io.OutputStream;
+
 import javax.annotation.concurrent.ThreadSafe;
+
 import org.apache.commons.io.IOUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import ch.ethz.ssh2.ServerConnection;
+import ch.ethz.ssh2.ServerSession;
+
 @ThreadSafe
 public class IOThread extends Thread {
 
     private static final Logger logger =  LoggerFactory.getLogger(IOThread.class);
 
-    private InputStream inputStream;
-    private OutputStream outputStream;
-    private String id;
-    private ServerSession servSession;
-    private ServerConnection servconnection;
+    private final InputStream inputStream;
+    private final OutputStream outputStream;
+    private final ServerSession servSession;
+    private final ServerConnection servconnection;
     private String customHeader;
 
 
@@ -37,6 +39,7 @@ public class IOThread extends Thread {
         super.setName(id);
         logger.trace("IOThread {} created", super.getName());
     }
+
     public IOThread (InputStream is, OutputStream os, String id,ServerSession ss, ServerConnection conn,String header){
         this.inputStream = is;
         this.outputStream = os;
@@ -53,7 +56,7 @@ public class IOThread extends Thread {
         try {
             if (this.customHeader!=null && !this.customHeader.equals("")){
                 this.outputStream.write(this.customHeader.getBytes());
-                logger.trace("adding  {} header", this.customHeader);
+                logger.trace("adding {} header", this.customHeader);
             }
             IOUtils.copy(this.inputStream, this.outputStream);
         } catch (Exception e) {
index d1b5213..204bf1d 100644 (file)
@@ -8,6 +8,16 @@
 package org.opendaylight.controller.netconf.ssh.threads;
 
 
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+
+import javax.annotation.concurrent.ThreadSafe;
+
+import org.opendaylight.controller.netconf.ssh.authentication.AuthProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import ch.ethz.ssh2.AuthenticationResult;
 import ch.ethz.ssh2.PtySettings;
 import ch.ethz.ssh2.ServerAuthenticationCallback;
@@ -16,25 +26,15 @@ import ch.ethz.ssh2.ServerConnectionCallback;
 import ch.ethz.ssh2.ServerSession;
 import ch.ethz.ssh2.ServerSessionCallback;
 import ch.ethz.ssh2.SimpleServerSessionCallback;
-import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.net.Socket;
-import javax.annotation.concurrent.ThreadSafe;
-import org.opendaylight.controller.netconf.ssh.authentication.AuthProvider;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 @ThreadSafe
-public class SocketThread implements Runnable, ServerAuthenticationCallback, ServerConnectionCallback
-{
-
-    private Socket socket;
-    private static final String USER = "netconf";
-    private static final String PASSWORD = "netconf";
-    private InetSocketAddress clientAddress;
+public class SocketThread implements Runnable, ServerAuthenticationCallback, ServerConnectionCallback {
     private static final Logger logger =  LoggerFactory.getLogger(SocketThread.class);
+
+    private final Socket socket;
+    private final InetSocketAddress clientAddress;
     private ServerConnection conn = null;
-    private long sessionId;
+    private final long sessionId;
     private String currentUser;
     private final String remoteAddressWithPort;
     private final AuthProvider authProvider;
@@ -77,6 +77,7 @@ public class SocketThread implements Runnable, ServerAuthenticationCallback, Ser
             logger.error("SocketThread error ",e);
         }
     }
+    @Override
     public ServerSessionCallback acceptSession(final ServerSession session)
     {
         SimpleServerSessionCallback cb = new SimpleServerSessionCallback()
@@ -85,6 +86,7 @@ public class SocketThread implements Runnable, ServerAuthenticationCallback, Ser
             public Runnable requestSubsystem(final ServerSession ss, final String subsystem) throws IOException
             {
                 return new Runnable(){
+                    @Override
                     public void run()
                     {
                         if (subsystem.equals("netconf")){
@@ -145,6 +147,7 @@ public class SocketThread implements Runnable, ServerAuthenticationCallback, Ser
             {
                 return new Runnable()
                 {
+                    @Override
                     public void run()
                     {
                         //noop
@@ -157,6 +160,7 @@ public class SocketThread implements Runnable, ServerAuthenticationCallback, Ser
             {
                 return new Runnable()
                 {
+                    @Override
                     public void run()
                     {
                         //noop
@@ -168,22 +172,26 @@ public class SocketThread implements Runnable, ServerAuthenticationCallback, Ser
         return cb;
     }
 
+    @Override
     public String initAuthentication(ServerConnection sc)
     {
         logger.trace("Established connection with host {}",remoteAddressWithPort);
         return "Established connection with host "+remoteAddressWithPort+"\r\n";
     }
 
+    @Override
     public String[] getRemainingAuthMethods(ServerConnection sc)
     {
         return new String[] { ServerAuthenticationCallback.METHOD_PASSWORD };
     }
 
+    @Override
     public AuthenticationResult authenticateWithNone(ServerConnection sc, String username)
     {
         return AuthenticationResult.FAILURE;
     }
 
+    @Override
     public AuthenticationResult authenticateWithPassword(ServerConnection sc, String username, String password)
     {
 
@@ -199,6 +207,7 @@ public class SocketThread implements Runnable, ServerAuthenticationCallback, Ser
         return AuthenticationResult.FAILURE;
     }
 
+    @Override
     public AuthenticationResult authenticateWithPublicKey(ServerConnection sc, String username, String algorithm,
             byte[] publickey, byte[] signature)
     {

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.