Skip to content

Commit 7b94338

Browse files
committed
8357561: BootstrapLoggerTest does not work on Ubuntu 24 with LANG de_DE.UTF-8
Reviewed-by: rrich Backport-of: 670ef8cc52e6eb068ca6968142629abc1c424571
1 parent 42cccb1 commit 7b94338

File tree

4 files changed

+18
-5
lines changed

4 files changed

+18
-5
lines changed

test/jdk/java/lang/System/LoggerFinder/internal/BootstrapLogger/BootstrapLoggerTest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2014, 2025, 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
@@ -39,6 +39,7 @@
3939
import java.security.ProtectionDomain;
4040
import java.util.concurrent.atomic.AtomicBoolean;
4141
import java.util.List;
42+
import java.util.Locale;
4243
import java.util.Optional;
4344
import java.util.Set;
4445
import java.util.stream.Collectors;
@@ -88,6 +89,8 @@ static enum TestCase {
8889
}
8990

9091
public static void main(String[] args) throws Exception {
92+
Locale savedLocale = Locale.getDefault();
93+
Locale.setDefault(Locale.US);
9194
if (args == null || args.length == 0) {
9295
args = new String[] { TestCase.SECURE_AND_WAIT.name() };
9396
}
@@ -373,6 +376,7 @@ public static void main(String[] args) throws Exception {
373376
LogStream.err.println("Not checking executor termination for " + test);
374377
}
375378
} finally {
379+
Locale.setDefault(savedLocale);
376380
SimplePolicy.allowAll.set(Boolean.FALSE);
377381
}
378382
LogStream.err.println(test.name() + ": PASSED");

test/jdk/java/util/logging/LocalizedLevelName.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2013, 2025, 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
@@ -52,6 +52,7 @@ public class LocalizedLevelName {
5252
public static void main(String args[]) throws Exception {
5353
Locale defaultLocale = Locale.getDefault();
5454
for (int i=0; i<namesMap.length; i += 4) {
55+
Locale.setDefault(Locale.US);
5556
final String key = (String) namesMap[i];
5657
final Locale locale = (Locale) namesMap[i+1];
5758
final String expectedTranslation = (String) namesMap[i+2];

test/jdk/java/util/logging/SimpleFormatterFormat.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2011, 2025, 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
@@ -30,6 +30,7 @@
3030
*/
3131

3232
import java.io.*;
33+
import java.util.Locale;
3334
import java.util.logging.*;
3435
import java.util.regex.*;
3536

@@ -38,6 +39,8 @@ public class SimpleFormatterFormat {
3839
private static final String origFormat = System.getProperty(key);
3940
private static final PrintStream err = System.err;
4041
public static void main(String[] args) throws Exception {
42+
Locale savedLocale = Locale.getDefault();
43+
Locale.setDefault(Locale.US);
4144
try {
4245
File dir = new File(System.getProperty("user.dir", "."));
4346
File log = new File(dir, "simpleformat.txt");
@@ -53,7 +56,8 @@ public static void main(String[] args) throws Exception {
5356
System.setProperty(key, origFormat);
5457
}
5558
System.setErr(err);
56-
}
59+
}
60+
Locale.setDefault(savedLocale);
5761
}
5862

5963
private static String[] loggers = new String[] {

test/jdk/sun/util/logging/SourceClassName.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2010, 2025, 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
@@ -33,17 +33,21 @@
3333
* @run main/othervm SourceClassName
3434
*/
3535

36+
import java.util.Locale;
3637
import java.util.logging.*;
3738
import java.io.*;
3839
import sun.util.logging.PlatformLogger;
3940

4041
public class SourceClassName {
4142
public static void main(String[] args) throws Exception {
43+
Locale savedLocale = Locale.getDefault();
44+
Locale.setDefault(Locale.US);
4245
File dir = new File(System.getProperty("user.dir", "."));
4346
File log = new File(dir, "testlog.txt");
4447
PrintStream logps = new PrintStream(log);
4548
writeLogRecords(logps);
4649
checkLogRecords(log);
50+
Locale.setDefault(savedLocale);
4751
}
4852

4953
private static void writeLogRecords(PrintStream logps) throws Exception {

0 commit comments

Comments
 (0)