Skip to content

Commit

Permalink
fix, java: Address NPE for RequestOptions with new timeout feature (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
armandobelardo authored Feb 25, 2024
1 parent fdd7a6a commit 881e55c
Show file tree
Hide file tree
Showing 134 changed files with 394 additions and 280 deletions.
2 changes: 1 addition & 1 deletion generators/java/sdk/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.8.3
0.8.4
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,11 @@ public GeneratedClientOptions generateFile() {
clientGeneratorContext.getPoetClassNameFactory().getRequestOptionsClassName(),
REQUEST_OPTIONS_PARAMETER_NAME)
.returns(OKHTTP_CLIENT_FIELD.type)
.beginControlFlow("if ($L == null)", REQUEST_OPTIONS_PARAMETER_NAME)
.addStatement("return this.$L", OKHTTP_CLIENT_FIELD.name)
.endControlFlow()
.addStatement(
"return $L.newBuilder().callTimeout($N.getTimeout().get(), $N.getTimeoutTimeUnit())" +
"return this.$L.newBuilder().callTimeout($N.getTimeout().get(), $N.getTimeoutTimeUnit())" +
".connectTimeout(0, $T.SECONDS)" +
".writeTimeout(0, $T.SECONDS)" +
".readTimeout(0, $T.SECONDS).build()",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ public final CodeBlock getResponseParserCodeBlock() {
defaultedClientName,
clientOptionsField,
generatedClientOptions.httpClient())
.beginControlFlow("if ($L.getTimeout().isPresent())", REQUEST_OPTIONS_PARAMETER_NAME)
.beginControlFlow("if ($L != null && $L.getTimeout().isPresent())", REQUEST_OPTIONS_PARAMETER_NAME, REQUEST_OPTIONS_PARAMETER_NAME)
// Set the client's callTimeout if requestOptions overrides it has one
.addStatement(
"$L = $N.$N($L)",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 881e55c

Please sign in to comment.