Modify

Opened 12 months ago

Closed 12 months ago

Last modified 12 months ago

#24054 closed defect (fixed)

Equal assertMatch and assertNoMatch in combinations.mapcss

Reported by: Famlam Owned by: team
Priority: normal Milestone: 24.12
Component: Core validator Version:
Keywords: template_report assertMatch assertNoMatch Cc: huntertur

Description

The combinations.mapcss file currently contains this rule:

/* #23932 */
way[cycleway:right][cycleway:right!=lane][cycleway:right!=separate][/^cycleway(:right|:both|):buffer/],
way[cycleway:left][cycleway:left!=lane][cycleway:left!=separate][/^cycleway(:left|:both|):buffer/],
way[cycleway:both][cycleway:both!=lane][cycleway:both!=separate][/^cycleway(:right|:left|:both|):buffer/],
way[cycleway][cycleway!=lane][cycleway!=separate][/^cycleway(:right|:left|:both|):buffer/] {
  throwWarning: tr("{0} together with {1}", "{0.tag}", "{3.tag}");
  group: tr("suspicious tag combination");
  assertMatch: "way cycleway:right=separate cycleway:right:buffer=yes";
  assertMatch: "way cycleway:left=shared_lane cycleway:buffer=no";
  assertMatch: "way cycleway:both=track cycleway:left:buffer=yes";
  assertMatch: "way cycleway=shared_busway cycleway:buffer=no";
  assertNoMatch: "way cycleway:right=lane cycleway:right:buffer=no";
  assertNoMatch: "way cycleway:right=separate cycleway:right:buffer=yes";
  assertNoMatch: "way cycleway:left=lane cycleway:left:buffer=yes";
  assertNoMatch: "way cycleway:both=lane cycleway:both:buffer=no";
  assertNoMatch: "way cycleway:both=lane cycleway:left:buffer=yes";
  assertNoMatch: "way cycleway:both=lane cycleway:buffer=no";
  assertNoMatch: "way cycleway=lane cycleway:buffer=yes";
  assertNoMatch: "way cycleway=lane cycleway:right:buffer=no";
  assertNoMatch: "way cycleway=lane cycleway:both:buffer=no";
}

Clearly the assertMatch: "way cycleway:right=separate cycleway:right:buffer=yes"; is incorrect, because of [cycleway:right!=separate]. (separate is excluded as the =separate-case is handled by a different rule)

JOSM does not detect that the assertMatch fails. (I have validator.check_assert_local_rules enabled). Possibly this is because the assertNoMatch rule also exists. It has both

  • assertMatch: "way cycleway:right=separate cycleway:right:buffer=yes";
  • assertNoMatch: "way cycleway:right=separate cycleway:right:buffer=yes";

Two possible solutions:

  1. Just removing the bad assertMatch from https://josm.openstreetmap.de/browser/josm/trunk/resources/data/validator/combinations.mapcss#L1076
  2. removing the bad assertMatch AND adding code to warn if assertMatch and assertNoMatch are equal

I suspect it fails at the following lines, as the addition to the HashMap probably overwrites the previously added entry:
https://github.com/JOSM/josm/blob/df5e76b7ed3167518d5624c7c7c7d3f1c998d644/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagCheckerRule.java#L153-L156


Revision:19265
Build-Date:2024-12-04 13:41:57

Identification: JOSM/1.5 (19265 nl) Windows 10 64-Bit
OS Build number: Windows 10 Home 22H2 (19045)
Memory Usage: 484 MB / 6032 MB (225 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 1920x1080x32bpp@60Hz (scaling 1.10×1.10)
Maximum Screen Size: 1920×1080
Best cursor sizes: 16×16→32×32, 32×32→32×32
System property file.encoding: UTF-8
System property sun.jnu.encoding: Cp1252
Locale info: nl_NL
Numbers with default locale: 1234567890 -> 1234567890
VM arguments: [-Djpackage.app-version=1.5.19265, -XX:MaxRAMPercentage=75.0, --add-modules=java.scripting,java.sql,javafx.controls,javafx.media,javafx.swing,javafx.web, --add-exports=java.base/sun.security.action=ALL-UNNAMED, --add-exports=java.desktop/com.sun.imageio.plugins.jpeg=ALL-UNNAMED, --add-exports=java.desktop/com.sun.imageio.spi=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, -Djpackage.app-path=%UserProfile%\AppData\Local\JOSM\JOSM.exe]

Plugins:
+ OpeningHoursEditor (36344)
+ imagery_offset_db (36344)
+ measurement (36350)
+ pbf (36348)
+ pt_assistant (637)
+ reverter (36354)
+ tageditor (36350)
+ turnlanes-tagging (1727811971)
+ undelete (36349)
+ utilsplugin2 (36354)

Map paint styles:
+ https://josm.openstreetmap.de/josmfile?page=Styles/Potlatch2&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/Lane_and_Road_Attributes&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/PublicTransport&zip=1
+ %UserProfile%\Documents\tijdelijke bestanden\josm-eigen.mappaint.mapcss
+ https://josm.openstreetmap.de/josmfile?page=Styles/Sidewalks&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/ParkingLanes&zip=1

Validator rules:
+ %UserProfile%\Documents\tijdelijke bestanden\josm-eigen.validator.mapcss
+ https://josm.openstreetmap.de/josmfile?page=Rules/SuspiciousSwimming_Pool&zip=1
+ https://raw.githubusercontent.com/osm-fr/osmose-backend/master/plugins/TagFix_Destination.validator.mapcss
+ https://raw.githubusercontent.com/osm-fr/osmose-backend/master/plugins/Colour.validator.mapcss
+ https://raw.githubusercontent.com/osm-fr/osmose-backend/master/plugins/notprefix.validator.mapcss
+ https://raw.githubusercontent.com/osm-fr/osmose-backend/master/plugins/TagFix_MultipleTag2.validator.mapcss
+ https://raw.githubusercontent.com/Famlam/OsmMapcssValidationNL/main/netherlands.validator.mapcss
+ https://josm.openstreetmap.de/josmfile?page=Rules/ChargeRules&zip=1

Last errors/warnings:
- 00000.914 W: extended font config - overriding 'filename.Malgun_Gothic=malgun.ttf' with 'MALGUN.TTF'
- 00000.916 W: extended font config - overriding 'filename.Myanmar_Text=mmrtext.ttf' with 'MMRTEXT.TTF'
- 00000.917 W: extended font config - overriding 'filename.Mongolian_Baiti=monbaiti.ttf' with 'MONBAITI.TTF'
- 00001.873 E: java.security.KeyStoreException: Windows-ROOT not found. Oorzaak: java.security.NoSuchAlgorithmException: Windows-ROOT KeyStore not available

Attachments (0)

Change History (4)

comment:1 by stoecker, 12 months ago

Hmm an && !assertions.containsKey(val) for both statements should solve that.

comment:2 by Famlam, 12 months ago

This would result in a log entry of: E: Cannot add MapCSS rule: Cannot add instruction assert(No)Match: XYZ!
which seems perfectly fine for me for such a rare case, so this sounds like a good solution @Stoecker!

comment:3 by stoecker, 12 months ago

Resolution: fixed
Status: newclosed

In 19273/josm:

fix #24054 - no longer silently ignore identical or mismatching asserts in mapcss tag checker

comment:4 by stoecker, 12 months ago

Milestone: 24.12

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


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