Removed unnecesary checks 93/28893/2
authorburdziak <olaf.burdziakowski@nokia.com>
Tue, 23 Jan 2018 09:23:16 +0000 (10:23 +0100)
committerPatrick Brady <pb071s@att.com>
Thu, 25 Jan 2018 20:18:37 +0000 (20:18 +0000)
Issue-ID: APPC-446

Change-Id: I3d93bcff6c3ed8167dd7f273d90528a76cb2b02f
Signed-off-by: burdziak <olaf.burdziakowski@nokia.com>
appc-inbound/appc-artifact-handler/provider/src/main/java/org/onap/appc/artifact/handler/node/ArtifactHandlerNode.java

index 0c0fa46..fb19734 100644 (file)
@@ -100,15 +100,17 @@ public class ArtifactHandlerNode implements SvcLogicJavaPlugin {
     private static final EELFLogger log = EELFManager.getInstance().getLogger(ArtifactHandlerNode.class);
 
     public void processArtifact(Map<String, String> inParams, SvcLogicContext ctx) throws Exception {
-        String responsePrefix = inParams.get("response_prefix");
+        if (inParams == null || inParams.isEmpty())
+            return;
+        String postData = inParams.get("postData");
+        if(postData == null || postData.isEmpty())
+            return;
         try {
-            if (inParams != null && !inParams.isEmpty() && inParams.get("postData") != null) {
-                log.info("Received request for process Artifact with params: " + inParams.toString());
-                String postData = inParams.get("postData");
-                JSONObject input = new JSONObject(postData).getJSONObject("input");
-                responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix + ".") : "";
-                storeUpdateSdcArtifacts(input);
-            }
+            log.info("Received request for process Artifact with params: " + inParams.toString());
+            JSONObject input = new JSONObject(postData).getJSONObject("input");
+            String responsePrefix = inParams.get("response_prefix");
+            responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix + ".") : "";
+            storeUpdateSdcArtifacts(input);
         } catch (Exception e) {
             e.printStackTrace();
             throw e;
@@ -174,8 +176,7 @@ public class ArtifactHandlerNode implements SvcLogicJavaPlugin {
         String toscaContents = null;
         ArtifactProcessorImpl toscaGenerator = new ArtifactProcessorImpl();
         toscaGenerator.generateArtifact(PDFileContents, toscaStream);
-        if (toscaStream != null)
-            toscaContents = toscaStream.toString();
+        toscaContents = toscaStream.toString();
         log.info("Generated Tosca File : " + toscaContents);
 
         String yangContents = "YANG generation is in Progress";
@@ -199,8 +200,7 @@ public class ArtifactHandlerNode implements SvcLogicJavaPlugin {
         OutputStream yangStream = new ByteArrayOutputStream();
         YANGGenerator yangGenerator = YANGGeneratorFactory.getYANGGenerator();
         yangGenerator.generateYANG(artifactId, toscaContents, yangStream);
-        if (yangStream != null)
-            yangContents = yangStream.toString();
+        yangContents = yangStream.toString();
 
         if (yangContents != null) {
             updateYangContents(artifactId, ahpUtil.escapeSql(yangContents));