1414import org .slf4j .Logger ;
1515import org .slf4j .LoggerFactory ;
1616
17- import java .io .*;
18- import java .net .*;
17+ import java .io .InputStreamReader ;
18+ import java .io .BufferedReader ;
19+ import java .io .IOException ;
20+ import java .io .OutputStream ;
21+ import java .net .URI ;
22+ import java .net .HttpURLConnection ;
1923import java .nio .charset .StandardCharsets ;
2024import java .util .ArrayList ;
2125import java .util .List ;
@@ -38,7 +42,7 @@ public class SplitHttpClientKerberosImpl implements SplitHttpClient {
3842
3943 public static SplitHttpClientKerberosImpl create (RequestDecorator requestDecorator ,
4044 String apikey ,
41- SDKMetadata metadata ) throws URISyntaxException {
45+ SDKMetadata metadata ) {
4246 return new SplitHttpClientKerberosImpl (requestDecorator , apikey , metadata );
4347 }
4448
@@ -99,10 +103,11 @@ public SplitHttpResponse doGet(HttpURLConnection getHttpURLConnection, FetchOpti
99103 inputStreamReader = new InputStreamReader (getHttpURLConnection .getInputStream ());
100104 BufferedReader br = new BufferedReader (inputStreamReader );
101105 String strCurrentLine ;
102- String responseBody = new String ();
106+ StringBuilder bld = new StringBuilder ();
103107 while ((strCurrentLine = br .readLine ()) != null ) {
104- responseBody = responseBody + strCurrentLine ;
108+ bld . append ( strCurrentLine ) ;
105109 }
110+ String responseBody = bld .toString ();
106111 return new SplitHttpResponse (responseCode ,
107112 statusMessage ,
108113 responseBody ,
@@ -197,7 +202,7 @@ private void setAdditionalAndDecoratedHeaders(HttpURLConnection urlConnection, M
197202 }
198203
199204 private Header [] getResponseHeaders (HttpURLConnection urlConnection ) {
200- List <BasicHeader > responseHeaders = new ArrayList <BasicHeader >();
205+ List <BasicHeader > responseHeaders = new ArrayList <>();
201206 Map <String , List <String >> map = urlConnection .getHeaderFields ();
202207 for (Map .Entry <String , List <String >> entry : map .entrySet ()) {
203208 if (entry .getKey () != null ) {
@@ -209,6 +214,6 @@ private Header[] getResponseHeaders(HttpURLConnection urlConnection) {
209214 }
210215 @ Override
211216 public void close () throws IOException {
212-
217+ // Added for compatibility with HttpSplitClient, no action needed as URLConnection objects are closed.
213218 }
214219}
0 commit comments