8156007: Refix: TestPolicy should extend the default security policy
Reviewed-by: mchung, joehw
Contributed-by: Frank Yuan <frank.yuan@oracle.com>
--- a/jaxp/test/javax/xml/jaxp/libs/jaxp/library/TestPolicy.java Thu May 05 19:10:31 2016 +0000
+++ b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/TestPolicy.java Thu May 05 20:01:18 2016 -0700
@@ -36,6 +36,7 @@
import java.util.PropertyPermission;
import java.util.StringJoiner;
+
/*
* Simple Policy class that supports the required Permissions to validate the
* JAXP concrete classes.
@@ -45,6 +46,8 @@
public class TestPolicy extends Policy {
protected final PermissionCollection permissions = new Permissions();
+ private static Policy defaultPolicy = Policy.getPolicy();
+
/**
* Constructor which sets the minimum permissions by default allowing testNG
* to work with a SecurityManager.
@@ -87,11 +90,8 @@
"read"));
permissions.add(new PropertyPermission("user.dir", "read"));
permissions.add(new PropertyPermission("test.src", "read"));
- permissions.add(new PropertyPermission("file.separator", "read"));
- permissions.add(new PropertyPermission("line.separator", "read"));
permissions.add(new PropertyPermission("fileStringBuffer", "read"));
permissions.add(new PropertyPermission("dataproviderthreadcount", "read"));
- permissions.add(new RuntimePermission("charsetProvider"));
}
/*
@@ -145,6 +145,9 @@
@Override
public boolean implies(ProtectionDomain domain, Permission perm) {
+ if (defaultPolicy.implies(domain, perm))
+ return true;
+
return permissions.implies(perm);
}
}