From 1b0281dc77f41fc5df323c7f7b25a4138b1ffb9e Mon Sep 17 00:00:00 2001 From: KIRIYAMA Takuya Date: Wed, 6 Nov 2024 05:38:46 +0000 Subject: [PATCH] 8333427: langtools/tools/javac/newlines/NewLineTest.java is failing on Japanese Windows Reviewed-by: jjg --- test/langtools/tools/javac/newlines/NewLineTest.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/langtools/tools/javac/newlines/NewLineTest.java b/test/langtools/tools/javac/newlines/NewLineTest.java index b1567d363b0..35c60e59653 100644 --- a/test/langtools/tools/javac/newlines/NewLineTest.java +++ b/test/langtools/tools/javac/newlines/NewLineTest.java @@ -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. * * This code is free software; you can redistribute it and/or modify it @@ -58,8 +58,9 @@ public class NewLineTest { .options("-J-Dline.separator='@'") .run(Task.Expect.FAIL); - List lines = Files.readAllLines(javacOutput.toPath(), - Charset.defaultCharset()); + String encoding = System.getProperty("native.encoding"); + Charset cs = (encoding != null) ? Charset.forName(encoding) : Charset.defaultCharset(); + List lines = Files.readAllLines(javacOutput.toPath(), cs); if (lines.size() != 1) { throw new AssertionError("The compiler output should have one line only"); }