checkstyle fixes for library 33/41933/2
authorSam Hague <shague@redhat.com>
Sun, 17 Jul 2016 19:58:03 +0000 (15:58 -0400)
committerSam Hague <shague@redhat.com>
Mon, 18 Jul 2016 15:13:09 +0000 (11:13 -0400)
Change-Id: If68706ed7cf2bb2c605f4e2b3894c273f57643d3
Signed-off-by: Sam Hague <shague@redhat.com>
library/impl/src/main/java/org/opendaylight/ovsdb/lib/impl/OvsdbClientImpl.java
library/impl/src/main/java/org/opendaylight/ovsdb/lib/impl/OvsdbConnectionService.java
library/impl/src/main/java/org/opendaylight/ovsdb/lib/jsonrpc/JsonRpcEndpoint.java
library/impl/src/main/java/org/opendaylight/ovsdb/lib/schema/DatabaseSchema.java
library/impl/src/main/java/org/opendaylight/ovsdb/lib/schema/TableSchema.java
library/impl/src/main/java/org/opendaylight/ovsdb/lib/schema/typed/TyperUtils.java

index f2e39d48e83bae3ddaec7a3a0f200de6deb290d9..807b9ea05acfae353e4908fb4a26342281a7453d 100644 (file)
@@ -36,6 +36,7 @@ import org.opendaylight.ovsdb.lib.OvsdbClient;
 import org.opendaylight.ovsdb.lib.OvsdbConnectionInfo;
 import org.opendaylight.ovsdb.lib.OvsdbConnectionInfo.ConnectionType;
 import org.opendaylight.ovsdb.lib.OvsdbConnectionInfo.SocketConnectionType;
+import org.opendaylight.ovsdb.lib.error.ParsingException;
 import org.opendaylight.ovsdb.lib.jsonrpc.Params;
 import org.opendaylight.ovsdb.lib.message.MonitorRequest;
 import org.opendaylight.ovsdb.lib.message.OvsdbRPC;
@@ -373,7 +374,7 @@ public class OvsdbClientImpl implements OvsdbClient {
                             } else if (schema.size() == 1) {
                                 sfuture.set(schema);
                             }
-                        } catch (Exception e) {
+                        } catch (ParsingException e) {
                             LOG.warn("Failed to populate schema {}:{}", dbNames, schema, e);
                             sfuture.setException(e);
                         }
index ff1ee1a58c25d8142fb58f9d61dcc379e31e7d25..674e7af680fb4f6728f1a57f269654300180cf4a 100644 (file)
@@ -143,9 +143,7 @@ public class OvsdbConnectionService implements AutoCloseable, OvsdbConnection {
             Channel channel = future.channel();
             return getChannelClient(channel, ConnectionType.ACTIVE, SocketConnectionType.SSL);
         } catch (InterruptedException e) {
-            LOG.warn("Thread was interrupted during connect", e);
-        } catch (Exception e) {
-            LOG.warn("bootstrap.connect failed", e);
+            LOG.warn("Failed to connect {}:{}", address, port, e);
         }
         return null;
     }
@@ -327,7 +325,7 @@ public class OvsdbConnectionService implements AutoCloseable, OvsdbConnection {
                 public final Channel channel;
                 private int retryTimes;
 
-                public HandleNewPassiveSslRunner(Channel channel, SslHandler sslHandler) {
+                HandleNewPassiveSslRunner(Channel channel, SslHandler sslHandler) {
                     this.channel = channel;
                     this.sslHandler = sslHandler;
                     this.retryTimes = 3;
index 9ee33cd0465d67281871e77a787053d076b756bb..30964ce53399073c32a1506e184365a46a9c4315 100644 (file)
@@ -74,7 +74,7 @@ public class JsonRpcEndpoint {
 
         return Reflection.newProxy(klazz, new InvocationHandler() {
             @Override
-            public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+            public Object invoke(Object proxy, Method method, Object[] args) throws Exception {
                 if (method.getName().equals(OvsdbRPC.REGISTER_CALLBACK_METHOD)) {
                     if ((args == null) || args.length != 1 || !(args[0] instanceof OvsdbRPC.Callback)) {
                         return false;
index 6dce22ac7652dc9fceb0c1b6e7ab1aa32457ee2d..af07c092bdf6f3753c8720595b24d1ab9ce8906f 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.ovsdb.lib.schema;
 import com.fasterxml.jackson.databind.JsonNode;
 import com.google.common.reflect.Invokable;
 import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
@@ -72,7 +73,7 @@ public class DatabaseSchema {
         Invokable<E, E> invokable = Invokable.from(declaredConstructor);
         try {
             return invokable.invoke(null, table);
-        } catch (Exception e) {
+        } catch (InvocationTargetException | IllegalAccessException e) {
             String message = String.format("Not able to create instance of class %s using public constructor "
                     + "that accepts TableSchema object", clazz);
             throw new IllegalArgumentException(message, e);
index 2c7ee602cc97faac759f65567e1f40800e6ead66..96a26eca6c2cfa250c35c2fdd7df8f3a7a6e80c3 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.ovsdb.lib.schema;
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
@@ -64,7 +65,8 @@ public abstract class TableSchema<E extends TableSchema<E>> {
         try {
             Constructor<E> instance = clazz.getConstructor(TableSchema.class);
             return instance.newInstance(this);
-        } catch (Exception e) {
+        } catch (InstantiationException | IllegalAccessException
+                | InvocationTargetException | NoSuchMethodException e) {
             throw new RuntimeException("exception constructing instance of clazz " + clazz, e);
         }
     }
index e3eb23e19eadcaadf0f1679d630157d3ad974829..fc9dd639c306ebca578ec068f5b5ad59561e7e0e 100644 (file)
@@ -345,7 +345,7 @@ public class TyperUtils {
             }
 
             @Override
-            public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+            public Object invoke(Object proxy, Method method, Object[] args) throws Exception {
                 if (isGetTableSchema(method)) {
                     return processGetTableSchema();
                 } else if (isGetRow(method)) {
@@ -390,10 +390,10 @@ public class TyperUtils {
 
             @Override public String toString() {
                 String tableName;
-                try {
-                    TableSchema<?> schema = (TableSchema<?>)processGetTableSchema();
+                TableSchema<?> schema = (TableSchema<?>)processGetTableSchema();
+                if (schema != null) {
                     tableName = schema.getName();
-                } catch (Exception e) {
+                } else {
                     tableName = "";
                 }
                 if (row == null) {