sonar issue fix blocker, critical

Issue-ID: SDC-1534

Change-Id: I58ae2497568fbdff58a1928bdc1e7187be9f0632
Signed-off-by: Arindam Mondal <arind.mondal@samsung.com>
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/DataMigration.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/DataMigration.java
index cad7a05..fddcab1 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/DataMigration.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/DataMigration.java
@@ -718,20 +718,18 @@
 	 */
 	private Map<Table, PrintWriter> createWriters(Map<Table, File> files) {
 		Map<Table, PrintWriter> printerWritersMap = new EnumMap<>(Table.class);
-		try {
+      
 			for (Table table : files.keySet()) {
 				log.info("creating writer for {}", table);
 				File file = files.get(table);
-				FileWriter fw = new FileWriter(file, true);
-				BufferedWriter bw = new BufferedWriter(fw);
-				PrintWriter out = new PrintWriter(bw);
+                try(PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(file)) )){
 				printerWritersMap.put(table, out);
 				log.info("creating writer for {} was successful", table);
-			}
-		} catch (IOException e) {
-			log.error("create writer to file failed", e);
-			return null;
-		}
+            } catch (IOException e) {
+            	log.error("create writer to file failed",e);
+            	return null;
+			} 
+        } 
 		return printerWritersMap;
 	}
 
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/SdcSchemaFileImport.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/SdcSchemaFileImport.java
index d2fa3a4..5c3c036 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/SdcSchemaFileImport.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/SdcSchemaFileImport.java
@@ -100,11 +100,10 @@
 		//Loop over schema file list and create each yaml file from /import/tosca folder 
 		SchemaZipFileEnum[] schemaFileList = SchemaZipFileEnum.values();
 		for (SchemaZipFileEnum schemaZipFileEnum : schemaFileList) {
-			try {
+			String pathname = importToscaPath + SEPARATOR + schemaZipFileEnum.getSourceFolderName() + SEPARATOR +  schemaZipFileEnum.getSourceFileName() + YAML_EXTENSION;
+			try(InputStream input = new FileInputStream(new File(pathname));) {
 				//get the source yaml file
-				String pathname = importToscaPath + SEPARATOR + schemaZipFileEnum.getSourceFolderName() + SEPARATOR +  schemaZipFileEnum.getSourceFileName() + YAML_EXTENSION;
 				System.out.println("Processing file "+pathname+"....");
-				InputStream input = new FileInputStream(new File(pathname));
 				//Convert the content of file to yaml 
 				Yaml yamlFileSource = new Yaml();
 			    Object content = yamlFileSource.load(input);