fix(server): build progress notification JSON with Jackson instead of String.format #88
No reviewers
Labels
No labels
bug
build
enhancement
headless
P1-critical
P2-high
P3-medium
P4-low
refactoring
No milestone
No project
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ai-tools/jdt-mcp-server!88
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/50-json-injection-progress"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
McpStdioServer.sendProgress()built thenotifications/progressmessage viaString.format()and only escaped". Backslashes, control characters and newlines in themessage(e.g. from a Windows path or a test name) produced invalid JSON and could break the NDJSON framing on stdout.Fix: build the notification with the
ObjectMapperalready used elsewhere in the server (McpProtocolHandlerfollows the sameObjectNode+writeValueAsStringpattern), instead of hand-rolled string escaping.Test plan
mvn -pl org.naturzukunft.jdt.mcp -am compile(with the entity-limitMAVEN_OPTS) — BUILD SUCCESSmvn clean package— full product build succeedstests/smoke-test.shagainst the built product — 9 passed, 0 failedsendProgress()with a message containing\,",\n,\t,\r(e.g.C:\Users\fred\weird "path"\nwith\ttab\rand newline) — output is single-line, valid JSON perjq, and round-trips the original message content correctly.Closes #50
🤖 Generated with Claude Code
https://claude.ai/code/session_016tHV1dzUTdTwMLgx6yotVd