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