fix(gwc-core): srs equals(..) should allow one-directional aliases#1450
Merged
aaime merged 1 commit intoNov 24, 2025
Merged
Conversation
| Constructor<SRS> constructor = SRS.class.getDeclaredConstructor(int.class, List.class); | ||
| constructor.setAccessible(true); | ||
|
|
||
| return constructor.newInstance(epsgCode, aliases); |
Contributor
Author
There was a problem hiding this comment.
I'm using reflection here, because it simulates what the XML deserialization process is doing - invoking the private constructor without initializing the aliases list.
| SRS srs2 = createSRSWithReflection(3857); | ||
|
|
||
| Assert.assertEquals("Expect two alias SRS to be equal", srs1, srs2); | ||
| Assert.assertEquals("Expect two alias SRS to be equal", srs2, srs1); |
Contributor
Author
There was a problem hiding this comment.
This is the case that is failing in the current release
This was referenced Nov 24, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.