Skip to content

Commit 2a7155f

Browse files
Fix compilation errors: resolve variable scope conflict and use StreamResponse constructor
Co-authored-by: gunjansingh-msft <[email protected]>
1 parent 013d2ff commit 2a7155f

File tree

1 file changed

+9
-32
lines changed

1 file changed

+9
-32
lines changed

sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobAsyncClientBase.java

Lines changed: 9 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1482,40 +1482,17 @@ Mono<BlobDownloadAsyncResponse> downloadStreamWithResponse(BlobRange range, Down
14821482
}
14831483
};
14841484

1485-
// Apply structured message decoding if enabled - this allows both MD5 and structured message to coexist
1485+
// If structured message decoding was applied, we need to create a new StreamResponse with the processed stream
14861486
if (contentValidationOptions != null && contentValidationOptions.isStructuredMessageValidationEnabled()) {
1487-
// Use the content length from headers to determine expected length for structured message decoding
1488-
Long contentLength = blobDownloadHeaders.getContentLength();
1489-
Flux<ByteBuffer> processedStream = StructuredMessageDecodingStream.wrapStreamIfNeeded(response.getValue(), contentLength, contentValidationOptions);
1487+
// Create a new StreamResponse using the deprecated but available constructor
1488+
@SuppressWarnings("deprecation")
1489+
StreamResponse processedResponse = new StreamResponse(
1490+
response.getRequest(),
1491+
response.getStatusCode(),
1492+
response.getHeaders(),
1493+
processedStream
1494+
);
14901495

1491-
// Create a new StreamResponse with the processed stream
1492-
StreamResponse processedResponse = new StreamResponse() {
1493-
@Override
1494-
public int getStatusCode() {
1495-
return response.getStatusCode();
1496-
}
1497-
1498-
@Override
1499-
public HttpHeaders getHeaders() {
1500-
return response.getHeaders();
1501-
}
1502-
1503-
@Override
1504-
public Flux<ByteBuffer> getValue() {
1505-
return processedStream;
1506-
}
1507-
1508-
@Override
1509-
public HttpRequest getRequest() {
1510-
return response.getRequest();
1511-
}
1512-
1513-
@Override
1514-
public void close() {
1515-
response.close();
1516-
}
1517-
};
1518-
15191496
return BlobDownloadAsyncResponseConstructorProxy.create(processedResponse, onDownloadErrorResume, finalOptions);
15201497
} else {
15211498
// No structured message processing needed, use original response

0 commit comments

Comments
 (0)