Skip to content

Commit f118f3f

Browse files
add JacksonException handling
1 parent 19d1296 commit f118f3f

15 files changed

Lines changed: 93 additions & 87 deletions

File tree

modules/openapi-generator/src/main/resources/Java/libraries/native/api.mustache

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
1616
import com.fasterxml.jackson.databind.ObjectMapper;
1717
{{/useJackson3}}
1818
{{#useJackson3}}
19+
import tools.jackson.core.JacksonException;
1920
import tools.jackson.core.type.TypeReference;
2021
import tools.jackson.databind.ObjectMapper;
2122
{{/useJackson3}}
@@ -530,7 +531,7 @@ public class {{classname}} {
530531
localVarResponseBody.close();
531532
}
532533
}
533-
} catch (IOException e) {
534+
} catch (IOException {{#useJackson3}}| JacksonException {{/useJackson3}}e) {
534535
throw new ApiException(e);
535536
}
536537
catch (InterruptedException e) {
@@ -617,7 +618,7 @@ public class {{classname}} {
617618
localVarResponseBody.close();
618619
}
619620
}
620-
} catch (IOException e) {
621+
} catch (IOException {{#useJackson3}}| JacksonException {{/useJackson3}}e) {
621622
return CompletableFuture.failedFuture(new ApiException(e));
622623
}
623624
}
@@ -748,7 +749,7 @@ public class {{classname}} {
748749
{{^useGzipFeature}}
749750
localVarRequestBuilder.method("{{httpMethod}}", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
750751
{{/useGzipFeature}}
751-
} catch (IOException e) {
752+
} catch (IOException {{#useJackson3}}| JacksonException {{/useJackson3}}e) {
752753
throw new ApiException(e);
753754
}
754755
{{/isString}}

samples/client/others/typescript/builds/null-types-simple/.openapi-generator/FILES

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

samples/client/others/typescript/builds/null-types-simple/models/ObjectSerializer.ts

Lines changed: 6 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

samples/client/others/typescript/builds/null-types-simple/models/all.ts

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

samples/client/others/typescript/builds/null-types-simple/types/ObjectParamAPI.ts

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

samples/client/others/typescript/builds/null-types-simple/types/ObservableAPI.ts

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

samples/client/others/typescript/builds/null-types-simple/types/PromiseAPI.ts

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

samples/client/petstore/java/native-jackson3/src/main/java/org/openapitools/client/ApiClient.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,12 +260,12 @@ public ApiClient setObjectMapper(ObjectMapper mapper) {
260260
}
261261

262262
/**
263-
* Get a copy of the current {@link ObjectMapper}.
263+
* Get the current {@link ObjectMapper}.
264264
*
265-
* @return A copy of the current object mapper.
265+
* @return The current object mapper.
266266
*/
267267
public ObjectMapper getObjectMapper() {
268-
return mapper.copy();
268+
return mapper;
269269
}
270270

271271
/**

samples/client/petstore/java/native-jackson3/src/main/java/org/openapitools/client/api/AnotherFakeApi.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import org.openapitools.client.model.Client;
2222

23+
import tools.jackson.core.JacksonException;
2324
import tools.jackson.core.type.TypeReference;
2425
import tools.jackson.databind.ObjectMapper;
2526

@@ -244,7 +245,7 @@ public ApiResponse<Client> call123testSpecialTagsWithHttpInfo(@javax.annotation.
244245
localVarResponseBody.close();
245246
}
246247
}
247-
} catch (IOException e) {
248+
} catch (IOException | JacksonException e) {
248249
throw new ApiException(e);
249250
}
250251
catch (InterruptedException e) {
@@ -271,7 +272,7 @@ private HttpRequest.Builder call123testSpecialTagsRequestBuilder(@javax.annotati
271272
try {
272273
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(client);
273274
localVarRequestBuilder.method("PATCH", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
274-
} catch (IOException e) {
275+
} catch (IOException | JacksonException e) {
275276
throw new ApiException(e);
276277
}
277278
if (memberVarReadTimeout != null) {

samples/client/petstore/java/native-jackson3/src/main/java/org/openapitools/client/api/DefaultApi.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import org.openapitools.client.model.FooGetDefaultResponse;
2222

23+
import tools.jackson.core.JacksonException;
2324
import tools.jackson.core.type.TypeReference;
2425
import tools.jackson.databind.ObjectMapper;
2526

@@ -240,7 +241,7 @@ public ApiResponse<FooGetDefaultResponse> fooGetWithHttpInfo(Map<String, String>
240241
localVarResponseBody.close();
241242
}
242243
}
243-
} catch (IOException e) {
244+
} catch (IOException | JacksonException e) {
244245
throw new ApiException(e);
245246
}
246247
catch (InterruptedException e) {

0 commit comments

Comments
 (0)