Skip to content

Commit baf425a

Browse files
committed
fixes: #20 properly compare response type
1 parent fc4b6b8 commit baf425a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/main/java/feign/error/ExceptionGenerator.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ class ExceptionGenerator {
4646
private final Integer bodyIndex;
4747
private final Integer headerMapIndex;
4848
private final Integer numOfParams;
49-
private final Class bodyType;
49+
private final Class<?> bodyType;
5050
private final Class<? extends Exception> exceptionType;
5151
private final Decoder bodyDecoder;
5252

53-
ExceptionGenerator(Integer bodyIndex, Integer headerMapIndex, Integer numOfParams, Class bodyType,
53+
ExceptionGenerator(Integer bodyIndex, Integer headerMapIndex, Integer numOfParams, Class<?> bodyType,
5454
Class<? extends Exception> exceptionType, Decoder bodyDecoder) {
5555
this.bodyIndex = bodyIndex;
5656
this.headerMapIndex = headerMapIndex;
@@ -84,7 +84,7 @@ Class<? extends Exception> getExceptionType() {
8484
}
8585

8686
private Object resolveBody(Response response) {
87-
if (bodyType.getClass().equals(Response.class)) {
87+
if (bodyType.isInstance(response)) {
8888
return response;
8989
}
9090
try {
@@ -120,7 +120,7 @@ public ExceptionGenerator build() {
120120
Integer bodyIndex = -1;
121121
Integer headerMapIndex = -1;
122122
Integer numOfParams = parameterTypes.length;
123-
Class bodyType = null;
123+
Class<?> bodyType = null;
124124

125125
for (int i = 0; i < parameterTypes.length; i++) {
126126
Annotation[] paramAnnotations = parametersAnnotations[i];

0 commit comments

Comments
 (0)