X-Git-Url: https://gerrit.onap.org/r/gitweb?p=policy%2Fengine.git;a=blobdiff_plain;f=ONAP-PAP-REST%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fpap%2Fxacml%2Frest%2Fcomponents%2FCreateNewMicroServiceModel.java;h=af789569591db8053c4ccccdec66031d73ae0e11;hp=aad70e5ddbcc8ff96c5b6880d4d8aeeb7a474b10;hb=401b48bc573561f097960a9ca7abe6d788456f28;hpb=9301fed7c290f52208922f780fdfe4b5a880b5aa diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/CreateNewMicroServiceModel.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/CreateNewMicroServiceModel.java index aad70e5dd..af7895695 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/CreateNewMicroServiceModel.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/CreateNewMicroServiceModel.java @@ -70,7 +70,7 @@ public class CreateNewMicroServiceModel { this.newModel.setUserCreatedBy(userInfo); String cleanUpFile = null; - HashMap tempMap = new HashMap<>(); + Map tempMap = new HashMap<>(); //Need to delete the file if (importFile.contains(".zip")){ extractFolder(randomID + ".zip"); @@ -143,16 +143,14 @@ public class CreateNewMicroServiceModel { int currentByte; byte data[] = new byte[BUFFER]; - - FileOutputStream fos = new FileOutputStream(destFile); - BufferedOutputStream dest = new BufferedOutputStream(fos, - BUFFER); - - while ((currentByte = is.read(data, 0, BUFFER)) != -1) { - dest.write(data, 0, currentByte); - } - dest.flush(); - dest.close(); + try(FileOutputStream fos = new FileOutputStream(destFile); + BufferedOutputStream dest = new BufferedOutputStream(fos, BUFFER)) { + + while ((currentByte = is.read(data, 0, BUFFER)) != -1) { + dest.write(data, 0, currentByte); + } + dest.flush(); + } is.close(); } @@ -177,7 +175,7 @@ public class CreateNewMicroServiceModel { Map successMap = new HashMap<>(); MSAttributeObject mainClass = null; - ArrayList dependency = null; + List dependency = null; String subAttribute = null; if (!classMap.containsKey(this.newModel.getModelName())){