Modify

Opened 4 months ago

Last modified 4 months ago

#24443 new defect

Error loading Mapbox/MapLibre stylesheet containing expressions

Reported by: 1ec5 Owned by: team
Priority: normal Milestone:
Component: Core Version: latest
Keywords: template_report Cc:

Description

What steps will reproduce the problem?

  1. In Imagery Preferences, add a layer with the URL mvt[22]:https://www.openhistoricalmap.org/map-styles/historical/historical.json
  2. Activate the layer.

What is the expected result?

OpenHistoricalMap’s Historical basemap appears when the layer is active.

What happens instead?

The following error:

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

Revision:19423
Build-Date:2025-07-12 12:05:40

Identification: JOSM/1.5 (19423 en) Mac OS X 15.6
OS Build number: macOS 15.6 (24G84)
Memory Usage: 4592 MB / 27648 MB (2034 MB allocated, but free)
Java version: 24.0.1+9, Azul Systems, Inc., OpenJDK 64-Bit Server VM
Look and Feel: com.apple.laf.AquaLookAndFeel
Screen: Display 1 1728x1117x32bpp@120Hz (scaling 2.00×2.00)
Maximum Screen Size: 1728×1117
Best cursor sizes: 16×16→16×16, 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: [-Djpackage.app-version=19423, -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.apple.eawt=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=/Applications/JOSM_24_arm64.app/Contents/MacOS/JOSM]

Plugins:
+ apache-commons (36438)
+ apache-http (36438)
+ ejml (36438)
+ geotools (36438)
+ imagery-xml-bounds (36438)
+ imagery_offset_db (36438)
+ jackson (36438)
+ jaxb (36438)
+ jna (36438)
+ jts (36438)
+ ohm-date-filter (1726089000)
+ opendata (36440)
+ pbf (36438)
+ reverter (36447)
+ undelete (36438)
+ utilsplugin2 (36438)
+ wikipedia (440)

Map paint styles:
+ https://josm.openstreetmap.de/josmfile?page=Styles/iD&zip=1

Last errors/warnings:
- 235453.440 W: javax.net.ssl.SSLHandshakeException: (certificate_unknown) PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target. Cause: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target. Cause: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
- 236935.987 E: org.openstreetmap.josm.io.OsmApiException: ResponseCode=503, Error Body=<
- 236935.998 E: Communication with OSM server failed - ResponseCode=503, Error Body=&lt;
- 237095.935 E: org.openstreetmap.josm.io.OsmApiException: ResponseCode=503, Error Body=<
- 237095.941 E: Communication with OSM server failed - ResponseCode=503, Error Body=&lt;
- 237564.107 E: Communication with OSM server failed - <html>
- 237577.966 E: org.openstreetmap.josm.io.OsmApiException: ResponseCode=500, Error Body=<
- 237577.973 E: Internal Server Error - <html>The OSM server<br>'https://www.openhistoricalmap.org/api/0.6/'<br>reported an internal server error.<br>This is most likely a temporary problem. Please try again later.</html>
- 242080.329 E: Handled by bug report queue: java.lang.ClassCastException: class org.eclipse.parsson.JsonArrayBuilderImpl$JsonArrayImpl cannot be cast to class jakarta.json.JsonNumber (org.eclipse.parsson.JsonArrayBuilderImpl$JsonArrayImpl and jakarta.json.JsonNumber are in unnamed module of loader 'app')
- 242533.247 E: Handled by bug report queue: java.lang.ClassCastException: class org.eclipse.parsson.JsonArrayBuilderImpl$JsonArrayImpl cannot be cast to class jakarta.json.JsonNumber (org.eclipse.parsson.JsonArrayBuilderImpl$JsonArrayImpl and jakarta.json.JsonNumber are in unnamed module of loader 'app')

OSM API: https://www.openhistoricalmap.org/api


=== REPORTED CRASH DATA ===
BugReportExceptionHandler#handleException:
No data collected.

Warning issued by: BugReportExceptionHandler#handleException

