Merge "Cyclomatic complexity more than 10"
authormichal rehak <mirehak@cisco.com>
Fri, 8 Jul 2016 07:20:00 +0000 (07:20 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Fri, 8 Jul 2016 07:20:00 +0000 (07:20 +0000)
applications/bulk-o-matic/src/main/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/SalBulkFlowServiceImpl.java
applications/statistics-manager/src/test/java/org/opendaylight/openflowplugin/applications/statistics/manager/impl/StatListenCommitFlowTest.java
applications/statistics-manager/src/test/java/test/mock/util/NotificationProviderServiceHelper.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/OFRpcFutureResultTransformFactory.java

index 68de810198ca8317968b1095321442d191792388..2ddfc89da39af52eae3b560cb05ce7cc28fadcb3 100644 (file)
@@ -62,12 +62,16 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.common.RpcError;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Simple implementation providing bulk flows operations.
  */
 public class SalBulkFlowServiceImpl implements SalBulkFlowService {
 
+    private static final Logger LOG = LoggerFactory.getLogger(SalBulkFlowServiceImpl.class);
+
     private final SalFlowService flowService;
     private final DataBroker dataBroker;
     private final FlowCounter flowCounterBeanImpl = new FlowCounter();
@@ -211,7 +215,7 @@ public class SalBulkFlowServiceImpl implements SalBulkFlowService {
         } catch (MalformedObjectNameException | InstanceAlreadyExistsException
                 | MBeanRegistrationException | NotCompliantMBeanException e) {
             rpcResultBuilder = RpcResultBuilder.failed();
-            e.printStackTrace();
+            LOG.warn("Exception occurred: {} ", e.getMessage(), e);
         }
         return Futures.immediateFuture(rpcResultBuilder.build());
     }
index c70130cb3c99a01e4e6a116fd439de0530fa3f10..bf7917d0be129739d7c64b75a5382fc9a56f4e33 100644 (file)
@@ -56,6 +56,8 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
 import com.google.common.base.Optional;
 import com.google.common.util.concurrent.Futures;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Unit tests for StatListenCommitFlow.
@@ -64,6 +66,8 @@ import com.google.common.util.concurrent.Futures;
  */
 public class StatListenCommitFlowTest {
 
+    private static final Logger LOG = LoggerFactory.getLogger(StatListenCommitFlowTest.class);
+
     @Mock
     private NotificationProviderService mockNotificationProviderService;
 
@@ -126,7 +130,7 @@ public class StatListenCommitFlowTest {
             method.setAccessible(true);
             method.invoke(statCommitFlow, argObjects);
         } catch (Exception e) {
-            e.printStackTrace();
+            LOG.error("Exception occurred: {} ", e.getMessage(), e);
             fail(e.getCause().toString());
         }
     }
@@ -203,7 +207,7 @@ public class StatListenCommitFlowTest {
             method.setAccessible(true);
             method.invoke(statCommitFlow, argObjects);
         } catch (Exception e) {
-            e.printStackTrace();
+            LOG.error("Exception occurred: {} ", e.getMessage(), e);
             fail(e.getCause().toString());
         }
     }
@@ -248,7 +252,7 @@ public class StatListenCommitFlowTest {
             method.setAccessible(true);
             method.invoke(statCommitFlow, argObjects);
         } catch (Exception e) {
-            e.printStackTrace();
+            LOG.error("Exception occurred: {} ", e.getMessage(), e);
             fail(e.getCause().toString());
         }
     }
index d5a6a861bd756b19c921cf5dd6dc4e16132915d9..b9f849e7be2cad6a04148af812bdaa589ffcbcf4 100644 (file)
@@ -11,8 +11,13 @@ import org.opendaylight.controller.sal.binding.api.NotificationListener;
 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.binding.Notification;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class NotificationProviderServiceHelper {
+
+    private static final Logger LOG = LoggerFactory.getLogger(NotificationProviderServiceHelper.class);
+
     private NotificationProviderService notifBroker = new NotificationProviderServiceDummyImpl();
 
     public NotificationProviderService getNotifBroker() {
@@ -38,11 +43,9 @@ public class NotificationProviderServiceHelper {
 
         void propagateNotification(Notification notification) {
             try {
-                m.invoke(listenerInst, new Object[]{notification});
-            } catch (IllegalAccessException e) {
-                e.printStackTrace();
-            } catch (InvocationTargetException e) {
-                e.printStackTrace();
+                m.invoke(listenerInst, notification);
+            } catch (IllegalAccessException | InvocationTargetException e) {
+                LOG.error("Exception occurred: {} ", e.getMessage(), e);
             }
         }
 
index dfe92306c900d926d93c4b2dbcb5c8efb7e29071..41cb4bb63933fe522447fd7d111d18821d035343 100644 (file)
@@ -90,7 +90,7 @@ public abstract class OFRpcFutureResultTransformFactory {
                 RemoveFlowOutput result = removeFlowOutput.build();
 
                 RpcResult<RemoveFlowOutput> rpcResult = assembleRpcResult(input, result);
-                LOG.debug(MSG_ADD_FLOW_RPC);
+                LOG.debug("Returning the Remove Flow RPC result to MD-SAL");
                 return rpcResult;
             }
 
@@ -134,7 +134,7 @@ public abstract class OFRpcFutureResultTransformFactory {
                 RemoveGroupOutput result = removeGroupOutput.build();
 
                 RpcResult<RemoveGroupOutput> rpcResult = assembleRpcResult(input, result);
-                LOG.debug(MSG_ADD_FLOW_RPC);
+                LOG.debug("Returning the Remove Group RPC result to MD-SAL");
                 return rpcResult;
             }
 
@@ -178,7 +178,7 @@ public abstract class OFRpcFutureResultTransformFactory {
                 RemoveMeterOutput result = removeMeterOutput.build();
 
                 RpcResult<RemoveMeterOutput> rpcResult = assembleRpcResult(input, result);
-                LOG.debug("Returning the Add Meter RPC result to MD-SAL");
+                LOG.debug("Returning the Remove Meter RPC result to MD-SAL");
                 return rpcResult;
             }
         };