Skip to content

Commit

Permalink
Race condition (#5359)
Browse files Browse the repository at this point in the history
  • Loading branch information
dtbaum authored Oct 17, 2023
1 parent 313cc36 commit d4a0612
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2023 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -283,7 +283,9 @@ public interface ConnectionFactory {
* @throws java.io.IOException in case the connection cannot be provided.
*/
default HttpURLConnection getConnection(URL url, Proxy proxy) throws IOException {
return (proxy == null) ? getConnection(url) : (HttpURLConnection) url.openConnection(proxy);
synchronized (this){
return (proxy == null) ? getConnection(url) : (HttpURLConnection) url.openConnection(proxy);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ protected void secureConnection(final JerseyClient client, final HttpURLConnecti
if (DEFAULT_SSL_SOCKET_FACTORY.get() == suc.getSSLSocketFactory()) {
// indicates that the custom socket factory was not set
suc.setSSLSocketFactory(sslSocketFactory.get());
}
}
}
}

Expand Down

0 comments on commit d4a0612

Please sign in to comment.