forked from loafle/openapi-generator-original
Re-interrupt the thread in the generated code (#4382)
* Re-interrupt the thread in the generated code, otherwise the client has to check for the type of the cause of the thrown exception. * update samples
This commit is contained in:
committed by
William Cheng
parent
34c715e4ce
commit
440e3f301d
@@ -148,7 +148,10 @@ public class {{classname}} {
|
||||
{{#returnType}}
|
||||
return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<{{{returnType}}}>() {});
|
||||
{{/returnType}}
|
||||
} catch (IOException | InterruptedException e) {
|
||||
} catch (IOException e) {
|
||||
throw new ApiException(e);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new ApiException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +98,10 @@ public class AnotherFakeApi {
|
||||
}
|
||||
|
||||
return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<Client>() {});
|
||||
} catch (IOException | InterruptedException e) {
|
||||
} catch (IOException e) {
|
||||
throw new ApiException(e);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new ApiException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +104,10 @@ public class FakeApi {
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
}
|
||||
|
||||
} catch (IOException | InterruptedException e) {
|
||||
} catch (IOException e) {
|
||||
throw new ApiException(e);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new ApiException(e);
|
||||
}
|
||||
}
|
||||
@@ -147,7 +150,10 @@ public class FakeApi {
|
||||
}
|
||||
|
||||
return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<Boolean>() {});
|
||||
} catch (IOException | InterruptedException e) {
|
||||
} catch (IOException e) {
|
||||
throw new ApiException(e);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new ApiException(e);
|
||||
}
|
||||
}
|
||||
@@ -190,7 +196,10 @@ public class FakeApi {
|
||||
}
|
||||
|
||||
return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<OuterComposite>() {});
|
||||
} catch (IOException | InterruptedException e) {
|
||||
} catch (IOException e) {
|
||||
throw new ApiException(e);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new ApiException(e);
|
||||
}
|
||||
}
|
||||
@@ -233,7 +242,10 @@ public class FakeApi {
|
||||
}
|
||||
|
||||
return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<BigDecimal>() {});
|
||||
} catch (IOException | InterruptedException e) {
|
||||
} catch (IOException e) {
|
||||
throw new ApiException(e);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new ApiException(e);
|
||||
}
|
||||
}
|
||||
@@ -276,7 +288,10 @@ public class FakeApi {
|
||||
}
|
||||
|
||||
return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<String>() {});
|
||||
} catch (IOException | InterruptedException e) {
|
||||
} catch (IOException e) {
|
||||
throw new ApiException(e);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new ApiException(e);
|
||||
}
|
||||
}
|
||||
@@ -321,7 +336,10 @@ public class FakeApi {
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
}
|
||||
|
||||
} catch (IOException | InterruptedException e) {
|
||||
} catch (IOException e) {
|
||||
throw new ApiException(e);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new ApiException(e);
|
||||
}
|
||||
}
|
||||
@@ -380,7 +398,10 @@ public class FakeApi {
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
}
|
||||
|
||||
} catch (IOException | InterruptedException e) {
|
||||
} catch (IOException e) {
|
||||
throw new ApiException(e);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new ApiException(e);
|
||||
}
|
||||
}
|
||||
@@ -427,7 +448,10 @@ public class FakeApi {
|
||||
}
|
||||
|
||||
return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<Client>() {});
|
||||
} catch (IOException | InterruptedException e) {
|
||||
} catch (IOException e) {
|
||||
throw new ApiException(e);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new ApiException(e);
|
||||
}
|
||||
}
|
||||
@@ -495,7 +519,10 @@ public class FakeApi {
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
}
|
||||
|
||||
} catch (IOException | InterruptedException e) {
|
||||
} catch (IOException e) {
|
||||
throw new ApiException(e);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new ApiException(e);
|
||||
}
|
||||
}
|
||||
@@ -559,7 +586,10 @@ public class FakeApi {
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
}
|
||||
|
||||
} catch (IOException | InterruptedException e) {
|
||||
} catch (IOException e) {
|
||||
throw new ApiException(e);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new ApiException(e);
|
||||
}
|
||||
}
|
||||
@@ -633,7 +663,10 @@ public class FakeApi {
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
}
|
||||
|
||||
} catch (IOException | InterruptedException e) {
|
||||
} catch (IOException e) {
|
||||
throw new ApiException(e);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new ApiException(e);
|
||||
}
|
||||
}
|
||||
@@ -678,7 +711,10 @@ public class FakeApi {
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
}
|
||||
|
||||
} catch (IOException | InterruptedException e) {
|
||||
} catch (IOException e) {
|
||||
throw new ApiException(e);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new ApiException(e);
|
||||
}
|
||||
}
|
||||
@@ -726,7 +762,10 @@ public class FakeApi {
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
}
|
||||
|
||||
} catch (IOException | InterruptedException e) {
|
||||
} catch (IOException e) {
|
||||
throw new ApiException(e);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new ApiException(e);
|
||||
}
|
||||
}
|
||||
@@ -802,7 +841,10 @@ public class FakeApi {
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
}
|
||||
|
||||
} catch (IOException | InterruptedException e) {
|
||||
} catch (IOException e) {
|
||||
throw new ApiException(e);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new ApiException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +98,10 @@ public class FakeClassnameTags123Api {
|
||||
}
|
||||
|
||||
return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<Client>() {});
|
||||
} catch (IOException | InterruptedException e) {
|
||||
} catch (IOException e) {
|
||||
throw new ApiException(e);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new ApiException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +98,10 @@ public class PetApi {
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
}
|
||||
|
||||
} catch (IOException | InterruptedException e) {
|
||||
} catch (IOException e) {
|
||||
throw new ApiException(e);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new ApiException(e);
|
||||
}
|
||||
}
|
||||
@@ -146,7 +149,10 @@ public class PetApi {
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
}
|
||||
|
||||
} catch (IOException | InterruptedException e) {
|
||||
} catch (IOException e) {
|
||||
throw new ApiException(e);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new ApiException(e);
|
||||
}
|
||||
}
|
||||
@@ -200,7 +206,10 @@ public class PetApi {
|
||||
}
|
||||
|
||||
return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<List<Pet>>() {});
|
||||
} catch (IOException | InterruptedException e) {
|
||||
} catch (IOException e) {
|
||||
throw new ApiException(e);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new ApiException(e);
|
||||
}
|
||||
}
|
||||
@@ -256,7 +265,10 @@ public class PetApi {
|
||||
}
|
||||
|
||||
return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<List<Pet>>() {});
|
||||
} catch (IOException | InterruptedException e) {
|
||||
} catch (IOException e) {
|
||||
throw new ApiException(e);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new ApiException(e);
|
||||
}
|
||||
}
|
||||
@@ -302,7 +314,10 @@ public class PetApi {
|
||||
}
|
||||
|
||||
return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<Pet>() {});
|
||||
} catch (IOException | InterruptedException e) {
|
||||
} catch (IOException e) {
|
||||
throw new ApiException(e);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new ApiException(e);
|
||||
}
|
||||
}
|
||||
@@ -347,7 +362,10 @@ public class PetApi {
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
}
|
||||
|
||||
} catch (IOException | InterruptedException e) {
|
||||
} catch (IOException e) {
|
||||
throw new ApiException(e);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new ApiException(e);
|
||||
}
|
||||
}
|
||||
@@ -393,7 +411,10 @@ public class PetApi {
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
}
|
||||
|
||||
} catch (IOException | InterruptedException e) {
|
||||
} catch (IOException e) {
|
||||
throw new ApiException(e);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new ApiException(e);
|
||||
}
|
||||
}
|
||||
@@ -441,7 +462,10 @@ public class PetApi {
|
||||
}
|
||||
|
||||
return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<ModelApiResponse>() {});
|
||||
} catch (IOException | InterruptedException e) {
|
||||
} catch (IOException e) {
|
||||
throw new ApiException(e);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new ApiException(e);
|
||||
}
|
||||
}
|
||||
@@ -493,7 +517,10 @@ public class PetApi {
|
||||
}
|
||||
|
||||
return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<ModelApiResponse>() {});
|
||||
} catch (IOException | InterruptedException e) {
|
||||
} catch (IOException e) {
|
||||
throw new ApiException(e);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new ApiException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +95,10 @@ public class StoreApi {
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
}
|
||||
|
||||
} catch (IOException | InterruptedException e) {
|
||||
} catch (IOException e) {
|
||||
throw new ApiException(e);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new ApiException(e);
|
||||
}
|
||||
}
|
||||
@@ -135,7 +138,10 @@ public class StoreApi {
|
||||
}
|
||||
|
||||
return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<Map<String, Integer>>() {});
|
||||
} catch (IOException | InterruptedException e) {
|
||||
} catch (IOException e) {
|
||||
throw new ApiException(e);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new ApiException(e);
|
||||
}
|
||||
}
|
||||
@@ -181,7 +187,10 @@ public class StoreApi {
|
||||
}
|
||||
|
||||
return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<Order>() {});
|
||||
} catch (IOException | InterruptedException e) {
|
||||
} catch (IOException e) {
|
||||
throw new ApiException(e);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new ApiException(e);
|
||||
}
|
||||
}
|
||||
@@ -228,7 +237,10 @@ public class StoreApi {
|
||||
}
|
||||
|
||||
return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<Order>() {});
|
||||
} catch (IOException | InterruptedException e) {
|
||||
} catch (IOException e) {
|
||||
throw new ApiException(e);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new ApiException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,7 +96,10 @@ public class UserApi {
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
}
|
||||
|
||||
} catch (IOException | InterruptedException e) {
|
||||
} catch (IOException e) {
|
||||
throw new ApiException(e);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new ApiException(e);
|
||||
}
|
||||
}
|
||||
@@ -141,7 +144,10 @@ public class UserApi {
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
}
|
||||
|
||||
} catch (IOException | InterruptedException e) {
|
||||
} catch (IOException e) {
|
||||
throw new ApiException(e);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new ApiException(e);
|
||||
}
|
||||
}
|
||||
@@ -186,7 +192,10 @@ public class UserApi {
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
}
|
||||
|
||||
} catch (IOException | InterruptedException e) {
|
||||
} catch (IOException e) {
|
||||
throw new ApiException(e);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new ApiException(e);
|
||||
}
|
||||
}
|
||||
@@ -230,7 +239,10 @@ public class UserApi {
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
}
|
||||
|
||||
} catch (IOException | InterruptedException e) {
|
||||
} catch (IOException e) {
|
||||
throw new ApiException(e);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new ApiException(e);
|
||||
}
|
||||
}
|
||||
@@ -276,7 +288,10 @@ public class UserApi {
|
||||
}
|
||||
|
||||
return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<User>() {});
|
||||
} catch (IOException | InterruptedException e) {
|
||||
} catch (IOException e) {
|
||||
throw new ApiException(e);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new ApiException(e);
|
||||
}
|
||||
}
|
||||
@@ -336,7 +351,10 @@ public class UserApi {
|
||||
}
|
||||
|
||||
return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<String>() {});
|
||||
} catch (IOException | InterruptedException e) {
|
||||
} catch (IOException e) {
|
||||
throw new ApiException(e);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new ApiException(e);
|
||||
}
|
||||
}
|
||||
@@ -374,7 +392,10 @@ public class UserApi {
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
}
|
||||
|
||||
} catch (IOException | InterruptedException e) {
|
||||
} catch (IOException e) {
|
||||
throw new ApiException(e);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new ApiException(e);
|
||||
}
|
||||
}
|
||||
@@ -425,7 +446,10 @@ public class UserApi {
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
}
|
||||
|
||||
} catch (IOException | InterruptedException e) {
|
||||
} catch (IOException e) {
|
||||
throw new ApiException(e);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new ApiException(e);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user