Skip to content

Commit ed0268b

Browse files
committed
Make sure the index.json ends with EOL
1 parent d10e2dc commit ed0268b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

tests/tck-build-logic/src/main/java/org/graalvm/internal/tck/TestedVersionUpdaterTask.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import java.io.File;
2121
import java.io.IOException;
22+
import java.nio.file.Files;
2223
import java.util.Comparator;
2324
import java.util.List;
2425

@@ -65,6 +66,11 @@ void run() throws IllegalStateException, IOException {
6566
DefaultPrettyPrinter prettyPrinter = new DefaultPrettyPrinter();
6667
prettyPrinter.indentArraysWith(DefaultIndenter.SYSTEM_LINEFEED_INSTANCE);
6768

68-
objectMapper.writer(prettyPrinter).writeValue(coordinatesMetadataIndex, entries);
69+
// Ensure the JSON file ends with a trailing EOL
70+
String json = objectMapper.writer(prettyPrinter).writeValueAsString(entries);
71+
if (!json.endsWith("\n")) {
72+
json = json + System.lineSeparator();
73+
}
74+
Files.writeString(coordinatesMetadataIndex.toPath(), json, java.nio.charset.StandardCharsets.UTF_8);
6975
}
7076
}

0 commit comments

Comments
 (0)