Skip to content

OldEnum#valueOf check for valid NamespacedKey#13596

Open
Doc94 wants to merge 4 commits intoPaperMC:mainfrom
Doc94:fix/13594-OldEnum-valueOf-namespace-null
Open

OldEnum#valueOf check for valid NamespacedKey#13596
Doc94 wants to merge 4 commits intoPaperMC:mainfrom
Doc94:fix/13594-OldEnum-valueOf-namespace-null

Conversation

@Doc94
Copy link
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
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
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?

@Lulu13022002 Lulu13022002 force-pushed the fix/13594-OldEnum-valueOf-namespace-null branch from 201c383 to 36108a4 Compare February 5, 2026 22:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Awaiting review

Development

Successfully merging this pull request may close these issues.

NPE instead IAE when using Sound.valueOf with invalid sound

3 participants