summaryrefslogtreecommitdiffstats
path: root/juju/juju-vnfmadapter
diff options
context:
space:
mode:
Diffstat (limited to 'juju/juju-vnfmadapter')
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/service/adapter/impl/JujuClientManager.java21
1 files changed, 4 insertions, 17 deletions
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/service/adapter/impl/JujuClientManager.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/service/adapter/impl/JujuClientManager.java
index fee0f28..6753108 100644
--- a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/service/adapter/impl/JujuClientManager.java
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/service/adapter/impl/JujuClientManager.java
@@ -167,16 +167,13 @@ public class JujuClientManager implements IJujuClientManager {
* @since NFVO 0.5
*/
public static String readJujuConfigInfo() {
- InputStream ins = null;
-
- BufferedInputStream bins = null;
String fileContent = null;
String fileName = SystemEnvVariablesFactory.getInstance().getAppRoot() + System.getProperty("file.separator")
+ "etc" + System.getProperty("file.separator") + "conf" + System.getProperty("file.separator")
+ "juju_conf.json";
- try {
- ins = new FileInputStream(fileName);
- bins = new BufferedInputStream(ins);
+ try (
+ InputStream ins = new FileInputStream(fileName);
+ BufferedInputStream bins = new BufferedInputStream(ins)){
byte[] contentByte = new byte[ins.available()];
int num = bins.read(contentByte);
@@ -186,17 +183,7 @@ public class JujuClientManager implements IJujuClientManager {
}
} catch (Exception e) {
LOG.error(fileName + "is not found!", e);
- } finally {
- try {
- if (ins != null) {
- ins.close();
- }
- if (bins != null) {
- bins.close();
- }
- } catch (IOException e) {
- }
- }
+ }
return fileContent;
}
private JSONObject changeDir(String charmPath) {