UrlParamsChangedEvent handling of getOrDefault() produces error

Hello,

I might just need some help in the right direction, as there’s not much documentation on the UrlParamsChangedEvent handler.

I’ve got a route set on a browse screen and a UrlParamsChangedEvent set to handle expected parameters when routed to from an external source. When extracting the parameters, if one parameter value is empty, I receive the following error:

Unable to extract params from the given params string: "customerName=Testing&customerNumber=11223344&locationId="

This is the event handler that produced that error:

    @Subscribe
    public void onUrlParamsChanged(UrlParamsChangedEvent event) {
        event.getSource().addAfterShowListener(afterShowEvent -> {
            String customerNumber = event.getParams().get("customerNumber");
            String customerName = event.getParams().get("customerName");
            String locationId = event.getParams().getOrDefault("locationId", null);

            // do stuff
        });
    }

getOrDefault() includes the following in the IDE:

Returns the value to which the specified key is mapped, or defaultValue if this map contains no mapping for the key.

From this, I need to know how to handle the absence of a value in the query string parameters. Will this always fail, or is this a bug? The wording leaves me unsure if this is a bug or if Jmix simply cannot even attempt to parse the absence of a value, which I need it to do.

Thanks in advance!
Adam

I see in UrlTools.java, in parseParamsRoute, it will fail when the pattern doesn’t match:

    @Nullable
    protected NavigationState parseParamsRoute(String uriFragment) {
        Matcher matcher = PARAMS_ROUTE_PATTERN.matcher(uriFragment);
        if (!matcher.matches()) {
            return null;
        }

        String root = matcher.group(1);
        String stateMark;
        String nestedRoute;
        String params = matcher.group(matcher.groupCount());

        if (matcher.groupCount() == 3) {
            stateMark = "";
            nestedRoute = matcher.group(2);
        } else {
            stateMark = matcher.group(2);
            nestedRoute = matcher.group(3);
        }

        return new NavigationState(root, stateMark, nestedRoute, extractParams(params));
    }

It looks like my only solution is to force a dummy value when no value exists. I think this is the only way. Do you agree?

Thanks,
Adam