Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on null body with non-nullable controller parameters. #8

Open
Foxcapades opened this issue Oct 14, 2022 · 0 comments
Open

Error on null body with non-nullable controller parameters. #8

Foxcapades opened this issue Oct 14, 2022 · 0 comments

Comments

@Foxcapades
Copy link
Member

Foxcapades commented Oct 14, 2022

If the controller is developed in kotlin and does not allow null parameters there is a server error on null request body.

The plugin should detect when the controller method parameter is non nullable and reject empty requests with a 400.

{
    "status": "server-error",
    "message": "Parameter specified as non-null is null: method org.veupathdb.service.mblast.query.controller.JobsController.postJobs, parameter entity",
    "requestId": "41kSB9ZqT9EtSnwGVzPNpP"
}
2022-10-14 11:57:42.389 [rid:41kSB] WARN  ErrorMapper:64 - Caught Exception: 
 java.lang.NullPointerException: Parameter specified as non-null is null: method org.veupathdb.service.mblast.query.controller.JobsController.postJobs, parameter entity
        at org.veupathdb.service.mblast.query.controller.JobsController.postJobs(JobsController.kt) ~[service.jar:2.0.0]
        at jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:577) ~[?:?]
        at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.java:52) ~[service.jar:2.0.0]
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:134) ~[service.jar:2.0.0]
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:177) ~[service.jar:2.0.0]
        at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:176) ~[service.jar:2.0.0]
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:81) ~[service.jar:2.0.0]
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:478) ~[service.jar:2.0.0]
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:400) ~[service.jar:2.0.0]
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:81) ~[service.jar:2.0.0]
        at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:255) ~[service.jar:2.0.0]
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:248) ~[service.jar:2.0.0]
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:244) ~[service.jar:2.0.0]
        at org.glassfish.jersey.internal.Errors.process(Errors.java:292) ~[service.jar:2.0.0]
        at org.glassfish.jersey.internal.Errors.process(Errors.java:274) ~[service.jar:2.0.0]
        at org.glassfish.jersey.internal.Errors.process(Errors.java:244) ~[service.jar:2.0.0]
        at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:265) ~[service.jar:2.0.0]
        at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:234) ~[service.jar:2.0.0]
        at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:684) ~[service.jar:2.0.0]
        at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:356) ~[service.jar:2.0.0]
        at org.glassfish.grizzly.http.server.HttpHandler$1.run(HttpHandler.java:190) ~[service.jar:2.0.0]
        at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:535) ~[service.jar:2.0.0]
        at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:515) ~[service.jar:2.0.0]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant