Skip to content

Commit 428991b

Browse files
committed
Issue #41: Fixed header lineSeparator() bug
1 parent a2d69a9 commit 428991b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/main/java/org/checkstyle/autofix/recipe/Header.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public class Header extends Recipe {
4444
private static final String HEADER_FILE_PROPERTY = "headerFile";
4545
private static final String IGNORE_LINES_PROPERTY = "ignoreLines";
4646
private static final String CHARSET_PROPERTY = "charset";
47+
private static final String LINE_SEPRATOR = "\n";
4748

4849
private final List<CheckstyleViolation> violations;
4950
private final CheckConfiguration config;
@@ -129,7 +130,7 @@ public J visit(Tree tree, ExecutionContext ctx) {
129130
currentHeader, ignoreLines);
130131

131132
sourceFile = sourceFile.withPrefix(
132-
Space.format(fixedHeader + System.lineSeparator()));
133+
Space.format(fixedHeader + LINE_SEPRATOR));
133134
}
134135
result = super.visit(sourceFile, ctx);
135136
}
@@ -166,7 +167,7 @@ private static String fixHeaderLines(String licenseHeader,
166167
}
167168
}
168169

169-
return String.join(System.lineSeparator(), currentLines);
170+
return String.join(LINE_SEPRATOR, currentLines);
170171
}
171172

172173
private boolean hasViolation(Path filePath) {

0 commit comments

Comments
 (0)