diff options
Diffstat (limited to 'service/src/main/java/org/onap/vfc/nfvo/multivimproxy/common/util/restclient/RestfulConfigure.java')
-rw-r--r-- | service/src/main/java/org/onap/vfc/nfvo/multivimproxy/common/util/restclient/RestfulConfigure.java | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/service/src/main/java/org/onap/vfc/nfvo/multivimproxy/common/util/restclient/RestfulConfigure.java b/service/src/main/java/org/onap/vfc/nfvo/multivimproxy/common/util/restclient/RestfulConfigure.java index 6bb383f..ad186c9 100644 --- a/service/src/main/java/org/onap/vfc/nfvo/multivimproxy/common/util/restclient/RestfulConfigure.java +++ b/service/src/main/java/org/onap/vfc/nfvo/multivimproxy/common/util/restclient/RestfulConfigure.java @@ -134,28 +134,15 @@ public class RestfulConfigure { LOG.error(filePath + "isn't exist."); return null; } - BufferedReader reader = null; final StringBuilder jsonstr = new StringBuilder(); - JSONObject jo = null; - try { - reader = new BufferedReader(new FileReader(file)); + try (BufferedReader reader = new BufferedReader(new FileReader(file))){ final ReaderHelper rHelpper = new ReaderHelper(reader); - String tempString = null; - while((tempString = rHelpper.getLine()) != null) { - jsonstr.append(tempString); + while(null != rHelpper.getLine()) { + jsonstr.append(rHelpper.getLine()); } - jo = JSONObject.fromObject(jsonstr.toString()); } catch(final IOException e) { LOG.error("load file exception:" + e); - } finally { - if(reader != null) { - try { - reader.close(); - } catch(final IOException e) { - LOG.error("close error.", e); - } - } - } - return jo; + } + return JSONObject.fromObject(jsonstr.toString()); } } |