Refactor Json to JsonMapper, update Gradle to 9.5.1, and set Java 26 toolchain.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
package dev.coph.nextusweb.server.router;
|
||||
|
||||
import dev.coph.nextusweb.server.json.Json;
|
||||
import dev.coph.nextusweb.server.json.JsonMapper;
|
||||
import dev.coph.nextusweb.server.router.exception.BadRequestException;
|
||||
import io.netty.handler.codec.http.*;
|
||||
import io.netty.util.CharsetUtil;
|
||||
@@ -54,9 +54,9 @@ public final class Request {
|
||||
byte[] bytes = new byte[raw.content().readableBytes()];
|
||||
raw.content().getBytes(raw.content().readerIndex(), bytes);
|
||||
if (bytes.length == 0) {
|
||||
jsonCache = Json.MAPPER.nullNode();
|
||||
jsonCache = JsonMapper.MAPPER.nullNode();
|
||||
} else {
|
||||
jsonCache = Json.MAPPER.readTree(bytes);
|
||||
jsonCache = JsonMapper.MAPPER.readTree(bytes);
|
||||
}
|
||||
} catch (JacksonException e) {
|
||||
throw new BadRequestException("Invalid JSON: " + e.getOriginalMessage());
|
||||
@@ -69,7 +69,7 @@ public final class Request {
|
||||
try {
|
||||
byte[] bytes = new byte[raw.content().readableBytes()];
|
||||
raw.content().getBytes(raw.content().readerIndex(), bytes);
|
||||
return Json.MAPPER.readValue(bytes, type);
|
||||
return JsonMapper.MAPPER.readValue(bytes, type);
|
||||
} catch (JacksonException e) {
|
||||
throw new BadRequestException(
|
||||
"Could not deserialize body as " + type.getSimpleName() + ": " + e.getOriginalMessage());
|
||||
|
||||
Reference in New Issue
Block a user