Skip to content

Commit

Permalink
Fix #6157: Updated native template to fix null async return (#6168)
Browse files Browse the repository at this point in the history
* Fix #6157: Updated native template to fix null async return

Should fix issue: #6157

* fixed uncaught json exception in java native api gen

* cleaning up

Co-authored-by: Luis Ballabeni <luis.ballabeni@lexisnexis.com>
  • Loading branch information
laballab and Luis Ballabeni authored May 5, 2020
1 parent 90ff492 commit 30ee3f3
Showing 1 changed file with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -180,14 +180,18 @@ public class {{classname}} {
localVarResponse.body())
);
} else {
return CompletableFuture.completedFuture(
{{#returnValue}}
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<{{{returnType}}}>() {})
{{/returnValue}}
{{^returnValue}}
null
{{/returnValue}}
);
try {
return CompletableFuture.completedFuture(
{{#returnType}}
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<{{{returnType}}}>() {})
{{/returnType}}
{{^returnType}}
null
{{/returnType}}
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
}
});
{{/asyncNative}}
Expand Down

0 comments on commit 30ee3f3

Please sign in to comment.