Opened 12 months ago

Last modified 12 months ago

#22967 new defect

NullPointerException on Overpass download with "out ids/tags center"

Reported by: martin@… Owned by: team
Priority: normal Milestone:
Component: Core Version:
Keywords: template_report overpass xml json Cc:


What steps will reproduce the problem?

Download from Overpass with this query: "[out:json][bbox:{{bbox}}]; way; out ids center;"

  • out:xml instead of out:json gives an explicit illegal data error instead
  • node instead of way works fine
  • Without center there is no error and the layer tooltip suggests nodes and ways were imported. Nothing is rendered which makes sense when no coordinates are returned.
  • "out tags" behaves the same way as "out ids"

What is the expected result?

Probably one of:

  1. Illegal data error like with out:xml
  2. Same behaviour as without center

What happens instead?

NullPointerException as reported below. I have not seen any signs that the data or application state is broken after ignoring the exception.

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

Relative:URL: ^/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2023-05-01 18:25:03 +0200 (Mon, 01 May 2023)
Build-Date:2023-05-02 01:30:57

Identification: JOSM/1.5 (18721 en_GB) Linux Fedora Linux 37 (KDE Plasma)
Memory Usage: 2836 MB / 8004 MB (498 MB allocated, but free)
Java version: 17.0.6+10, Red Hat, Inc., OpenJDK 64-Bit Server VM
Look and Feel: javax.swing.plaf.metal.MetalLookAndFeel
Screen: :0.0 3840×2160 (scaling 1.00×1.00)
Maximum Screen Size: 3840×2160
Best cursor sizes: 16×16→16×16, 32×32→32×32
Environment variable LANG: en_GB.UTF-8
System property file.encoding: UTF-8
System property sun.jnu.encoding: UTF-8
Locale info: en_GB
Numbers with default locale: 1234567890 -> 1234567890
Desktop environment: KDE
Java package: java-17-openjdk:x86_64-
Dataset consistency test: No problems found

+ FastDraw (36057)
+ ImportImagePlugin (36013)
+ Mapillary (2.1.3)
+ OpeningHoursEditor (35924)
+ apache-commons (36034)
+ apache-http (35924)
+ areaselector (1652822522)
+ austriaaddresshelper (master-4e80dc2e4261d321150187f4951684ad97342d5e)
+ conflation (0.6.11)
+ editgpx (36054)
+ ejml (35924)
+ geotools (36068)
+ jackson (36034)
+ jaxb (35952)
+ jna (36005)
+ jogl (1.2.3)
+ jts (36004)
+ log4j (36034)
+ measurement (35978)
+ photo_geotagging (35933)
+ photoadjust (36011)
+ reverter (36043)
+ todo (123)
+ utilsplugin2 (36011)

Tagging presets:
+ ${HOME}/src/josm_styles/ped_bike/sykkel-preset.xml
+ ${HOME}/src/josm_styles/ped_bike/gange-preset.xml

Map paint styles:
- ${HOME}/src/josm_styles/pedestrian_details.mapcss
- ${HOME}/src/josm_styles/ski_details.mapcss
- ${HOME}/src/josm_styles/missing_surface.mapcss
- ${HOME}/src/josm_styles/ped_bike/ped_bike.mapcss

Validator rules:
- ${HOME}/src/josm_styles/buildings-import.validator.mapcss
- ${HOME}/src/josm_styles/barnehage-import.validator.mapcss
- ${HOME}/src/josm_styles/n50-hytter-import.validator.mapcss
- ${HOME}/src/josm_styles/pedestrian_details.validator.mapcss
+ ${HOME}/src/josm_styles/ped_bike/ped_bike.validator.mapcss

Last errors/warnings:
- 05107.766 E: Handled by bug report queue: java.lang.NullPointerException: Cannot invoke "javax.json.JsonArray.iterator()" because the return value of "javax.json.JsonObject.getJsonArray(String)" is null

No data collected.

Warning issued by: BugReportExceptionHandler#handleException

Thread: AWT-EventQueue-0 (29) of main
java.lang.NullPointerException: Cannot invoke "javax.json.JsonArray.iterator()" because the return value of "javax.json.JsonObject.getJsonArray(String)" is null
	at org.openstreetmap.josm.actions.downloadtasks.DownloadOsmTask$DownloadTask.parseDataSet(
	at org.openstreetmap.josm.actions.downloadtasks.DownloadOsmTask$DownloadTask.realRun(
	at org.openstreetmap.josm.gui.PleaseWaitRunnable.doRealRun(
	at java.base/java.util.concurrent.Executors$
	at java.base/
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(
	at java.base/java.util.concurrent.ThreadPoolExecutor$
	at java.base/

Attachments (0)

Change History (3)

comment:1 by mmd, 12 months ago

A few comments:

  • JOSM needs XML format, so [out:json] cannot be used, as it produces OSM JSON format.
  • out center; uses an (incompatible) Overpass API specific format extension for OSM XML. However, JOSM expects the original OSM XML format.

You can see the difference with ways:

  <way id="51005607">
    <center lat="40.5547721" lon="-5.1136667"/>       <!-- center is an Overpass API specific extension --->


  <way id="51005607" version="15" timestamp="2023-05-01T13:51:29Z" changeset="135574988" uid="12166970" user="loborman">
    <nd ref="654172021"/>
    <nd ref="367109529"/>
    <nd ref="650358343"/>
    <nd ref="367109548"/>
    <tag k="highway" v="tertiary"/>
    <tag k="name" v="Calle Mayor"/>
    <tag k="old_name" v="Calle Calvo Sotelo"/>
    <tag k="oneway" v="no"/>
    <tag k="ref" v="N-110A"/>
    <tag k="surface" v="asphalt"/>

Maybe JOSM could show a warning message or similar, if the query doesn't use out meta; . That's the only output mode which generates OSM data like the OSM API itself.

comment:2 by gaben, 12 months ago

Keywords: overpass xml json added

comment:3 by martin@…, 12 months ago

OSM JSON works and is implemented in, however unlike readRelationMembersAndTags readWayNodesAndTags doesn't check for null after trying to read the nodes array. Based on a quick look at the code I suspect readWayNodesAndTags could check for null and throw an IllegalDataException, but I'm not certain enough to submit a patch. The XML parser handles ways without nodes, but that seems like more of an accidental implementation detail rather than a deliberate choice.

Modify Ticket

Change Properties
Set your email in Preferences
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 martin@….
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.