{"record":{"id":"2e3a2d346f65aa2d","repo":"apache/dolphinscheduler","slug":"address-is-null","errorCode":null,"errorMessage":"address is null.","messagePattern":"address is null\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/BaseDataSourceParamDTO.java","lineNumber":60,"sourceCode":"\n    protected Integer port;\n\n    protected String database;\n\n    protected String userName;\n\n    protected String password;\n\n    protected Map<String, String> other;\n\n    /**\n     * extract the host and port from the address,\n     * then set it\n     * @param address address like 'jdbc:mysql://host:port' or 'jdbc:hive2://zk1:port,zk2:port,zk3:port'\n     */\n    public void setHostAndPortByAddress(String address) {\n        if (address == null) {\n            throw new IllegalArgumentException(\"address is null.\");\n        }\n        address = address.trim();\n\n        int doubleSlashIndex = address.indexOf(Constants.DOUBLE_SLASH);\n        // trim address like 'jdbc:mysql://host:port/xxx' ends with '/xxx'\n        int slashIndex = address.indexOf(Constants.SLASH, doubleSlashIndex + 2);\n        String hostPortString = slashIndex == -1 ? address.substring(doubleSlashIndex + 2)\n                : address.substring(doubleSlashIndex + 2, slashIndex);\n\n        ArrayList<String> hosts = new ArrayList<>();\n        String portString = null;\n        for (String hostPort : hostPortString.split(Constants.COMMA)) {\n            String[] parts = hostPort.split(Constants.COLON);\n            hosts.add(parts[0]);\n            if (portString == null && parts.length > 1)\n                portString = parts[1];\n        }\n        if (hosts.size() == 0 || portString == null) {","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/BaseDataSourceParamDTO.java#L42-L78","documentation":"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.","triggerScenarios":"Calling setHostAndPortByAddress(null), typically because the address field of the DTO/form was never populated before submission.","commonSituations":"Client-side form not sending the address field, programmatic DTO construction skipping address, plugin code calling this before address defaults are set.","solutions":["Set the address field before calling setHostAndPortByAddress","Guard the call with an address null/blank check","Construct the DTO via the standard form path that populates address"],"exampleFix":"// before\nparam.setHostAndPortByAddress(param.getAddress()); // address may be null\n// after\nif (StringUtils.isNotBlank(param.getAddress())) {\n  param.setHostAndPortByAddress(param.getAddress());\n}","handlingStrategy":"type-guard","validationCode":"if (address == null || address.trim().isEmpty()) { throw new IllegalArgumentException(\"address required\"); }","typeGuard":"boolean hasAddress = (String s) -> s != null && !s.trim().isEmpty();","tryCatchPattern":"try { dto.setHostAndPortByAddress(address); } catch (IllegalArgumentException e) { /* handle null/malformed address */ }","preventionTips":["Always populate the address field before DTO submission","Validate form fields client-side","Default the address when host/port are given directly"],"tags":["validation","null","datasource"],"backgroundTag":"null-argument","analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}