fix: update UploadCallable to use createFrom to avoid NPE trying to resolve resulting object #2086
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.
This PR has a few parts to it, all small enough to where I did not feel the need to separate.
Major Addition
There was a bug where the storageObject was being accessed before the WriteChannel closes, when the upload is not finished WriteChannel returns a null storageObject resulting in an NPE when we go to decode the storageObject. see BlobWriteChannel#storageObject for where this is documented.
First Pass (up to commit 76462df): addressed this by trying to process the storageObject outside of the scope of the try block, which would ensure the write has completed. All we have to do is manually ensure that the channel is closed.
Refactor (commit 976b9ba): utilizes createFrom, this addition is to both relieve the upload call of handling the Write/FileChannels directly and also allows us to take advantage of any performance improvements being made. The drawback of this is we will regress on our TransferStatus reporting as we no longer have direct byte access to track upload progress. The plan is to short term handle this via Status code checks and long term add in progress monitoring.
Minor Additions