Skip to content

Remove useless try-catch in StringUtil joinList methods - #6610

Closed
Smorki wants to merge 1 commit into
EssentialsX:2.xfrom
Smorki:remove-useless-trycatch-stringutil
Closed

Remove useless try-catch in StringUtil joinList methods#6610
Smorki wants to merge 1 commit into
EssentialsX:2.xfrom
Smorki:remove-useless-trycatch-stringutil

Conversation

@Smorki

@Smorki Smorki commented Aug 15, 2026

Copy link
Copy Markdown

**### Information

This PR is not tied to an existing issue, the change was found while reading the source code

Details

Proposed fix:
The try-catch blocks in StringUtil.joinList and StringUtil.joinListSkip call each.toString() inside both the try and the catch. If the first call throws, the catch calls the exact same method on the same object and throws the same exception again, so the try-catch doesn'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.

  • Most recent Paper version (XX.YY.Z, git-Paper-BUILD)
  • CraftBukkit/Spigot/Paper 1.12.2
  • CraftBukkit 1.8.8

All server versions — this is a text-only source change with identical runtime behavior on every server version.

Demonstration:
No screenshots — the try-catch was dead code, so removing it produces no visible difference at runtime. The diff itself demonstrates the change.**

@mdcfe

mdcfe commented Aug 16, 2026

Copy link
Copy Markdown
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.

@Smorki

Smorki commented Aug 16, 2026

Copy link
Copy Markdown
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

@pop4959 pop4959 closed this Aug 16, 2026
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.

3 participants