streetcomplete / StreetComplete

Easy to use OpenStreetMap editor for Android
https://streetcomplete.app
GNU General Public License v3.0
3.9k stars 357 forks source link

Crash on MarkCompletedHighwayConstruction (Round 2) #1055

Closed westnordost closed 6 years ago

westnordost commented 6 years ago

Got this crash report.

Device: samsung on5xfltechn, Android 6.0.1

de.westnordost.osmapi.common.errors.OsmBadUserInputException: Bad Request (400) - <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta http-equiv="content-type" content="text/html; lang="en"/>
  <title>OSM3S Response</title>
</head>
<body>

<p>The data included in this document is from www.openstreetmap.org. The data is made available under ODbL.</p>
<p><strong style="color:#FF0000">Error</strong>: line 1: static error: The attribute "than" must contain a timestamp exactly in the form yyyy-mm-ddThh:mm:ssZ. </p>
<p><strong style="color:#FF0000">Error</strong>: line 1: static error: The attribute "than" must contain a timestamp exactly in the form yyyy-mm-ddThh:mm:ssZ. </p>

</body>
</html>

at de.westnordost.osmapi.OsmApiErrorFactory.createError(OsmApiErrorFactory.java:37)
at de.westnordost.osmapi.OsmConnection.handleResponseCode(OsmConnection.java:343)
at de.westnordost.osmapi.OsmConnection.makeRequest(OsmConnection.java:189)
at de.westnordost.streetcomplete.data.osm.download.OverpassMapDataDao.get(OverpassMapDataDao.java:60)
at de.westnordost.streetcomplete.data.osm.download.OverpassMapDataDao.getAndHandleQuota(OverpassMapDataDao.java:84)
at de.westnordost.streetcomplete.quests.construction.MarkCompletedHighwayConstruction.download(MarkCompletedHighwayConstruction.java:29)
at de.westnordost.streetcomplete.data.osm.download.OsmQuestDownload.download(OsmQuestDownload.java:76)
at de.westnordost.streetcomplete.data.download.QuestDownload.downloadQuestTypes(QuestDownload.java:200)
at de.westnordost.streetcomplete.data.download.QuestDownload.download(QuestDownload.java:124)
at de.westnordost.streetcomplete.data.download.QuestDownloadService$ServiceHandler.handleMessage(QuestDownloadService.java:185)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.os.HandlerThread.run(HandlerThread.java:61)
westnordost commented 6 years ago

cc @matkoniecz

The overpass error message says that the date must be in exactly this format: yyyy-mm-ddThh:mm:ssZ In the Java code, it looks like the date is in the form yyyy-MM-ddThh:mm:ssZ

Not sure if the MM vs mm makes a difference? Which of the two, if not both, is correct ISO8601?

I also only got one error report so far. Perhaps it is a problem that only arises on certain locales?

matkoniecz commented 6 years ago

Oh dear, again.

according to https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html lowercase m is for "Minute in hour" and uppercase M is for month, so apparently date format syntax is incompatible here.

matkoniecz commented 6 years ago

I think that I will resurrect #954 - I looked a bit at what is happening here and at this moment I have no idea what went wrong and it would be useful to know what was send to overpass.

westnordost commented 6 years ago

Well, that's Java. For example in PHP, the letters stand for something else. So, in any case, the error message might also be imprecise.

HolgerJeromin commented 6 years ago

https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html

Constructs a SimpleDateFormat using the default pattern and date format symbols for the default locale. Note: This constructor may not support all locales. For full coverage, use the factory methods in the DateFormat class.

Is this the problem?

westnordost commented 6 years ago

It is reliably reproducable if you change your language to Persian. The query is i.e.

[bbox:37.38761749978395,-122.10205078125,37.43997405227058,-122.080078125];
way[highway=construction](if:!is_date(t['opening_date']) || date(t['opening_date'])<date('۲۰۱۸-۰۵-۱۸T00:00:00Z')) -> .construction_with_unknown_state;
(way[highway=construction](newer: '۲۰۱۸-۰۵-۰۴T00:00:00Z');relation[highway=construction](newer: '۲۰۱۸-۰۵-۰۴T00:00:00Z');) -> .recently_edited_construction;
(.construction_with_unknown_state; - .recently_edited_construction;) -> .roads_for_review;
.roads_for_review out meta geom;