diff --git a/config-data-executor/src/main/java/org/micord/service/DownloadService.java b/config-data-executor/src/main/java/org/micord/service/DownloadService.java index 95106ba..529fe6d 100644 --- a/config-data-executor/src/main/java/org/micord/service/DownloadService.java +++ b/config-data-executor/src/main/java/org/micord/service/DownloadService.java @@ -280,14 +280,14 @@ public class DownloadService { if (!results.isEmpty()) { List headers = new ArrayList<>(results.get(0).keySet()); writer.write(String.join(",", headers)); - writer.write("\r\n"); + writer.newLine(); for (Map row : results) { List rowValues = headers.stream() .map(header -> formatCsvField(row.get(header))) .collect(Collectors.toList()); - writer.write(String.join(";", rowValues)); - writer.write("\r\n"); + writer.write(String.join(",", rowValues)); + writer.newLine(); } } } @@ -300,15 +300,10 @@ public class DownloadService { private String formatCsvField(Object value) { if (value == null) { - return ""; + return "\"\""; } - String strValue = value.toString(); - - if (strValue.contains(";") || strValue.contains("\"") || strValue.contains("\r") || strValue.contains("\n")) { - strValue = strValue.replace("\"", "\"\""); - return "\"" + strValue + "\""; - } - return strValue; + String strValue = value.toString().replace("\"", "\"\""); + return "\"" + strValue + "\""; } private String formatCsvRow(String[] row) {