[NO ISSUE]: Fail multipart complete attempt on abort

As part of calling close(), we attempt to complete the multipart upload,
however, close() is also called at the end in case we aborted, we should
ignore such attempt as during aborting, we deleted the multipart upload.

Ext-ref: MB-62859
Change-Id: I4677672ae2c25de889d4a83ae585a6fa54219509
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/18518
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Hussain Towaileb <hussainht@gmail.com>
Reviewed-by: Michael Blow <mblow@apache.org>
diff --git a/asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/CloudOutputStream.java b/asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/CloudOutputStream.java
index bea91fb..1da3e4c 100644
--- a/asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/CloudOutputStream.java
+++ b/asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/CloudOutputStream.java
@@ -22,9 +22,14 @@
 import java.io.OutputStream;
 
 import org.apache.asterix.cloud.clients.ICloudWriter;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 
 public final class CloudOutputStream extends OutputStream {
+    private static final Logger LOGGER = LogManager.getLogger();
+
     private final ICloudWriter cloudWriter;
+    private boolean aborted = false;
 
     public CloudOutputStream(ICloudWriter cloudWriter) {
         this.cloudWriter = cloudWriter;
@@ -42,10 +47,19 @@
 
     @Override
     public void close() throws IOException {
+        if (aborted) {
+            LOGGER.debug("Skipping call to finish() as operation was aborted");
+            return;
+        }
         cloudWriter.finish();
     }
 
     public void abort() throws IOException {
+        if (aborted) {
+            LOGGER.debug("Skipping call to abort() as we have aborted already");
+            return;
+        }
+        aborted = true;
         cloudWriter.abort();
     }
 }
diff --git a/asterixdb/asterix-server/pom.xml b/asterixdb/asterix-server/pom.xml
index cc75514..e65c742 100644
--- a/asterixdb/asterix-server/pom.xml
+++ b/asterixdb/asterix-server/pom.xml
@@ -268,11 +268,11 @@
               <url>https://raw.githubusercontent.com/reactor/reactor-netty/v1.0.28/LICENSE</url>
             </override>
             <override>
-              <gav>com.microsoft.azure:msal4j:1.13.8</gav>
-              <url>https://raw.githubusercontent.com/AzureAD/microsoft-authentication-library-for-java/v1.13.8/LICENSE</url>
+              <gav>com.microsoft.azure:msal4j:1.16.1</gav>
+              <url>https://raw.githubusercontent.com/AzureAD/microsoft-authentication-library-for-java/v1.16.1/LICENSE</url>
             </override>
             <override>
-              <gav>com.microsoft.azure:msal4j-persistence-extension:1.2.0</gav>
+              <gav>com.microsoft.azure:msal4j-persistence-extension:1.3.0</gav>
               <url>https://raw.githubusercontent.com/AzureAD/microsoft-authentication-extensions-for-java/master/LICENSE</url>
             </override>
             <override>
@@ -484,6 +484,10 @@
               <url>https://raw.githubusercontent.com/luben/zstd-jni/v1.5.0-1/LICENSE</url>
             </override>
             <override>
+              <gav>com.github.luben:zstd-jni:1.5.6-2</gav>
+              <url>https://raw.githubusercontent.com/luben/zstd-jni/v1.5.6-2/LICENSE</url>
+            </override>
+            <override>
               <gav>org.slf4j:slf4j-reload4j:1.7.36</gav>
               <url>https://raw.githubusercontent.com/qos-ch/slf4j/v_1.7.36/LICENSE.txt</url>
             </override>
@@ -718,6 +722,7 @@
                 <aliasUrl>http://www.opensource.org/licenses/mit-license.php</aliasUrl>
                 <aliasUrl>http://opensource.org/licenses/MIT</aliasUrl>
                 <aliasUrl>https://raw.githubusercontent.com/AzureAD/microsoft-authentication-library-for-java/v1.13.8/LICENSE</aliasUrl>
+                <aliasUrl>https://raw.githubusercontent.com/AzureAD/microsoft-authentication-library-for-java/v1.16.1/LICENSE</aliasUrl>
                 <aliasUrl>https://raw.githubusercontent.com/AzureAD/microsoft-authentication-extensions-for-java/master/LICENSE</aliasUrl>
               </aliasUrls>
             </license>
diff --git a/asterixdb/src/main/appended-resources/supplemental-models.xml b/asterixdb/src/main/appended-resources/supplemental-models.xml
index 1717ba6..cd80e3f 100644
--- a/asterixdb/src/main/appended-resources/supplemental-models.xml
+++ b/asterixdb/src/main/appended-resources/supplemental-models.xml
@@ -775,8 +775,8 @@
       <groupId>com.microsoft.azure</groupId>
       <artifactId>msal4j</artifactId>
       <properties>
-        <license.ignoreMissingEmbeddedLicense>1.14.0</license.ignoreMissingEmbeddedLicense>
-        <license.ignoreMissingEmbeddedNotice>1.14.0</license.ignoreMissingEmbeddedNotice>
+        <license.ignoreMissingEmbeddedLicense>1.16.1</license.ignoreMissingEmbeddedLicense>
+        <license.ignoreMissingEmbeddedNotice>1.16.1</license.ignoreMissingEmbeddedNotice>
       </properties>
     </project>
   </supplement>
@@ -787,9 +787,9 @@
       <groupId>com.microsoft.azure</groupId>
       <artifactId>msal4j-persistence-extension</artifactId>
       <properties>
-        <license.ignoreMissingEmbeddedLicense>1.2.0</license.ignoreMissingEmbeddedLicense>
-        <license.ignoreMissingEmbeddedNotice>1.2.0</license.ignoreMissingEmbeddedNotice>
-        <license.ignoreLicenseOverride>1.2.0</license.ignoreLicenseOverride>
+        <license.ignoreMissingEmbeddedLicense>1.3.0</license.ignoreMissingEmbeddedLicense>
+        <license.ignoreMissingEmbeddedNotice>1.3.0</license.ignoreMissingEmbeddedNotice>
+        <license.ignoreLicenseOverride>1.3.0</license.ignoreLicenseOverride>
       </properties>
     </project>
   </supplement>
@@ -2217,9 +2217,9 @@
       <groupId>com.github.luben</groupId>
       <artifactId>zstd-jni</artifactId>
       <properties>
-        <license.ignoreMissingEmbeddedLicense>1.5.0-1,1.5.5-1</license.ignoreMissingEmbeddedLicense>
-        <license.ignoreMissingEmbeddedNotice>1.5.0-1,1.5.5-1</license.ignoreMissingEmbeddedNotice>
-        <license.ignoreLicenseOverride>1.5.0-1,1.5.5-1</license.ignoreLicenseOverride>
+        <license.ignoreMissingEmbeddedLicense>1.5.0-1,1.5.5-1,1.5.6-2</license.ignoreMissingEmbeddedLicense>
+        <license.ignoreMissingEmbeddedNotice>1.5.0-1,1.5.5-1,1.5.6-2</license.ignoreMissingEmbeddedNotice>
+        <license.ignoreLicenseOverride>1.5.0-1,1.5.5-1,1.5.6-2</license.ignoreLicenseOverride>
       </properties>
     </project>
   </supplement>
diff --git a/asterixdb/src/main/licenses/content/raw.githubusercontent.com_luben_zstd-jni_v1.5.6-2_LICENSE.txt b/asterixdb/src/main/licenses/content/raw.githubusercontent.com_luben_zstd-jni_v1.5.6-2_LICENSE.txt
new file mode 100644
index 0000000..7bdccb6
--- /dev/null
+++ b/asterixdb/src/main/licenses/content/raw.githubusercontent.com_luben_zstd-jni_v1.5.6-2_LICENSE.txt
@@ -0,0 +1,26 @@
+Zstd-jni: JNI bindings to Zstd Library
+
+Copyright (c) 2015-present, Luben Karavelov/ All rights reserved.
+
+BSD License
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+  list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice, this
+  list of conditions and the following disclaimer in the documentation and/or
+  other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file