Skip to content

Fix attribute parsing for missing required attributes and address code review feedback#3984

Merged
sbrunner merged 11 commits intofix/scalebar-wmts-epsg-3857from
copilot/sub-pr-3981
Feb 12, 2026
Merged

Fix attribute parsing for missing required attributes and address code review feedback#3984
sbrunner merged 11 commits intofix/scalebar-wmts-epsg-3857from
copilot/sub-pr-3981

Conversation

Copy link

Copilot AI commented Feb 11, 2026

Fix ClusteredMapPrinterServletTest.testCreateReport_Failure

  • Investigate the test failure
  • Understand root cause - OneOf validation failing on missing attributes with empty defaults
  • Fix ReflectiveAttribute.getValue() to throw ObjectMissingException for missing attributes
  • Address code review comments from PR reviews
  • Run final code review and address feedback
  • Run security scan - no issues found
  • Fix build error - type mismatch in ObjectMissingException call
  • Fix test failures caused by code review changes
  • Fix floating-point precision tolerance in geodetic median test

Changes Summary

Test Failure Fix (commits 4c5b3d8, 22258b0, 88ca4c9, 1472533, b2a8240)

  • Fixed attribute parsing when an attribute is missing from the request but defined in the template
  • Only throws ObjectMissingException for attributes with OneOf constraints to avoid breaking optional attributes
  • This provides clearer error messages about missing required map bounds
  • Fixed type mismatch by casting PObject to PElement as required by ObjectMissingException constructor

Code Review Fixes (commit 22258b0)

  • Fixed BBoxMapBounds.zoomToScale to propagate useGeodeticCalculations flag
  • Fixed WMTS computeExtraScalingFactor to use geographic CRS (EPSG:4326) and map center coordinates
  • Fixed spelling errors in comments (degress → degrees, geowidith → geoWidth)
  • Fixed test name typo (Widthout → Without)
  • Fixed computeGeodeticBBoxInPseudoMercator to use destination positions instead of linear distance calculations
  • Fixed computeGeodeticWidthInInches to construct calculator with CRS matching the coordinates
  • Fixed isPseudoMercator to safely handle missing CRS identifiers and use case-insensitive name matching

Test Updates (commits b2a8240, latest)

  • Updated Y coordinate expectations in CenterScaleMapBoundsTest and BBoxMapBoundsTest to match the more accurate geodetic calculations
  • Updated GenericMapAttributeTest to expect 17 fields (added useGeodeticCalculations field)
  • Increased tolerance for median coordinate comparison to account for improved geodetic precision

All changes maintain backward compatibility while improving accuracy of Web Mercator calculations and error handling.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits February 11, 2026 14:05
When an attribute is missing from the request and has an empty default value,
throw ObjectMissingException instead of trying to parse with empty object.
This prevents OneOf validation errors on missing required attributes.

Co-authored-by: sbrunner <353872+sbrunner@users.noreply.github.com>
- Fix BBoxMapBounds.zoomToScale to propagate useGeodeticCalculations flag
- Fix WMTS computeExtraScalingFactor to use geographic CRS and map center
- Fix spelling errors in comments (degrees, geoWidth)
- Fix test name typo (Widthout → Without)
- Fix computeGeodeticBBoxInPseudoMercator to use destination positions
- Fix computeGeodeticWidthInInches to match calculator CRS with coordinates
- Fix isPseudoMercator to handle missing identifiers and be case-insensitive

Co-authored-by: sbrunner <353872+sbrunner@users.noreply.github.com>
Add detailed comment explaining why ObjectMissingException is thrown for
empty default values, clarifying the rationale for the framework.

Co-authored-by: sbrunner <353872+sbrunner@users.noreply.github.com>
Copy link
Author

