aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/ReadConfigTask.java
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/ReadConfigTask.java')
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/ReadConfigTask.java27
1 files changed, 4 insertions, 23 deletions
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/ReadConfigTask.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/ReadConfigTask.java
index b46ffcd..09288f0 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/ReadConfigTask.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/ReadConfigTask.java
@@ -27,7 +27,6 @@ import java.util.Properties;
import org.camunda.bpm.engine.ProcessEngineException;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.Expression;
-
import org.openecomp.mso.logger.MsoLogger;
/**
@@ -57,38 +56,20 @@ public class ReadConfigTask extends BaseTask {
msoLogger.debug("propertiesFile = " + thePropertiesFile);
}
- Boolean shouldFail = (Boolean) execution.getVariable("shouldFail");
-
- if (shouldFail != null && shouldFail) {
- throw new ProcessEngineException(getClass().getSimpleName() + " Failed");
- }
+ if (shouldFail(execution)) {
+ throw new ProcessEngineException(getTaskName() + " Failed");
+ }
synchronized (ReadConfigTask.class) {
if (properties == null) {
properties = new Properties();
- InputStream stream = null;
-
- try {
- stream = getClass().getResourceAsStream(thePropertiesFile);
-
+ try(InputStream stream = getClass().getResourceAsStream(thePropertiesFile)) {
if (stream == null) {
throw new IOException("Resource not found: " + thePropertiesFile);
}
properties.load(stream);
-
- stream.close();
- stream = null;
-
- } finally {
- if (stream != null) {
- try {
- stream.close();
- } catch (Exception e) {
- // Do nothing
- }
- }
}
}
}