=== STACK TRACE ===
Thread: AWT-EventQueue-0 (43) of main
java.lang.ClassCastException: class org.eclipse.parsson.JsonArrayBuilderImpl$JsonArrayImpl cannot be cast to class jakarta.json.JsonNumber (org.eclipse.parsson.JsonArrayBuilderImpl$JsonArrayImpl and jakarta.json.JsonNumber are in unnamed module of loader 'app')
	at org.eclipse.parsson.JsonObjectBuilderImpl$JsonObjectImpl.getJsonNumber(JsonObjectBuilderImpl.java:239)
	at org.openstreetmap.josm.data.imagery.vectortile.mapbox.style.Layers.parsePaintLine(Layers.java:229)
	at org.openstreetmap.josm.data.imagery.vectortile.mapbox.style.Layers.<init>(Layers.java:135)
	at org.openstreetmap.josm.data.imagery.vectortile.mapbox.style.MapboxVectorStyle.lambda$new$2(MapboxVectorStyle.java:122)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
	at java.base/java.util.stream.ReferencePipeline$2$1.accept(Unknown Source)
	at java.base/java.util.Iterator.forEachRemaining(Unknown Source)
	at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Unknown Source)
	at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source)
	at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
	at java.base/java.util.stream.ReferencePipeline.collect(Unknown Source)
	at org.openstreetmap.josm.data.imagery.vectortile.mapbox.style.MapboxVectorStyle.<init>(MapboxVectorStyle.java:123)
	at org.openstreetmap.josm.data.imagery.vectortile.mapbox.style.MapboxVectorStyle.lambda$getMapboxVectorStyle$0(MapboxVectorStyle.java:63)
	at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(Unknown Source)
	at org.openstreetmap.josm.data.imagery.vectortile.mapbox.style.MapboxVectorStyle.getMapboxVectorStyle(MapboxVectorStyle.java:59)
	at org.openstreetmap.josm.data.imagery.vectortile.mapbox.MapboxVectorTileSource.<init>(MapboxVectorTileSource.java:49)
	at org.openstreetmap.josm.gui.layer.imagery.MVTLayer.getTileSource(MVTLayer.java:123)
	at org.openstreetmap.josm.gui.layer.imagery.MVTLayer.getTileSource(MVTLayer.java:66)
	at org.openstreetmap.josm.gui.layer.AbstractTileSourceLayer.initializeIfRequired(AbstractTileSourceLayer.java:580)
	at org.openstreetmap.josm.gui.layer.AbstractTileSourceLayer.attachToMapView(AbstractTileSourceLayer.java:562)
	at org.openstreetmap.josm.gui.MapView.layerAdded(MapView.java:361)
	at org.openstreetmap.josm.gui.layer.LayerManager.fireLayerAdded(LayerManager.java:462)
	at org.openstreetmap.josm.gui.layer.LayerManager.realAddLayer(LayerManager.java:237)
	at org.openstreetmap.josm.gui.layer.MainLayerManager.realAddLayer(MainLayerManager.java:327)
	at org.openstreetmap.josm.gui.layer.LayerManager.lambda$addLayer$0(LayerManager.java:221)
	at org.openstreetmap.josm.gui.util.GuiHelper.runInEDTAndWaitWithException(GuiHelper.java:247)
	at org.openstreetmap.josm.gui.layer.LayerManager.addLayer(LayerManager.java:221)
	at org.openstreetmap.josm.actions.AddImageryLayerAction.actionPerformed(AddImageryLayerAction.java:171)
	at java.desktop@24.0.1/javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
	at java.desktop@24.0.1/javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
	at java.desktop@24.0.1/javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
	at java.desktop@24.0.1/javax.swing.DefaultButtonModel.setPressed(Unknown Source)
	at java.desktop@24.0.1/javax.swing.AbstractButton.doClick(Unknown Source)
	at java.desktop@24.0.1/com.apple.laf.ScreenMenuItem.actionPerformed(Unknown Source)
	at java.desktop@24.0.1/java.awt.MenuItem.processActionEvent(Unknown Source)
	at java.desktop@24.0.1/java.awt.MenuItem.processEvent(Unknown Source)
	at java.desktop@24.0.1/java.awt.MenuComponent.dispatchEventImpl(Unknown Source)
	at java.desktop@24.0.1/java.awt.MenuComponent.dispatchEvent(Unknown Source)
	at java.desktop@24.0.1/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
	at java.desktop@24.0.1/java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.desktop@24.0.1/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.desktop@24.0.1/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.desktop@24.0.1/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.desktop@24.0.1/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.desktop@24.0.1/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.desktop@24.0.1/java.awt.EventDispatchThread.run(Unknown Source)

Attachments (0)

Change History (1)

comment:1 by 1ec5, 4 months ago

This issue was first reported on the OpenHistoricalMap forum, though it would affect almost any Mapbox or MapLibre stylesheet that a user might be tempted to add to their imagery preferences.

The issue is that the stylesheet sets the line-width paint property to an expression. Unfortunately, JOSM assumes that each paint or layout property is set to a literal number, which is almost never the case in a nontrivial stylesheet. As explained in #21250, Mapbox/MapLibre stylesheet support is very rudimentary. Proper support for parsing and interpreting expressions or even the simpler legacy function syntax would require substantial code. That said, there might be some usable parsing code as part of MapLibre for Android, specifically in the implementation of a DSL for runtime styling in Java.

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 1ec5.
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.