File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
src/main/java/software/amazon/encryption/s3/internal Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -47,9 +47,8 @@ public void onNext(ByteBuffer byteBuffer) {
4747 byte [] buf = BinaryUtils .copyBytesFrom (byteBuffer , amountToReadFromByteBuffer );
4848 outputBuffer = cipher .update (buf , 0 , amountToReadFromByteBuffer );
4949 if (outputBuffer == null || outputBuffer .length == 0 ) {
50- // No bytes provided from upstream; just return.
51- // No need to emit empty bytes to downstream; this can be misinterpreted.
52- return ;
50+ // No bytes provided from upstream; to avoid blocking, send an empty buffer to the wrapped subscriber.
51+ wrappedSubscriber .onNext (ByteBuffer .allocate (0 ));
5352 } else {
5453 boolean atEnd = isLastPart && contentRead .get () + amountToReadFromByteBuffer >= contentLength ;
5554
@@ -80,6 +79,9 @@ public void onNext(ByteBuffer byteBuffer) {
8079 wrappedSubscriber .onNext (ByteBuffer .wrap (outputBuffer ));
8180 }
8281 }
82+ } else {
83+ // Do nothing
84+ wrappedSubscriber .onNext (byteBuffer );
8385 }
8486 }
8587
You can’t perform that action at this time.
0 commit comments