{"record":{"id":"0e05e7eccb647a35","repo":"openzipkin/zipkin","slug":"logger-null","errorCode":null,"errorMessage":"logger == null","messagePattern":"logger == null","errorType":"exception","errorClass":"NullPointerException","httpStatus":null,"severity":"warning","filePath":"zipkin-collector/core/src/main/java/zipkin2/collector/Collector.java","lineNumber":89,"sourceCode":"    /** Sets {@link {@link CollectorComponent.Builder#sampler(CollectorSampler)}} */\n    public Builder sampler(CollectorSampler sampler) {\n      if (sampler == null) throw new NullPointerException(\"sampler == null\");\n      this.sampler = sampler;\n      return this;\n    }\n\n    public Collector build() {\n      return new Collector(this);\n    }\n  }\n\n  final Logger logger;\n  final CollectorMetrics metrics;\n  final CollectorSampler sampler;\n  final StorageComponent storage;\n\n  Collector(Builder builder) {\n    if (builder.logger == null) throw new NullPointerException(\"logger == null\");\n    this.logger = builder.logger;\n    this.metrics = builder.metrics == null ? CollectorMetrics.NOOP_METRICS : builder.metrics;\n    if (builder.storage == null) throw new NullPointerException(\"storage == null\");\n    this.storage = builder.storage;\n    this.sampler = builder.sampler == null ? CollectorSampler.ALWAYS_SAMPLE : builder.sampler;\n  }\n\n  public void accept(List<Span> spans, Callback<Void> callback) {\n    accept(spans, callback, Runnable::run);\n  }\n\n  /**\n   * Calls to get the storage component could be blocking. This ensures requests that block\n   * callers (such as http or gRPC) do not add additional load during such events.\n   *\n   * @param executor the executor used to enqueue the storage request.\n   */\n  public void accept(List<Span> spans, Callback<Void> callback, Executor executor) {","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/openzipkin/zipkin/blob/878ce2a1fad54ca941d17fdcf2e1d924b148eb1f/zipkin-collector/core/src/main/java/zipkin2/collector/Collector.java#L71-L107","documentation":"Defensive re-check in Collector's package-private constructor: the builder's logger must not be null. In practice unreachable through Collector.newBuilder(Class) because that entry point creates the logger from a non-null class; the guard protects against future/alternate construction paths and bugs in the builder itself.","triggerScenarios":"Constructing Collector via a Builder obtained only through Collector.newBuilder(...) after nulling the logger reflectively, or a new entry point that skips logger initialization. Not reachable from normal public API use.","commonSituations":"Reflection/mocking frameworks (e.g. Mockito constructing with null fields); modified or forked builder code that loses the logger assignment.","solutions":["Use the public entry point Collector.newBuilder(YourCollectorClass.class) which always sets a logger.","If you forked the builder, ensure the logger field is final and set in the constructor."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Unreachable via public API; avoid reflective/mocked construction of Collector and use Collector.newBuilder(Class)."],"tags":["zipkin","java","collector","internal","logging"],"backgroundTag":null,"analyzedSha":"878ce2a1fad54ca941d17fdcf2e1d924b148eb1f","analyzedAt":"2026-08-14T15:17:09.895Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}