{"record":{"id":"3a6cefd0ae471392","repo":"apache/pulsar","slug":"pulsarserviceurlarray-contains-a-blank-value-at-in","errorCode":null,"errorMessage":"pulsarServiceUrlArray contains a blank value at index ","messagePattern":"pulsarServiceUrlArray contains a blank value at index ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"pulsar-client/src/main/java/org/apache/pulsar/client/impl/SameAuthParamsLookupAutoClusterFailover.java","lineNumber":364,"sourceCode":"            return this;\n        }\n\n        public Builder markTopicNotFoundAsAvailable(boolean markTopicNotFoundAsAvailable) {\n            sameAuthParamsLookupAutoClusterFailover.markTopicNotFoundAsAvailable = markTopicNotFoundAsAvailable;\n            return this;\n        }\n\n        public Builder pulsarServiceUrlArray(String[] pulsarServiceUrlArray) {\n            if (pulsarServiceUrlArray == null || pulsarServiceUrlArray.length == 0) {\n                throw new IllegalArgumentException(\"pulsarServiceUrlArray can not be empty\");\n            }\n            sameAuthParamsLookupAutoClusterFailover.pulsarServiceUrlArray = pulsarServiceUrlArray;\n            int pulsarServiceLen = pulsarServiceUrlArray.length;\n            HashSet<String> uniqueChecker = new HashSet<>();\n            for (int i = 0; i < pulsarServiceLen; i++) {\n                String pulsarService = pulsarServiceUrlArray[i];\n                if (StringUtils.isBlank(pulsarService)) {\n                    throw new IllegalArgumentException(\"pulsarServiceUrlArray contains a blank value at index \" + i);\n                }\n                if (pulsarService.startsWith(\"http\") || pulsarService.startsWith(\"HTTP\")) {\n                    throw new IllegalArgumentException(\"SameAuthParamsLookupAutoClusterFailover does not support HTTP\"\n                            + \" protocol pulsar service url so far.\");\n                }\n                if (!uniqueChecker.add(pulsarService)) {\n                    throw new IllegalArgumentException(\"pulsarServiceUrlArray contains duplicated value \"\n                            + pulsarServiceUrlArray[i]);\n                }\n            }\n            return this;\n        }\n\n        public SameAuthParamsLookupAutoClusterFailover build() {\n            String[] pulsarServiceUrlArray = sameAuthParamsLookupAutoClusterFailover.pulsarServiceUrlArray;\n            if (pulsarServiceUrlArray == null) {\n                throw new IllegalArgumentException(\"pulsarServiceUrlArray can not be empty\");\n            }","sourceCodeStart":346,"sourceCodeEnd":382,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-client/src/main/java/org/apache/pulsar/client/impl/SameAuthParamsLookupAutoClusterFailover.java#L346-L382","documentation":"Builder.pulsarServiceUrlArray iterates the given URLs and rejects any entry that is null/blank, reporting the offending index. Each cluster entry must be a real service URL for the probe to connect to.","triggerScenarios":"Passing an array containing null, \"\", or whitespace-only entries to pulsarServiceUrlArray, typically from an improperly parsed comma-separated list that yields empty strings (e.g. \"pulsar://a:6650,,pulsar://b:6650\").","commonSituations":"Trailing commas in a config list; YAML list items left empty; entries with only spaces after trimming failures; null entries from a partially initialized collection.","solutions":["Trim and filter out empty/null entries from the array before passing it to the builder.","Fix the source config so every listed cluster has a URL (remove stray commas/blank lines).","Validate the array yourself before calling the builder to get a clearer error message."],"exampleFix":"// before\nbuilder.pulsarServiceUrlArray(\"pulsar://a:6650,,pulsar://b:6650\".split(\",\"));\n\n// after\nString[] urls = Arrays.stream(\"pulsar://a:6650,,pulsar://b:6650\".split(\",\"))\n    .map(String::trim).filter(s -> !s.isEmpty()).toArray(String[]::new);\nbuilder.pulsarServiceUrlArray(urls);","handlingStrategy":"validation","validationCode":"String[] urls = Arrays.stream(raw.split(\",\"))\n    .map(String::trim).filter(s -> !s.isEmpty()).toArray(String[]::new);\nfor (int i = 0; i < urls.length; i++) {\n    if (urls[i] == null || urls[i].isBlank()) {\n        throw new IllegalArgumentException(\"Blank cluster URL at index \" + i);\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    builder.pulsarServiceUrlArray(urls);\n} catch (IllegalArgumentException e) {\n    log.error(\"Cluster URL list contains a blank entry: {}\", e.getMessage());\n    throw new ConfigurationException(e.getMessage(), e);\n}","preventionTips":["Always trim and filter entries after splitting comma-separated URL lists.","Ban trailing/leading commas in list-style config values.","Log the parsed URL array at DEBUG so blank entries are visible during setup."],"tags":["pulsar-client","configuration","validation","illegal-argument"],"backgroundTag":"invalid-config-value","analyzedSha":"820761864ed8e2a7d2e52dd9763ad2ae117c1395","analyzedAt":"2026-09-06T00:14:20.138Z","contentChangedAt":"2026-09-06T00:14:20.138Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}