summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
046922b)
One major issue in sdnc/northbound module
*This is done for a guaranteed closing of resource
and not worrying about finally block to close it
Issue-Id: CCSDK-87
Change-Id: Ic6ea871cb9fb61cbce24b61d7c434d3404570ae7
Signed-off-by: surya-huawei <a.u.surya@huawei.com>
File file = new File(PROPERTIES_FILE);
properties = new Properties();
File file = new File(PROPERTIES_FILE);
properties = new Properties();
- InputStream input = null;
- if (file.isFile() && file.canRead()) {
- try {
- input = new FileInputStream(file);
+ if(file.isFile() && file.canRead()) {
+ try(InputStream input = new FileInputStream(file)){
properties.load(input);
LOG.info("Loaded properties from " + PROPERTIES_FILE );
setYangMappingProperties(properties);
properties.load(input);
LOG.info("Loaded properties from " + PROPERTIES_FILE );
setYangMappingProperties(properties);
+ } catch (IOException e) {
+ LOG.error("Failed to close properties file " + PROPERTIES_FILE +"\n",e);
} catch (Exception e) {
LOG.error("Failed to load properties " + PROPERTIES_FILE +"\n",e);
} catch (Exception e) {
LOG.error("Failed to load properties " + PROPERTIES_FILE +"\n",e);
- } finally {
- if (input != null) {
- try {
- input.close();
- } catch (IOException e) {
- LOG.error("Failed to close properties file " + PROPERTIES_FILE +"\n",e);
- }
- }