{"record":{"id":"b18f7d8a6d2ba915","repo":"flowable/flowable-engine","slug":"malformed-url-url-b18f7d","errorCode":null,"errorMessage":"malformed url: ${url}","messagePattern":"malformed url: (.+?)","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/parser/EventDefinitionParse.java","lineNumber":131,"sourceCode":"\n    public EventDefinitionParse setSourceSystemId(String sourceSystemId) {\n        this.sourceSystemId = sourceSystemId;\n        return this;\n    }\n\n    public EventDefinitionParse sourceUrl(URL url) {\n        if (name == null) {\n            name(url.toString());\n        }\n        setStreamSource(new UrlStreamSource(url));\n        return this;\n    }\n\n    public EventDefinitionParse sourceUrl(String url) {\n        try {\n            return sourceUrl(new URL(url));\n        } catch (MalformedURLException e) {\n            throw new FlowableException(\"malformed url: \" + url, e);\n        }\n    }\n\n    public EventDefinitionParse sourceResource(String resource) {\n        if (name == null) {\n            name(resource);\n        }\n        setStreamSource(new ResourceStreamSource(resource));\n        return this;\n    }\n\n    public EventDefinitionParse sourceString(String string) {\n        if (name == null) {\n            name(\"string\");\n        }\n        setStreamSource(new StringStreamSource(string));\n        return this;\n    }","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/parser/EventDefinitionParse.java#L113-L149","documentation":"EventDefinitionParse.sourceUrl(String) converts the given string into a java.net.URL to use as the parse source. If the string is not a well-formed URL (bad protocol syntax, illegal characters, unknown scheme), java.net.URL throws MalformedURLException, which is rethrown as a FlowableException with the offending url in the message.","triggerScenarios":"Calling EventDefinitionParse.sourceUrl(String) with a string that fails new URL(url) parsing: missing protocol (e.g. 'resources/events.json'), typos in scheme ('http:/'), spaces or other illegal characters, or an unsupported scheme.","commonSituations":"Hardcoded resource paths passed instead of URLs; environment-specific config where a base URL is empty or mis-concatenated; users confusing sourceResource (classpath/file resource) with sourceUrl.","solutions":["Fix the url string to be a fully valid absolute URL, e.g. add the scheme: 'https://host/path' instead of 'host/path'","If you meant a classpath/file resource, use sourceResource(resource) instead of sourceUrl(url)","Pre-validate with try { new URL(url); } catch (MalformedURLException e) { ... } and log the reason","URL-encode illegal characters (spaces -> %20) before passing"],"exampleFix":"// before\nparse.sourceUrl(\"events/order-event.json\");\n// after\nparse.sourceResource(\"events/order-event.json\");\n// or a valid URL:\nparse.sourceUrl(\"https://config.example.com/events/order-event.json\");","handlingStrategy":"validation","validationCode":"boolean isValidUrl(String s) {\n    if (s == null) return false;\n    try { new java.net.URL(s); return true; } catch (java.net.MalformedURLException e) { return false; }\n}","typeGuard":"boolean isUsableUrl(String s) { return s != null && s.matches(\"^[a-zA-Z][a-zA-Z0-9+.-]*:.*\"); }","tryCatchPattern":"try {\n    parse.sourceUrl(url);\n} catch (org.flowable.common.engine.api.FlowableException e) {\n    throw new IllegalArgumentException(\"Not a valid URL: \" + url, e);\n}","preventionTips":["Prefer sourceResource for classpath/file resources; reserve sourceUrl for real http(s)/file URLs","Always include the scheme in URL strings","Validate URLs in configuration at startup, not at parse time"],"tags":["java","event-registry","url-parsing"],"backgroundTag":"invalid-url-format","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}