Copilot AI commented Feb 11, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • jaspersoft.jfrog.io
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED --add-opens=java.base/java.time=ALL-UNNAMED -Xms4G -Xmx6G -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en (dns block)
    • Triggering command: /usr/lib/jvm/temurin-21-jdk-amd64/bin/java /usr/lib/jvm/temurin-21-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED --add-opens=java.base/java.time=ALL-UNNAMED -Xms4G -Xmx6G -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en (dns block)
  • www.puppycrawl.com
    • Triggering command: /opt/hostedtoolcache/CodeQL/2.24.0/x64/codeql/tools/linux64/java/bin/java /opt/hostedtoolcache/CodeQL/2.24.0/x64/codeql/tools/linux64/java/bin/java -jar /opt/hostedtoolcache/CodeQL/2.24.0/x64/codeql/xml/tools/xml-extractor.jar --fileList=/home/REDACTED/work/mapfish-print/.codeql-scratch/dbs/java/working/files-to-index12785245670076633356.list --sourceArchiveDir=/home/REDACTED/work/mapfish-print/.codeql-scratch/dbs/java/src --outputDir=/home/REDACTED/work/mapfish-print/.codeql-scratch/dbs/java/trap/java r = get &amp;&amp; echo &#34;******&#34;; }; f (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Introduce PseudoMercatorUtils for accurate Web Mercator handling Fix attribute parsing for missing required attributes and address code review feedback Feb 11, 2026
Copilot AI requested a review from sbrunner February 11, 2026 14:13
From the artifact of the previous workflow run
@sbrunner
Copy link
Member

@copilot your last commit generated this build error:

#19 35.82   /src/core/src/main/java/org/mapfish/print/attribute/ReflectiveAttribute.java:451: error: incompatible types: PObject cannot be converted to PElement
#19 35.82           throw new ObjectMissingException(requestJsonAttributes, attributeName);
#19 35.82                                            ^

Cast requestJsonAttributes to PElement as required by ObjectMissingException
constructor. All PObject implementations extend PAbstractObject which extends
PElement, so the cast is safe.

Co-authored-by: sbrunner <353872+sbrunner@users.noreply.github.com>
Copy link
Author

Copilot AI commented Feb 11, 2026

@copilot your last commit generated this build error:

#19 35.82   /src/core/src/main/java/org/mapfish/print/attribute/ReflectiveAttribute.java:451: error: incompatible types: PObject cannot be c...

Fixed in commit 1472533. The issue was that ObjectMissingException constructor expects a PElement parameter, but requestJsonAttributes is typed as PObject (interface). Since all PObject implementations extend PAbstractObject which extends PElement, I added a cast to PElement which is safe.

@sbrunner
Copy link
Member

sbrunner commented Feb 11, 2026

@copilot Fix those tests:


BBoxMapBoundsTest > testAdjustToScaleInSphericalMercatorProjectionWidthGeodeticCalculations() FAILED
   org.opentest4j.AssertionFailedError: expected: <4721167.0> but was: <4721130.878126721>
       at app//org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:158)
       at app//org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:139)
       at app//org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:201)
       at app//org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:88)
       at app//org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:83)
       at app//org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1052)
       at app//org.mapfish.print.attribute.map.BBoxMapBoundsTest.testAdjustToScaleInSphericalMercatorProjectionWidthGeodeticCalculations(BBoxMapBoundsTest.java:213)
CenterScaleMapBoundsTest > testToReferencedEnvelopeSphericalMercatorProjectionWidthGeodeticCalculation() FAILED
   org.opentest4j.AssertionFailedError: expected: <4721167.0> but was: <4721130.878126721>
       at app//org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:158)
       at app//org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:139)
       at app//org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:201)
       at app//org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:88)
       at app//org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:83)
       at app//org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1052)
       at app//org.mapfish.print.attribute.map.CenterScaleMapBoundsTest.testToReferencedEnvelopeSphericalMercatorProjectionWidthGeodeticCalculation(CenterScaleMapBoundsTest.java:101)
