Skip to content

Commit 7203110

Browse files
committed
8333427: langtools/tools/javac/newlines/NewLineTest.java is failing on Japanese Windows
Backport-of: 1b0281dc77f41fc5df323c7f7b25a4138b1ffb9e
1 parent 33ff519 commit 7203110

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

test/langtools/tools/javac/newlines/NewLineTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -58,8 +58,9 @@ public static void main(String args[]) throws Exception {
5858
.options("-J-Dline.separator='@'")
5959
.run(Task.Expect.FAIL);
6060

61-
List<String> lines = Files.readAllLines(javacOutput.toPath(),
62-
Charset.defaultCharset());
61+
String encoding = System.getProperty("native.encoding");
62+
Charset cs = (encoding != null) ? Charset.forName(encoding) : Charset.defaultCharset();
63+
List<String> lines = Files.readAllLines(javacOutput.toPath(), cs);
6364
if (lines.size() != 1) {
6465
throw new AssertionError("The compiler output should have one line only");
6566
}

0 commit comments

Comments
 (0)