Is there a reason you are not using the UploadManager
? It should do everything for you, including adding parts and committing. Here's an end-to-end example: https://github.com/oracle/oci-java-sdk/blob/master/bmc-examples/src/main/java/UploadObjectExample.java
If, for some reason, you cannot use UploadManager
, please take a look at its source code nonetheless, since it demonstrates the intended usage of MultipartObjectAssembler
: https://github.com/oracle/oci-java-sdk/blob/master/bmc-objectstorage/bmc-objectstorage-extensions/src/main/java/com/oracle/bmc/objectstorage/transfer/UploadManager.java#L175-L249
- You create the
MultipartObjectAssembler
:
MultipartObjectAssembler assembler =
createAssembler(request, uploadRequest, executorServiceToUse);
- You create a new request. This gives you back a
MultipartManifest
, which will later let you check if parts failed.
manifest =
assembler.newRequest(
request.getContentType(),
request.getContentLanguage(),
request.getContentEncoding(),
request.getOpcMeta());
- Then you add all the parts:
assembler.addPart(
ProgressTrackingInputStreamFactory.create(
chunk, progressTrackerFactory.getProgressTracker()),
chunk.length(),
null);
- Then you commit. This is where your code currently throws. I suspect not all parts have been added.
CommitMultipartUploadResponse response = assembler.commit();
- If something goes wrong, check
MultipartManifest.listCompletedParts()
, MultipartManifest.listFailedParts()
, and MultipartManifest.listInProgressParts()
. The manifest should tell you what parts failed. Unfortunately not why; for that, you can enable ERROR
level logging for com.oracle.bmc.objectstorage.transfer
(for the class com.oracle.bmc.objectstorage.transfer.internal.MultipartTransferManager
in particular).
If I have misunderstood something, please let me know. In that case, a larger, more complete code snippet would help me debug. Thanks!