mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8278263: Remove redundant synchronized from URLStreamHandler.openConnection methods
Reviewed-by: dfuchs
This commit is contained in:
parent
251351f494
commit
c6ed2046b4
3 changed files with 9 additions and 31 deletions
|
@ -95,7 +95,7 @@ public class Handler extends URLStreamHandler {
|
|||
// }
|
||||
*/
|
||||
|
||||
public synchronized URLConnection openConnection(URL u) {
|
||||
public URLConnection openConnection(URL u) {
|
||||
return new MailToURLConnection(u);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1994, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1994, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -25,13 +25,10 @@
|
|||
|
||||
package sun.net.www.protocol.file;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.URLConnection;
|
||||
import java.net.URL;
|
||||
import java.net.Proxy;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URLStreamHandler;
|
||||
import java.io.InputStream;
|
||||
import java.io.IOException;
|
||||
import sun.net.www.ParseUtil;
|
||||
import java.io.File;
|
||||
|
@ -42,14 +39,6 @@ import java.io.File;
|
|||
*/
|
||||
public class Handler extends URLStreamHandler {
|
||||
|
||||
private String getHost(URL url) {
|
||||
String host = url.getHost();
|
||||
if (host == null)
|
||||
host = "";
|
||||
return host;
|
||||
}
|
||||
|
||||
|
||||
protected void parseURL(URL u, String spec, int start, int limit) {
|
||||
/*
|
||||
* Ugly backwards compatibility. Flip any file separator
|
||||
|
@ -61,18 +50,18 @@ public class Handler extends URLStreamHandler {
|
|||
* rather than forcing this to be fixed in the caller of the URL
|
||||
* class where it belongs. Since backslash is an "unwise"
|
||||
* character that would normally be encoded if literally intended
|
||||
* as a non-seperator character the damage of veering away from the
|
||||
* as a non-separator character the damage of veering away from the
|
||||
* specification is presumably limited.
|
||||
*/
|
||||
super.parseURL(u, spec.replace(File.separatorChar, '/'), start, limit);
|
||||
}
|
||||
|
||||
public synchronized URLConnection openConnection(URL u)
|
||||
public URLConnection openConnection(URL u)
|
||||
throws IOException {
|
||||
return openConnection(u, null);
|
||||
}
|
||||
|
||||
public synchronized URLConnection openConnection(URL u, Proxy p)
|
||||
public URLConnection openConnection(URL u, Proxy p)
|
||||
throws IOException {
|
||||
String host = u.getHost();
|
||||
if (host == null || host.isEmpty() || host.equals("~") ||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -25,13 +25,10 @@
|
|||
|
||||
package sun.net.www.protocol.file;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.URLConnection;
|
||||
import java.net.URL;
|
||||
import java.net.Proxy;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URLStreamHandler;
|
||||
import java.io.InputStream;
|
||||
import java.io.IOException;
|
||||
import sun.net.www.ParseUtil;
|
||||
import java.io.File;
|
||||
|
@ -42,14 +39,6 @@ import java.io.File;
|
|||
*/
|
||||
public class Handler extends URLStreamHandler {
|
||||
|
||||
private String getHost(URL url) {
|
||||
String host = url.getHost();
|
||||
if (host == null)
|
||||
host = "";
|
||||
return host;
|
||||
}
|
||||
|
||||
|
||||
protected void parseURL(URL u, String spec, int start, int limit) {
|
||||
/*
|
||||
* Ugly backwards compatibility. Flip any file separator
|
||||
|
@ -61,18 +50,18 @@ public class Handler extends URLStreamHandler {
|
|||
* rather than forcing this to be fixed in the caller of the URL
|
||||
* class where it belongs. Since backslash is an "unwise"
|
||||
* character that would normally be encoded if literally intended
|
||||
* as a non-seperator character the damage of veering away from the
|
||||
* as a non-separator character the damage of veering away from the
|
||||
* specification is presumably limited.
|
||||
*/
|
||||
super.parseURL(u, spec.replace(File.separatorChar, '/'), start, limit);
|
||||
}
|
||||
|
||||
public synchronized URLConnection openConnection(URL url)
|
||||
public URLConnection openConnection(URL url)
|
||||
throws IOException {
|
||||
return openConnection(url, null);
|
||||
}
|
||||
|
||||
public synchronized URLConnection openConnection(URL url, Proxy p)
|
||||
public URLConnection openConnection(URL url, Proxy p)
|
||||
throws IOException {
|
||||
|
||||
String path;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue