gnodet commented on code in PR #77: URL: https://github.com/apache/maven-archiver/pull/77#discussion_r1859153862
########## src/main/java/org/apache/maven/shared/archiver/PomPropertiesUtil.java: ########## @@ -71,25 +64,8 @@ private void createPropertiesFile(Properties properties, Path outputFile, boolea return; } - try (PrintWriter pw = new PrintWriter(outputFile.toFile(), StandardCharsets.ISO_8859_1.name()); - StringWriter sw = new StringWriter()) { - - properties.store(sw, null); - - List<String> lines = new ArrayList<>(); - try (BufferedReader r = new BufferedReader(new StringReader(sw.toString()))) { - String line; - while ((line = r.readLine()) != null) { - if (!line.startsWith("#")) { - lines.add(line); - } - } - } - - Collections.sort(lines); - for (String l : lines) { - pw.println(l); - } + try (OutputStream out = Files.newOutputStream(outputFile)) { + properties.store(out, null); Review Comment: I don't think we can use `properties.store` here. The removal of comments and the ordering is definitely important for reproducible builds. We could refactor the code to use `BufferedReader.lines()`, filter out comments, sort, and print using the streams api. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org