Remove useless try-catch in StringUtil joinList methods - #6610
Closed
Smorki wants to merge 1 commit into
Closed
Conversation
Member
|
Hey there, thanks for opening a PR. We don't generally take minor code cleanup PRs purely for the sake of cleanup. If you can point to an obvious improvement at runtime (fixing unintended behaviour or noticeably performance improvements) then we're happy to consider this. If not, we would prefer to handle cleanup like this when we are working in and around these files. You're welcome to PR a related feature or bug fix in the future that happens to include this improvement, which we would consider on its own merit. |
Author
|
Thanks for the explanation! Makes complete sense i completely understand your policy on pure cleanup PRs. Feel free to close this and ill keep an eye out for actual bugs or feature requests to contribute to in the future |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
**### Information
This PR is not tied to an existing issue, the change was found while reading the source code
Details
Proposed fix:
The
try-catchblocks inStringUtil.joinListandStringUtil.joinListSkipcalleach.toString()inside both thetryand thecatch. If the first call throws, the catch calls the exact same method on the same object and throws the same exception again, so thetry-catchdoesn't actually recover from anything.Removed both blocks. Behavior is unchanged — if
toString()throws, it will still propagate exactly as before.Environments tested:
OS: N/A — pure code cleanup no runtime behavior change to test
Java version: N/A — no behavior change.
All server versions— this is a text-only source change with identical runtime behavior on every server version.Demonstration:
No screenshots — the
try-catchwas dead code, so removing it produces no visible difference at runtime. The diff itself demonstrates the change.**