{"record":{"id":"a340f627283b369c","repo":"eclipse-vertx/vert.x","slug":"null-delegate-not-allowed-a340f6","errorCode":null,"errorMessage":"Null delegate not allowed","messagePattern":"Null delegate not allowed","errorType":"validation","errorClass":"NullPointerException","httpStatus":null,"severity":"error","filePath":"vertx-core/src/main/java/io/vertx/core/internal/http/HttpServerRequestWrapper.java","lineNumber":34,"sourceCode":"import io.vertx.core.net.NetSocket;\n\nimport java.util.Set;\n\n/**\n * A wrapper class that delegates all method calls to the {@link #delegate} instance.\n *\n * Implementing {@link HttpServerRequest} or extending {@link HttpServerRequestInternal} is not encouraged however if that is necessary,\n * implementations should favor extending this class to ensure minimum breakage when new methods are added to the interface.\n *\n * The delegate instance can be accessed using protected final {@link #delegate} field, any implemented method can be overridden.\n */\npublic class HttpServerRequestWrapper extends HttpServerRequestInternal {\n\n  protected final HttpServerRequestInternal delegate;\n\n  public HttpServerRequestWrapper(HttpServerRequestInternal delegate) {\n    if (delegate == null) {\n      throw new NullPointerException(\"Null delegate not allowed\");\n    }\n    this.delegate = delegate;\n  }\n\n  @Override\n  public HttpServerRequest exceptionHandler(Handler<Throwable> handler) {\n    return delegate.exceptionHandler(handler);\n  }\n\n  @Override\n  public HttpServerRequest handler(Handler<Buffer> handler) {\n    return delegate.handler(handler);\n  }\n\n  @Override\n  public HttpServerRequest pause() {\n    return delegate.pause();\n  }","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/eclipse-vertx/vert.x/blob/fb308bd8c3f12c79f4ae89bef67fadf6c80d036e/vertx-core/src/main/java/io/vertx/core/internal/http/HttpServerRequestWrapper.java#L16-L52","documentation":"Null guard in the HttpServerRequestWrapper constructor: the wrapped HttpServerRequest delegate passed in is null. The wrapper forwards every call to the delegate field, so a null delegate is rejected immediately with this generic sentinel.","triggerScenarios":"Thrown at vertx-core/src/main/java/io/vertx/core/internal/http/HttpServerRequestWrapper.java:34 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a non-null HttpServerRequest when constructing the wrapper","Guard wrapper creation sites for null requests"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fb308bd8c3f12c79f4ae89bef67fadf6c80d036e","analyzedAt":"2026-09-06T11:37:12.241Z","contentChangedAt":"2026-09-06T11:37:12.241Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}