@@ -80,12 +80,11 @@ public class JdkHttpClient implements HttpClient {
8080 private final ExecutorService executorService ;
8181 private final Duration readTimeout ;
8282 private final Duration connectTimeout ;
83- private ClientConfig config ;
83+ private final ClientConfig config ;
8484
8585 JdkHttpClient (ClientConfig config ) {
8686 Objects .requireNonNull (config , "Client config must be set" );
8787
88- this .config = config ;
8988 this .messages = new JdkHttpMessages (config );
9089 this .readTimeout = config .readTimeout ();
9190 this .connectTimeout = config .connectionTimeout ();
@@ -110,7 +109,6 @@ public class JdkHttpClient implements HttpClient {
110109
111110 Credentials credentials = config .credentials ();
112111 String info = config .baseUri ().getUserInfo ();
113- URI baseUri = config .baseUri ();
114112
115113 if (info != null && !info .trim ().isEmpty ()) {
116114 String [] parts = info .split (":" , 2 );
@@ -128,17 +126,15 @@ protected PasswordAuthentication getPasswordAuthentication() {
128126
129127 // Remove credentials from URL
130128 try {
131- this .config =
132- ClientConfig .defaultConfig ()
133- .baseUri (
134- new URI (
135- config .baseUri ().getScheme (),
136- null ,
137- config .baseUri ().getHost (),
138- config .baseUri ().getPort (),
139- config .baseUri ().getPath (),
140- config .baseUri ().getQuery (),
141- config .baseUri ().getFragment ()));
129+ config = config .baseUri (
130+ new URI (
131+ config .baseUri ().getScheme (),
132+ null ,
133+ config .baseUri ().getHost (),
134+ config .baseUri ().getPort (),
135+ config .baseUri ().getPath (),
136+ config .baseUri ().getQuery (),
137+ config .baseUri ().getFragment ()));
142138 } catch (URISyntaxException e ) {
143139 LOG .log (Level .WARNING , "Could not strip credentials from URI" , e );
144140 }
@@ -174,6 +170,7 @@ protected PasswordAuthentication getPasswordAuthentication() {
174170 builder .version (Version .valueOf (version ));
175171 }
176172
173+ this .config = config ;
177174 this .client = builder .build ();
178175 }
179176
@@ -529,7 +526,7 @@ private HttpResponse execute0(HttpRequest req) throws UncheckedIOException {
529526
530527 // Package-private method for testing
531528 URI getBaseUri () {
532- return config .baseUri ();
529+ return this . config .baseUri ();
533530 }
534531
535532 @ Override
0 commit comments