8278263: Remove redundant synchronized from URLStreamHandler.openConnection methods

Reviewed-by: dfuchs
This commit is contained in:
Andrey Turbanov 2022-01-31 12:11:03 +00:00
parent 251351f494
commit c6ed2046b4
3 changed files with 9 additions and 31 deletions

View file

@ -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("~") ||