Skip to content

[#7249] Remove unnecessary instanceof check for IOException handling#7253

Merged
justinmclean merged 1 commit intoapache:mainfrom
AjaxStepGit:fix-7249-simplify-exception-handling
May 26, 2025
Merged

[#7249] Remove unnecessary instanceof check for IOException handling#7253
justinmclean merged 1 commit intoapache:mainfrom
AjaxStepGit:fix-7249-simplify-exception-handling

Conversation

@AjaxStepGit
Copy link
Contributor

This PR addresses Issue #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.

Copy link
Member

@justinmclean justinmclean left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution.

@justinmclean justinmclean merged commit c4068a9 into apache:main May 26, 2025
29 checks passed
vishnu-chalil pushed a commit to vishnu-chalil/gravitino that referenced this pull request Jul 14, 2025
…dling (apache#7253)

This PR addresses [Issue
apache#7249](apache#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 <vasadent399@Dentalkart399s-MacBook-Air.local>
hdygxsj pushed a commit to hdygxsj/gravitino that referenced this pull request Jul 15, 2025
…dling (apache#7253)

This PR addresses [Issue
apache#7249](apache#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 <vasadent399@Dentalkart399s-MacBook-Air.local>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants