eclipse-transformer/transformer

New line codes in text files are always converted to LF only.

11rx4f opened this issue · 0 comments

Environment Details

  • Transformer Version: 0.5.0
  • JDK version: openjdk 11.0.12
  • OS: Red Hat Enterprise Linux 7.4

Problem Description

New line codes in text files are always converted to LF only,
even if text files contain CRLF or CR.

Steps to reproduce

Specify a text file such as java or xml whose new line codes are CRLF.

Cause

String read by BufferedReader.readLine() are always written with LF.
(BufferedReader.readLine() doesn't return String which includes any line-termination characters.)

https://github.com/eclipse/transformer/blob/2411075cc0413f4a3aa36a21c360d780dc55555c/org.eclipse.transformer/src/main/java/org/eclipse/transformer/action/impl/TextActionImpl.java#L100
https://github.com/eclipse/transformer/blob/2411075cc0413f4a3aa36a21c360d780dc55555c/org.eclipse.transformer/src/main/java/org/eclipse/transformer/action/impl/ServiceLoaderConfigActionImpl.java#L205
https://github.com/eclipse/transformer/blob/2411075cc0413f4a3aa36a21c360d780dc55555c/org.eclipse.transformer/src/main/java/org/eclipse/transformer/action/impl/JavaActionImpl.java#L94

Impact of Issue

When the difference between before conversion and after conversion is checked, all lines are displayed as differences, so it is not possible to evaluate whether the conversion processing was performed correctly.