This is an automated email from the ASF dual-hosted git repository. tilman pushed a commit to branch branch_2x in repository https://gitbox.apache.org/repos/asf/tika.git
commit 76b536062c52bfaa0749699249fc7f1d6c1d0279 Author: Tilman Hausherr <[email protected]> AuthorDate: Fri Apr 5 14:34:25 2024 +0200 TIKA-4236: remove guava dependency, as suggested by Manfred Baedke; replace deprecated --- .../tika/parser/geo/topic/gazetteer/GeoGazetteerClient.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tika-parsers/tika-parsers-ml/tika-parser-nlp-module/src/main/java/org/apache/tika/parser/geo/topic/gazetteer/GeoGazetteerClient.java b/tika-parsers/tika-parsers-ml/tika-parser-nlp-module/src/main/java/org/apache/tika/parser/geo/topic/gazetteer/GeoGazetteerClient.java index 6047206c5..9017fcad1 100644 --- a/tika-parsers/tika-parsers-ml/tika-parser-nlp-module/src/main/java/org/apache/tika/parser/geo/topic/gazetteer/GeoGazetteerClient.java +++ b/tika-parsers/tika-parsers-ml/tika-parser-nlp-module/src/main/java/org/apache/tika/parser/geo/topic/gazetteer/GeoGazetteerClient.java @@ -18,18 +18,18 @@ package org.apache.tika.parser.geo.topic.gazetteer; import java.lang.reflect.Type; +import java.nio.charset.StandardCharsets; import java.util.List; import java.util.Map; -import com.google.common.reflect.TypeToken; import com.google.gson.Gson; -import org.apache.commons.io.Charsets; +import com.google.gson.reflect.TypeToken; import org.apache.commons.io.IOUtils; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.utils.URIBuilder; -import org.apache.http.impl.client.DefaultHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -65,7 +65,7 @@ public class GeoGazetteerClient { * @return Map of input location strings to gazetteer locations */ public Map<String, List<Location>> getLocations(List<String> locations) { - HttpClient httpClient = new DefaultHttpClient(); + HttpClient httpClient = HttpClientBuilder.create().build(); try { URIBuilder uri = new URIBuilder(url + SEARCH_API); @@ -75,7 +75,7 @@ public class GeoGazetteerClient { HttpGet httpGet = new HttpGet(uri.build()); HttpResponse resp = httpClient.execute(httpGet); - String respJson = IOUtils.toString(resp.getEntity().getContent(), Charsets.UTF_8); + String respJson = IOUtils.toString(resp.getEntity().getContent(), StandardCharsets.UTF_8); @SuppressWarnings("serial") Type typeDef = new TypeToken<Map<String, List<Location>>>() { @@ -96,7 +96,7 @@ public class GeoGazetteerClient { * @return true if API is available else returns false */ public boolean checkAvail() { - HttpClient httpClient = new DefaultHttpClient(); + HttpClient httpClient = HttpClientBuilder.create().build(); try { HttpGet httpGet = new HttpGet(url + PING);
