BoundingBoxMapWithAIDownloader: Use response headers to determine parser

Signed-off-by: Taylor Smock <tsmock@fb.com>
pull/1/head v1.9.2
Taylor Smock 2021-11-22 08:27:56 -07:00
rodzic 385c16a061
commit 516a508620
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 625F6A74A3E4311A
1 zmienionych plików z 3 dodań i 5 usunięć

Wyświetl plik

@ -32,7 +32,6 @@ import org.openstreetmap.josm.io.OsmTransferException;
import org.openstreetmap.josm.plugins.mapwithai.MapWithAIPlugin;
import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAIConflationCategory;
import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAIInfo;
import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAIType;
import org.openstreetmap.josm.plugins.mapwithai.tools.MapPaintUtils;
import org.openstreetmap.josm.tools.HttpClient;
import org.openstreetmap.josm.tools.Logging;
@ -168,10 +167,9 @@ public class BoundingBoxMapWithAIDownloader extends BoundingBoxDownloader {
@Override
protected DataSet parseDataSet(InputStream source, ProgressMonitor progressMonitor) throws IllegalDataException {
DataSet ds;
String contentType = this.activeConnection.getResponse().getHeaderField("Content-Type");
if (contentType.contains("text/xml")) {
ds = OsmReader.parseDataSet(source, progressMonitor, OsmReader.Options.SAVE_ORIGINAL_ID);
} else if (MapWithAIType.ESRI_FEATURE_SERVER == this.info.getSourceType()) {
String contentType = this.activeConnection.getResponse().getContentType();
if (contentType.contains("text/json") || contentType.contains("application/json")
|| contentType.contains("application/geo+json")) {
ds = GeoJSONReader.parseDataSet(source, progressMonitor);
if (info.getReplacementTags() != null) {
GetDataRunnable.replaceKeys(ds, info.getReplacementTags());