Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8282042: [testbug] FileEncodingTest.java depends on default encoding #7525

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions test/jdk/java/lang/System/FileEncodingTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2022, 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
Expand All @@ -23,7 +23,7 @@

/*
* @test
* @bug 8260265
* @bug 8260265 8282042
* @summary Test file.encoding system property
* @library /test/lib
* @build jdk.test.lib.process.*
Expand All @@ -40,7 +40,7 @@
import org.testng.annotations.Test;

public class FileEncodingTest {
private static final boolean IS_WINDOWS = System.getProperty("os.name").startsWith("Windows");
private static final String OS_NAME = System.getProperty("os.name");

@DataProvider
public Object[][] fileEncodingToDefault() {
Expand All @@ -56,14 +56,16 @@ public Object[][] fileEncodingToDefault() {
@Test(dataProvider = "fileEncodingToDefault")
public void testFileEncodingToDefault(String fileEncoding, String expected) throws Exception {
if (fileEncoding.equals("COMPAT")) {
if (IS_WINDOWS) {
if (OS_NAME.startsWith("Windows")) {
// Only tests on English locales
if (Locale.getDefault().getLanguage().equals("en")) {
expected = "windows-1252";
} else {
System.out.println("Tests only run on Windows with English locales");
return;
}
} else if (OS_NAME.startsWith("AIX")) {
expected = "ISO-8859-1";
} else {
expected = "US-ASCII";
}
Expand Down