line.separator is a system dependent property, and not a system property that you can override.
This will be CRLF for Windows, and LF for *Nix & MacOS. https://www.geeksforgeeks.org/system-lineseparator-method-in-java-with-examples/ <https://www.geeksforgeeks.org/system-lineseparator-method-in-java-with-examples/> Normally code should be flexible to accommodate different line separators — it is usually whitespace that can be safely ignored. For example: * PrintWriter allows code to output using println, and the output will automatically use system dependent line separators. * BufferedReader.readLine allows code to input lines, ignoring line separators. > On May 7, 2019, at 11:07 AM, John Passaro <[email protected]> wrote: > > Hi, I may have found a bug. > > My team's code has tests failing depending on what system they're run > on, apparently because of conflicting line separator. I'm trying to > change the line.separator value so I can debug. > > My normal setting is line.separator=\n, and tests currently pass. I > tried adding this to my surefire config: > > <systemPropertyVariables> > <line.separator>
</line.separator> > </systemPropertyVariables> > > I expected that this was just giving explicitly the same setting that > was normally natively available, so the tests should be unaffected. In > fact, tests started to fail, it seems like the VM is treating > line.separator as empty. For example, we expected a formatted stack > trace: > > * Stack trace: > java.lang.Exception: exception message > at com.poppin.Foo.bar(Foo.java:47) > at com.poppin.Eggs.spam(Eggs.java:305) > > and we got one without line breaks: > > * Stack trace: > java.lang.Exception: exception message at > com.poppin.Foo.bar(Foo.java:47) at > com.poppin.Eggs.spam(Eggs.java:305) > > (the above is all one line) > > Similar results when I give <line.separator>
</line.separator>. > > Am I right in thinking this is a bug? Maybe when reading the xml, > whitespace is stripped, including my 
, and the property entry > winds up empty (though I can't find anything in the surefire source > explicitly doing that). Or is there something else I am doing wrong? > > Appreciate > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] >
