escapeChar="" causes StringIndexOutOfBoundsException

Description

Get records in this form (with escapeChar="") :

<csw:GetRecords xmlns:csw="http://www.opengis.net/cat/csw/2.0.2" xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dct="http://purl.org/dc/terms/" xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:gmi="http://www.isotc211.org/2005/gmi" xmlns:ows="http://www.opengis.net/ows" service="CSW" version="2.0.2" resultType="results" startPosition="1" maxRecords="6"><csw:Query typeNames="csw:Record"><csw:ElementSetName>full</csw:ElementSetName><csw:Constraint version="1.1.0"><ogc:Filter><ogcropertyIsLike wildCard="%" singleChar="_" escapeChar=""><ogcropertyName>csw:AnyText</ogcropertyName><ogc:Literal>test</ogc:Literal></ogcropertyIsLike></ogc:Filter></csw:Constraint></csw:Query></csw:GetRecords>

Causes an Exception :
ava.lang.StringIndexOutOfBoundsException: String index out of range: 0
at java.lang.String.charAt(String.java:658)
at org.geotools.filter.LikeToRegexConverter.<init>(LikeToRegexConverter.java:47)
at org.geotools.filter.LikeFilterImpl.getMatcher(LikeFilterImpl.java:199)
at org.geotools.filter.LikeFilterImpl.evaluate(LikeFilterImpl.java:407)
at org.geotools.filter.AndImpl.evaluate(AndImpl.java:44)
at org.geoserver.catalog.impl.DefaultCatalogFacade$1.apply(DefaultCatalogFacade.java:1193)
at org.geoserver.catalog.impl.DefaultCatalogFacade$1.apply(DefaultCatalogFacade.java:1189)
at com.google.common.collect.Iterators$7.computeNext(Iterators.java:647)
at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143)
at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138)
at org.geoserver.catalog.util.CloseableIteratorAdapter.hasNext(CloseableIteratorAdapter.java:47)
at org.geoserver.csw.store.internal.CatalogStoreFeatureIterator.nextLayer(CatalogStoreFeatureIterator.java:119)
at org.geoserver.csw.store.internal.CatalogStoreFeatureIterator.<init>(CatalogStoreFeatureIterator.java:98)
at org.geoserver.csw.store.internal.CatalogStoreFeatureCollection.openIterator(CatalogStoreFeatureCollection.java:68)
at org.geoserver.csw.feature.AbstractFeatureCollection.features(AbstractFeatureCollection.java:50)
at org.geoserver.csw.feature.AbstractFeatureCollection.size(AbstractFeatureCollection.java:346)
at org.geoserver.csw.store.AbstractCatalogStore.getRecordsCount(AbstractCatalogStore.java:145)
at org.geoserver.csw.GetRecords.run(GetRecords.java:105)

The request is valid but it fails.

Environment

None

Status

Assignee

Andrea Aime

Reporter

Lorenzo Natali

Triage

None

Fix versions

Affects versions

Components

Priority

Medium
Configure