Skip to content

Commit ecf8478

Browse files
committed
Fix deprecated URL warning in codedx addon
1 parent b506bc1 commit ecf8478

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

addOns/codedx/src/main/java/org/zaproxy/zap/extension/codedx/CodeDxExtension.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import java.io.IOException;
2121
import java.net.MalformedURLException;
2222
import java.net.URL;
23+
import java.nio.file.Paths;
2324
import java.security.GeneralSecurityException;
2425

2526
import org.apache.http.client.config.RequestConfig;
@@ -115,7 +116,7 @@ public CloseableHttpClient getHttpClient(String url) throws IOException, General
115116
RequestConfig config = RequestConfig.custom().setConnectTimeout(getTimeout()).setSocketTimeout(getTimeout())
116117
.setConnectionRequestTimeout(getTimeout()).build();
117118
return HttpClientBuilder.create()
118-
.setSSLSocketFactory(SSLConnectionSocketFactoryFactory.getFactory(new URL(url).getHost(), this))
119+
.setSSLSocketFactory(SSLConnectionSocketFactoryFactory.getFactory(Paths.get(url).toUri().getHost(), this))
119120
.setDefaultRequestConfig(config).build();
120121
}
121122

@@ -129,7 +130,7 @@ public CloseableHttpClient getHttpClient(
129130
return HttpClientBuilder.create()
130131
.setSSLSocketFactory(
131132
SSLConnectionSocketFactoryFactory.getFactory(
132-
new URL(url).getHost(), this, fingerprint, acceptPermanently
133+
Paths.get(url).toUri().getHost(), this, fingerprint, acceptPermanently
133134
)
134135
).setDefaultRequestConfig(config).build();
135136
}

0 commit comments

Comments
 (0)