I'm using MultipartObjectAssembler to upload data from a Database to OCI object storage. Is there a way to know the reason for failure when using multipart upload?
When I try to commit assembler I'm getting IllegalStateException with the message "One or more parts were have not completed upload successfully". I would like to know why any part got failed? I couldn't find a way to get this information from SDK.
try {
assembler.addPart(new ByteArrayInputStream(part, 0, length),
length,
null);
assembler.commit();
} catch (Exception e) {
assembler.abort();
throw new RuntimeException(e.getMessage());
}
Edit: I need to get an Exception thrown by a failed part and propagate the error message.
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.javaIf, for some reason, you cannot use
UploadManager, please take a look at its source code nonetheless, since it demonstrates the intended usage ofMultipartObjectAssembler: 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-L249MultipartObjectAssembler:MultipartManifest, which will later let you check if parts failed.MultipartManifest.listCompletedParts(),MultipartManifest.listFailedParts(), andMultipartManifest.listInProgressParts(). The manifest should tell you what parts failed. Unfortunately not why; for that, you can enableERRORlevel logging forcom.oracle.bmc.objectstorage.transfer(for the classcom.oracle.bmc.objectstorage.transfer.internal.MultipartTransferManagerin particular).If I have misunderstood something, please let me know. In that case, a larger, more complete code snippet would help me debug. Thanks!