diff options
Diffstat (limited to 'huawei')
-rw-r--r-- | huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/DownloadCsarManager.java | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/DownloadCsarManager.java b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/DownloadCsarManager.java index 2cbd1ab8..b09c50d7 100644 --- a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/DownloadCsarManager.java +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/DownloadCsarManager.java @@ -192,17 +192,17 @@ public class DownloadCsarManager { if(parent != null && (!parent.exists())) { parent.mkdirs(); } - FileOutputStream fos = new FileOutputStream(file); - BufferedOutputStream bos = new BufferedOutputStream(fos, BUFFER); + try(FileOutputStream fos = new FileOutputStream(file)){ + try(BufferedOutputStream bos = new BufferedOutputStream(fos, BUFFER)){ - int count; - byte data[] = new byte[BUFFER]; - while((count = bis.read(data, 0, BUFFER)) != -1) { - bos.write(data, 0, count); + int count; + byte data[] = new byte[BUFFER]; + while((count = bis.read(data, 0, BUFFER)) != -1) { + bos.write(data, 0, count); + } + bos.flush(); + } } - bos.flush(); - bos.close(); - bis.close(); } status = Constant.UNZIP_SUCCESS; |