Here's my last week story. I was trying to debug an NPE, so I added the `notNull(` line in the follwing:
@PUT
@Path("/{rest}/path")
@LogBody
public Answer controllerMethod(
@PathParam("param1") UUID param1,
@ApiParam(required = true, value = "body") @NotNull @Valid Body1 body1) {
notNull(body1, "Annotations are a joke. This null value made it through reqired=true, NotNull, and Valid");
return service.serviceMethod(param1, body1);
}
And sure enough that line was hit:
2023-09-08T07:34:34,511 ${env:K8S_POD_IP} WARN org.eclipse.jetty.server.HttpChannel - /api/v3/service/rest/path
javax.servlet.ServletException: javax.servlet.ServletException: org.jboss.resteasy.spi.UnhandledException: java.lang.NullPointerException: Annotations are a joke. This null value made it through reqired=true, NotNull, and Valid
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:162) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927]
at org.eclipse.jetty.server.handler.StatisticsHandler.handle(StatisticsHandler.java:179) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927]
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927]
I just don't know what is to be done at this point. I don't know how the median Java programmer doesn't walk away after getting burned by this one.