Opened 18 months ago
Last modified 17 months ago
#22967 new defect
NullPointerException on Overpass download with "out ids/tags center"
Reported by: | Owned by: | team | |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Core | Version: | |
Keywords: | template_report overpass xml json | Cc: |
Description
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:
- Illegal data error like with out:xml
- 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) Revision:18721 Build-Date:2023-05-02 01:30:57 URL:https://josm.openstreetmap.de/svn/trunk 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-17.0.6.0.10 Dataset consistency test: No problems found Plugins: + 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: + https://github.com/yopaseopor/traffic_signs_preset_JOSM/raw/master/NO.zip + ${HOME}/src/josm_styles/ped_bike/sykkel-preset.xml + ${HOME}/src/josm_styles/ped_bike/gange-preset.xml Map paint styles: - https://raw.githubusercontent.com/JohanEntur/JohanEntur/main/otpWayPropertySets.mapcss - https://osm.wzh.be/josm/different_buildings/different_buildings.mapcss - ${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 - https://osm.wzh.be/josm/validation/advanced-power.validator.mapcss - https://osm.wzh.be/josm/validation/buildings-import.validator.mapcss - https://osm.wzh.be/josm/validation/wulfmorn.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 + https://nyhus.dev/osm/josm/highest_quality.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 === REPORTED CRASH DATA === BugReportExceptionHandler#handleException: No data collected. Warning issued by: BugReportExceptionHandler#handleException === STACK TRACE === 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.io.OsmJsonReader.readWayNodesAndTags(OsmJsonReader.java:150) at org.openstreetmap.josm.io.OsmJsonReader.lambda$parseWay$3(OsmJsonReader.java:146) at org.openstreetmap.josm.io.AbstractReader.parseWay(AbstractReader.java:725) at org.openstreetmap.josm.io.OsmJsonReader.parseWay(OsmJsonReader.java:146) at org.openstreetmap.josm.io.OsmJsonReader.parseElements(OsmJsonReader.java:88) at org.openstreetmap.josm.io.OsmJsonReader.parseRoot(OsmJsonReader.java:71) at org.openstreetmap.josm.io.OsmJsonReader.parse(OsmJsonReader.java:60) at org.openstreetmap.josm.io.OsmJsonReader.lambda$doParseDataSet$6(OsmJsonReader.java:187) at org.openstreetmap.josm.io.AbstractReader.doParseDataSet(AbstractReader.java:326) at org.openstreetmap.josm.io.AbstractReader.doParseDataSet(AbstractReader.java:309) at org.openstreetmap.josm.io.OsmJsonReader.doParseDataSet(OsmJsonReader.java:185) at org.openstreetmap.josm.io.OverpassDownloadReader.parseDataSet(OverpassDownloadReader.java:394) at org.openstreetmap.josm.io.BoundingBoxDownloader.parseOsm(BoundingBoxDownloader.java:215) at org.openstreetmap.josm.io.OverpassDownloadReader.parseOsm(OverpassDownloadReader.java:400) at org.openstreetmap.josm.actions.downloadtasks.DownloadOsmTask$DownloadTask.parseDataSet(DownloadOsmTask.java:469) at org.openstreetmap.josm.actions.downloadtasks.DownloadOsmTask$DownloadTask.realRun(DownloadOsmTask.java:477) at org.openstreetmap.josm.gui.PleaseWaitRunnable.doRealRun(PleaseWaitRunnable.java:94) at org.openstreetmap.josm.gui.PleaseWaitRunnable.run(PleaseWaitRunnable.java:142) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:833)
Attachments (0)
Change History (3)
comment:1 by , 18 months ago
comment:2 by , 18 months ago
Keywords: | overpass xml json added |
---|
comment:3 by , 17 months ago
OSM JSON works and is implemented in OsmJsonReader.java, 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.
A few comments:
[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:
vs.
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.