fix(http-client-java): handle null LRO error response bodies#11007
Merged
weidongxu-microsoft merged 3 commits intoJun 18, 2026
Merged
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
|
All changed packages have been documented.
Show changes
|
|
You can try these changes here
|
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Java management (fluent-lite) LRO error handling so that when an LRO error is surfaced without a response body, the generated HttpResponseImpl uses an empty byte array instead of null, preventing NPEs in body accessors and keeping response-body APIs usable.
Changes:
- Update mgmt
FluentServiceClientTemplateto emitresponseBody == null ? new byte[0] : ...for LRO error responses. - Add a mgmt template unit test asserting the generated
HttpResponseImpluses the empty-byte-array behavior. - Regenerate affected mgmt test clients and add a Chronus changelog entry.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/http-client-java/generator/http-client-generator-mgmt/src/main/java/com/microsoft/typespec/http/client/generator/mgmt/template/FluentServiceClientTemplate.java | Changes generated HttpResponseImpl to default responseBody to new byte[0] when null (prevents NPEs in body accessors). |
| packages/http-client-java/generator/http-client-generator-mgmt/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/template/FluentServiceClientTemplateTests.java | Adds a unit test validating the template output contains the new empty-byte-array logic and not the old null logic. |
| packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/ArmVersionedClientImpl.java | Regenerated client reflects the new HttpResponseImpl null-body behavior. |
| packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/ArmResourceProviderManagementClientImpl.java | Regenerated client reflects the new HttpResponseImpl null-body behavior. |
| packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ArmClientImpl.java | Regenerated client reflects the new HttpResponseImpl null-body behavior. |
| packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/ArmLegacyClientImpl.java | Regenerated client reflects the new HttpResponseImpl null-body behavior. |
| packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/ArmCustomizationClientImpl.java | Regenerated client reflects the new HttpResponseImpl null-body behavior. |
| packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/ResourcesClientImpl.java | Regenerated client reflects the new HttpResponseImpl null-body behavior. |
| packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OperationTemplatesClientImpl.java | Regenerated client reflects the new HttpResponseImpl null-body behavior. |
| packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/NonResourceClientImpl.java | Regenerated client reflects the new HttpResponseImpl null-body behavior. |
| packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservicesharedmodels/combined/implementation/CombinedImpl.java | Regenerated client reflects the new HttpResponseImpl null-body behavior. |
| packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/CombinedImpl.java | Regenerated client reflects the new HttpResponseImpl null-body behavior. |
| packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MethodSubscriptionIdClientImpl.java | Regenerated client reflects the new HttpResponseImpl null-body behavior. |
| packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/managementgroup/implementation/ManagementGroupClientImpl.java | Regenerated client reflects the new HttpResponseImpl null-body behavior. |
| packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/LargeHeaderClientImpl.java | Regenerated client reflects the new HttpResponseImpl null-body behavior. |
| packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/CommonPropertiesClientImpl.java | Regenerated client reflects the new HttpResponseImpl null-body behavior. |
| .chronus/changes/fix-http-client-java-lro-empty-body-2026-6-17-15-59-00.md | Adds a fix changelog entry for the null LRO error body handling change. |
XiaofeiCao
approved these changes
Jun 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
downstream Azure/azure-sdk-for-java#49537
Summary