Skip to content

Commit

Permalink
8282042: [testbug] FileEncodingTest.java depends on default encoding
Browse files Browse the repository at this point in the history
Adds expected encoding "ISO-8859-1" for AIX in FileEncodingTest.java

Reviewed-by: naoto
  • Loading branch information
backwaterred authored and naotoj committed Feb 22, 2022
1 parent 3cb3867 commit 58e1882
Showing 1 changed file with 6 additions and 4 deletions.
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

1 comment on commit 58e1882

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.