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

jshao pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gravitino.git


The following commit(s) were added to refs/heads/main by this push:
     new 1266b79e6 [#4606] Improvement(trino-connector): Possible null pointer 
expection/code handling (#4619)
1266b79e6 is described below

commit 1266b79e664d55007f87f5d6cbb7828ffe8bed6e
Author: Jing-Jia Hung <[email protected]>
AuthorDate: Mon Aug 26 19:48:56 2024 +0800

    [#4606] Improvement(trino-connector): Possible null pointer expection/code 
handling (#4619)
    
    ### What changes were proposed in this pull request?
    
    - Remove the outer try block and throw new TrinoException exception by
    passing failedException.
    - The InterruptedException during Thread.sleep is handled.
    
    ### Why are the changes needed?
    
    Fix: #4606
    
    ### Does this PR introduce _any_ user-facing change?
    
    No
    
    ### How was this patch tested?
    
    use original UT
---
 .../apache/gravitino/trino/connector/catalog/CatalogRegister.java    | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git 
a/trino-connector/src/main/java/org/apache/gravitino/trino/connector/catalog/CatalogRegister.java
 
b/trino-connector/src/main/java/org/apache/gravitino/trino/connector/catalog/CatalogRegister.java
index 1749d8aa3..a305ded30 100644
--- 
a/trino-connector/src/main/java/org/apache/gravitino/trino/connector/catalog/CatalogRegister.java
+++ 
b/trino-connector/src/main/java/org/apache/gravitino/trino/connector/catalog/CatalogRegister.java
@@ -220,7 +220,10 @@ public class CatalogRegister {
   private void executeSql(String sql) {
     try {
       int retries = EXECUTE_QUERY_MAX_RETRIES;
-      Exception failedException = null;
+      Exception failedException =
+          new TrinoException(
+              GravitinoErrorCode.GRAVITINO_RUNTIME_ERROR,
+              "Initial placeholder exception - this should be replaced with a 
real exception if retries fail.");
       while (retries-- > 0) {
         try (Statement statement = connection.createStatement()) {
           // check the catalog is already created

Reply via email to