I am trying to build a dynamic url for a PointSymbolizer:
/api/icons?foo=${strUrlEncode("foo")}&bar=${strUrlEncode("bar")}
The problem I am running into is that the strUrlEncode
will return null if the "foo"
property is null
. When that happens I get the following exception:
DEBUG [function.string] - Failed to concatenate string in Concatenate function
java.lang.NullPointerException
at java.net.URLEncoder.encode(URLEncoder.java:204)
at org.geotools.filter.function.string.URLEncodeFunction.evaluate(URLEncodeFunction.java:87)
at org.geotools.filter.expression.ExpressionAbstract.evaluate(ExpressionAbstract.java:45)
at org.geotools.filter.function.string.ConcatenateFunction.evaluate(ConcatenateFunction.java:66)
at org.geotools.filter.expression.ExpressionAbstract.evaluate(ExpressionAbstract.java:45)
I imagine that is happening because the result of my first strUrlEncode
(which is null) is being concatenated to the second parameter.
Is there any way I can provide a default non-null value in a case where foo
is null
to avoid the NPE?