< prev index next >
src/java.base/share/classes/java/net/URL.java
Print this page
rev 14210 : 8154231: Simplify access to System properties from JDK code
Reviewed-by: rriggs
*** 40,49 ****
--- 40,50 ----
import java.util.NoSuchElementException;
import java.util.ServiceConfigurationError;
import java.util.ServiceLoader;
import sun.security.util.SecurityConstants;
+ import sun.security.action.GetPropertyAction;
/**
* Class {@code URL} represents a Uniform Resource
* Locator, a pointer to a "resource" on the World
* Wide Web. A resource can be something as simple as a file or a
*** 1208,1223 ****
return null;
}
}
private static URLStreamHandler lookupViaProperty(String protocol) {
! String packagePrefixList = java.security.AccessController.doPrivileged(
! new PrivilegedAction<>() {
! public String run() {
! return System.getProperty(protocolPathProp, null);
! }
! });
if (packagePrefixList == null) {
// not set
return null;
}
--- 1209,1220 ----
return null;
}
}
private static URLStreamHandler lookupViaProperty(String protocol) {
! String packagePrefixList =
! GetPropertyAction.getProperty(protocolPathProp);
if (packagePrefixList == null) {
// not set
return null;
}
< prev index next >