Skip to content

Commit 891b8fa

Browse files
committed
commiting file outputter just in case
1 parent 201c640 commit 891b8fa

File tree

1 file changed

+36
-2
lines changed

1 file changed

+36
-2
lines changed

sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/policy/StorageContentValidationPolicy.java

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import com.azure.core.http.HttpPipelineNextSyncPolicy;
1010
import com.azure.core.http.HttpResponse;
1111
import com.azure.core.http.policy.HttpPipelinePolicy;
12-
import com.azure.storage.common.implementation.BufferAggregator;
1312
import com.azure.storage.common.implementation.BufferStagingArea;
1413
import com.azure.storage.common.implementation.StorageCrc64Calculator;
1514
import com.azure.storage.common.implementation.structuredmessage.StructuredMessageEncoder;
@@ -112,7 +111,42 @@ private void applyStructuredMessage(HttpPipelineCallContext context) {
112111
.getBody()
113112
.flatMapSequential(stagingArea::write, 1, 1)
114113
.concatWith(Flux.defer(stagingArea::flush))
115-
.flatMap(bufferAggregator -> bufferAggregator.asFlux().flatMap(structuredMessageEncoder::encode));
114+
.concatMap(bufferAggregator -> bufferAggregator.asFlux().concatMap(structuredMessageEncoder::encode));
115+
//
116+
// // For test purposes, write the encoded body to a file.
117+
// final AtomicReference<FileChannel> fileChannelRef = new AtomicReference<>();
118+
// encodedBody = encodedBody.doOnSubscribe(subscription -> {
119+
// try {
120+
// Path path = Paths.get("encoded-output-bad.bin");
121+
// fileChannelRef.set(FileChannel.open(path, StandardOpenOption.CREATE, StandardOpenOption.WRITE,
122+
// StandardOpenOption.TRUNCATE_EXISTING));
123+
// } catch (IOException e) {
124+
// throw new UncheckedIOException(e);
125+
// }
126+
// }).doOnNext(buffer -> {
127+
// try {
128+
// // Duplicate buffer to avoid affecting the original buffer's position
129+
// fileChannelRef.get().write(buffer.duplicate());
130+
// } catch (IOException e) {
131+
// throw new UncheckedIOException(e);
132+
// }
133+
// }).doOnComplete(() -> {
134+
// try {
135+
// if (fileChannelRef.get() != null) {
136+
// fileChannelRef.get().close();
137+
// }
138+
// } catch (IOException e) {
139+
// throw new UncheckedIOException(e);
140+
// }
141+
// }).doOnError(error -> {
142+
// try {
143+
// if (fileChannelRef.get() != null) {
144+
// fileChannelRef.get().close();
145+
// }
146+
// } catch (IOException e) {
147+
// error.addSuppressed(e);
148+
// }
149+
// });
116150

117151
// Set the encoded body
118152
context.getHttpRequest().setBody(encodedBody);

0 commit comments

Comments
 (0)