8334333: MissingResourceCauseTestRun.java fails if run by root
Reviewed-by: naoto, jlu
This commit is contained in:
parent
265a0f5547
commit
de8ee97718
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2007, 2023, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* @test
|
* @test
|
||||||
* @bug 4354216 8213127
|
* @bug 4354216 8213127 8334333
|
||||||
* @summary Test for the cause support when throwing a
|
* @summary Test for the cause support when throwing a
|
||||||
* MissingResourceBundle. (This test exists under
|
* MissingResourceBundle. (This test exists under
|
||||||
* ResourceBundle/Control because bad resource bundle data can be
|
* ResourceBundle/Control because bad resource bundle data can be
|
||||||
@ -32,6 +32,7 @@
|
|||||||
* @build jdk.test.lib.JDKToolLauncher
|
* @build jdk.test.lib.JDKToolLauncher
|
||||||
* jdk.test.lib.Utils
|
* jdk.test.lib.Utils
|
||||||
* jdk.test.lib.process.ProcessTools
|
* jdk.test.lib.process.ProcessTools
|
||||||
|
* jdk.test.lib.Platform
|
||||||
* MissingResourceCauseTest
|
* MissingResourceCauseTest
|
||||||
* NonResourceBundle
|
* NonResourceBundle
|
||||||
* PrivateConstructorRB
|
* PrivateConstructorRB
|
||||||
@ -50,9 +51,14 @@ import java.nio.file.Paths;
|
|||||||
import jdk.test.lib.JDKToolLauncher;
|
import jdk.test.lib.JDKToolLauncher;
|
||||||
import jdk.test.lib.Utils;
|
import jdk.test.lib.Utils;
|
||||||
import jdk.test.lib.process.ProcessTools;
|
import jdk.test.lib.process.ProcessTools;
|
||||||
|
import jdk.test.lib.Platform;
|
||||||
|
import jtreg.SkippedException;
|
||||||
|
|
||||||
public class MissingResourceCauseTestRun {
|
public class MissingResourceCauseTestRun {
|
||||||
public static void main(String[] args) throws Throwable {
|
public static void main(String[] args) throws Throwable {
|
||||||
|
if (Platform.isRoot() && !Platform.isWindows()) {
|
||||||
|
throw new SkippedException("Unable to create an unreadable properties file.");
|
||||||
|
}
|
||||||
Path path = Paths.get("UnreadableRB.properties");
|
Path path = Paths.get("UnreadableRB.properties");
|
||||||
Files.deleteIfExists(path);
|
Files.deleteIfExists(path);
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user