On Fri, 22 Apr 2022 16:06:22 GMT, Daniel Fuchs <dfu...@openjdk.org> wrote:
>> Sibabrata Sahoo has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Update FileUtils.java > > test/lib/jdk/test/lib/util/FileUtils.java line 402: > >> 400: if (!removed.equals(froms)) { >> 401: throw new IOException("Removed not the same"); >> 402: } > > That's a bit strange. I would suggest to return the removed lines instead, or > to pass a `Consumer<String>` (or even better, a `Predicate<String>` ?) that > will accept the removed lines. You could continue to remove if the predicate > returns true and throw if it returns false. It would also enable you to tell > exactly which line failed the check. I was just thinking about providing the removed lines and the added lines at the same time into the method (just like what a patch file looks like). The exception here can probably be enhanced to compare the content of `removed` with `from`. Two blocks of code (call and callback) would be needed if a consumer or predicate is used, and I don't feel it's worth doing. Here I've already trimmed the lines to make sure whitespaces do not matter. ------------- PR: https://git.openjdk.java.net/jdk/pull/8360