Skip to content

Commit 49ad9bb

Browse files
committed
format code style
1 parent 4f81146 commit 49ad9bb

2 files changed

Lines changed: 12 additions & 7 deletions

File tree

framework/src/main/java/org/tron/core/services/jsonrpc/JsonRpcServlet.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,11 @@ protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws I
111111
try {
112112
rootNode = MAPPER.readTree(body);
113113
if (rootNode == null || rootNode.isMissingNode()) {
114-
writeJsonRpcError(resp, JsonRpcError.PARSE_ERROR, "Parse error", null, false);
114+
writeJsonRpcError(resp, JsonRpcError.PARSE_ERROR, "JSON parse error", null, false);
115115
return;
116116
}
117117
} catch (JsonProcessingException e) {
118-
writeJsonRpcError(resp, JsonRpcError.PARSE_ERROR, "Parse error", null, false);
118+
writeJsonRpcError(resp, JsonRpcError.PARSE_ERROR, "JSON parse error", null, false);
119119
return;
120120
}
121121

framework/src/test/java/org/tron/core/services/jsonrpc/JsonRpcServletTest.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -285,21 +285,24 @@ public void primitiveRootNull_returnsInvalidRequestWithJsonNullId() throws Excep
285285
public void primitiveRootBoolean_returnsInvalidRequest() throws Exception {
286286
MockHttpServletResponse resp = doPost("true");
287287
assertEquals(200, resp.getStatus());
288-
assertEquals(-32600, MAPPER.readTree(resp.getContentAsString()).get("error").get("code").asInt());
288+
assertEquals(-32600,
289+
MAPPER.readTree(resp.getContentAsString()).get("error").get("code").asInt());
289290
}
290291

291292
@Test
292293
public void primitiveRootNumber_returnsInvalidRequest() throws Exception {
293294
MockHttpServletResponse resp = doPost("123");
294295
assertEquals(200, resp.getStatus());
295-
assertEquals(-32600, MAPPER.readTree(resp.getContentAsString()).get("error").get("code").asInt());
296+
assertEquals(-32600,
297+
MAPPER.readTree(resp.getContentAsString()).get("error").get("code").asInt());
296298
}
297299

298300
@Test
299301
public void primitiveRootString_returnsInvalidRequest() throws Exception {
300302
MockHttpServletResponse resp = doPost("\"hello\"");
301303
assertEquals(200, resp.getStatus());
302-
assertEquals(-32600, MAPPER.readTree(resp.getContentAsString()).get("error").get("code").asInt());
304+
assertEquals(-32600,
305+
MAPPER.readTree(resp.getContentAsString()).get("error").get("code").asInt());
303306
}
304307

305308
// --- Non-object element inside a batch → Invalid Request per element ---
@@ -362,7 +365,8 @@ public void excessivelyNestedRequest_returnsParseError() throws Exception {
362365

363366
MockHttpServletResponse resp = doPost(sb.toString());
364367
assertEquals(200, resp.getStatus());
365-
assertEquals(-32700, MAPPER.readTree(resp.getContentAsString()).get("error").get("code").asInt());
368+
assertEquals(-32700,
369+
MAPPER.readTree(resp.getContentAsString()).get("error").get("code").asInt());
366370
}
367371

368372
@Test
@@ -379,7 +383,8 @@ public void tooManyTokens_returnsParseError() throws Exception {
379383

380384
MockHttpServletResponse resp = doPost(sb.toString());
381385
assertEquals(200, resp.getStatus());
382-
assertEquals(-32700, MAPPER.readTree(resp.getContentAsString()).get("error").get("code").asInt());
386+
assertEquals(-32700,
387+
MAPPER.readTree(resp.getContentAsString()).get("error").get("code").asInt());
383388
}
384389

385390
// --- helpers ---

0 commit comments

Comments
 (0)