Show better error message when receiving an empty JSON RPC line

Fixes #1715
This commit is contained in:
AsamK 2025-02-27 11:39:31 +01:00
parent cf5c943127
commit e1f4dae5c2

View file

@ -151,6 +151,13 @@ public class JsonRpcReader {
} }
private JsonRpcMessage parseJsonRpcMessage(final String input) { private JsonRpcMessage parseJsonRpcMessage(final String input) {
if (input.trim().isEmpty()) {
jsonRpcSender.sendResponse(JsonRpcResponse.forError(new JsonRpcResponse.Error(JsonRpcResponse.Error.PARSE_ERROR,
"Empty input line",
null), null));
return null;
}
final JsonNode jsonNode; final JsonNode jsonNode;
try { try {
jsonNode = objectMapper.readTree(input); jsonNode = objectMapper.readTree(input);