GenericMapAttributeTest > testPrintClientConfig() FAILED
   org.opentest4j.AssertionFailedError: {
     "optionalEmbedded": {
       "default": null,
       "type": "EmbeddedTestAttribute",
       "embeddedType": {"embeddedElem": {"type": "boolean"}}
     },
     "pArray": {"type": "array"},
     "rotation": {
       "default": null,
       "type": "double"
     },
     "requiredElem": {"type": "int"},
     "useNearestScale": {
       "default": null,
       "type": "boolean"
     },
     "dpiSensitiveStyle": {
       "default": true,
       "type": "boolean"
     },
     "useGeodeticCalculations": {
       "default": false,
       "type": "boolean"
     },
     "useAdjustBounds": {
       "default": null,
       "type": "boolean"
     },
     "pObject": {"type": "object"},
     "requiredArray": {
       "isArray": true,
       "type": "int"
     },
     "width": {
       "default": null,
       "type": "int"
     },
     "longitudeFirst": {
       "default": null,
       "type": "boolean"
     },
     "projection": {
       "default": null,
       "type": "String"
     },
     "pdfA": {
       "default": null,
       "type": "boolean"
     },
     "embedded": {
       "type": "EmbeddedTestAttribute",
       "embeddedType": {"embeddedElem": {"type": "boolean"}}
     },
     "optionalArray": {
       "default": [
         1,
         2
       ],
       "isArray": true,
       "type": "int"
     },
     "height": {
       "default": null,
       "type": "int"
     }
   } ==> expected: <16> but was: <17>
       at app//org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:158)
       at app//org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:139)
       at app//org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:201)
       at app//org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:152)
       at app//org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:590)
       at app//org.mapfish.print.attribute.map.GenericMapAttributeTest.testPrintClientConfig(GenericMapAttributeTest.java:50)
OverviewMapAttributeTest > testAttributesFromYaml() FAILED
   org.mapfish.print.wrapper.ObjectMissingException: attribute [spec.attributes.overviewMap] missing
       at app//org.mapfish.print.attribute.ReflectiveAttribute.getValue(ReflectiveAttribute.java:451)
       at app//org.mapfish.print.output.Values.populateFromAttributes(Values.java:225)
       at app//org.mapfish.print.output.Values.<init>(Values.java:173)
       at app//org.mapfish.print.output.Values.<init>(Values.java:108)
       at app//org.mapfish.print.attribute.map.OverviewMapAttributeTest.testAttributesFromYaml(OverviewMapAttributeTest.java:85)
       
AddBackgroundLayersTest > testExecute() FAILED
   org.mapfish.print.wrapper.ObjectMissingException: attribute [spec.attributes.overviewMap] missing
       at app//org.mapfish.print.attribute.ReflectiveAttribute.getValue(ReflectiveAttribute.java:451)
       at app//org.mapfish.print.output.Values.populateFromAttributes(Values.java:225)
       at app//org.mapfish.print.output.Values.<init>(Values.java:173)
       at app//org.mapfish.print.output.Values.<init>(Values.java:108)
       at app//org.mapfish.print.processor.map.AddBackgroundLayersTest.testExecute(AddBackgroundLayersTest.java:64)

AddOverlayLayersTest > testExecute() FAILED
   org.mapfish.print.wrapper.ObjectMissingException: attribute [spec.attributes.overviewMap] missing
       at app//org.mapfish.print.attribute.ReflectiveAttribute.getValue(ReflectiveAttribute.java:451)
       at app//org.mapfish.print.output.Values.populateFromAttributes(Values.java:225)
       at app//org.mapfish.print.output.Values.<init>(Values.java:173)
       at app//org.mapfish.print.output.Values.<init>(Values.java:108)
       at app//org.mapfish.print.processor.map.AddOverlayLayersTest.testExecute(AddOverlayLayersTest.java:64)

It's possible that the tests asserts should be updated.

1 similar comment
@sbrunner
Copy link
Member

@copilot Fix those tests:


