{"record":{"id":"9cfe8cc600587c36","repo":"openzipkin/zipkin","slug":"clientprops-is-empty","errorCode":null,"errorMessage":"clientProps is empty","messagePattern":"clientProps is empty","errorType":"validation","errorClass":"NullPointerException","httpStatus":null,"severity":"error","filePath":"zipkin-collector/pulsar/src/main/java/zipkin2/collector/pulsar/PulsarCollector.java","lineNumber":98,"sourceCode":"      return this;\n    }\n\n    /** Specify the subscription name for this consumer. No default. */\n    public Builder subscriptionName(String subscriptionName) {\n      if (StringUtils.isNullOrEmpty(subscriptionName)) throw new NullPointerException(\"serviceUrl is null or empty\");\n      consumerProps.put(\"subscriptionName\", subscriptionName);\n      return this;\n    }\n\n    /**\n     * Any properties set here will override the previous Pulsar client configuration.\n     *\n     * @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","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/openzipkin/zipkin/blob/878ce2a1fad54ca941d17fdcf2e1d924b148eb1f/zipkin-collector/pulsar/src/main/java/zipkin2/collector/pulsar/PulsarCollector.java#L80-L116","documentation":"PulsarCollector.Builder.clientProps(Map) throws NullPointerException when the supplied map is empty (again an NPE type for what is really a validation failure). These props override the Pulsar client configuration via ClientBuilder.loadConf; passing an empty map is treated as a caller bug rather than a no-op. Note null is not explicitly checked here — a null map would throw NPE from isEmpty() instead.","triggerScenarios":"Calling .clientProps(new HashMap<>()) or .clientProps(emptyMap()) — e.g. loading an optional overrides section from config that came back empty.","commonSituations":"Config binding that always calls the setter when a section exists, even if the section has zero keys.","solutions":["Skip the clientProps() call when the map is empty: if (!map.isEmpty()) builder.clientProps(map)","If overrides are optional, guard at the call site rather than sending an empty map","Initialize config sections with sensible entries or remove them entirely"],"exampleFix":"// before\nbuilder.clientProps(config.getClientProps()); // empty map when section has no keys\n\n// after\nMap<String, Object> props = config.getClientProps();\nif (props != null && !props.isEmpty()) builder.clientProps(props);","handlingStrategy":"type-guard","validationCode":"Map<String, Object> m = config.clientProps();\nif (m != null && !m.isEmpty()) builder.clientProps(m);","typeGuard":"static boolean isNonEmptyMap(Map<?, ?> m) { return m != null && !m.isEmpty(); }","tryCatchPattern":null,"preventionTips":["Skip optional override setters for empty maps instead of calling them","Null is not safe either here — the map method NPEs on null via isEmpty()"],"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"}