@@ -122,11 +122,8 @@ public class ApiClient
122122 public static ApiClient fromHttpClient ( @ Nonnull final CloseableHttpClient httpClient )
123123 {
124124 if ( !httpClient .getClass ().getName ().startsWith ("com.sap.cloud.sdk.cloudplatform.connectivity" ) ) {
125- log
126- .debug (
127- "Creating ApiClient from HttpClient of type {}. The default base-path is \" {}\" ." ,
128- httpClient .getClass ().getName (),
129- DEFAULT_BASE_PATH );
125+ val msg = "Creating ApiClient from HttpClient of type {}. The default base-path is \" {}\" ." ;
126+ log .debug (msg , httpClient .getClass ().getName (), DEFAULT_BASE_PATH );
130127 }
131128 return fromHttpClient (httpClient , DEFAULT_BASE_PATH );
132129 }
@@ -517,8 +514,7 @@ public <T> T invokeAPI(
517514 headerParams ,
518515 formParams ,
519516 accept ,
520- contentType ,
521- objectMapper );
517+ contentType );
522518
523519 return invokeAPI (builder , returnType );
524520 }
@@ -555,7 +551,7 @@ protected <T> T invokeAPI(
555551 }
556552
557553 @ Nonnull
558- private static ClassicRequestBuilder buildClassicRequest (
554+ private ClassicRequestBuilder buildClassicRequest (
559555 @ Nonnull final String basePath ,
560556 @ Nonnull final String path ,
561557 @ Nonnull final String method ,
@@ -566,8 +562,7 @@ private static ClassicRequestBuilder buildClassicRequest(
566562 @ Nonnull final Map <String , String > headerParams ,
567563 @ Nonnull final Map <String , Object > formParams ,
568564 @ Nullable final String accept ,
569- @ Nonnull final String contentType ,
570- @ Nonnull final ObjectMapper objectMapper )
565+ @ Nonnull final String contentType )
571566 {
572567 if ( body != null && !formParams .isEmpty () ) {
573568 throw new OpenApiRequestException ("Cannot have body and form params" );
@@ -588,7 +583,7 @@ private static ClassicRequestBuilder buildClassicRequest(
588583 if ( body != null || !formParams .isEmpty () ) {
589584 if ( isBodyAllowed (Method .valueOf (method )) ) {
590585 // Add entity if we have content and a valid method
591- builder .setEntity (serialize (body , formParams , contentTypeObj , headerParams , objectMapper ));
586+ builder .setEntity (serialize (body , formParams , contentTypeObj , headerParams ));
592587 } else {
593588 throw new OpenApiRequestException ("method " + method + " does not support a request body" );
594589 }
@@ -599,35 +594,17 @@ private static ClassicRequestBuilder buildClassicRequest(
599594 return builder ;
600595 }
601596
602- /**
603- * Serialize the given Java object into string according the given Content-Type (only JSON is supported for now).
604- *
605- * @param body
606- * Object
607- * @param contentType
608- * Content type
609- * @param formParams
610- * Form parameters
611- * @param headerParams
612- * Header parameters, used to check content encoding for JSON serialization
613- * @param objectMapper
614- * Object mapper for JSON serialization
615- * @return Object
616- * @throws OpenApiRequestException
617- * API exception
618- */
619597 @ Nonnull
620- private static HttpEntity serialize (
598+ private HttpEntity serialize (
621599 @ Nullable final Object body ,
622600 @ Nonnull final Map <String , Object > formParams ,
623601 @ Nonnull final ContentType contentType ,
624- @ Nonnull final Map <String , String > headerParams ,
625- @ Nonnull final ObjectMapper objectMapper )
602+ @ Nonnull final Map <String , String > headerParams )
626603 throws OpenApiRequestException
627604 {
628605 final String mimeType = contentType .getMimeType ();
629606 if ( isJsonMime (mimeType ) ) {
630- return serializeJson (body , contentType , headerParams , objectMapper );
607+ return serializeJson (body , contentType , headerParams );
631608 } else if ( mimeType .equals (ContentType .MULTIPART_FORM_DATA .getMimeType ()) ) {
632609 return serializeMultipart (formParams , contentType );
633610 } else if ( mimeType .equals (ContentType .APPLICATION_FORM_URLENCODED .getMimeType ()) ) {
@@ -641,11 +618,10 @@ private static HttpEntity serialize(
641618 }
642619
643620 @ Nonnull
644- private static HttpEntity serializeJson (
621+ private HttpEntity serializeJson (
645622 @ Nullable final Object body ,
646623 @ Nonnull final ContentType contentType ,
647- @ Nonnull final Map <String , String > headerParams ,
648- @ Nonnull final ObjectMapper objectMapper )
624+ @ Nonnull final Map <String , String > headerParams )
649625 throws OpenApiRequestException
650626 {
651627 if ( "gzip" .equalsIgnoreCase (headerParams .get (CONTENT_ENCODING ))
@@ -673,7 +649,7 @@ private static HttpEntity serializeJson(
673649 }
674650
675651 @ Nonnull
676- private static
652+ private
677653 HttpEntity
678654 serializeMultipart ( @ Nonnull final Map <String , Object > formParams , @ Nonnull final ContentType contentType )
679655 {
@@ -691,7 +667,7 @@ private static HttpEntity serializeJson(
691667 return builder .build ();
692668 }
693669
694- private static void addMultipartTextField (
670+ private void addMultipartTextField (
695671 @ Nonnull final MultipartEntityBuilder builder ,
696672 @ Nonnull final Entry <String , Object > entry ,
697673 @ Nonnull final ContentType contentType )
@@ -706,7 +682,7 @@ private static void addMultipartTextField(
706682 }
707683
708684 @ Nonnull
709- private static
685+ private
710686 HttpEntity
711687 serializeFormUrlEncoded ( @ Nonnull final Map <String , Object > formParams , @ Nonnull final ContentType contentType )
712688 {
0 commit comments