BBoxMapBoundsTest > testAdjustToScaleInSphericalMercatorProjectionWidthGeodeticCalculations() FAILED
   org.opentest4j.AssertionFailedError: expected: <4721167.0> but was: <4721130.878126721>
       at app//org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:158)
       at app//org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:139)
       at app//org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:201)
       at app//org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:88)
       at app//org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:83)
       at app//org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1052)
       at app//org.mapfish.print.attribute.map.BBoxMapBoundsTest.testAdjustToScaleInSphericalMercatorProjectionWidthGeodeticCalculations(BBoxMapBoundsTest.java:213)
CenterScaleMapBoundsTest > testToReferencedEnvelopeSphericalMercatorProjectionWidthGeodeticCalculation() FAILED
   org.opentest4j.AssertionFailedError: expected: <4721167.0> but was: <4721130.878126721>
       at app//org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:158)
       at app//org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:139)
       at app//org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:201)
       at app//org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:88)
       at app//org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:83)
       at app//org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1052)
       at app//org.mapfish.print.attribute.map.CenterScaleMapBoundsTest.testToReferencedEnvelopeSphericalMercatorProjectionWidthGeodeticCalculation(CenterScaleMapBoundsTest.java:101)
GenericMapAttributeTest > testPrintClientConfig() FAILED
   org.opentest4j.AssertionFailedError: {
     "optionalEmbedded": {
       "default": null,
       "type": "EmbeddedTestAttribute",
       "embeddedType": {"embeddedElem": {"type": "boolean"}}
     },
     "pArray": {"type": "array"},
     "rotation": {
       "default": null,
       "type": "double"
     },
     "requiredElem": {"type": "int"},
     "useNearestScale": {
       "default": null,
       "type": "boolean"
     },
     "dpiSensitiveStyle": {
       "default": true,
       "type": "boolean"
     },
     "useGeodeticCalculations": {
       "default": false,
       "type": "boolean"
     },
     "useAdjustBounds": {
       "default": null,
       "type": "boolean"
     },
     "pObject": {"type": "object"},
     "requiredArray": {
       "isArray": true,
       "type": "int"
     },
     "width": {
       "default": null,
       "type": "int"
     },
     "longitudeFirst": {
       "default": null,
       "type": "boolean"
     },
     "projection": {
       "default": null,
       "type": "String"
     },
     "pdfA": {
       "default": null,
       "type": "boolean"
     },
     "embedded": {
       "type": "EmbeddedTestAttribute",
       "embeddedType": {"embeddedElem": {"type": "boolean"}}
     },
     "optionalArray": {
       "default": [
         1,
         2
       ],
       "isArray": true,
       "type": "int"
     },
     "height": {
       "default": null,
       "type": "int"
     }
   } ==> expected: <16> but was: <17>
       at app//org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:158)
       at app//org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:139)
       at app//org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:201)
       at app//org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:152)
       at app//org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:590)
       at app//org.mapfish.print.attribute.map.GenericMapAttributeTest.testPrintClientConfig(GenericMapAttributeTest.java:50)
OverviewMapAttributeTest > testAttributesFromYaml() FAILED
   org.mapfish.print.wrapper.ObjectMissingException: attribute [spec.attributes.overviewMap] missing
       at app//org.mapfish.print.attribute.ReflectiveAttribute.getValue(ReflectiveAttribute.java:451)
       at app//org.mapfish.print.output.Values.populateFromAttributes(Values.java:225)
       at app//org.mapfish.print.output.Values.<init>(Values.java:173)
       at app//org.mapfish.print.output.Values.<init>(Values.java:108)
       at app//org.mapfish.print.attribute.map.OverviewMapAttributeTest.testAttributesFromYaml(OverviewMapAttributeTest.java:85)
       
AddBackgroundLayersTest > testExecute() FAILED
   org.mapfish.print.wrapper.ObjectMissingException: attribute [spec.attributes.overviewMap] missing
       at app//org.mapfish.print.attribute.ReflectiveAttribute.getValue(ReflectiveAttribute.java:451)
       at app//org.mapfish.print.output.Values.populateFromAttributes(Values.java:225)
       at app//org.mapfish.print.output.Values.<init>(Values.java:173)
       at app//org.mapfish.print.output.Values.<init>(Values.java:108)
       at app//org.mapfish.print.processor.map.AddBackgroundLayersTest.testExecute(AddBackgroundLayersTest.java:64)

