Remove redundant catch clause 87/33887/1
authorMunir Ahmad <munir.ahmad@bell.ca>
Sat, 3 Mar 2018 01:02:15 +0000 (20:02 -0500)
committerMunir Ahmad <munir.ahmad@bell.ca>
Sat, 3 Mar 2018 01:02:15 +0000 (20:02 -0500)
Change-Id: Ib26f47171384125847a1b31bc1a958b50d0bba70
Issue-ID: SO-437
Signed-off-by: Munir Ahmad <munir.ahmad@bell.ca>
adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java
adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtilsWithUpdate.java
adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsTest.java
adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCConnector.java
adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java
adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java
bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/JsonWrapper.java
bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonWrapper.java
common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoLoggerTest.java

index a736bd4..b812dd4 100644 (file)
@@ -1243,8 +1243,6 @@ public class MsoHeatUtils extends MsoCommonUtils {
                        final Object obj = JSON_MAPPER.treeToValue(node, Object.class);
                        final String json = JSON_MAPPER.writeValueAsString(obj);
                        return json;
-               } catch (JsonParseException jpe) {
-                       LOGGER.debug("Error converting json to string " + jpe.getMessage(), jpe);
                } catch (Exception e) {
                        LOGGER.debug("Error converting json to string " + e.getMessage(), e);
                }
index f7e67d8..75bb003 100644 (file)
@@ -428,8 +428,6 @@ public class MsoHeatUtilsWithUpdate extends MsoHeatUtils {
                        final Object obj = JSON_MAPPER.treeToValue(node, Object.class);
                        final String json = JSON_MAPPER.writeValueAsString(obj);
                        return json;
-               } catch (JsonParseException jpe) {
-                       LOGGER.debug("Error converting json to string " + jpe.getMessage(), jpe);
                } catch (Exception e) {
                        LOGGER.debug("Error converting json to string " + e.getMessage(), e);
                }
index c2d4f9b..30830b0 100644 (file)
@@ -62,13 +62,11 @@ public class MsoHeatUtilsTest extends MsoCommonUtils {
                try {
                        msoHeatUtils.createStack("DOESNOTEXIST", "test", "stackName", "test", new HashMap<>(),
                                        Boolean.TRUE, 10);
-               } catch (MsoCloudSiteNotFound e) {
-
-               } catch (java.lang.NullPointerException npe) {
+               } catch (MsoCloudSiteNotFound | NullPointerException e) {
 
                }
 
-       }
+    }
 
        @Test
        public final void testCreateStackFailedConnectionHeatClient()
