< prev index next >
src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java
Print this page
@@ -242,11 +242,11 @@
allowRestrictedHeaders = java.security.AccessController.doPrivileged(
new sun.security.action.GetBooleanAction(
"sun.net.http.allowRestrictedHeaders")).booleanValue();
if (!allowRestrictedHeaders) {
- restrictedHeaderSet = new HashSet<String>(restrictedHeaders.length);
+ restrictedHeaderSet = new HashSet<>(restrictedHeaders.length);
for (int i=0; i < restrictedHeaders.length; i++) {
restrictedHeaderSet.add(restrictedHeaders[i].toLowerCase());
}
} else {
restrictedHeaderSet = null;
@@ -411,11 +411,11 @@
final String prompt,
final String scheme,
final URL url,
final RequestorType authType) {
return java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction<PasswordAuthentication>() {
+ new java.security.PrivilegedAction<>() {
public PasswordAuthentication run() {
if (logger.isLoggable(PlatformLogger.Level.FINEST)) {
logger.finest("Requesting Authentication: host =" + host + " url = " + url);
}
PasswordAuthentication pass = Authenticator.requestPasswordAuthentication(
@@ -815,18 +815,18 @@
try {
cookieHandler = CookieHandler.getDefault();
} catch (SecurityException se) { /* swallow exception */ }
} else {
cookieHandler = java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction<CookieHandler>() {
+ new java.security.PrivilegedAction<>() {
public CookieHandler run() {
return CookieHandler.getDefault();
}
});
}
cacheHandler = java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction<ResponseCache>() {
+ new java.security.PrivilegedAction<>() {
public ResponseCache run() {
return ResponseCache.getDefault();
}
});
}
@@ -907,11 +907,11 @@
// Have to resolve addresses before comparing, otherwise
// names like tachyon and tachyon.eng would compare different
final boolean result[] = {false};
java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction<Void>() {
+ new java.security.PrivilegedAction<>() {
public Void run() {
try {
InetAddress a1 = InetAddress.getByName(h1);
InetAddress a2 = InetAddress.getByName(h2);
result[0] = a1.equals(a2);
@@ -952,11 +952,11 @@
String host = url.getHost();
final String hostarg = host;
try {
// lookup hostname and use IP address if available
host = AccessController.doPrivileged(
- new PrivilegedExceptionAction<String>() {
+ new PrivilegedExceptionAction<>() {
public String run() throws IOException {
InetAddress addr = InetAddress.getByName(hostarg);
return addr.getHostAddress();
}
}
@@ -982,11 +982,11 @@
}
SocketPermission p = URLtoSocketPermission(this.url);
if (p != null) {
try {
AccessController.doPrivileged(
- new PrivilegedExceptionAction<Void>() {
+ new PrivilegedExceptionAction<>() {
public Void run() throws IOException {
plainConnect0();
return null;
}
}, null, p
@@ -1084,11 +1084,11 @@
/**
* Do we have to use a proxy?
*/
ProxySelector sel =
java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction<ProxySelector>() {
+ new java.security.PrivilegedAction<>() {
public ProxySelector run() {
return ProxySelector.getDefault();
}
});
if (sel != null) {
@@ -1243,11 +1243,11 @@
SocketPermission p = URLtoSocketPermission(this.url);
if (p != null) {
try {
return AccessController.doPrivileged(
- new PrivilegedExceptionAction<OutputStream>() {
+ new PrivilegedExceptionAction<>() {
public OutputStream run() throws IOException {
return getOutputStream0();
}
}, null, p
);
@@ -1421,11 +1421,11 @@
SocketPermission p = URLtoSocketPermission(this.url);
if (p != null) {
try {
return AccessController.doPrivileged(
- new PrivilegedExceptionAction<InputStream>() {
+ new PrivilegedExceptionAction<>() {
public InputStream run() throws IOException {
return getInputStream0();
}
}, null, p
);
@@ -1875,11 +1875,11 @@
private IOException getChainedException(final IOException rememberedException) {
try {
final Object[] args = { rememberedException.getMessage() };
IOException chainedException =
java.security.AccessController.doPrivileged(
- new java.security.PrivilegedExceptionAction<IOException>() {
+ new java.security.PrivilegedExceptionAction<>() {
public IOException run() throws Exception {
return (IOException)
rememberedException.getClass()
.getConstructor(new Class<?>[] { String.class })
.newInstance(args);
@@ -2202,11 +2202,11 @@
case BASIC:
InetAddress addr = null;
try {
final String finalHost = host;
addr = java.security.AccessController.doPrivileged(
- new java.security.PrivilegedExceptionAction<InetAddress>() {
+ new java.security.PrivilegedExceptionAction<>() {
public InetAddress run()
throws java.net.UnknownHostException {
return InetAddress.getByName(finalHost);
}
});
@@ -2564,11 +2564,11 @@
SocketPermission p = URLtoSocketPermission(locUrl);
if (p != null) {
try {
return AccessController.doPrivileged(
- new PrivilegedExceptionAction<Boolean>() {
+ new PrivilegedExceptionAction<>() {
public Boolean run() throws IOException {
return followRedirect0(loc, stat, locUrl0);
}
}, null, p
);
< prev index next >