From e575ea8b9c775f72a906aea75c338e1fbb04df06 Mon Sep 17 00:00:00 2001 From: Michael Lando Date: Mon, 24 Jul 2017 00:48:40 +0300 Subject: [SDC] 1710 rebase Change-Id: Ib07b7baacc68a357d302ee591e1fe74151dcea96 Signed-off-by: Michael Lando --- .../openecomp/sdc/asdctool/main/SdcSchemaFileImport.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'asdctool/src') 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 50563a5412..758dae0342 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 @@ -28,6 +28,8 @@ import java.io.FileOutputStream; import java.io.FileWriter; import java.io.IOException; import java.io.InputStream; +import java.nio.file.FileSystem; +import java.nio.file.FileSystems; import java.nio.file.Files; import java.nio.file.Paths; import java.util.Date; @@ -53,6 +55,8 @@ import org.yaml.snakeyaml.Yaml; public class SdcSchemaFileImport { + private static final String SEPARATOR = FileSystems.getDefault().getSeparator(); + private static SdcSchemaFilesCassandraDao schemaFilesCassandraDao; private static final String TOSCA_VERSION = "tosca_simple_yaml_1_1"; @@ -70,7 +74,7 @@ public class SdcSchemaFileImport { public static void main(String[] args) throws Exception { //Generation flow start - generating SDC from normatives - + System.out.println("Starting SdcSchemaFileImport procedure..."); final String FILE_NAME = "SDC.zip"; if (args == null || args.length < 4) { @@ -88,10 +92,10 @@ public class SdcSchemaFileImport { //Initialize the license text try { - LICENSE_TXT = new String(Files.readAllBytes(Paths.get(appConfigDir + "\\license.txt"))); + LICENSE_TXT = new String(Files.readAllBytes(Paths.get(appConfigDir + SEPARATOR+"license.txt"))); } catch(Exception e) { - System.err.println("Couldn't read license.txt in location :" + appConfigDir); + System.err.println("Couldn't read license.txt in location :" + appConfigDir+", error: "+e); System.exit(1); } @@ -100,7 +104,7 @@ public class SdcSchemaFileImport { for (SchemaZipFileEnum schemaZipFileEnum : schemaFileList) { try { //get the source yaml file - String pathname = importToscaPath + "\\" + schemaZipFileEnum.getSourceFolderName() + "\\" + schemaZipFileEnum.getSourceFileName() + YAML_EXTENSION; + 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 @@ -223,7 +227,7 @@ public class SdcSchemaFileImport { String[] nodeTypesMainFolders = new String[]{"normative-types", "heat-types"}; for (String nodeTypesMainFolder : nodeTypesMainFolders) { - Files.walk(Paths.get(importToscaPath + "\\" + nodeTypesMainFolder)) + Files.walk(Paths.get(importToscaPath + SEPARATOR + nodeTypesMainFolder)) .filter(path -> path.getFileName().toString().toLowerCase().endsWith(YAML_EXTENSION)) .forEach(yamlFile -> { try { -- cgit 1.2.3-korg