Skip to content

Commit 0b6d69c

Browse files
oschwaldclaude
andcommitted
Remove deprecated WebServiceClient methods
* Remove deprecated Builder methods: connectTimeout(int), readTimeout(int), and proxy(Proxy) * Remove deprecated close() method and Closeable interface implementation * Use Duration-based and ProxySelector-based methods instead 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent c2971a4 commit 0b6d69c

File tree

2 files changed

+7
-45
lines changed

2 files changed

+7
-45
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ CHANGELOG
66

77
* The deprecation notices for IP Risk database support have been removed.
88
IP Risk database support will continue to be maintained.
9+
* **BREAKING:** The deprecated `WebServiceClient.Builder` methods
10+
`connectTimeout(int)`, `readTimeout(int)`, and `proxy(Proxy)` have been
11+
removed. Use `connectTimeout(Duration)`, `requestTimeout(Duration)`, and
12+
`proxy(ProxySelector)` respectively.
13+
* **BREAKING:** The deprecated `WebServiceClient.close()` method has been
14+
removed along with the `Closeable` interface implementation.
915

1016
4.4.0
1117
------------------

src/main/java/com/maxmind/geoip2/WebServiceClient.java

Lines changed: 1 addition & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@
1616
import com.maxmind.geoip2.model.CityResponse;
1717
import com.maxmind.geoip2.model.CountryResponse;
1818
import com.maxmind.geoip2.model.InsightsResponse;
19-
import java.io.Closeable;
2019
import java.io.IOException;
2120
import java.io.InputStream;
2221
import java.net.InetAddress;
2322
import java.net.InetSocketAddress;
24-
import java.net.Proxy;
2523
import java.net.ProxySelector;
2624
import java.net.URI;
2725
import java.net.URISyntaxException;
@@ -107,7 +105,7 @@
107105
* throws a {@link GeoIp2Exception}.
108106
* </p>
109107
*/
110-
public class WebServiceClient implements WebServiceProvider, Closeable {
108+
public class WebServiceClient implements WebServiceProvider {
111109
private final String host;
112110
private final List<String> locales;
113111
private final String authHeader;
@@ -192,17 +190,6 @@ public Builder(int accountId, String licenseKey) {
192190
this.licenseKey = licenseKey;
193191
}
194192

195-
/**
196-
* @param val Timeout in milliseconds to establish a connection to the
197-
* web service. The default is 3000 (3 seconds).
198-
* @return Builder object
199-
* @deprecated Use connectTimeout(Duration) instead
200-
*/
201-
@Deprecated
202-
public Builder connectTimeout(int val) {
203-
this.connectTimeout = Duration.ofMillis(val);
204-
return this;
205-
}
206193

207194
/**
208195
* @param val Timeout duration to establish a connection to the
@@ -258,18 +245,6 @@ public Builder locales(List<String> val) {
258245
return this;
259246
}
260247

261-
/**
262-
* @param val readTimeout in milliseconds to read data from an
263-
* established connection to the web service. The default is
264-
* 20000 (20 seconds).
265-
* @return Builder object
266-
* @deprecated Use requestTimeout(Duration) instead
267-
*/
268-
@Deprecated
269-
public Builder readTimeout(int val) {
270-
this.requestTimeout = Duration.ofMillis(val);
271-
return this;
272-
}
273248

274249
/**
275250
* @param val Request timeout duration. The default is 20 seconds.
@@ -280,18 +255,6 @@ public Builder requestTimeout(Duration val) {
280255
return this;
281256
}
282257

283-
/**
284-
* @param val the proxy to use when making this request.
285-
* @return Builder object
286-
* @deprecated Use proxy(ProxySelector)
287-
*/
288-
@Deprecated
289-
public Builder proxy(Proxy val) {
290-
if (val != null && val != Proxy.NO_PROXY) {
291-
this.proxy = ProxySelector.of((InetSocketAddress) val.address());
292-
}
293-
return this;
294-
}
295258

296259
/**
297260
* @param val the proxy to use when making this request.
@@ -538,13 +501,6 @@ private void exhaustBody(HttpResponse<InputStream> response) throws HttpExceptio
538501
}
539502
}
540503

541-
/**
542-
* @deprecated Closing is no longer necessary with java.net.http.HttpClient.
543-
*/
544-
@Deprecated
545-
@Override
546-
public void close() throws IOException {
547-
}
548504

549505
@Override
550506
public String toString() {

0 commit comments

Comments
 (0)