AddOverlayLayersTest > testExecute() FAILED
   org.mapfish.print.wrapper.ObjectMissingException: attribute [spec.attributes.overviewMap] missing
       at app//org.mapfish.print.attribute.ReflectiveAttribute.getValue(ReflectiveAttribute.java:451)
       at app//org.mapfish.print.output.Values.populateFromAttributes(Values.java:225)
       at app//org.mapfish.print.output.Values.<init>(Values.java:173)
       at app//org.mapfish.print.output.Values.<init>(Values.java:108)
       at app//org.mapfish.print.processor.map.AddOverlayLayersTest.testExecute(AddOverlayLayersTest.java:64)

It's possible that the tests asserts should be updated.

- Only throw ObjectMissingException for attributes with OneOf constraints
- Update test expectations for geodetic Y coordinates after fixing
  computeGeodeticBBoxInPseudoMercator to use getDestinationPosition()
- Update GenericMapAttributeTest to expect 17 fields (added useGeodeticCalculations)

Co-authored-by: sbrunner <353872+sbrunner@users.noreply.github.com>
Copy link
Author

Copilot AI commented Feb 11, 2026

@copilot Fix those tests:


...

Fixed in commit b2a8240. The issues were:

  1. OverviewMapAttributeTest failure: My change was throwing ObjectMissingException for all attributes with empty defaults. Fixed by only throwing for attributes with @OneOf constraints.
  2. Y coordinate mismatches: The geodetic calculation fix produces more accurate results. Updated test expectations from 4721167→4721131 and 4721421→4721458.
  3. GenericMapAttributeTest field count: Added assertion for the new useGeodeticCalculations field (16→17 fields).

@copilot Fix those tests:


...

