{"record":{"id":"342a8e3bc9e8b351","repo":"openzipkin/zipkin","slug":"consumerprops-is-empty","errorCode":null,"errorMessage":"consumerProps is empty","messagePattern":"consumerProps is empty","errorType":"validation","errorClass":"NullPointerException","httpStatus":null,"severity":"error","filePath":"zipkin-collector/pulsar/src/main/java/zipkin2/collector/pulsar/PulsarCollector.java","lineNumber":111,"sourceCode":"     * @param clientPropsMap Map<String, Object>\n     * @return Builder\n     * @see org.apache.pulsar.client.api.ClientBuilder#loadConf(Map)\n     */\n    public Builder clientProps(Map<String, Object> clientPropsMap) {\n      if (clientPropsMap.isEmpty()) throw new NullPointerException(\"clientProps is empty\");\n      clientProps.putAll(clientPropsMap);\n      return this;\n    }\n\n    /**\n     * Any properties set here will override the previous Pulsar consumer configuration.\n     *\n     * @param consumerPropsMap Map<String, Object>\n     * @return Builder\n     * @see org.apache.pulsar.client.api.ConsumerBuilder#loadConf(Map)\n     */\n    public Builder consumerProps(Map<String, Object> consumerPropsMap) {\n      if (consumerPropsMap.isEmpty()) throw new NullPointerException(\"consumerProps is empty\");\n      consumerProps.putAll(consumerPropsMap);\n      return this;\n    }\n  }\n\n  final Map<String, Object> clientProps, consumerProps;\n  final String topic;\n  final LazyPulsarInit lazyPulsarInit;\n\n  PulsarCollector(Builder builder) {\n    clientProps = builder.clientProps;\n    consumerProps = builder.consumerProps;\n    this.topic = builder.topic;\n    this.lazyPulsarInit = new LazyPulsarInit(builder);\n  }\n\n  @Override\n  public PulsarCollector start() {","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/openzipkin/zipkin/blob/878ce2a1fad54ca941d17fdcf2e1d924b148eb1f/zipkin-collector/pulsar/src/main/java/zipkin2/collector/pulsar/PulsarCollector.java#L93-L129","documentation":"PulsarCollector.Builder.consumerProps(Map) throws NullPointerException when the supplied map is empty. These props override the Pulsar consumer configuration via ConsumerBuilder.loadConf; an empty map is rejected as a no-op misconfiguration. As with clientProps, a null argument would NPE on isEmpty() before this message.","triggerScenarios":"Calling .consumerProps(Collections.emptyMap()) or with an empty map built from an absent config section.","commonSituations":"Dynamic config that constructs an overrides map and calls consumerProps unconditionally, even when no overrides were specified.","solutions":["Guard the call: if (map != null && !map.isEmpty()) builder.consumerProps(map)","Populate the map with actual intended overrides (e.g. subscriptionType, receiverQueueSize) or remove the call","Default optional config sections to null and only invoke the setter when present"],"exampleFix":"// before\nbuilder.consumerProps(buildConsumerOverrides(config)); // may return empty map\n\n// after\nMap<String, Object> overrides = buildConsumerOverrides(config);\nif (!overrides.isEmpty()) builder.consumerProps(overrides);","handlingStrategy":"type-guard","validationCode":"Map<String, Object> m = config.consumerProps();\nif (m != null && !m.isEmpty()) builder.consumerProps(m);","typeGuard":"static boolean isNonEmptyMap(Map<?, ?> m) { return m != null && !m.isEmpty(); }","tryCatchPattern":null,"preventionTips":["Only call consumerProps when you actually have overrides","Guard both null and empty — both fail"],"tags":["pulsar","zipkin","builder","validation","configuration"],"backgroundTag":null,"analyzedSha":"878ce2a1fad54ca941d17fdcf2e1d924b148eb1f","analyzedAt":"2026-08-14T15:17:09.895Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}