This is an automated email from the ASF dual-hosted git repository.

mblow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git

commit 5df3c6ff72b61a35a4a5183e1f1c4a37af8432b3
Author: Michael Blow <[email protected]>
AuthorDate: Tue Jun 20 12:32:07 2023 -0400

    [NO ISSUE][*DB] Apply missing change for GCS anonymous
    
    Change-Id: I20aff3a73a822ff8627af685cd33b904384d6905
    Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/17607
    Reviewed-by: Hussain Towaileb <[email protected]>
    Tested-by: Michael Blow <[email protected]>
---
 .../org/apache/asterix/external/util/google/gcs/GCSUtils.java     | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git 
a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/google/gcs/GCSUtils.java
 
b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/google/gcs/GCSUtils.java
index 3efb041dae..6183a88143 100644
--- 
a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/google/gcs/GCSUtils.java
+++ 
b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/google/gcs/GCSUtils.java
@@ -58,6 +58,7 @@ import org.apache.hyracks.api.exceptions.Warning;
 import com.google.api.gax.paging.Page;
 import com.google.auth.oauth2.GoogleCredentials;
 import com.google.cloud.BaseServiceException;
+import com.google.cloud.NoCredentials;
 import com.google.cloud.storage.Blob;
 import com.google.cloud.storage.Storage;
 import com.google.cloud.storage.StorageOptions;
@@ -101,15 +102,14 @@ public class GCSUtils {
             } catch (IOException ex) {
                 throw CompilationException.create(EXTERNAL_SOURCE_ERROR, 
getMessageOrToString(ex));
             }
-        }
-
-        // json credentials
-        if (jsonCredentials != null) {
+        } else if (jsonCredentials != null) {
             try (InputStream credentialsStream = new 
ByteArrayInputStream(jsonCredentials.getBytes())) {
                 
builder.setCredentials(GoogleCredentials.fromStream(credentialsStream));
             } catch (IOException ex) {
                 throw new CompilationException(EXTERNAL_SOURCE_ERROR, 
getMessageOrToString(ex));
             }
+        } else {
+            builder.setCredentials(NoCredentials.getInstance());
         }
 
         if (endpoint != null) {

Reply via email to