{"record":{"id":"7518d9ab4f254762","repo":"openzipkin/zipkin","slug":"overrides-null","errorCode":null,"errorMessage":"overrides == null","messagePattern":"overrides == null","errorType":"exception","errorClass":"NullPointerException","httpStatus":null,"severity":"error","filePath":"zipkin-collector/kafka/src/main/java/zipkin2/collector/kafka/KafkaCollector.java","lineNumber":126,"sourceCode":"    }\n\n    /**\n     * By default, a consumer will be built from properties derived from builder defaults, as well\n     * as \"auto.offset.reset\" -> \"earliest\". Any properties set here will override the consumer\n     * config.\n     *\n     * <p>For example: Only consume spans since you connected by setting the below.\n     *\n     * <pre>{@code\n     * Map<String, String> overrides = new LinkedHashMap<>();\n     * overrides.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, \"latest\");\n     * builder.overrides(overrides);\n     * }</pre>\n     *\n     * @see org.apache.kafka.clients.consumer.ConsumerConfig\n     */\n    public final Builder overrides(Map<String, ?> overrides) {\n      if (overrides == null) throw new NullPointerException(\"overrides == null\");\n      properties.putAll(overrides);\n      return this;\n    }\n\n    @Override\n    public KafkaCollector build() {\n      return new KafkaCollector(this);\n    }\n\n    Builder() {\n      // Settings below correspond to \"New Consumer Configs\"\n      // https://kafka.apache.org/documentation/#newconsumerconfigs\n      properties.put(GROUP_ID_CONFIG, \"zipkin\");\n      properties.put(AUTO_OFFSET_RESET_CONFIG, \"earliest\");\n      properties.put(KEY_DESERIALIZER_CLASS_CONFIG, ByteArrayDeserializer.class.getName());\n      properties.put(VALUE_DESERIALIZER_CLASS_CONFIG, ByteArrayDeserializer.class.getName());\n    }\n  }","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/openzipkin/zipkin/blob/878ce2a1fad54ca941d17fdcf2e1d924b148eb1f/zipkin-collector/kafka/src/main/java/zipkin2/collector/kafka/KafkaCollector.java#L108-L144","documentation":"KafkaCollector.Builder.overrides(Map) throws NullPointerException when the map argument is null. Overrides let you replace any consumer config property (e.g. auto.offset.reset=latest) on top of the builder defaults; the guard is a simple null check before properties.putAll(overrides).","triggerScenarios":"Calling .overrides(null), or passing a Map field that was never initialized (common when overrides are optional and the config loader returns null for a missing section).","commonSituations":"Treating overrides as optional: a config binding produces null when no overrides are defined, and the caller forwards it unconditionally.","solutions":["Pass an empty map instead of null when no overrides are needed (an empty map is accepted; putAll is a no-op)","Guard the call: if (overrides != null) builder.overrides(overrides)","Fix the config loader to return an empty map by default"],"exampleFix":"// before\nbuilder.overrides(config.getKafkaOverrides()); // returns null when section absent\n\n// after\nbuilder.overrides(config.getKafkaOverrides() != null\n  ? config.getKafkaOverrides()\n  : Collections.emptyMap());","handlingStrategy":"type-guard","validationCode":"Map<String, ?> overrides = config.kafkaOverrides();\nif (overrides != null) builder.overrides(overrides);","typeGuard":"static boolean hasOverrides(Map<String, ?> m) { return m != null && !m.isEmpty(); }","tryCatchPattern":null,"preventionTips":["Treat overrides as optional: skip the setter instead of passing null","Make config loaders return empty maps, never null, for optional sections"],"tags":["kafka","zipkin","builder","null-check","configuration"],"backgroundTag":null,"analyzedSha":"878ce2a1fad54ca941d17fdcf2e1d924b148eb1f","analyzedAt":"2026-08-14T15:17:09.895Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}