Skip to content

OldEnum#valueOf check for valid NamespacedKey#13596

Merged
Warriorrrr merged 6 commits intoPaperMC:mainfrom
Doc94:fix/13594-OldEnum-valueOf-namespace-null
Feb 28, 2026
Merged

OldEnum#valueOf check for valid NamespacedKey#13596
Warriorrrr merged 6 commits intoPaperMC:mainfrom
Doc94:fix/13594-OldEnum-valueOf-namespace-null

Conversation

@Doc94
Copy link
Copy Markdown
Member

@Doc94 Doc94 commented Feb 3, 2026

This PR fix #13594 where the OldEnum#valueOf (its a reference i know its not like that) can take invalid name like "@" and throw a NPE in the Registry class because the NamespaceKey generated before is null for the invalid characters, the change its just check the NamespaceKey and throw an issue, the only exception its the Sound where another check is made later then just avoid check Registry if the key was invalid

@Doc94 Doc94 requested a review from a team as a code owner February 3, 2026 12:41
@github-project-automation github-project-automation Bot moved this to Awaiting review in Paper PR Queue Feb 3, 2026
@Doc94 Doc94 force-pushed the fix/13594-OldEnum-valueOf-namespace-null branch from 431b0e7 to 8b54869 Compare February 3, 2026 12:46
@Lulu13022002
Copy link
Copy Markdown
Contributor

Make sure to catch all the places using NamespacedKey.fromString like Art.getByName, also I think this can just fallback to the latter precondition keep in mind this try to mimic Enum#valueOf.

@Doc94
Copy link
Copy Markdown
Member Author

Doc94 commented Feb 3, 2026

Make sure to catch all the places using NamespacedKey.fromString like Art.getByName, also I think this can just fallback to the latter precondition keep in mind this try to mimic Enum#valueOf.

latter precondition?

Comment thread paper-api/src/main/java/org/bukkit/Art.java Outdated
@Lulu13022002 Lulu13022002 force-pushed the fix/13594-OldEnum-valueOf-namespace-null branch from 201c383 to 36108a4 Compare February 5, 2026 22:24
@Warriorrrr Warriorrrr merged commit c58f844 into PaperMC:main Feb 28, 2026
4 checks passed
@github-project-automation github-project-automation Bot moved this from Awaiting review to Merged in Paper PR Queue Feb 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Merged

Development

Successfully merging this pull request may close these issues.

NPE instead IAE when using Sound.valueOf with invalid sound

5 participants