RFR: 8228434: jdk/net/Sockets/Test.java fails after JDK-8227642
Severin Gehwolf
sgehwolf at redhat.com
Fri Jul 19 15:07:36 UTC 2019
Hi Alan, Claes,
Shouldn't we consider the less risky alternative? I.e. the original webrev? More below.
On Fri, 2019-07-19 at 15:14 +0100, Alan Bateman wrote:
>
> On 19/07/2019 15:00, Severin Gehwolf wrote:
> > :
> > Sure. By adding a method also accepting a default value it would work
> > as well. If that's preferred, I can change it:
> >
> > diff --git a/test/lib/jdk/test/lib/Platform.java b/test/lib/jdk/test/lib/Platform.java
> > --- a/test/lib/jdk/test/lib/Platform.java
> > +++ b/test/lib/jdk/test/lib/Platform.java
> > @@ -37,8 +37,7 @@
> > // E.g.: "/usr/local/bin/docker". We define this constant here so
> > // that it can be used in VMProps as well which checks docker support
> > // via this command
> > - public static final String DOCKER_COMMAND =
> > - System.getProperty("jdk.test.docker.command", "docker");
> > + public static final String DOCKER_COMMAND = privilegedGetProperty("jdk.test.docker.command", "docker");
> > public static final String vmName = privilegedGetProperty("java.vm.name");
> > public static final String vmInfo = privilegedGetProperty("java.vm.info");
> > private static final String osVersion = privilegedGetProperty("os.version");
> > @@ -57,6 +56,11 @@
> > PrivilegedAction<String>) () -> System.getProperty(key));
> > }
> >
> > + private static String privilegedGetProperty(String key, String defVal) {
> > + return AccessController.doPrivileged((
> > + PrivilegedAction<String>) () -> System.getProperty(key, defVal));
> > + }
> > +
> > public static boolean isClient() {
> > return vmName.endsWith(" Client VM");
> > }
> >
> > Alan suggested the approach in webrev 01.
> >
> Using privilegedGetProperty is okay as long as the test classes are
> granted permission to read this property.
> You should be able to verify
> that quickly by running a few tests that come with their own policy files.
Since this is a case of a) test using Platform class from test library
*and* b) using a security manager c) check policy files whether
permissions have been granted. This isn't an easy task for me.
My cursory query brought up this test set:
test/jdk/com/oracle/security/ucrypto/TestAES.java
test/jdk/java/net/httpclient/AsFileDownloadTest.java
test/jdk/java/net/httpclient/RequestBodyTest.java
test/jdk/javax/swing/JFileChooser/8062561/bug8062561.java
test/jdk/jdk/net/Sockets/Test.java
bug8062561.java is windows only :(
Rather finding all tests which got broken, wouldn't the original
proposed webrev be less risky?
Do you have objections, to go with that, Claes?
http://cr.openjdk.java.net/~sgehwolf/webrevs/JDK-8228434/01/webrev/
Thanks,
Severin
More information about the core-libs-dev
mailing list