|
1 | 1 | /* |
2 | | - * Copyright (c) 2007, 2023, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 2007, 2024, 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 4354216 8213127 |
| 26 | + * @bug 4354216 8213127 8334333 |
27 | 27 | * @summary Test for the cause support when throwing a |
28 | 28 | * MissingResourceBundle. (This test exists under |
29 | 29 | * ResourceBundle/Control because bad resource bundle data can be |
|
32 | 32 | * @build jdk.test.lib.JDKToolLauncher |
33 | 33 | * jdk.test.lib.Utils |
34 | 34 | * jdk.test.lib.process.ProcessTools |
| 35 | + * jdk.test.lib.Platform |
35 | 36 | * MissingResourceCauseTest |
36 | 37 | * NonResourceBundle |
37 | 38 | * PrivateConstructorRB |
|
50 | 51 | import jdk.test.lib.JDKToolLauncher; |
51 | 52 | import jdk.test.lib.Utils; |
52 | 53 | import jdk.test.lib.process.ProcessTools; |
| 54 | +import jdk.test.lib.Platform; |
| 55 | +import jtreg.SkippedException; |
53 | 56 |
|
54 | 57 | public class MissingResourceCauseTestRun { |
55 | 58 | public static void main(String[] args) throws Throwable { |
| 59 | + if (Platform.isRoot() && !Platform.isWindows()) { |
| 60 | + throw new SkippedException("Unable to create an unreadable properties file."); |
| 61 | + } |
56 | 62 | Path path = Paths.get("UnreadableRB.properties"); |
57 | 63 | Files.deleteIfExists(path); |
58 | 64 | try { |
@@ -98,7 +104,7 @@ private static void runCmd() throws Throwable { |
98 | 104 | } |
99 | 105 |
|
100 | 106 | private static void deleteFile(Path path) throws Throwable { |
101 | | - if(path.toFile().exists()) { |
| 107 | + if (path.toFile().exists()) { |
102 | 108 | ProcessTools.executeCommand("chmod", "666", path.toString()) |
103 | 109 | .outputTo(System.out) |
104 | 110 | .errorTo(System.out) |
|
0 commit comments