openzipkin/zipkin · error · NullPointerException

clientProps is empty

Error message

clientProps is empty

What it means

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.

Source

Thrown at zipkin-collector/pulsar/src/main/java/zipkin2/collector/pulsar/PulsarCollector.java:98

      return this;
    }

    /** Specify the subscription name for this consumer. No default. */
    public Builder subscriptionName(String subscriptionName) {
      if (StringUtils.isNullOrEmpty(subscriptionName)) throw new NullPointerException("serviceUrl is null or empty");
      consumerProps.put("subscriptionName", subscriptionName);
      return this;
    }

    /**
     * Any properties set here will override the previous Pulsar client configuration.
     *
     * @param clientPropsMap Map<String, Object>
     * @return Builder
     * @see org.apache.pulsar.client.api.ClientBuilder#loadConf(Map)
     */
    public Builder clientProps(Map<String, Object> clientPropsMap) {
      if (clientPropsMap.isEmpty()) throw new NullPointerException("clientProps is empty");
      clientProps.putAll(clientPropsMap);
      return this;
    }

    /**
     * Any properties set here will override the previous Pulsar consumer configuration.
     *
     * @param consumerPropsMap Map<String, Object>
     * @return Builder
     * @see org.apache.pulsar.client.api.ConsumerBuilder#loadConf(Map)
     */
    public Builder consumerProps(Map<String, Object> consumerPropsMap) {
      if (consumerPropsMap.isEmpty()) throw new NullPointerException("consumerProps is empty");
      consumerProps.putAll(consumerPropsMap);
      return this;
    }
  }

View on GitHub (pinned to 878ce2a1fa)

Solutions

  1. Skip the clientProps() call when the map is empty: if (!map.isEmpty()) builder.clientProps(map)
  2. If overrides are optional, guard at the call site rather than sending an empty map
  3. Initialize config sections with sensible entries or remove them entirely

Example fix

// before
builder.clientProps(config.getClientProps()); // empty map when section has no keys

// after
Map<String, Object> props = config.getClientProps();
if (props != null && !props.isEmpty()) builder.clientProps(props);
Defensive patterns

Strategy: type-guard

Validate before calling

Map<String, Object> m = config.clientProps();
if (m != null && !m.isEmpty()) builder.clientProps(m);

Type guard

static boolean isNonEmptyMap(Map<?, ?> m) { return m != null && !m.isEmpty(); }

Prevention

When it happens

Trigger: Calling .clientProps(new HashMap<>()) or .clientProps(emptyMap()) — e.g. loading an optional overrides section from config that came back empty.

Common situations: Config binding that always calls the setter when a section exists, even if the section has zero keys.

Related errors


AI-assisted analysis of openzipkin/zipkin@878ce2a1fa (2026-08-14). Data as JSON: /api/errors/9cfe8cc600587c36. Report an issue: GitHub.