diff --git a/api/src/main/java/io/minio/S3Base.java b/api/src/main/java/io/minio/S3Base.java index 18115370e..a58e9ebc9 100644 --- a/api/src/main/java/io/minio/S3Base.java +++ b/api/src/main/java/io/minio/S3Base.java @@ -2849,14 +2849,14 @@ private CompletableFuture putMultipartObjectAsync( | XmlParserException | InterruptedException | ExecutionException e) { + Throwable throwable = e; + if (throwable instanceof ExecutionException) { + throwable = ((ExecutionException) throwable).getCause(); + } + if (throwable instanceof CompletionException) { + throwable = ((CompletionException) throwable).getCause(); + } if (uploadId == null) { - Throwable throwable = e; - if (throwable instanceof ExecutionException) { - throwable = ((ExecutionException) throwable).getCause(); - } - if (throwable instanceof CompletionException) { - throwable = ((CompletionException) throwable).getCause(); - } throw new CompletionException(throwable); } try { @@ -2871,15 +2871,15 @@ private CompletableFuture putMultipartObjectAsync( | XmlParserException | InterruptedException | ExecutionException ex) { - Throwable throwable = ex; + throwable = ex; if (throwable instanceof ExecutionException) { throwable = ((ExecutionException) throwable).getCause(); } if (throwable instanceof CompletionException) { throwable = ((CompletionException) throwable).getCause(); } - throw new CompletionException(throwable); } + throw new CompletionException(throwable); } return response; });