flowable/flowable-engine · error · MalformedURLException

Path can not be null or empty. Syntax:

Error message

Path can not be null or empty. Syntax: 

What it means

The Flowable OSGi BAR URL handler (bar:) requires the URL path to point at the BAR deployment XML. openConnection validates the path before use and throws MalformedURLException when it is null or blank, appending the expected SYNTAX. This fails fast rather than producing a confusing NullPointerException from the inner URL constructor.

Solutions

  1. Ensure the bar: URL includes a valid path to the bar XML, e.g. bar:file:/path/to/deployment.bar.xml or bar:http://host/bar.xml
  2. Log/inspect the full URL before constructing it
  3. Null/empty-check the URL string before wrapping it in java.net.URL

Example fix

// before
URL url = new URL("bar:" + maybeNullPath);
// after
if (maybeNullPath == null || maybeNullPath.trim().isEmpty()) {
    throw new IllegalArgumentException("bar path is required");
}
URL url = new URL("bar:" + maybeNullPath);
Defensive patterns

Strategy: validation

Validate before calling

boolean validBarUrl(String u) {
    if (u == null || !u.startsWith("bar:")) return false;
    String path = u.substring(4);
    return path != null && !path.trim().isEmpty();
}

Try / catch

try {
    URLConnection conn = new URL(barUrl).openConnection();
} catch (MalformedURLException e) {
    throw new IllegalArgumentException("Invalid bar URL, expected " + SYNTAX + ": " + barUrl, e);
}

Prevention

When it happens

Trigger: Calling new URL("bar:...") or resolving a bar: URL whose path portion is null or whitespace-only, e.g. new URL("bar:") or new URL("bar: "), which then invokes BarURLHandler.openConnection.

Common situations: Malformed deployment descriptor references in OSGi manifests; string concatenation that dropped the actual bar XML location; programmatically constructed URLs missing the path component.

Understand the failure class

Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/29f3835029356ee8. Report an issue: GitHub.

Appendix: source

Thrown at modules/flowable-osgi/src/main/java/org/flowable/osgi/BarURLHandler.java:50

    private static final Logger LOGGER = LoggerFactory.getLogger(BarURLHandler.class);

    private static final String SYNTAX = "bar: bar-xml-uri";

    private URL barXmlURL;

    /**
     * Open the connection for the given URL.
     * 
     * @param url
     *            the url from which to open a connection.
     * @return a connection on the specified URL.
     * @throws IOException
     *             if an error occurs or if the URL is malformed.
     */
    @Override
    public URLConnection openConnection(URL url) throws IOException {
        if (url.getPath() == null || url.getPath().trim().length() == 0) {
            throw new MalformedURLException("Path can not be null or empty. Syntax: " + SYNTAX);
        }
        barXmlURL = new URL(url.getPath());

        LOGGER.debug("bar xml URL is: [{}]", barXmlURL);
        return new Connection(url);
    }

    public URL getBarXmlURL() {
        return barXmlURL;
    }

    public class Connection extends URLConnection {

        public Connection(URL url) {
            super(url);
        }

        @Override

View on GitHub (pinned to d6d39ce1c6)