* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
private static final Logger LOG = LoggerFactory.getLogger(VnfSdnUtil.class);
- public static File ODLHOME = null;
+ private static File ODLHOME = null;
private static Properties properties;
File propFile = new File(ODLHOME.getAbsolutePath() + "/configuration/vnfapi.properties");
String propFileName = propFile.getAbsolutePath();
properties = new Properties();
- InputStream input = null;
if (propFile.isFile() && propFile.canRead()) {
- try {
- input = new FileInputStream(propFile);
+ try (InputStream input = new FileInputStream(propFile)) {
properties.load(input);
LOG.info("Loaded properties from " + propFileName );
- setProperties(properties);
+ setYangMappingProperties(properties);
+ } catch (IOException e) {
+ LOG.error("Failed to close properties file " + propFileName +"\n",e);
} catch (Exception e) {
LOG.error("Failed to load properties " + propFileName +"\n",e);
- } finally {
- if (input != null) {
- try {
- input.close();
- } catch (IOException e) {
- LOG.error("Failed to close properties file " + propFileName +"\n",e);
- }
- }
}
}
}