{"record":{"id":"99acf9db1a412287","repo":"pinpoint-apm/pinpoint","slug":"malformed-webhook-url","errorCode":null,"errorMessage":"Malformed webhook URL","messagePattern":"Malformed webhook URL","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"commons-server/src/main/java/com/navercorp/pinpoint/common/server/webhook/WebhookUrlValidator.java","lineNumber":97,"sourceCode":"\n        return uri.toString();\n    }\n\n    public static String validateSyntax(String url) {\n        return validateUriSyntax(url).toString();\n    }\n\n    private static URI validateUriSyntax(String url) {\n        if (url == null || url.isBlank()) {\n            throw new IllegalArgumentException(\"Webhook URL is required\");\n        }\n\n        final URI uri;\n\n        try {\n            uri = new URI(url).normalize().parseServerAuthority();\n        } catch (URISyntaxException e) {\n            throw new IllegalArgumentException(\"Malformed webhook URL\", e);\n        }\n\n        validateScheme(uri);\n        validateAuthority(uri);\n\n        return uri;\n    }\n\n    private static void validateScheme(URI uri) {\n        String scheme = uri.getScheme();\n        if (scheme == null) {\n            throw new IllegalArgumentException(\"Webhook URL scheme is required\");\n        }\n\n        String normalizedScheme = scheme.toLowerCase(Locale.ROOT);\n        if (!\"http\".equals(normalizedScheme) && !\"https\".equals(normalizedScheme)) {\n            throw new IllegalArgumentException(\"Webhook URL scheme must be http or https\");\n        }","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/commons-server/src/main/java/com/navercorp/pinpoint/common/server/webhook/WebhookUrlValidator.java#L79-L115","documentation":"WebhookUrlValidator.validateUriSyntax throws IllegalArgumentException (wrapping the original URISyntaxException) when the URL string cannot be parsed as a URI with a valid server authority, e.g. new URI(url).parseServerAuthority() fails. The URL is syntactically malformed.","triggerScenarios":"Passing strings like 'http:/missing-host', 'http://exa mple.com', 'http://[bad-ipv6', or any string with illegal characters/unbalanced brackets to validateSyntax/uri.","commonSituations":"Hand-edited webhook config with a typo; URL copied with stray spaces or unencoded characters; missing double slash after scheme; unencoded special characters like '|' or spaces in the URL.","solutions":["Fix the URL syntax: ensure scheme://host[:port]/path with legal characters","URL-encode special characters in path/query (e.g. spaces -> %20)","Use a URI builder or the original error message (getCause is URISyntaxException) to locate the offending character index"],"exampleFix":"// before\nvalidator.validateSyntax(\"http://example.com/my webhook\");\n// after\nvalidator.validateSyntax(\"http://example.com/my%20webhook\");","handlingStrategy":"validation","validationCode":"try { new java.net.URI(url).parseServerAuthority(); } catch (java.net.URISyntaxException e) { /* reject */ }","typeGuard":null,"tryCatchPattern":"try { WebhookUrlValidator.validateSyntax(url); } catch (IllegalArgumentException e) { Throwable cause = e.getCause(); if (cause instanceof URISyntaxException use) { log.error(\"bad URL at index {}\", use.getIndex()); } }","preventionTips":["URL-encode special characters before storing webhook URLs","Use a URI builder instead of string concatenation to compose URLs","Inspect URISyntaxException index in the cause to pinpoint the bad character"],"tags":["java","webhook","url","validation"],"backgroundTag":"invalid-url-format","analyzedSha":"744c3d3075e595656abb1ae331ad2c0e4c9eb996","analyzedAt":"2026-09-07T18:48:45.289Z","contentChangedAt":"2026-09-07T18:48:45.289Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}