Remove redundant type cast 23/35023/2
authorMunir Ahmad <munir.ahmad@bell.ca>
Sat, 10 Mar 2018 00:49:54 +0000 (19:49 -0500)
committerMunir Ahmad <munir.ahmad@bell.ca>
Sat, 10 Mar 2018 01:45:40 +0000 (01:45 +0000)
Change-Id: Ie00d5ec5a4677c99a9a689bf18a85055902f6384
Issue-ID: SO-437
Signed-off-by: Munir Ahmad <munir.ahmad@bell.ca>
adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java
adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcManager.java
adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/RestfulResponse.java
bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTest.java
bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java
bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/plugins/LoggingAndURNMappingPlugin.java
bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/TestBaseTask.java

index ab2c4ef..69e015e 100644 (file)
@@ -115,7 +115,7 @@ public class SDNCServiceRequestConnector extends SDNCConnector {
                                } else if ("ack-final-indicator".equals(child.getNodeName())) {
                                        ackFinalIndicator = child.getTextContent();
                                } else if ("response-parameters".equals(child.getNodeName())) {
-                    responseParameters.add((Element) child);
+                    responseParameters.add(child);
                                }
                        }
 
index 2c2143c..6f06fbf 100644 (file)
@@ -398,7 +398,7 @@ public class VfcManager {
 
         String url;
         String originalUrl;
-        originalUrl = (String)nfvoUrlMap.get(step);
+        originalUrl = nfvoUrlMap.get(step);
         url = String.format(originalUrl, variable);
         return url;
 
index 483c952..e4f7f30 100644 (file)
@@ -65,7 +65,7 @@ public class RestfulResponse {
 \r
     public int getRespHeaderInt(String key) {\r
         if(this.respHeaderMap != null) {\r
-            String result = (String)this.respHeaderMap.get(key);\r
+            String result = this.respHeaderMap.get(key);\r
             if(result != null) {\r
                 return Integer.parseInt(result);\r
             }\r
@@ -75,7 +75,7 @@ public class RestfulResponse {
 \r
     public long getRespHeaderLong(String key) {\r
         if(this.respHeaderMap != null) {\r
-            String result = (String)this.respHeaderMap.get(key);\r
+            String result = this.respHeaderMap.get(key);\r
             if(result != null) {\r
                 return Long.parseLong(result);\r
             }\r
@@ -85,7 +85,7 @@ public class RestfulResponse {
 \r
     public String getRespHeaderStr(String key) {\r
         if(this.respHeaderMap != null) {\r
-            return ((String)this.respHeaderMap.get(key));\r
+            return this.respHeaderMap.get(key);\r
         }\r
         return null;\r
     }\r
index 6f0095f..849aae8 100644 (file)
@@ -133,8 +133,7 @@ public class WorkflowTest {
                List<ResponseTransformer> transformerList = new ArrayList<ResponseTransformer>();\r
 \r
                for (Field field : getClass().getFields()) {\r
-                       WorkflowTestTransformer annotation = (WorkflowTestTransformer)\r
-                               field.getAnnotation(WorkflowTestTransformer.class);\r
+                       WorkflowTestTransformer annotation = field.getAnnotation(WorkflowTestTransformer.class);\r
 \r
                        if (annotation == null) {\r
                                continue;\r
index b0152a1..bfad9ba 100644 (file)
@@ -327,7 +327,7 @@ public class JsonUtils {
                                        return null;\r
                                } else {\r
                                        if (rawValue instanceof String) {\r
-                                               msoLogger.debug("getJsonValue(): the raw value is a String Object=" + ((String) rawValue));\r
+                                               msoLogger.debug("getJsonValue(): the raw value is a String Object=" + rawValue);\r
                                                return (String) rawValue;\r
                                        } else {\r
                                                msoLogger.debug("getJsonValue(): the raw value is NOT a String Object=" + rawValue.toString());\r
@@ -356,7 +356,7 @@ public class JsonUtils {
                                        return null;\r
                                } else {\r
                                        if (rawValue instanceof String) {\r
-                                               msoLogger.debug("getJsonNodeValue(): the raw value is a String Object=" + ((String) rawValue));\r
+                                               msoLogger.debug("getJsonNodeValue(): the raw value is a String Object=" + rawValue);\r
                                                return (String) rawValue;\r
                                        } else {\r
                                                msoLogger.debug("getJsonNodeValue(): the raw value is NOT a String Object=" + rawValue.toString());\r
@@ -388,7 +388,7 @@ public class JsonUtils {
                                        return 0;\r
                                } else {\r
                                        if (rawValue instanceof Integer) {\r
-                                               msoLogger.debug("getJsonValue(): the raw value is an Integer Object=" + ((String) rawValue));\r
+                                               msoLogger.debug("getJsonValue(): the raw value is an Integer Object=" + rawValue);\r
                                                return (Integer) rawValue;\r
                                        } else {\r
                                                msoLogger.debug("getJsonValue(): the raw value is NOT an Integer Object=" + rawValue.toString());\r
@@ -416,7 +416,7 @@ public class JsonUtils {
                                        return false;\r
                                } else {\r
                                        if (rawValue instanceof Boolean) {\r
-                                               msoLogger.debug("getJsonValue(): the raw value is a Boolean Object=" + ((String) rawValue));\r
+                                               msoLogger.debug("getJsonValue(): the raw value is a Boolean Object=" + rawValue);\r
                                                return (Boolean) rawValue;\r
                                        } else {\r
                                                msoLogger.debug("getJsonValue(): the raw value is NOT an Boolean Object=" + rawValue.toString());\r
@@ -462,7 +462,7 @@ public class JsonUtils {
                                return null;\r
                        } else {\r
                                if (rawValue instanceof JSONArray) {\r
-                                       msoLogger.debug("getJsonParamValue(): keys=" + keys + " points to JSONArray: " + ((JSONArray) rawValue).toString());\r
+                                       msoLogger.debug("getJsonParamValue(): keys=" + keys + " points to JSONArray: " + rawValue.toString());\r
                                        int arrayLen = ((JSONArray) rawValue).length();\r
                                        if (index < 0 || arrayLen < index+1) {\r
                                                msoLogger.debug("getJsonParamValue(): index: " + index + " is out of bounds for array size of " + arrayLen);\r
@@ -549,7 +549,7 @@ public class JsonUtils {
                                msoLogger.debug("getJsonValueForKey(): iterating over the keys");\r
                                Iterator <String> itr = jsonObj.keys();\r
                                while (itr.hasNext()) {\r
-                                       String nextKey = (String) itr.next();\r
+                                       String nextKey = itr.next();\r
                                        Object obj = jsonObj.get(nextKey);\r
                                        if (obj instanceof JSONObject) {\r
                                                msoLogger.debug("getJsonValueForKey(): key=" + nextKey + ", points to JSONObject, recursive call");\r
@@ -592,7 +592,7 @@ public class JsonUtils {
                                msoLogger.debug("getJsonValueForKey(): iterating over the keys");\r
                                Iterator <String> itr = jsonObj.keys();\r
                                while (itr.hasNext()) {\r
-                                       String nextKey = (String) itr.next();\r
+                                       String nextKey = itr.next();\r
                                        Object obj = jsonObj.get(nextKey);\r
                                        if (obj instanceof JSONObject) {\r
                                                msoLogger.debug("getJsonValueForKey(): key=" + nextKey + ", points to JSONObject, recursive call");\r
@@ -634,7 +634,7 @@ public class JsonUtils {
                                msoLogger.debug("getJsonBooleanValueForKey(): iterating over the keys");\r
                                Iterator <String> itr = jsonObj.keys();\r
                                while (itr.hasNext()) {\r
-                                       String nextKey = (String) itr.next();\r
+                                       String nextKey = itr.next();\r
                                        Object obj = jsonObj.get(nextKey);\r
                                        if (obj instanceof JSONObject) {\r
                                                msoLogger.debug("getJsonBooleanValueForKey(): key=" + nextKey + ", points to JSONObject, recursive call");\r
@@ -690,7 +690,7 @@ public class JsonUtils {
                if (!jsonValueExists(jsonStr, keys)) {\r
                        return putJsonValue(jsonStr, keys, value);\r
                } else {\r
-                       msoLogger.debug("addJsonValue(): JSON add failed, key=" + keys + "/value=" + (String) value + " already exists");\r
+                       msoLogger.debug("addJsonValue(): JSON add failed, key=" + keys + "/value=" + value + " already exists");\r
                        return jsonStr;\r
                }\r
        }\r
@@ -826,7 +826,7 @@ public class JsonUtils {
                                                msoLogger.debug("putJsonValue(): key=" + keyStr + " points to json object");\r
                                                jsonObj = (JSONObject) keyValue;\r
                                        } else {\r
-                                               msoLogger.debug("putJsonValue(): key=" + keyStr + " not the last key but points to non-json object: " + (String) keyValue);\r
+                                               msoLogger.debug("putJsonValue(): key=" + keyStr + " not the last key but points to non-json object: " + keyValue);\r
                                                return null;\r
                                        }\r
                                } else { // at the last/new key value\r
index 730c145..b66169d 100644 (file)
@@ -421,7 +421,7 @@ public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin {
                                try {
                                        String id = execution.getId();
                                        if ("START".equals(event) && id != null ) {
-                                               startTimes.put(id, (Long)System.currentTimeMillis());
+                                               startTimes.put(id, System.currentTimeMillis());
                                        } else if ("END".equals(event) && id != null) {
                                                String prefix = (String) execution.getVariable("prefix");
 
index 2d204c3..d434ac7 100644 (file)
@@ -58,8 +58,8 @@ public class TestBaseTask {
                Map<String, Object> variables = new HashMap<>();
                variables.put("firstName", "Jane");
                variables.put("lastName", "Doe");
-               variables.put("age", (Integer)25);
-               variables.put("lastVisit", (Long)1438270117000L);
+               variables.put("age", 25);
+               variables.put("lastVisit", 1438270117000L);
 
                RuntimeService runtimeService = processEngineRule.getRuntimeService();
                assertNotNull(runtimeService);