summaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerSupport.java2
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/ReadConfigTask.java23
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/ReadFileTask.java26
3 files changed, 8 insertions, 43 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerSupport.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerSupport.java
index 3b7089153f..bfd0d7dee4 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerSupport.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerSupport.java
@@ -108,7 +108,7 @@ public class ApplicationControllerSupport {
try {
return (Status) statusReader.invoke(response);
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
- throw new RuntimeException(String.format("Unable to obtain status from LCM Kit response"), e);
+ throw new RuntimeException("Unable to obtain status from LCM Kit response", e);
}
}
return new Status();
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 6249040342..b27a2fa64e 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
@@ -67,29 +67,12 @@ public class ReadConfigTask extends BaseTask {
synchronized (ReadConfigTask.class) {
if (properties == null) {
properties = new Properties();
-
- InputStream stream = null;
-
- try {
- stream = getClass().getResourceAsStream(thePropertiesFile);
-
- if (stream == null) {
- throw new IOException("Resource not found: " + thePropertiesFile);
- }
+ try (InputStream stream = getClass().getResourceAsStream(thePropertiesFile)) {
properties.load(stream);
- stream.close();
- stream = null;
-
- } finally {
- if (stream != null) {
- try {
- stream.close();
- } catch (Exception e) {
- msoLogger.debug("Exception:", e);
- }
- }
+ } catch (Exception e) {
+ msoLogger.debug("Exception at readResourceFile stream: " + e);
}
}
}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/ReadFileTask.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/ReadFileTask.java
index 6b3cb5a1db..af38053fac 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/ReadFileTask.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/ReadFileTask.java
@@ -76,36 +76,18 @@ public class ReadFileTask extends BaseTask {
Object value = execution.getVariable(theInputVariable);
if (value == null) {
- InputStream xmlStream = null;
-
- try {
- xmlStream = getClass().getResourceAsStream(theFile);
-
- if (xmlStream == null) {
- throw new IOException("Resource not found: " + theFile);
- }
-
- BufferedReader reader = new BufferedReader(new InputStreamReader(xmlStream));
+ try (InputStream xmlStream = getClass().getResourceAsStream(theFile);
+ BufferedReader reader = new BufferedReader(new InputStreamReader(xmlStream))) {
StringBuilder output = new StringBuilder();
String line;
while ((line = reader.readLine()) != null) {
output.append(line);
}
-
- xmlStream.close();
- xmlStream = null;
-
value = output.toString();
- } finally {
- if (xmlStream != null) {
- try {
- xmlStream.close();
- } catch (Exception e) {
- msoLogger.debug("Exception ", e);
- }
- }
+ } catch (Exception e) {
+ msoLogger.debug("Exception at readResourceFile stream: " + e);
}
}
execution.setVariable(theInputVariable, value);