index be0466a..fa25716 100644 (file)
@@ -154,12 +154,7 @@ public abstract class SDNCConnector {
                        LOGGER.info(MessageEnum.RA_RESPONSE_FROM_SDNC, responseContent, "SDNC", "");
                        return createResponseFromContent(statusCode, statusMessage, responseContent, rt);
 
-               } catch (SocketTimeoutException e) {
-                       String errMsg = "Request to SDNC timed out";
-                       logError(errMsg, e);
-                       return createErrorResponse(HttpURLConnection.HTTP_CLIENT_TIMEOUT, errMsg, rt);
-
-               } catch (ConnectTimeoutException e) {
+               } catch (SocketTimeoutException | ConnectTimeoutException e) {
                        String errMsg = "Request to SDNC timed out";
                        logError(errMsg, e);
                        return createErrorResponse(HttpURLConnection.HTTP_CLIENT_TIMEOUT, errMsg, rt);
index afee1bb..fcbbf85 100644 (file)
@@ -166,12 +166,7 @@ public class RestfulUtil {
             method = null;
             return createResponse(statusCode, responseContent);
 
-        } catch(SocketTimeoutException e) {
-            String errMsg = "Request to VFC timed out";
-            logError(errMsg, e);
-            return createResponse(HttpURLConnection.HTTP_CLIENT_TIMEOUT, errMsg);
-
-        } catch(ConnectTimeoutException e) {
+        } catch(SocketTimeoutException | ConnectTimeoutException e) {
             String errMsg = "Request to VFC timed out";
             logError(errMsg, e);
             return createResponse(HttpURLConnection.HTTP_CLIENT_TIMEOUT, errMsg);
index cdfaf29..957cd0d 100644 (file)
@@ -536,8 +536,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
             final Object obj = JSON_MAPPER.treeToValue(node, Object.class);
             final String json = JSON_MAPPER.writeValueAsString(obj);
             return json;
-        } catch (JsonParseException jpe) {
-            LOGGER.debug("Error converting json to string " + jpe.getMessage(),jpe);
         } catch (Exception e) {
             LOGGER.debug("Error converting json to string " + e.getMessage(),e);
         }
index 4d895f3..fbed365 100644 (file)
@@ -92,10 +92,6 @@ public abstract class JsonWrapper implements Serializable  {
         JSONObject json = new JSONObject();\r
          try {\r
                        json = new JSONObject(mapper.writeValueAsString(this));\r
-               } catch (JsonGenerationException e) {\r
-                       LOGGER.debug("Exception :",e);\r
-               } catch (JsonMappingException e) {\r
-                       LOGGER.debug("Exception :",e);\r
                } catch (JSONException e) {\r
                        LOGGER.debug("Exception :",e);\r
                } catch (IOException e) {\r
@@ -113,8 +109,6 @@ public abstract class JsonWrapper implements Serializable  {
                        jsonString = mapper.writeValueAsString(list);\r
                } catch (JsonGenerationException e) {\r
                        LOGGER.debug("Exception :",e);\r
-               } catch (JsonMappingException e) {\r
-                       LOGGER.debug("Exception :",e);\r
                } catch (IOException e) {\r
                        LOGGER.debug("Exception :",e);\r
                }\r
index 967b1df..cfa5c85 100644 (file)
@@ -85,10 +85,6 @@ public abstract class JsonWrapper implements Serializable  {
         JSONObject json = new JSONObject();\r
          try {\r
                        json = new JSONObject(mapper.writeValueAsString(this));\r
-               } catch (JsonGenerationException e) {\r
-                       LOGGER.debug("Exception :",e);\r
-               } catch (JsonMappingException e) {\r
-                       LOGGER.debug("Exception :",e);\r
                } catch (JSONException e) {\r
                        LOGGER.debug("Exception :",e);\r
                } catch (IOException e) {\r
@@ -106,8 +102,6 @@ public abstract class JsonWrapper implements Serializable  {
                        jsonString = mapper.writeValueAsString(list);\r
                } catch (JsonGenerationException e) {\r
                        LOGGER.debug("Exception :",e);\r
-               } catch (JsonMappingException e) {\r
-                       LOGGER.debug("Exception :",e);\r
                } catch (IOException e) {\r
                        LOGGER.debug("Exception :",e);\r
                }\r
index 473f532..efa0dc2 100644 (file)
@@ -292,23 +292,11 @@ public class MsoLoggerTest {
                        method = MsoLogger.class.getDeclaredMethod("prepareMsg", String.class, String.class, String.class);
                        method.setAccessible(true);
                return  (String)method.invoke(msoLogger, arg1, arg2, arg3);
-               } catch (NoSuchMethodException e) {
-                       // TODO Auto-generated catch block
-                       e.printStackTrace();
-               } catch (SecurityException e) {
-                       // TODO Auto-generated catch block
-                       e.printStackTrace();
-               } catch (IllegalAccessException e) {
-                       // TODO Auto-generated catch block
-                       e.printStackTrace();
-               } catch (IllegalArgumentException e) {
-                       // TODO Auto-generated catch block
-                       e.printStackTrace();
-               } catch (InvocationTargetException e) {
+               } catch (NoSuchMethodException | InvocationTargetException | IllegalArgumentException | IllegalAccessException | SecurityException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                }
-       return null;
+        return null;
     }
 
     // User reflection to invoke to avoid change the publicity of the method
@@ -318,22 +306,10 @@ public class MsoLoggerTest {
                        method = MsoLogger.class.getDeclaredMethod(methodName, String.class);
                        method.setAccessible(true);
                return  method.invoke(msoLogger, arg);
-               } catch (NoSuchMethodException e) {
-                       // TODO Auto-generated catch block
-                       e.printStackTrace();
-               } catch (SecurityException e) {
-                       // TODO Auto-generated catch block
-                       e.printStackTrace();
-               } catch (IllegalAccessException e) {
-                       // TODO Auto-generated catch block
-                       e.printStackTrace();
-               } catch (IllegalArgumentException e) {
-                       // TODO Auto-generated catch block
-                       e.printStackTrace();
-               } catch (InvocationTargetException e) {
+               } catch (NoSuchMethodException | InvocationTargetException | IllegalArgumentException | IllegalAccessException | SecurityException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                }
-       return null;
+        return null;
     }
 }