Changeset 18989 in josm for trunk/scripts


Ignore:
Timestamp:
2024-02-20T16:44:22+01:00 (10 months ago)
Author:
taylor.smock
Message:

Fix #23485: JOSM crashes when opening Imagery Preferences

  • SyncEditorLayerIndex.java now checks to see if imagery entries are valid; if not, it prints the missing fields and the standard description.
  • ImageryInfo now has isValid and getMissingFields; the latter method should only be called in tests or SyncEditorLayerIndex.
  • ImageryLayerInfo removes invalid ImageryInfo objects after parsing the source
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/scripts/SyncEditorLayerIndex.java

    r18801 r18989  
    11// License: GPL. For details, see LICENSE file.
     2
    23import static java.nio.charset.StandardCharsets.UTF_8;
    34import static org.apache.commons.lang3.StringUtils.isBlank;
     
    3839import java.util.stream.Collectors;
    3940
    40 import jakarta.json.Json;
    41 import jakarta.json.JsonArray;
    42 import jakarta.json.JsonNumber;
    43 import jakarta.json.JsonObject;
    44 import jakarta.json.JsonReader;
    45 import jakarta.json.JsonString;
    46 import jakarta.json.JsonValue;
    47 
    4841import org.openstreetmap.gui.jmapviewer.Coordinate;
    4942import org.openstreetmap.josm.data.Preferences;
     
    6659import org.openstreetmap.josm.tools.Utils;
    6760import org.xml.sax.SAXException;
     61
     62import jakarta.json.Json;
     63import jakarta.json.JsonArray;
     64import jakarta.json.JsonNumber;
     65import jakarta.json.JsonObject;
     66import jakarta.json.JsonReader;
     67import jakarta.json.JsonString;
     68import jakarta.json.JsonValue;
    6869
    6970/**
     
    500501
    501502        for (ImageryInfo e : josmEntries) {
     503            if (!e.isValid()) {
     504                myprintln("~~~ JOSM-Entry missing fields (" + String.join(", ", e.getMissingFields()) + "): " + getDescription(e));
     505            }
    502506            if (isBlank(getUrl(e))) {
    503507                myprintln("~~~ JOSM-Entry without URL: " + getDescription(e));
Note: See TracChangeset for help on using the changeset viewer.