|
1 | 1 | /*
|
2 |
| - * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
4 | 4 | *
|
5 | 5 | * This code is free software; you can redistribute it and/or modify it
|
|
23 | 23 |
|
24 | 24 | /*
|
25 | 25 | * @test
|
26 |
| - * @bug 8295232 |
27 |
| - * @summary Ensures java.locale.useOldISOCodes is statically initialized |
| 26 | + * @bug 8295232 8353118 |
| 27 | + * @summary Tests for the "java.locale.useOldISOCodes" system property |
28 | 28 | * @library /test/lib
|
29 | 29 | * @run junit UseOldISOCodesTest
|
30 | 30 | */
|
|
38 | 38 |
|
39 | 39 | public class UseOldISOCodesTest {
|
40 | 40 |
|
41 |
| - // Ensure java.locale.useOldISOCodes is only interpreted at runtime startup |
42 | 41 | @Test
|
43 |
| - public void staticInitializationTest() throws Exception { |
44 |
| - ProcessTools.executeTestJava("-Djava.locale.useOldISOCodes=true", "UseOldISOCodesTest$Runner") |
| 42 | + public void testUseOldISOCodes() throws Exception { |
| 43 | + var oa = ProcessTools.executeTestJava("-Djava.locale.useOldISOCodes=true", "UseOldISOCodesTest$Runner") |
45 | 44 | .outputTo(System.out)
|
46 |
| - .errorTo(System.err) |
47 |
| - .shouldHaveExitValue(0); |
| 45 | + .errorTo(System.err); |
| 46 | + oa.shouldHaveExitValue(0); |
| 47 | + oa.stderrShouldMatch("WARNING: The use of the system property \"java.locale.useOldISOCodes\" is deprecated. It will be removed in a future release of the JDK."); |
48 | 48 | }
|
49 | 49 |
|
50 | 50 | static class Runner {
|
51 | 51 | private static final String obsoleteCode = "iw";
|
52 | 52 | private static final String newCode = "he";
|
53 | 53 |
|
54 | 54 | public static void main(String[] args) {
|
| 55 | + // Ensure java.locale.useOldISOCodes is only interpreted at runtime startup |
55 | 56 | // Should have no effect
|
56 | 57 | System.setProperty("java.locale.useOldISOCodes", "false");
|
57 | 58 | Locale locale = Locale.of(newCode);
|
|
0 commit comments