[Policy-8 ,Policy-23] Updated Matchid for policies
[policy/engine.git] / ECOMP-PAP-REST / src / main / java / org / openecomp / policy / pap / xacml / rest / service / ImportService.java
index d70332e..0b3e313 100644 (file)
@@ -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);
                                                }