summaryrefslogtreecommitdiffstats
path: root/asdctool/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'asdctool/src/main/java')
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/DataMigration.java16
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/main/SdcSchemaFileImport.java5
2 files changed, 9 insertions, 12 deletions
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 cad7a05cb2..fddcab1e9f 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 @@ public class DataMigration {
*/
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 d2fa3a41fc..5c3c0361a3 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 @@ public class SdcSchemaFileImport {
//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);