6262import java .util .Arrays ;
6363import java .util .ArrayList ;
6464import java .util .Date ;
65- import java .util .Locale ;
6665import java .util .stream .Collectors ;
6766import java .util .stream .Stream ;
6867import java .time .OffsetDateTime ;
@@ -975,7 +974,6 @@ public File prepareDownloadFile(Response response) throws IOException {
975974 * @param authNames The authentications to apply
976975 * @param returnType The return type into which to deserialize the response
977976 * @param isBodyNullable True if the body is nullable
978- * @param errorTypes Mapping of error codes to types into which to deserialize the response
979977 * @return The response body in type of string
980978 * @throws ApiException API exception
981979 */
@@ -992,9 +990,7 @@ public <T> ApiResponse<T> invokeAPI(
992990 String contentType ,
993991 String [] authNames ,
994992 GenericType <T > returnType ,
995- boolean isBodyNullable ,
996- Map <String , GenericType > errorTypes
997- )
993+ boolean isBodyNullable )
998994 throws ApiException {
999995
1000996 String targetURL ;
@@ -1005,7 +1001,7 @@ public <T> ApiResponse<T> invokeAPI(
10051001 if (index < 0 || index >= serverConfigurations .size ()) {
10061002 throw new ArrayIndexOutOfBoundsException (
10071003 String .format (
1008- Locale .ROOT ,
1004+ java . util . Locale .ROOT ,
10091005 "Invalid index %d when selecting the host settings. Must be less than %d" ,
10101006 index , serverConfigurations .size ()));
10111007 }
@@ -1092,16 +1088,14 @@ public <T> ApiResponse<T> invokeAPI(
10921088 String respBody = null ;
10931089 if (response .hasEntity ()) {
10941090 try {
1095- // call bufferEntity, so that a subsequent call to `readEntity` in `deserialize` doesn't fail
1096- response .bufferEntity ();
10971091 respBody = String .valueOf (response .readEntity (String .class ));
10981092 message = respBody ;
10991093 } catch (RuntimeException e ) {
11001094 // e.printStackTrace();
11011095 }
11021096 }
11031097 throw new ApiException (
1104- response .getStatus (), message , buildResponseHeaders (response ), respBody , deserializeErrorEntity ( errorTypes , response ) );
1098+ response .getStatus (), message , buildResponseHeaders (response ), respBody );
11051099 }
11061100 } finally {
11071101 try {
@@ -1112,30 +1106,6 @@ public <T> ApiResponse<T> invokeAPI(
11121106 }
11131107 }
11141108 }
1115-
1116- /**
1117- * Deserialize the response body into an error entity based on HTTP status code.
1118- * Looks up the error type from the errorTypes map using the response status code,
1119- * or falls back to the "default" error type if no match is found.
1120- *
1121- * @param errorTypes Map of status code strings to GenericType for deserialization
1122- * @param response The HTTP response
1123- * @return The deserialized error entity, or null if not found or deserialization fails
1124- */
1125- private Object deserializeErrorEntity (Map <String , GenericType > errorTypes , Response response ) {
1126- if (errorTypes == null ) {
1127- return null ;
1128- }
1129- GenericType errorType = errorTypes .get (String .valueOf (response .getStatus ()));
1130- if (errorType == null ) {
1131- errorType = errorTypes .get ("0" ); // "0" is the "default" response
1132- }
1133- try {
1134- return deserialize (response , errorType );
1135- } catch (Exception e ) {
1136- return null ;
1137- }
1138- }
11391109
11401110 protected Response sendRequest (String method , Invocation .Builder invocationBuilder , Entity <?> entity ) {
11411111 Response response ;
@@ -1162,7 +1132,7 @@ protected Response sendRequest(String method, Invocation.Builder invocationBuild
11621132 */
11631133 @ Deprecated
11641134 public <T > ApiResponse <T > invokeAPI (String path , String method , List <Pair > queryParams , Object body , Map <String , String > headerParams , Map <String , String > cookieParams , Map <String , Object > formParams , String accept , String contentType , String [] authNames , GenericType <T > returnType , boolean isBodyNullable ) throws ApiException {
1165- return invokeAPI (null , path , method , queryParams , body , headerParams , cookieParams , formParams , accept , contentType , authNames , returnType , isBodyNullable , null /*TODO SME manage*/ );
1135+ return invokeAPI (null , path , method , queryParams , body , headerParams , cookieParams , formParams , accept , contentType , authNames , returnType , isBodyNullable );
11661136 }
11671137
11681138 /**
0 commit comments