{"record":{"id":"0679cd48786ecddf","repo":"eclipse-vertx/vert.x","slug":"invalid-null-value-passed-for-traffic-shaping-opti","errorCode":null,"errorMessage":"Invalid null value passed for traffic shaping options update","messagePattern":"Invalid null value passed for traffic shaping options update","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"vertx-core/src/main/java/io/vertx/core/net/impl/tcp/NetServerImpl.java","lineNumber":341,"sourceCode":"  public int sniEntrySize() {\n    return sslContextManager.sniEntrySize();\n  }\n\n  public Future<Boolean> updateSSLOptions(ServerSSLOptions options, boolean force) {\n    NetServerImpl server = actualServer;\n    if (server != null && server != this) {\n      return server.updateSSLOptions(options, force);\n    } else {\n      ContextInternal ctx = vertx.getOrCreateContext();\n      return sslContextProviderRef\n        .update(options, ctx, force)\n        .map(Objects::nonNull);\n    }\n  }\n\n  public Future<Boolean> updateTrafficShapingOptions(TrafficShapingOptions options) {\n    if (options == null) {\n      throw new IllegalArgumentException(\"Invalid null value passed for traffic shaping options update\");\n    }\n    NetServerImpl server = actualServer;\n    ContextInternal ctx = vertx.getOrCreateContext();\n    if (server == null) {\n      // Server not yet started\n      TrafficShapingOptions prev = this.config.getTrafficShapingOptions();\n      boolean updated = prev == null || !prev.equals(options);\n      this.config.setTrafficShapingOptions(options);\n      return ctx.succeededFuture(updated);\n    }\n    // Update the traffic shaping options only for the actual/main server\n    if (server != this) {\n      return server.updateTrafficShapingOptions(options);\n    } else {\n      Promise<Boolean> promise = ctx.promise();\n      ctx.emit(v -> updateTrafficShapingOptions(options, promise));\n      return promise.future();\n    }","sourceCodeStart":323,"sourceCodeEnd":359,"githubUrl":"https://github.com/eclipse-vertx/vert.x/blob/fb308bd8c3f12c79f4ae89bef67fadf6c80d036e/vertx-core/src/main/java/io/vertx/core/net/impl/tcp/NetServerImpl.java#L323-L359","documentation":"updateTrafficShapingOptions applies new channel traffic-shaping settings to a running (or starting) server; a null options object carries no update and is rejected. Vert.x throws IllegalArgumentException as an argument precondition. Passing an empty/default TrafficShapingOptions is fine — only null is invalid.","triggerScenarios":"Calling server.updateTrafficShapingOptions(null), typically when the options come from optional config or a map lookup that returned null.","commonSituations":"Config-driven traffic shaping where the shaping section is absent; a cache of options returning null on first load; generic update paths that forward arbitrary option objects.","solutions":["Only call the method with a non-null TrafficShapingOptions instance","Guard the call: if (options != null) server.updateTrafficShapingOptions(options)","Skip the update entirely when no shaping options are configured"],"exampleFix":"// before\nserver.updateTrafficShapingOptions(loadShapingOptions()); // IllegalArgumentException when null\n// after\nTrafficShapingOptions opts = loadShapingOptions();\nif (opts != null) {\n  server.updateTrafficShapingOptions(opts);\n}","handlingStrategy":"validation","validationCode":"if (options != null) {\n  server.updateTrafficShapingOptions(options);\n}","typeGuard":null,"tryCatchPattern":"try {\n  server.updateTrafficShapingOptions(options);\n} catch (IllegalArgumentException e) {\n  // options was null: skip or substitute defaults\n}","preventionTips":["Guard optional config values before passing them in","Use TrafficShapingOptions defaults instead of null when config is absent","Keep option construction in one place so null cannot leak through"],"tags":["vertx","traffic-shaping","illegal-argument","null"],"backgroundTag":"null-argument","analyzedSha":"fb308bd8c3f12c79f4ae89bef67fadf6c80d036e","analyzedAt":"2026-09-06T11:37:12.241Z","contentChangedAt":"2026-09-06T11:37:12.241Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}