Sonar fixes in "appc-netconf-adapter-bundle"
[appc.git] / appc-adapters / appc-netconf-adapter / appc-netconf-adapter-bundle / src / main / java / org / onap / appc / adapter / netconf / internal / NetconfAdapter.java
index 2d8c6f4..bb2a333 100644 (file)
@@ -71,26 +71,17 @@ public class NetconfAdapter {
         final NetconfMessage message = new NetconfMessage();
         final byte[] buf = new byte[1024];
 
-        //int readByte = 1;
         // Read data with timeout
-        Callable<Boolean> readTask = new Callable<Boolean>() {
-            @Override
-            public Boolean call() throws Exception {
-                int c;
-                while ((c = in.read(buf)) > 0) {
-                    if (c > 0) {
-                        message.append(buf, 0, c);
-                        if (message.isCompleted()) {
-                            break;
-                        }
-                    }
+        Callable<Boolean> readTask = () -> {
+            int c;
+            while ((c = in.read(buf)) > 0) {
+                message.append(buf, 0, c);
+                if (message.isCompleted()) {
+                    break;
                 }
-
-                if (c < 0) {
-                    return false;
-                }
-                return true;
             }
+
+            return c >= 0;
         };
 
         Future<Boolean> future = executor.submit(readTask);
@@ -101,7 +92,7 @@ public class NetconfAdapter {
             throw new IOException(e);
         }
 
-        if (status == false) {
+        if (!status) {
             throw new IOException("Failed to read netconf message");
         }