Added null check to avoid crash at
getErrorCode() call; fixed typos in error
messages; removed unnecessary try...catch block

Issue-ID: SO-1841
Signed-off-by: Oleksandr Moliavko<o.moliavko@samsung.com>
Change-Id: I95765a1a5a10497e366b5d94b89d45b6bde2b212
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
index be53e50..9a9e914 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
@@ -104,7 +104,7 @@
                     }
                 } catch (Exception ex) {
                     // keep default serviceType value
-                    logger.error("Exception in serviceType retrivel", ex);
+                    logger.error("Exception in serviceType retrieval", ex);
                 }
                 String vnfType = ASTERISK;
                 try {
@@ -116,22 +116,21 @@
                     }
                 } catch (Exception ex) {
                     // keep default vnfType value
-                    logger.error("Exception in vnfType retrivel", ex);
+                    logger.error("Exception in vnfType retrieval", ex);
                 }
 
                 String errorCode = ASTERISK;
-                try {
+                if (workflowException != null) {
                     errorCode = "" + workflowException.getErrorCode();
-                } catch (Exception ex) {
-                    // keep default errorCode value
-                    logger.error("Exception in errorCode retrivel", ex);
+                } else {
+                    logger.debug("WorkflowException is null, unable to get error code");
                 }
 
                 try {
                     errorCode = "" + (String) execution.getVariable("WorkflowExceptionCode");
                 } catch (Exception ex) {
                     // keep default errorCode value
-                    logger.error("Exception in errorCode retrivel", ex);
+                    logger.error("Exception in errorCode retrieval", ex);
                 }
 
                 String workStep = ASTERISK;
@@ -139,7 +138,7 @@
                     workStep = workflowException.getWorkStep();
                 } catch (Exception ex) {
                     // keep default workStep value
-                    logger.error("Exception in workStep retrivel", ex);
+                    logger.error("Exception in workStep retrieval", ex);
                 }
 
                 String errorMessage = ASTERISK;
@@ -147,7 +146,7 @@
                     errorMessage = workflowException.getErrorMessage();
                 } catch (Exception ex) {
                     // keep default workStep value
-                    logger.error("Exception in errorMessage retrivel", ex);
+                    logger.error("Exception in errorMessage retrieval", ex);
                 }
 
                 String serviceRole = ASTERISK;