This is an automated email from the ASF dual-hosted git repository. diqiu50 pushed a commit to branch glue-pr03 in repository https://gitbox.apache.org/repos/asf/gravitino.git
commit 535d6e45f50a933e28c47df5d5dea491e33b464c Author: diqiu50 <[email protected]> AuthorDate: Thu Apr 9 16:33:43 2026 +0800 fix(catalog-glue): Address PR review comments - Replace real-looking AWS credential patterns in tests with obviously fake values - Improve partial-credential error message to always name both keys explicitly - Remove redundant isBlank() checks already covered by Strings.isNullOrEmpty() --- .../apache/gravitino/catalog/glue/GlueClientProvider.java | 14 +++++++------- .../org/apache/gravitino/catalog/glue/GlueConstants.java | 2 +- .../gravitino/catalog/glue/TestGlueClientProvider.java | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/catalogs/catalog-glue/src/main/java/org/apache/gravitino/catalog/glue/GlueClientProvider.java b/catalogs/catalog-glue/src/main/java/org/apache/gravitino/catalog/glue/GlueClientProvider.java index c0ade3e196..df0d37b641 100644 --- a/catalogs/catalog-glue/src/main/java/org/apache/gravitino/catalog/glue/GlueClientProvider.java +++ b/catalogs/catalog-glue/src/main/java/org/apache/gravitino/catalog/glue/GlueClientProvider.java @@ -57,7 +57,7 @@ public final class GlueClientProvider { public static GlueClient buildClient(Map<String, String> config) { String region = config.get(GlueConstants.AWS_REGION); Preconditions.checkArgument( - !Strings.isNullOrEmpty(region) && !region.isBlank(), + !Strings.isNullOrEmpty(region), "Property '%s' is required to create a Glue client", GlueConstants.AWS_REGION); @@ -67,15 +67,15 @@ public final class GlueClientProvider { // Both keys must be provided together — a partial pair is always a misconfiguration. String accessKey = config.get(GlueConstants.AWS_ACCESS_KEY_ID); String secretKey = config.get(GlueConstants.AWS_SECRET_ACCESS_KEY); - boolean hasAccessKey = !Strings.isNullOrEmpty(accessKey) && !accessKey.isBlank(); - boolean hasSecretKey = !Strings.isNullOrEmpty(secretKey) && !secretKey.isBlank(); + boolean hasAccessKey = !Strings.isNullOrEmpty(accessKey); + boolean hasSecretKey = !Strings.isNullOrEmpty(secretKey); Preconditions.checkArgument( hasAccessKey == hasSecretKey, - "Incomplete static credentials: '%s' requires '%s'. " + "Both '%s' and '%s' must be set together. " + "Either provide both keys for static authentication, " + "or omit both to use the default credential chain.", - hasAccessKey ? GlueConstants.AWS_ACCESS_KEY_ID : GlueConstants.AWS_SECRET_ACCESS_KEY, - hasAccessKey ? GlueConstants.AWS_SECRET_ACCESS_KEY : GlueConstants.AWS_ACCESS_KEY_ID); + GlueConstants.AWS_ACCESS_KEY_ID, + GlueConstants.AWS_SECRET_ACCESS_KEY); if (hasAccessKey) { builder.credentialsProvider( @@ -86,7 +86,7 @@ public final class GlueClientProvider { // Optional custom endpoint override for VPC endpoints or LocalStack testing. String endpoint = config.get(GlueConstants.AWS_GLUE_ENDPOINT); - if (!Strings.isNullOrEmpty(endpoint) && !endpoint.isBlank()) { + if (!Strings.isNullOrEmpty(endpoint)) { try { builder.endpointOverride(URI.create(endpoint)); } catch (IllegalArgumentException e) { diff --git a/catalogs/catalog-glue/src/main/java/org/apache/gravitino/catalog/glue/GlueConstants.java b/catalogs/catalog-glue/src/main/java/org/apache/gravitino/catalog/glue/GlueConstants.java index d02f03bf7e..90c4d0831f 100644 --- a/catalogs/catalog-glue/src/main/java/org/apache/gravitino/catalog/glue/GlueConstants.java +++ b/catalogs/catalog-glue/src/main/java/org/apache/gravitino/catalog/glue/GlueConstants.java @@ -68,7 +68,7 @@ public final class GlueConstants { /** * Glue table format type parameter key stored in {@code Table.parameters()}. Common values: - * {@code ICEBERG}, {@code HIVE}, {@code DELTA}, {@code PARQUET}, {@code VIRTUAL_VIEW}. + * {@code ICEBERG}, {@code HIVE}, {@code DELTA}, {@code PARQUET}. */ public static final String TABLE_FORMAT_TYPE = "table_format_type"; diff --git a/catalogs/catalog-glue/src/test/java/org/apache/gravitino/catalog/glue/TestGlueClientProvider.java b/catalogs/catalog-glue/src/test/java/org/apache/gravitino/catalog/glue/TestGlueClientProvider.java index 046f1d616d..5bccb0e138 100644 --- a/catalogs/catalog-glue/src/test/java/org/apache/gravitino/catalog/glue/TestGlueClientProvider.java +++ b/catalogs/catalog-glue/src/test/java/org/apache/gravitino/catalog/glue/TestGlueClientProvider.java @@ -37,8 +37,8 @@ class TestGlueClientProvider { void testBuildClientWithStaticCredentials() { Map<String, String> config = new HashMap<>(); config.put(AWS_REGION, "us-east-1"); - config.put(AWS_ACCESS_KEY_ID, "AKIAIOSFODNN7EXAMPLE"); - config.put(AWS_SECRET_ACCESS_KEY, "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"); + config.put(AWS_ACCESS_KEY_ID, "test-access-key"); + config.put(AWS_SECRET_ACCESS_KEY, "test-secret-key"); try (GlueClient client = GlueClientProvider.buildClient(config)) { assertNotNull(client); @@ -102,7 +102,7 @@ class TestGlueClientProvider { // Providing only the secret without the access key is also a misconfiguration. Map<String, String> config = new HashMap<>(); config.put(AWS_REGION, "ap-southeast-1"); - config.put(AWS_SECRET_ACCESS_KEY, "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"); + config.put(AWS_SECRET_ACCESS_KEY, "test-secret-key"); // No AWS_ACCESS_KEY_ID. IllegalArgumentException ex =
