Skip to content

Commit 149246d

Browse files
authored
fix(java): resolve feign ambiguity in ApiErrorDecoder fix(#17842) (#17843)
1 parent 8ca914d commit 149246d

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

modules/openapi-generator/src/main/resources/Java/libraries/feign/auth/ApiErrorDecoder.mustache

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package {{invokerPackage}}.auth;
22

3+
import java.util.Date;
4+
35
import feign.Response;
46
import feign.RetryableException;
57
import feign.codec.ErrorDecoder;
@@ -18,7 +20,7 @@ public class ApiErrorDecoder implements ErrorDecoder {
1820
Exception httpException = defaultErrorDecoder.decode(methodKey, response);
1921
if (response.status() == 401 || response.status() == 403) {
2022
return new RetryableException(response.status(), "Received status " + response.status() + " trying to renew access token",
21-
response.request().httpMethod(), httpException, null, response.request());
23+
response.request().httpMethod(), httpException, (Date) null, response.request());
2224
}
2325
return httpException;
2426
}

samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/auth/ApiErrorDecoder.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package org.openapitools.client.auth;
22

3+
import java.util.Date;
4+
35
import feign.Response;
46
import feign.RetryableException;
57
import feign.codec.ErrorDecoder;
@@ -18,7 +20,7 @@ public Exception decode(String methodKey, Response response) {
1820
Exception httpException = defaultErrorDecoder.decode(methodKey, response);
1921
if (response.status() == 401 || response.status() == 403) {
2022
return new RetryableException(response.status(), "Received status " + response.status() + " trying to renew access token",
21-
response.request().httpMethod(), httpException, null, response.request());
23+
response.request().httpMethod(), httpException, (Date) null, response.request());
2224
}
2325
return httpException;
2426
}

samples/client/petstore/java/feign/src/main/java/org/openapitools/client/auth/ApiErrorDecoder.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package org.openapitools.client.auth;
22

3+
import java.util.Date;
4+
35
import feign.Response;
46
import feign.RetryableException;
57
import feign.codec.ErrorDecoder;
@@ -18,7 +20,7 @@ public Exception decode(String methodKey, Response response) {
1820
Exception httpException = defaultErrorDecoder.decode(methodKey, response);
1921
if (response.status() == 401 || response.status() == 403) {
2022
return new RetryableException(response.status(), "Received status " + response.status() + " trying to renew access token",
21-
response.request().httpMethod(), httpException, null, response.request());
23+
response.request().httpMethod(), httpException, (Date) null, response.request());
2224
}
2325
return httpException;
2426
}

0 commit comments

Comments
 (0)