Modify

Opened 2 months ago

#24418 new defect

Placeholders and tag() don't work in group key for validator MapCSS expressions

Reported by: CAM-Gerlach Owned by: team
Priority: normal Milestone:
Component: Core validator Version:
Keywords: template_report placeholders group mapcss Cc:

Description

What steps will reproduce the problem?

  1. Add the following MapCSS validation rule, based on a JOSM wiki example:
    way[highway=~/^(motorway|trunk|primary|secondary|tertiary)$/][!ref] {
      group: tr("{0} without {1}", tag("highway"), "{1.key}");
      throwOther: tr("{0} without {1}", tag("highway"), "{1.key}");
    }
    
  2. Validate a major road (i.e. highway=tertiary or above) without a ref tag
  3. Get the below result

What is the expected result?

Both the group and the message are <roadclass> without ref, e.g. tertiary without ref.

What happens instead?

The group is shown as null without {1.key}; only the message is tertiary without ref. This occurs when tested with multiple placeholder indicies, with or without classes, with a different group name from the throwOther message, and with various test rules. I can also recall seeing similar behavior on a handful of third-party rules.

This contradicts the statement on the JOSM/MapCSS Validator Syntax OSM wiki page (the JOSM wiki page doesn't state anything at all about where/under what conditions placeholders don't work) that:

Placeholders will work in throw* or group functions, even when using classes.

Similar to #23206 but for group rather than suggestAlternative, and for multiple much simpler reproducers.

Please provide any additional information below. Attach a screenshot if possible.

Relative:URL: ^/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2025-07-11 10:12:51 +0200 (Fri, 11 Jul 2025)
Revision:19423
Build-Date:2025-07-12 01:30:35
URL:https://josm.openstreetmap.de/svn/trunk

Identification: JOSM/1.5 (19423 en) Windows 11 64-Bit
OS Build number: Windows 10 Pro for Workstations 24H2 (26100)
Memory Usage: 1400 MB / 8016 MB (552 MB allocated, but free)
Java version: 21.0.5+11-LTS, Azul Systems, Inc., OpenJDK 64-Bit Server VM
Look and Feel: com.sun.java.swing.plaf.windows.WindowsLookAndFeel
Screen: \Display0 1920x1200x32bpp@60Hz (scaling 1.00×1.00) \Display1 1920x1200x32bpp@60Hz (scaling 1.00×1.00) \Display2 1920x1200x32bpp@60Hz (scaling 1.00×1.00)
Maximum Screen Size: 1920×1200
Best cursor sizes: 16×16→32×32, 32×32→32×32
System property file.encoding: UTF-8
System property sun.jnu.encoding: UTF-8
Locale info: en_US
Numbers with default locale: 1234567890 -> 1234567890
VM arguments: [-Dicedtea-web.bin.location=%UserProfile%\AppData\Local\Programs\OpenWebStart\javaws, -Djava.util.Arrays.useLegacyMergeSort=true, --add-reads=java.base=ALL-UNNAMED,java.desktop, --add-reads=java.desktop=ALL-UNNAMED,java.naming, --add-reads=java.naming=ALL-UNNAMED,java.desktop, --add-exports=java.desktop/sun.awt=ALL-UNNAMED,java.desktop, --add-exports=java.desktop/javax.jnlp=ALL-UNNAMED,java.desktop, --add-exports=java.base/com.sun.net.ssl.internal.ssl=ALL-UNNAMED,java.desktop, --add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED,java.desktop, --add-exports=java.base/sun.security.action=ALL-UNNAMED,java.desktop, --add-exports=java.base/sun.security.provider=ALL-UNNAMED,java.desktop, --add-exports=java.base/sun.security.util=ALL-UNNAMED,java.desktop, --add-exports=java.base/sun.security.validator=ALL-UNNAMED,java.desktop, --add-exports=java.base/sun.security.x509=ALL-UNNAMED,java.desktop, --add-exports=java.base/jdk.internal.util.jar=ALL-UNNAMED,java.desktop, --add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED,java.desktop, --add-exports=java.desktop/sun.awt.X11=ALL-UNNAMED,java.desktop, --add-exports=java.desktop/sun.applet=ALL-UNNAMED,java.desktop,jdk.jsobject, --add-exports=java.naming/com.sun.jndi.toolkit.url=ALL-UNNAMED,java.desktop, --add-modules=java.scripting,java.sql,javafx.controls,javafx.media,javafx.swing,javafx.web, --add-exports=java.desktop/com.apple.eawt=ALL-UNNAMED, --add-exports=java.desktop/com.sun.imageio.spi=ALL-UNNAMED, --add-exports=java.desktop/com.sun.imageio.plugins.jpeg=ALL-UNNAMED, --add-exports=javafx.graphics/com.sun.javafx.application=ALL-UNNAMED, --add-exports=jdk.deploy/com.sun.deploy.config=ALL-UNNAMED, --add-opens=java.base/java.lang=ALL-UNNAMED, --add-opens=java.base/java.nio=ALL-UNNAMED, --add-opens=java.base/jdk.internal.loader=ALL-UNNAMED, --add-opens=java.base/jdk.internal.ref=ALL-UNNAMED, --add-opens=java.desktop/javax.imageio.spi=ALL-UNNAMED, --add-opens=java.desktop/javax.swing.text.html=ALL-UNNAMED, --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED, -Djava.security.manager=allow]
Dataset consistency test: No problems found

