Closed johann-petrak closed 4 years ago
This looks to be an encoding issue - the test uses IOUtils.toString(InputStream)
which is sensitive to the platform default encoding, we should use the two parameter version and specify a fixed charset.
On further investigation I believe it’s actually to do with the way Git by default converts LF to CRLF on text files when you check them out on Windows (i.e. it does by default what subversion used to do only if you opted in with svn:eol-style=native
). The fix would be either to turn off that setting for these specific files using .gitattributes
or .replace("\r\n", "\n")
on the test string before comparing it. Or change what we test for, e.g. check what the file .startsWith
instead of how long it is.
Yes. startsWith with a length smaller than the first line or just test for the number of lines in the file as Java properly deals with the various alternatives for line separation on different platforms.
OK, test now checks the number of lines plus the non-whitespace content of the first line. Works on Windows and Linux.
Trying to build Windows 10 with Java 8:
This fails with:
The same happend when I tried to compile with Java 13 as well.