Do not manually throw NullPointerException

This commit is contained in:
ghubstan 2022-05-17 10:05:01 -03:00
parent a6ab373079
commit 578d43f75c
No known key found for this signature in database
GPG key ID: E35592D6800A861E

View file

@ -27,6 +27,7 @@ import static bisq.daonode.web.jdk.handler.HandlerUtil.sendResponse;
import static bisq.daonode.web.jdk.handler.HandlerUtil.toJson;
import static bisq.daonode.web.jdk.handler.HandlerUtil.wrapErrorResponse;
import static bisq.daonode.web.jdk.handler.ResourcePathElement.PROOFOFBURN;
import static java.util.Objects.requireNonNull;
@ -49,8 +50,7 @@ public class RestHandler implements HttpHandler {
@Override
public void handle(HttpExchange httpExchange) throws IOException {
try {
if (httpExchange == null)
throw new NullPointerException("HttpExchange cannot be null.");
requireNonNull(httpExchange, "HttpExchange cannot be null.");
// Parse the request URI details here, and pass them to a new
// sub handler instance.