Plugins:
+ BuildingGeneralization (cd3f835)
+ CustomizePublicTransportStop (36438)
+ ExtendedClipboard (1748770730)
+ FixAddresses (36438)
+ HouseNumberTaggingTool (36438)
+ ImproveWay (38)
+ MakeParallel (v1.1.0)
+ MapRoulette (72)
+ Mapillary (1813)
+ MicrosoftStreetside (36438)
+ OpeningHoursEditor (36438)
+ PerpendicularWayFromNode (1.0.0)
+ PolygonCutOut (v0.7.3)
+ QuickLabel (24)
+ Review.Changes (1.1.1)
+ ShapeTools (e2b1469)
+ SimplifyArea (36438)
+ alignways (36438)
+ apache-commons (36438)
+ auto_tools (84)
+ buildings_tools (36438)
+ changeset-viewer (1746100587)
+ changessum (v0.1.1)
+ comfort0 (36438)
+ conflation (273)
+ easypresets (1623509627)
+ ejml (36438)
+ geotools (36438)
+ gpsblam (36438)
+ graphview (36438)
+ highwaynamemodification (c6d820b)
+ imagery_offset_db (36438)
+ jackson (36438)
+ javafx (36438)
+ jaxb (36438)
+ jts (36438)
+ libphonenumber (9.0.10)
+ mapwithai (839)
+ measurement (36438)
+ merge-overlap (36438)
+ movemembership (1.3.0)
+ namemanager (36438)
+ opendata (36440)
+ openqa (113)
+ osm-obj-info (68)
+ phonenumber (1.1.1)
+ pmtiles (36438)
+ public_transport (36438)
+ reltoolbox (36438)
+ sidewalks (71)
+ tageditor (36438)
+ terracer (36438)
+ todo (155)
+ turnlanes (36438)
+ turnrestrictions (36438)
+ undelete (36438)
+ utilsplugin2 (36438)
+ wikipedia (440)

Tagging presets:
+ https://josm.openstreetmap.de/josmfile?page=Presets/LaneAttributes&zip=1
+ https://raw.githubusercontent.com/osmlab/name-suggestion-index/main/dist/presets/nsi-josm-presets.min.xml
+ https://josm.openstreetmap.de/josmfile?page=Presets/ParkingLanes&zip=1
+ https://raw.githubusercontent.com/OpenNauticalChart/josm/master/INT-1-preset.xml
+ https://raw.githubusercontent.com/yopaseopor/traffic_signs_preset_JOSM/master/US.zip
+ https://josm.openstreetmap.de/josmfile?page=Presets/Wikidata&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Presets/NewTags&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Presets/PublicTransportGtfs&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Presets/PublicTransportOneClick&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Presets/public_bookcase&zip=1
+ %UserProfile%\Downloads\josm_presets.zip
+ %UserProfile%\Downloads\military-josm.zip
+ <josm.pref>\EasyPresets.xml
+ <josm.pref>/EasyPresets.xml

