@@ -103,7 +103,7 @@ public static final class Builder {
103103 Duration connectTimeout ;
104104 Duration requestTimeout ;
105105
106- List <String > locales = Collections . singletonList ("en" );
106+ List <String > locales = List . of ("en" );
107107 private ProxySelector proxy ;
108108 private HttpClient httpClient ;
109109
@@ -306,8 +306,8 @@ public void reportTransaction(TransactionReport transaction) throws IOException,
306306 if (transaction == null ) {
307307 throw new IllegalArgumentException ("transaction report must not be null" );
308308 }
309- URI uri = createUri (WebServiceClient .pathBase + "transactions/report" );
310- HttpRequest request = requestFor (transaction , uri );
309+ var uri = createUri (WebServiceClient .pathBase + "transactions/report" );
310+ var request = requestFor (transaction , uri );
311311
312312 HttpResponse <InputStream > response = null ;
313313 try {
@@ -328,8 +328,8 @@ private <T> T responseFor(String service, AbstractModel transaction, Class<T> cl
328328 if (transaction == null ) {
329329 throw new IllegalArgumentException ("transaction must not be null" );
330330 }
331- URI uri = createUri (WebServiceClient .pathBase + service );
332- HttpRequest request = requestFor (transaction , uri );
331+ var uri = createUri (WebServiceClient .pathBase + service );
332+ var request = requestFor (transaction , uri );
333333
334334 HttpResponse <InputStream > response = null ;
335335 try {
@@ -346,7 +346,7 @@ private <T> T responseFor(String service, AbstractModel transaction, Class<T> cl
346346
347347 private HttpRequest requestFor (AbstractModel transaction , URI uri )
348348 throws MinFraudException , IOException {
349- HttpRequest . Builder builder = HttpRequest .newBuilder ()
349+ var builder = HttpRequest .newBuilder ()
350350 .uri (uri )
351351 .header ("Accept" , "application/json" )
352352 .header ("Authorization" , authHeader )
@@ -365,7 +365,7 @@ private HttpRequest requestFor(AbstractModel transaction, URI uri)
365365
366366 private void maybeThrowException (HttpResponse <InputStream > response , URI uri )
367367 throws IOException , MinFraudException {
368- int status = response .statusCode ();
368+ var status = response .statusCode ();
369369 if (status >= 400 && status < 500 ) {
370370 this .handle4xxStatus (response , uri );
371371 } else if (status >= 500 && status < 600 ) {
@@ -383,7 +383,7 @@ private <T> T handleResponse(HttpResponse<InputStream> response, URI uri, Class<
383383 throws MinFraudException , IOException {
384384 maybeThrowException (response , uri );
385385
386- InjectableValues inject = new Std ().addValue (
386+ var inject = new Std ().addValue (
387387 "locales" , locales );
388388
389389 try (InputStream stream = response .body ()) {
@@ -398,7 +398,7 @@ private void handle4xxStatus(HttpResponse<InputStream> response, URI uri)
398398 throws IOException , InsufficientFundsException ,
399399 InvalidRequestException , AuthenticationException ,
400400 PermissionRequiredException {
401- int status = response .statusCode ();
401+ var status = response .statusCode ();
402402
403403 String body ;
404404 try (InputStream stream = response .body ()) {
@@ -425,8 +425,8 @@ private void handleErrorWithJsonBody(Map<String, String> content,
425425 throws HttpException , InsufficientFundsException ,
426426 InvalidRequestException , AuthenticationException ,
427427 PermissionRequiredException {
428- String error = content .get ("error" );
429- String code = content .get ("code" );
428+ var error = content .get ("error" );
429+ var code = content .get ("code" );
430430
431431 if (error == null || code == null ) {
432432 throw new HttpException (
0 commit comments