- Timestamp:
- 2024-02-20T16:44:22+01:00 (9 months ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/scripts/SyncEditorLayerIndex.java
r18801 r18989 1 1 // License: GPL. For details, see LICENSE file. 2 2 3 import static java.nio.charset.StandardCharsets.UTF_8; 3 4 import static org.apache.commons.lang3.StringUtils.isBlank; … … 38 39 import java.util.stream.Collectors; 39 40 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 48 41 import org.openstreetmap.gui.jmapviewer.Coordinate; 49 42 import org.openstreetmap.josm.data.Preferences; … … 66 59 import org.openstreetmap.josm.tools.Utils; 67 60 import org.xml.sax.SAXException; 61 62 import jakarta.json.Json; 63 import jakarta.json.JsonArray; 64 import jakarta.json.JsonNumber; 65 import jakarta.json.JsonObject; 66 import jakarta.json.JsonReader; 67 import jakarta.json.JsonString; 68 import jakarta.json.JsonValue; 68 69 69 70 /** … … 500 501 501 502 for (ImageryInfo e : josmEntries) { 503 if (!e.isValid()) { 504 myprintln("~~~ JOSM-Entry missing fields (" + String.join(", ", e.getMissingFields()) + "): " + getDescription(e)); 505 } 502 506 if (isBlank(getUrl(e))) { 503 507 myprintln("~~~ JOSM-Entry without URL: " + getDescription(e)); -
trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java
r18723 r18989 20 20 import java.util.stream.Collectors; 21 21 22 import jakarta.json.Json;23 import jakarta.json.JsonObject;24 import jakarta.json.JsonReader;25 22 import javax.swing.ImageIcon; 26 23 … … 39 36 import org.openstreetmap.josm.tools.StreamUtils; 40 37 import org.openstreetmap.josm.tools.Utils; 38 39 import jakarta.json.Json; 40 import jakarta.json.JsonObject; 41 import jakarta.json.JsonReader; 41 42 42 43 /** … … 205 206 } 206 207 } 208 209 private static final String[] EMPTY_STRING = new String[0]; 207 210 208 211 private double pixelPerDegree; … … 567 570 * Check if this object equals another ImageryInfo with respect to the properties 568 571 * that get written to the preference file. 569 * 572 * <p> 570 573 * The field {@link #pixelPerDegree} is ignored. 571 574 * … … 965 968 966 969 /** 970 * Check to see if this info is valid (the XSD is overly permissive due to limitations of the XSD syntax). 971 * @return {@code true} if this info is valid 972 * @see ImageryInfo#getMissingFields() 973 * @since 18989 974 */ 975 public boolean isValid() { 976 return this.getName() != null && 977 this.getId() != null && 978 this.getSourceType() != null && 979 this.getUrl() != null && 980 this.getImageryCategory() != null; 981 } 982 983 /** 984 * Get the missing fields for this info 985 * @return The missing fields, or an empty array 986 * @see ImageryInfo#isValid() 987 * @since 18989 988 */ 989 public String[] getMissingFields() { 990 if (this.isValid()) { 991 return EMPTY_STRING; 992 } 993 List<String> missingFields = new ArrayList<>(); 994 if (this.getName() == null) { 995 missingFields.add("name"); 996 } 997 if (this.getId() == null) { 998 missingFields.add("id"); 999 } 1000 if (this.getSourceType() == null) { 1001 missingFields.add("type"); 1002 } 1003 if (this.getUrl() == null) { 1004 missingFields.add("url"); 1005 } 1006 if (this.getImageryCategory() == null) { 1007 missingFields.add("category"); 1008 } 1009 return missingFields.toArray(new String[0]); 1010 } 1011 1012 /** 967 1013 * Return the sorted list of activated source IDs. 968 1014 * @return sorted list of activated source IDs -
trunk/src/org/openstreetmap/josm/data/imagery/ImageryLayerInfo.java
r18211 r18989 167 167 reader.setFastFail(fastFail); 168 168 Collection<ImageryInfo> result = reader.parse(); 169 // See #23485 (remove invalid source entries) 170 result.removeIf(info -> !info.isValid()); 169 171 newLayers.addAll(result); 170 172 } catch (IOException ex) {
Note:
See TracChangeset
for help on using the changeset viewer.