Map paint styles:
- https://josm.openstreetmap.de/josmfile?page=Styles/PublicTransportV2&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/Highway_Nodes&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Styles/MapWithAI&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Styles/ColorWays&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Styles/PublicTransport&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Styles/AddressValidator&zip=1
- https://github.com/MissingMaps/josm_styles/archive/master.zip
+ https://josm.openstreetmap.de/josmfile?page=Styles/Direction&zip=1
+ https://raw.githubusercontent.com/species/josm-preset-traffic_sign_direction/master/direction.mapcss
+ https://josm.openstreetmap.de/josmfile?page=Styles/FixmeAndNote&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Rules/IncompleteObjectWarnings&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Styles/Lane_and_Road_Attributes&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Styles/SidewalksAndFootways&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Styles/TigerReviewedNo&zip=1
+ https://raw.githubusercontent.com/yopaseopor/traffic_signs_style_JOSM/master/US.zip
+ https://josm.openstreetmap.de/josmfile?page=Styles/PTStops&zip=1
+ https://github.com/osmlab/appledata/archive/josm_paint_inline_validation.zip
+ https://josm.openstreetmap.de/josmfile?page=Styles/Modified&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Styles/ParkingLanes&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/Maxspeed&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/Landcover&zip=1

Validator rules:
+ https://josm.openstreetmap.de/josmfile?page=Rules/OSMLint&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Rules/InvalidWebsiteProtocol&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Rules/Geology&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Rules/CheckDate&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Rules/KeepRight&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Rules/QAToolInspiredValidations&zip=1
+ https://raw.githubusercontent.com/OpenNauticalChart/josm/master/Seamark.validator.mapcss
+ https://josm.openstreetmap.de/josmfile?page=Rules/SourceObjectTag&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Rules/SuspiciousSwimming_Pool&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Rules/AddrFullWarning&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Rules/CountryCodeCheck&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Rules/Runways&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Rules/FacebookWebsite&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Rules/IndoorRules&zip=1
- https://github.com/Jungle-Bus/transport_mapcss/raw/gh-pages/transport.validator.zip
+ https://josm.openstreetmap.de/josmfile?page=Rules/MissingOpeningHours&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Rules/NotCheck&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Rules/Pictures&zip=1
- https://josm.openstreetmap.de/josmfile?page=Rules/PublicTransportGtfs&zip=1
+ https://framagit.org/Midgard/osm/-/raw/master/josm_validation_grb.validator.mapcss
+ https://josm.openstreetmap.de/josmfile?page=Rules/MissingWeekdays&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Rules/ValidatingBuildingsInHOTTMProjects&zip=1
+ https://www.openrailwaymap.org/validator/openrailwaymap.validator.mapcss
+ https://josm.openstreetmap.de/josmfile?page=Rules/AddrRelationWarning&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Rules/DuplicateAttributes&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Rules/MissingMain&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Rules/OldCovid&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Rules/ThisOrThat&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Rules/ChargeRules&zip=1
+ https://raw.githubusercontent.com/stefan-a-bauer/josm-validators/master/mtb.validator.mapcss
+ %UserProfile%\Documents\OSM\tagcomplete_roads.validator.mapcss
+ %UserProfile%\Documents\OSM\test.validator.mapcss

Last errors/warnings:
- 00138.872 W: java.io.IOException: Attribution is not loaded yet
- 00138.872 W: java.io.IOException: Attribution is not loaded yet
- 00138.872 W: java.io.IOException: Attribution is not loaded yet
- 00138.872 W: java.io.IOException: Attribution is not loaded yet
- 00138.873 W: java.io.IOException: Attribution is not loaded yet
- 00138.873 W: java.io.IOException: Attribution is not loaded yet
- 00138.874 W: java.io.IOException: Attribution is not loaded yet
- 00138.874 W: java.io.IOException: Attribution is not loaded yet
- 00138.875 W: java.io.IOException: Attribution is not loaded yet
- 00138.876 W: java.io.IOException: Attribution is not loaded yet

Attachments (0)

Change History (0)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain team.
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from team to the specified user.
Next status will be 'needinfo'. The owner will be changed from team to CAM-Gerlach.
as duplicate The resolution will be set to duplicate. Next status will be 'closed'. The specified ticket will be cross-referenced with this ticket.
The owner will be changed from team to anonymous. Next status will be 'assigned'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.