fix(gwc-core): srs equals(..) should allow one-directional aliases #1450
+75
−5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
SRS comparison bug is leading to missing bounding box in WMTS capabilities in GeoServer.
Replication
I've created a Gridset using the GeoServer GWC REST API and assigned it to my layer in GeoServer. Now I view my layer capabilities, and there's no WGS84BoundingBox associated with the layer. Assigning a standard WebMercatorGrid resolves the issue, but I don't want that gridset.
Why it happens
This seems to happen because TileLayer#getGridSubsetForSRS(..) can't locate a gridset that's using EPSG:900913 or EPSG:4326 on my layer. Except I have my gridset defined as EPSG:3857, which is an alias of EPSG:900913. A bug in the comparison code seems to be preventing it from accepting EPSG:3857 as an alias!
Normally, this is fine because SRS is accessed using the static method SRS.getSRS(..) which looks it up in a cache. Unfortunately, during XML deserialization, I believe the private constructor is being invoked. That leaves
aliasesas null, which broke the comparison logic.Alternative fixes might include initializing the aliases to an empty list, or adding a SRS-specific deserializer.