Skip to content

Commit 7a30b0e

Browse files
Users/fabianm/portfixes (#47252)
* Update WebExceptionRetryPolicy.java * Update ThinClientStoreModel.java
1 parent 117a4e2 commit 7a30b0e

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/ThinClientStoreModel.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,21 @@ public StoreResponse unwrapToStoreResponse(
135135
payloadBuf
136136
);
137137

138+
if (payloadBuf != content) {
139+
// payload is a slice/derived view; super() owns payload, we still own the container
140+
// this includes scenarios where payloadBuf == EMPTY_BUFFER
141+
ReferenceCountUtil.safeRelease(content);
142+
}
143+
138144
return storeResponse;
139-
} finally {
145+
} catch (Throwable t){
140146
if (payloadBuf != content) {
141147
// payload is a slice/derived view; super() owns payload, we still own the container
142148
// this includes scenarios where payloadBuf == EMPTY_BUFFER
143149
ReferenceCountUtil.safeRelease(content);
144150
}
151+
152+
throw t;
145153
}
146154
}
147155

sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/WebExceptionRetryPolicy.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ public Mono<ShouldRetryResult> shouldRetry(Exception e) {
4848
.warn(
4949
"WebExceptionRetryPolicy() No retries because client is not initialized yet. - "
5050
+ "operationType = {}, count = {}, isAddressRefresh = {}",
51-
this.request.getOperationType(),
51+
this.request != null ? this.request.getOperationType() : "n/a",
5252
this.retryCount,
53-
this.request.isAddressRefresh());
53+
this.request != null ? this.request.isAddressRefresh() : "n/a");
5454

5555
return Mono.just(ShouldRetryResult.noRetry());
5656
}

0 commit comments

Comments
 (0)