{"record":{"id":"5cbb60374e7829ac","repo":"apache/incubator-seata","slug":"url-must-not-be-null-or-blank","errorCode":null,"errorMessage":"URL must not be null or blank","messagePattern":"URL must not be null or blank","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"common/src/main/java/org/apache/seata/common/util/HttpClientUtil.java","lineNumber":285,"sourceCode":"     * @param method HTTP method (GET, POST, PUT)\n     * @param eventType the class type for deserializing event data\n     * @param readTimeoutSeconds read timeout in seconds (0 = infinite)\n     * @param <T> the event data type\n     * @return a Watch instance for receiving SSE events\n     * @throws IOException if the request fails\n     * @throws IllegalArgumentException if the URL is null or blank\n     */\n    private static <T> SeataHttpWatch<T> watch(\n            String url,\n            Map<String, String> headers,\n            RequestBody requestBody,\n            String method,\n            Class<T> eventType,\n            int readTimeoutSeconds)\n            throws IOException {\n\n        if (StringUtils.isBlank(url)) {\n            throw new IllegalArgumentException(\"URL must not be null or blank\");\n        }\n\n        OkHttpClient client = createHttp2WatchClient(readTimeoutSeconds);\n        Request request = buildHttp2WatchRequest(url, headers, requestBody, method);\n        return SeataHttpWatch.createWatch(client, request, eventType);\n    }\n\n    public static <T> SeataHttpWatch<T> watch(\n            String url, Map<String, String> headers, Class<T> eventType, int readTimeoutSeconds) throws IOException {\n        return watch(url, headers, null, \"GET\", eventType, readTimeoutSeconds);\n    }\n\n    public static <T> SeataHttpWatch<T> watch(String url, Class<T> eventType, int readTimeoutSeconds)\n            throws IOException {\n        return watch(url, null, null, \"GET\", eventType, readTimeoutSeconds);\n    }\n\n    public static <T> SeataHttpWatch<T> watchPost(","sourceCodeStart":267,"sourceCodeEnd":303,"githubUrl":"https://github.com/apache/incubator-seata/blob/e01f97c6db397165050caa6764020410c2c8199a/common/src/main/java/org/apache/seata/common/util/HttpClientUtil.java#L267-L303","documentation":"HttpClientUtil.watch builds a long-lived HTTP/2 watch (SSE-style) connection for the given URL using OkHttp. Before creating the client it validates the URL and throws IllegalArgumentException when the URL is null, empty, or whitespace-only, because OkHttp would otherwise fail with a less clear error deep in the request builder.","triggerScenarios":"Calling HttpClientUtil.watch(url, headers, eventType, readTimeoutSeconds) (or the 5-arg overload with method/RequestBody) where url is null, \"\", or \"   \". Typically the URL was assembled from configuration that was never populated.","commonSituations":"registry/config server address missing from application.properties (e.g. seata.console URL or a watch endpoint property left blank), or a lookup returned null and was passed straight through.","solutions":["Set the missing URL property in configuration before starting the client","Null/blank-check the URL at the call site and fail fast with a clear config-key name","Log the resolved URL at startup to catch empty config early"],"exampleFix":"// before\nSeataHttpWatch<Event> w = HttpClientUtil.watch(url, headers, Event.class, 30);\n\n// after\nif (StringUtils.isBlank(url)) throw new IllegalStateException(\"watch url missing: check 'seata.watch.url' config\");\nSeataHttpWatch<Event> w = HttpClientUtil.watch(url, headers, Event.class, 30);","handlingStrategy":"validation","validationCode":"if (StringUtils.isBlank(watchUrl)) throw new ConfigurationException(\"watch URL not configured\");\nSeataHttpWatch<T> w = HttpClientUtil.watch(watchUrl, headers, eventType, timeout);","typeGuard":null,"tryCatchPattern":"try { watch = HttpClientUtil.watch(url, headers, type, t); } catch (IllegalArgumentException e) { log.error(\"watch URL invalid: {}\", url); throw e; }","preventionTips":["Fail startup fast when URL-bearing properties are blank","Log the fully assembled watch URL during initialization","Centralize URL building in one config-checked factory method"],"tags":["http","okhttp","config","validation"],"backgroundTag":null,"analyzedSha":"e01f97c6db397165050caa6764020410c2c8199a","analyzedAt":"2026-08-14T10:23:53.097Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}