apache/dolphinscheduler · error · IllegalArgumentException

address is null.

Error message

address is null.

What it means

A generic null-input guard, not a domain-specific failure: setHostAndPortByAddress throws IllegalArgumentException when the caller passes a null JDBC address string. It fires whenever a datasource processor or DTO consumer invokes this helper to derive host/port from an address but the address (typically taken from the datasource connection parameters) was never populated — i.e. the input at fault is a null `address` argument. Before throwing, no parsing occurs; the method only sets this.host/this.port after the guard, so a null here always aborts host/port derivation for the datasource connection.

Source

Thrown at dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/BaseDataSourceParamDTO.java:60

    protected Integer port;

    protected String database;

    protected String userName;

    protected String password;

    protected Map<String, String> other;

    /**
     * extract the host and port from the address,
     * then set it
     * @param address address like 'jdbc:mysql://host:port' or 'jdbc:hive2://zk1:port,zk2:port,zk3:port'
     */
    public void setHostAndPortByAddress(String address) {
        if (address == null) {
            throw new IllegalArgumentException("address is null.");
        }
        address = address.trim();

        int doubleSlashIndex = address.indexOf(Constants.DOUBLE_SLASH);
        // trim address like 'jdbc:mysql://host:port/xxx' ends with '/xxx'
        int slashIndex = address.indexOf(Constants.SLASH, doubleSlashIndex + 2);
        String hostPortString = slashIndex == -1 ? address.substring(doubleSlashIndex + 2)
                : address.substring(doubleSlashIndex + 2, slashIndex);

        ArrayList<String> hosts = new ArrayList<>();
        String portString = null;
        for (String hostPort : hostPortString.split(Constants.COMMA)) {
            String[] parts = hostPort.split(Constants.COLON);
            hosts.add(parts[0]);
            if (portString == null && parts.length > 1)
                portString = parts[1];
        }
        if (hosts.size() == 0 || portString == null) {

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Set the address field before calling setHostAndPortByAddress
  2. Guard the call with an address null/blank check
  3. Construct the DTO via the standard form path that populates address

Example fix

// before
param.setHostAndPortByAddress(param.getAddress()); // address may be null
// after
if (StringUtils.isNotBlank(param.getAddress())) {
  param.setHostAndPortByAddress(param.getAddress());
}
Defensive patterns

Strategy: type-guard

Validate before calling

if (address == null || address.trim().isEmpty()) { throw new IllegalArgumentException("address required"); }

Type guard

boolean hasAddress = (String s) -> s != null && !s.trim().isEmpty();

Try / catch

try { dto.setHostAndPortByAddress(address); } catch (IllegalArgumentException e) { /* handle null/malformed address */ }

Prevention

When it happens

Trigger: Calling setHostAndPortByAddress(null), typically because the address field of the DTO/form was never populated before submission.

Common situations: Client-side form not sending the address field, programmatic DTO construction skipping address, plugin code calling this before address defaults are set.

Related errors


AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06). Data as JSON: /api/errors/2e3a2d346f65aa2d. Report an issue: GitHub.