Fixed in commit b2a8240. See my response to the previous comment for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • jaspersoft.jfrog.io
    • Triggering command: /usr/lib/jvm/temurin-21-jdk-amd64/bin/java /usr/lib/jvm/temurin-21-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED --add-opens=java.base/java.time=ALL-UNNAMED -Xms4G -Xmx6G -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en (dns block)
  • www.puppycrawl.com
    • Triggering command: /opt/hostedtoolcache/CodeQL/2.24.0/x64/codeql/tools/linux64/java/bin/java /opt/hostedtoolcache/CodeQL/2.24.0/x64/codeql/tools/linux64/java/bin/java -jar /opt/hostedtoolcache/CodeQL/2.24.0/x64/codeql/xml/tools/xml-extractor.jar --fileList=/home/REDACTED/work/mapfish-print/.codeql-scratch/dbs/java/working/files-to-index11738111656404570801.list --sourceArchiveDir=/home/REDACTED/work/mapfish-print/.codeql-scratch/dbs/java/src --outputDir=/home/REDACTED/work/mapfish-print/.codeql-scratch/dbs/java/trap/java (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

From the artifact of the previous workflow run
@sbrunner
Copy link
Member

Fix:

StringArrayAttributeTest > testWrongType() STANDARD_OUT
    2026-02-11T15:40:06.414080630Z Test worker ERROR Log4j2 could not find a logging implementation. Please add log4j-core to the classpath. Using SimpleLogger to log to the console...

BBoxMapBoundsTest > testAdjustToScaleInSphericalMercatorProjectionWidthGeodeticCalculations() FAILED
    org.opentest4j.AssertionFailedError: expected: <4721294.605718248> but was: <4721294.606174145>
        at app//org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:158)
        at app//org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:139)
        at app//org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:201)
        at app//org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:88)
        at app//org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:83)
        at app//org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1052)
        at app//org.mapfish.print.attribute.map.BBoxMapBoundsTest.testAdjustToScaleInSphericalMercatorProjectionWidthGeodeticCalculations(BBoxMapBoundsTest.java:240)

@sbrunner
Copy link
Member

@copilot can you steal fix this test:

BBoxMapBoundsTest > testAdjustToScaleInSphericalMercatorProjectionWidthGeodeticCalculations() FAILED
    org.opentest4j.AssertionFailedError: expected: <4721294.605718248> but was: <4721294.606174145>
        at app//org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:158)
        at app//org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:139)
        at app//org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:201)
        at app//org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:88)
        at app//org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:83)
        at app//org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1052)
        at app//org.mapfish.print.attribute.map.BBoxMapBoundsTest.testAdjustToScaleInSphericalMercatorProjectionWidthGeodeticCalculations(BBoxMapBoundsTest.java:240)

The improved geodetic calculations produce slightly different results due to
more accurate destination position calculations. Increased tolerance from
0.00001 to 0.001 to account for acceptable rounding differences in geodetic
coordinate transformations.

Co-authored-by: sbrunner <353872+sbrunner@users.noreply.github.com>
Copy link
Author

Copilot AI commented Feb 12, 2026

Fix:

StringArrayAttributeTest > testWrongType() STANDARD_OUT

...

Fixed in commit f5cc31b. The improved geodetic calculations cause a small floating-point precision difference (~0.0005) in the median calculation. Increased the tolerance from 0.00001 to 0.001 to account for acceptable rounding differences in geodetic coordinate transformations.

@copilot can you steal fix this test:

BBoxMapBoundsTest > testAdjustToScaleInSphericalMercatorProjectionWidthGeodeticCalculations() FAILED

...

Fixed in commit f5cc31b. Increased the delta tolerance from 0.00001 to 0.001 to accommodate the small precision differences introduced by the more accurate geodetic calculations.

@sbrunner sbrunner force-pushed the copilot/sub-pr-3981 branch from 7168ee2 to 3079a23 Compare February 12, 2026 08:27
@sbrunner sbrunner marked this pull request as ready for review February 12, 2026 08:55
Copilot AI review requested due to automatic review settings February 12, 2026 08:55
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes attribute parsing for missing required attributes and addresses multiple code review feedback items. The primary fix resolves test failures in ClusteredMapPrinterServletTest.testCreateReport_Failure by improving error handling for missing map bounds attributes with OneOf constraints. Additionally, the PR corrects geodetic calculations for Web Mercator projections to improve accuracy.

Changes:

  • Fixed ReflectiveAttribute to throw ObjectMissingException for missing attributes with OneOf constraints
  • Corrected geodetic calculations to use geographic CRS (EPSG:4326) instead of Pseudo-Mercator when constructing GeodeticCalculator
  • Fixed spelling errors and test naming issues

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
GenericMapAttributeTest.java Updated expected field count from 16 to 17 to account for the new useGeodeticCalculations field
CenterScaleMapBoundsTest.java Updated Y coordinate expectations and fixed test name typo to match improved geodetic calculations
BBoxMapBoundsTest.java Updated Y coordinate expectations and increased tolerance for median comparison due to improved geodetic precision
WMTSLayer.java Fixed computeExtraScalingFactor to use geographic CRS (EPSG:4326) with map center coordinates for geodetic calculations
CenterScaleMapBounds.java Fixed computeGeodeticBBoxInPseudoMercator to use destination positions instead of linear distance calculations
BBoxMapBounds.java Fixed spelling errors, propagated useGeodeticCalculations flag in zoomToScale, and corrected geodetic width calculation to construct calculator with matching CRS
ReflectiveAttribute.java Added logic to throw ObjectMissingException only for missing attributes with OneOf constraints
PseudoMercatorUtils.java Improved isPseudoMercator to safely handle missing CRS identifiers with case-insensitive name matching

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sbrunner sbrunner merged commit f4a5c06 into fix/scalebar-wmts-epsg-3857 Feb 12, 2026
16 checks passed
@sbrunner sbrunner deleted the copilot/sub-pr-3981 branch February 12, 2026 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants