{"record":{"id":"d2e0f3762e8f0610","repo":"apache/incubator-seata","slug":"ip-and-port-string-cannot-be-empty","errorCode":null,"errorMessage":"ip and port string cannot be empty!","messagePattern":"ip and port string cannot be empty!","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"common/src/main/java/org/apache/seata/common/util/NetUtil.java","lineNumber":134,"sourceCode":"     * @return the inet socket address\n     */\n    public static InetSocketAddress toInetSocketAddress(String address) {\n        String[] ipPortStr = splitIPPortStr(address);\n        String host;\n        int port;\n        if (null != ipPortStr) {\n            host = ipPortStr[0];\n            port = Integer.parseInt(ipPortStr[1]);\n        } else {\n            host = address;\n            port = 0;\n        }\n        return new InetSocketAddress(host, port);\n    }\n\n    public static String[] splitIPPortStr(String address) {\n        if (StringUtils.isBlank(address)) {\n            throw new IllegalArgumentException(\"ip and port string cannot be empty!\");\n        }\n        if (address.charAt(0) == '[') {\n            address = removeBrackets(address);\n        }\n        int i = address.lastIndexOf(Constants.IP_PORT_SPLIT_CHAR);\n        if (i > -1) {\n            String hostAddress = address.substring(0, i);\n            if (hostAddress.contains(\"%\")) {\n                hostAddress = hostAddress.substring(0, hostAddress.indexOf(\"%\"));\n            }\n            String portStr = address.substring(i + 1);\n            if (StringUtils.isBlank(hostAddress) || StringUtils.isBlank(portStr)) {\n                throw new IllegalArgumentException(\n                        \"Invalid endpoint format: \" + address + \". Endpoint should be in the format ip:port.\");\n            }\n            try {\n                int port = Integer.parseInt(portStr);\n                if (port < 1 || port > 65535) {","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/apache/incubator-seata/blob/e01f97c6db397165050caa6764020410c2c8199a/common/src/main/java/org/apache/seata/common/util/NetUtil.java#L116-L152","documentation":"NetUtil.splitIPPortStr parses an \"ip:port\" (or \"[ipv6]:port\") address string. It rejects a null, empty, or whitespace-only address with IllegalArgumentException because there is nothing to split into host and port. Callers such as toInetSocketAddress rely on it for address parsing.","triggerScenarios":"Calling NetUtil.splitIPPortStr(address), toInetSocketAddress(address), or toLong(address) with a blank string — usually a registry/group address property (e.g. 127.0.0.1:8091 style value) that was never set or resolved to empty.","commonSituations":"Missing grouplist/registry address in seata config (e.g. service.default.grouplist left blank), or a config lookup returning \"\" that is passed straight into address parsing.","solutions":["Populate the address property with a valid host:port, e.g. 127.0.0.1:8091","Check for blank address before parsing and report which config key is empty","Log all resolved addresses at startup"],"exampleFix":"// before\nInetSocketAddress addr = NetUtil.toInetSocketAddress(address);\n\n// after\nif (StringUtils.isBlank(address)) throw new IllegalStateException(\"address not configured (check grouplist/registry config)\");\nInetSocketAddress addr = NetUtil.toInetSocketAddress(address);","handlingStrategy":"validation","validationCode":"if (StringUtils.isBlank(address)) throw new ConfigurationException(\"address is blank; check registry/grouplist config\");\nNetUtil.splitIPPortStr(address);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Assert address properties are non-blank at startup","Log every parsed address once at boot","Use config validation (schema or boot-time checks) for host:port properties"],"tags":["network","address-parsing","config","validation"],"backgroundTag":null,"analyzedSha":"e01f97c6db397165050caa6764020410c2c8199a","analyzedAt":"2026-08-14T10:23:53.097Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}