8333427: langtools/tools/javac/newlines/NewLineTest.java is failing on Japanese Windows

Reviewed-by: jjg
This commit is contained in:
KIRIYAMA Takuya 2024-11-06 05:38:46 +00:00 committed by Jaikiran Pai
parent 471f112bca
commit 1b0281dc77

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -58,8 +58,9 @@ public class NewLineTest {
.options("-J-Dline.separator='@'") .options("-J-Dline.separator='@'")
.run(Task.Expect.FAIL); .run(Task.Expect.FAIL);
List<String> lines = Files.readAllLines(javacOutput.toPath(), String encoding = System.getProperty("native.encoding");
Charset.defaultCharset()); Charset cs = (encoding != null) ? Charset.forName(encoding) : Charset.defaultCharset();
List<String> lines = Files.readAllLines(javacOutput.toPath(), cs);
if (lines.size() != 1) { if (lines.size() != 1) {
throw new AssertionError("The compiler output should have one line only"); throw new AssertionError("The compiler output should have one line only");
} }