Changeset 19247 in josm


Ignore:
Timestamp:
2024-10-21T22:45:38+02:00 (4 weeks ago)
Author:
taylor.smock
Message:

Fix #23950: Fix a StackOverflowError that occurs when a self-referencing relation exists

Also disable StyledTiledMapRendererTest in CI for now.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java

    r19180 r19247  
    12901290        } else if (p instanceof IRelation<?>) {
    12911291            for (IPrimitive member : ((IRelation<?>) p).getMemberPrimitivesList()) {
    1292                 resetTiles(member);
     1292                if (member instanceof IRelation) {
     1293                    resetBounds(member.getBBox()); // Avoid recursive relation issues
     1294                    break;
     1295                } else {
     1296                    resetTiles(member);
     1297                }
    12931298            }
    12941299        } else {
  • trunk/test/unit/org/openstreetmap/josm/data/osm/visitor/paint/StyledTiledMapRendererTest.java

    r19221 r19247  
    2020import org.apache.commons.jcs3.access.CacheAccess;
    2121import org.awaitility.Awaitility;
     22import org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable;
    2223import org.junit.jupiter.params.ParameterizedTest;
    2324import org.junit.jupiter.params.provider.Arguments;
     
    3839 * Test class for {@link StyledTiledMapRenderer}
    3940 */
     41@DisabledIfEnvironmentVariable(disabledReason = "Needs more work; leave enabled locally but disable on CI", named = "CI", matches = "true")
    4042@Main
    4143@Projection
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/OsmDataLayerTest.java

    r18870 r19247  
    2929import org.openstreetmap.josm.data.osm.OsmPrimitive;
    3030import org.openstreetmap.josm.data.osm.Relation;
     31import org.openstreetmap.josm.data.osm.RelationMember;
    3132import org.openstreetmap.josm.data.osm.Way;
    3233import org.openstreetmap.josm.gui.MainApplication;
     
    335336        assertTrue(Logging.getLastErrorAndWarnings().stream().noneMatch(s -> s.contains("UnsupportedFlavorException")));
    336337    }
     338
     339    /**
     340     * Non-regression test for #23950
     341     */
     342    @Test
     343    void testTicket23950() {
     344        final Relation first = TestUtils.newRelation("", new RelationMember("", TestUtils.newNode("")));
     345        final DataSet ds = new DataSet();
     346        // This is needed to cause the condition
     347        MainApplication.getLayerManager().addLayer(new OsmDataLayer(ds, "StyledTiledMapRendererTest#testRecursiveRelation", null));
     348        ds.addPrimitiveRecursive(first);
     349        first.addMember(new RelationMember("", first));
     350        ds.setSelected(first);
     351    }
     352
    337353}
Note: See TracChangeset for help on using the changeset viewer.