Repository navigation
[26.3] Fix placeholder syntax that discarded message arguments - #10916
Open
berkay8987 wants to merge 1 commit into
Open
berkay8987 wants to merge 1 commit into
berkay8987 wants to merge 1 commit into
Conversation
Two messages mixed up printf and SLF4J/Log4j placeholder syntax, so in
both cases the format string was emitted verbatim and every argument was
silently dropped.
JsonCodecProvider passed `{}` to String.format, which only understands
`%s`. A datagen encoding failure therefore threw
`IllegalStateException: Failed to encode {}: {}`, naming neither the file
being written nor the reason it failed. On 1.20.1 this was
`LOGGER.error("Failed to encode {}: {}", path, msg)`; the placeholders
were carried over unchanged when the call became a thrown exception.
DisplayWindow made the inverse mistake, passing `%d`/`%s` to an
org.slf4j.Logger, which only understands `{}`. The failure to create a
window logged no GL version and no SDL error. The same file already uses
`{}` correctly elsewhere.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Two messages mix up printf and SLF4J/Log4j placeholder syntax. In both cases the format string is emitted verbatim and every argument is silently dropped, so a failure reports nothing useful about itself. No issue filed for either; found while auditing format strings.
JsonCodecProvider— datagen failures name neither the file nor the reasonString.formatonly understands%s, so this throwsIllegalStateException: Failed to encode {}: {}withpathandmsgdiscarded. A modder whose datagen fails learns neither which file was being written nor why.On 1.20.1 the line reads:
The
{}placeholders were correct for the logger, and were carried over unchanged when DataFixerUpper'sgetOrThrowsignature changed and the call became a thrown exception. Present on 26.3, 26.2, 26.1.2, 1.21.11, 1.21.10, 1.21.8, 1.21.5, 1.21.1 and 1.20.x; 1.20.1 predates the port and is unaffected. Happy to open the backports if wanted.DisplayWindow— the inverse mistakeLOGGERhere is anorg.slf4j.Logger, which only understands{}, so%d/%slog literally and the GL version and SDL error are lost — exactly the detail thetracecall exists to provide. Line 369 of the same file already uses{}correctly. This one is 26.3 only, since it is part of the SDL window creation added on this branch.Notes
src/test_old/.../DataGeneratorTest.javahas two more printf-in-logger calls, left alone deliberately: that tree is not referenced by any build script.I have not run a full game build — both changes are placeholder characters inside string literals, with no change to control flow or arity. Verified by sweeping the repo afterwards: no
{}remains inside anyString.format, and no printf specifier remains in any logger call outsidetest_old.🤖 Generated with Claude Code