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

jmclean 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 c4068a9dbd [#7249] Remove unnecessary instanceof check for IOException 
handling (#7253)
c4068a9dbd is described below

commit c4068a9dbde1eeba5ef177c8fd5ebbce84b37510
Author: Ajax <[email protected]>
AuthorDate: Mon May 26 17:33:40 2025 +0530

    [#7249] Remove unnecessary instanceof check for IOException handling (#7253)
    
    This PR addresses [Issue
    #7249](https://github.com/apache/gravitino/issues/7249), which pointed
    out unnecessary use of instanceof in exception handling in
    GravitinoVirtualFileSystem.java.
    
    
    ```
    } catch (IOException e) {
      if (e instanceof FilesetPathNotFoundException) {
        throw (FilesetPathNotFoundException) e;
      }
      throw e;
    }
    ```
    
    This check is redundant since:
    
    FilesetPathNotFoundException is a subtype of IOException
    
    Both branches simply rethrow the exception
    
    ```
    
    } catch (IOException e) {
      throw e;
    }
    ```
    Or if this block serves no purpose beyond that, it could be safely
    removed altogether.
    
    Co-authored-by: Dentalkart399 <[email protected]>
---
 .../apache/gravitino/filesystem/hadoop/GravitinoVirtualFileSystem.java | 3 ---
 1 file changed, 3 deletions(-)

diff --git 
a/clients/filesystem-hadoop3/src/main/java/org/apache/gravitino/filesystem/hadoop/GravitinoVirtualFileSystem.java
 
b/clients/filesystem-hadoop3/src/main/java/org/apache/gravitino/filesystem/hadoop/GravitinoVirtualFileSystem.java
index 33ef650d2e..0645e91304 100644
--- 
a/clients/filesystem-hadoop3/src/main/java/org/apache/gravitino/filesystem/hadoop/GravitinoVirtualFileSystem.java
+++ 
b/clients/filesystem-hadoop3/src/main/java/org/apache/gravitino/filesystem/hadoop/GravitinoVirtualFileSystem.java
@@ -330,9 +330,6 @@ public class GravitinoVirtualFileSystem extends FileSystem {
       throw new FilesetPathNotFoundException(message, e);
 
     } catch (IOException e) {
-      if (e instanceof FilesetPathNotFoundException) {
-        throw (FilesetPathNotFoundException) e;
-      }
       throw e;
     }
   }

Reply via email to