aboutsummaryrefslogtreecommitdiffstats
path: root/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/service/ImportService.java
diff options
context:
space:
mode:
Diffstat (limited to 'ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/service/ImportService.java')
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/service/ImportService.java7
1 files changed, 1 insertions, 6 deletions
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/service/ImportService.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/service/ImportService.java
index d70332edf..0b3e313d6 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/service/ImportService.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/service/ImportService.java
@@ -95,10 +95,8 @@ public class ImportService {
}
}else{
InputStream inputStream = null;
- FileOutputStream outputStream = null;
- try {
+ try(FileOutputStream outputStream = new FileOutputStream("ExtractDir" + File.separator + randomID+".zip")) {
inputStream = request.getInputStream();
- outputStream = new FileOutputStream("ExtractDir" + File.separator + randomID+".zip");
byte[] buffer = new byte[4096];
int bytesRead = -1 ;
while ((bytesRead = inputStream.read(buffer)) != -1) {
@@ -112,9 +110,6 @@ public class ImportService {
if(inputStream != null){
inputStream.close();
}
- if(outputStream != null){
- outputStream.close();
- }
} catch (IOException e) {
PolicyLogger.error("Exception Occured while closing the input/output stream"+e);
}