Change this condition so that it does not always evaluate to "false"
https://sonar.onap.org/component_issues?id=org.openecomp.so%3Aso#resolved=false|severities=BLOCKER
Issue-Id:SO-118
Change-Id: I29713fa4c4623439addb4b7f30325dcb7e1ccfcc
Signed-off-by: shashikanth.vh <shashikanth.vh@huawei.com>
Object value = execution.getVariable(theInputVariable);
if (value == null) {
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);
}
StringBuilder output = new StringBuilder();
String line;
while ((line = reader.readLine()) != null) {
output.append(line);
}
-
- xmlStream.close();
- xmlStream = null;
-
value = output.toString();
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);
}
}
execution.setVariable(theInputVariable, value);