Changeset 14554 in josm for trunk


Ignore:
Timestamp:
2018-12-12T09:49:40+01:00 (6 years ago)
Author:
stoecker
Message:

see #16301 - make sync script stable against missing data

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/scripts/SyncEditorLayerIndex.groovy

    r14351 r14554  
    288288                + (getOverlay(e) ? " overlay=\"true\"" : "" )
    289289                + ">\n")
    290             stream.write "        <name>${cdata(getName(e), true)}</name>\n"
    291             stream.write "        <id>${getId(e)}</id>\n"
    292290            def t
     291            if((t = getName(e)))
     292                stream.write "        <name>${cdata(t, true)}</name>\n"
     293            if((t = getId(e)))
     294                stream.write "        <id>$t</id>\n"
     295            if((t = getCategory(e)))
     296                stream.write "        <category>$t</category>\n"
    293297            if((t = getDate(e)))
    294298                stream.write "        <date>$t</date>\n"
     
    363367
    364368        for (def e : josmEntries) {
     369            if(!getUrl(e)) {
     370              myprintln "+++ JOSM-Entry without URL: " + getDescription(e)
     371              continue;
     372            }
     373            if(!getName(e)) {
     374              myprintln "+++ JOSM-Entry without Name: " + getDescription(e)
     375              continue;
     376            }
    365377            def url = getUrlStripped(e)
    366378            if (url.contains("{z}")) {
     
    920932            }
    921933            def cat = getCategory(j)
    922             if(cat != null && cat != "photo" && cat != "map" && cat != "historicmap" && cat != "osmbasedmap" && cat != "historicphoto" && cat != "other") {
     934            if(cat == null) {
     935                myprintln "* No category: ${getDescription(j)}"
     936            } else if(cat != "photo" && cat != "map" && cat != "historicmap" && cat != "osmbasedmap" && cat != "historicphoto" && cat != "other") {
    923937                myprintln "* Strange category ${cat}: ${getDescription(j)}"
    924938            }
Note: See TracChangeset for help on using the changeset viewer.