From 1044ceac6a628e0f259e65c434161c574668b915 Mon Sep 17 00:00:00 2001 From: Taylor Smock Date: Mon, 17 Jun 2024 07:44:40 -0600 Subject: [PATCH 1/3] Spotless Signed-off-by: Taylor Smock --- .../mapillary/MapillaryLayerListener.java | 1 + .../actions/MapObjectLayerAction.java | 4 +-- .../actions/MapPointObjectLayerAction.java | 16 ++++----- .../mapillary/command/DeleteCommand.java | 1 + .../mapillary/command/GenericCommand.java | 1 + .../data/mapillary/MapillaryPrimitive.java | 1 + .../VectorDataSelectionListener.java | 1 + .../gui/dialog/MapillaryFilterDialog.java | 2 +- .../gui/layer/AdditionalActionPanel.java | 1 + ...DisableShortcutsOnFocusGainedJSpinner.java | 1 + .../io/download/TileAddEventSource.java | 1 + .../io/download/TileAddListener.java | 1 + .../spi/preferences/IMapillaryUrlChange.java | 1 + .../mapillary/utils/MapillaryUserUtils.java | 1 + .../mapillary/utils/SecurityManagerUtils.java | 1 + .../mapillary/command/DeleteCommandTest.java | 1 + .../mapillary/MapillaryFilterModelTest.java | 1 + .../AddTagToPrimitiveActionTest.java | 1 + .../annotations/GuiWorkersStopper.java | 6 ++-- .../annotations/MapillaryCaches.java | 1 + .../annotations/MapillaryLayerAnnotation.java | 1 + .../annotations/MapillaryURLWireMock.java | 34 ++++++++----------- .../annotations/SecurityManagerTest.java | 1 + 23 files changed, 48 insertions(+), 32 deletions(-) diff --git a/src/main/java/org/openstreetmap/josm/plugins/mapillary/MapillaryLayerListener.java b/src/main/java/org/openstreetmap/josm/plugins/mapillary/MapillaryLayerListener.java index 5bb1ca59d..9ddd50d0e 100644 --- a/src/main/java/org/openstreetmap/josm/plugins/mapillary/MapillaryLayerListener.java +++ b/src/main/java/org/openstreetmap/josm/plugins/mapillary/MapillaryLayerListener.java @@ -1,3 +1,4 @@ +// License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.plugins.mapillary; import java.util.stream.Stream; diff --git a/src/main/java/org/openstreetmap/josm/plugins/mapillary/actions/MapObjectLayerAction.java b/src/main/java/org/openstreetmap/josm/plugins/mapillary/actions/MapObjectLayerAction.java index aa4c20191..5a4efc1da 100644 --- a/src/main/java/org/openstreetmap/josm/plugins/mapillary/actions/MapObjectLayerAction.java +++ b/src/main/java/org/openstreetmap/josm/plugins/mapillary/actions/MapObjectLayerAction.java @@ -22,8 +22,8 @@ public class MapObjectLayerAction extends JosmAction { public MapObjectLayerAction() { super( - I18n.tr(ACTION_NAME), MapillaryPlugin.LOGO.setSize(ImageSizes.DEFAULT), I18n.tr(DESCRIPTION), - Shortcut.registerShortcut("mapillary:trafficSignLayer", ACTION_NAME, KeyEvent.CHAR_UNDEFINED, Shortcut.NONE), + I18n.tr(ACTION_NAME), MapillaryPlugin.LOGO.setSize(ImageSizes.DEFAULT), I18n.tr(DESCRIPTION), Shortcut + .registerShortcut("mapillary:trafficSignLayer", ACTION_NAME, KeyEvent.CHAR_UNDEFINED, Shortcut.NONE), false, "mapillary:trafficSignLayer", true); } diff --git a/src/main/java/org/openstreetmap/josm/plugins/mapillary/actions/MapPointObjectLayerAction.java b/src/main/java/org/openstreetmap/josm/plugins/mapillary/actions/MapPointObjectLayerAction.java index a400660af..3c6618b22 100644 --- a/src/main/java/org/openstreetmap/josm/plugins/mapillary/actions/MapPointObjectLayerAction.java +++ b/src/main/java/org/openstreetmap/josm/plugins/mapillary/actions/MapPointObjectLayerAction.java @@ -1,6 +1,12 @@ // License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.plugins.mapillary.actions; +import static org.openstreetmap.josm.tools.I18n.marktr; +import static org.openstreetmap.josm.tools.I18n.tr; + +import java.awt.event.ActionEvent; +import java.awt.event.KeyEvent; + import org.openstreetmap.josm.actions.JosmAction; import org.openstreetmap.josm.gui.MainApplication; import org.openstreetmap.josm.gui.layer.Layer; @@ -11,12 +17,6 @@ import org.openstreetmap.josm.tools.ImageProvider.ImageSizes; import org.openstreetmap.josm.tools.Shortcut; -import java.awt.event.ActionEvent; -import java.awt.event.KeyEvent; - -import static org.openstreetmap.josm.tools.I18n.marktr; -import static org.openstreetmap.josm.tools.I18n.tr; - /** * An action to create a layer for Mapillary point objects (not traffic signs) */ @@ -27,8 +27,8 @@ public class MapPointObjectLayerAction extends JosmAction { "Displays the layer displaying the map point objects detected by Mapillary"); public MapPointObjectLayerAction() { - super(tr(ACTION_NAME), MapillaryPlugin.LOGO.setSize(ImageSizes.DEFAULT), tr(TOOLTIP), - Shortcut.registerShortcut("mapillary:pointFeaturesLayer", tr(ACTION_NAME), KeyEvent.CHAR_UNDEFINED, Shortcut.NONE), + super(tr(ACTION_NAME), MapillaryPlugin.LOGO.setSize(ImageSizes.DEFAULT), tr(TOOLTIP), Shortcut + .registerShortcut("mapillary:pointFeaturesLayer", tr(ACTION_NAME), KeyEvent.CHAR_UNDEFINED, Shortcut.NONE), false, "mapillary:pointFeaturesLayer", true); } diff --git a/src/main/java/org/openstreetmap/josm/plugins/mapillary/command/DeleteCommand.java b/src/main/java/org/openstreetmap/josm/plugins/mapillary/command/DeleteCommand.java index 0d263b686..d555bcb61 100644 --- a/src/main/java/org/openstreetmap/josm/plugins/mapillary/command/DeleteCommand.java +++ b/src/main/java/org/openstreetmap/josm/plugins/mapillary/command/DeleteCommand.java @@ -1,3 +1,4 @@ +// License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.plugins.mapillary.command; import static org.openstreetmap.josm.tools.I18n.tr; diff --git a/src/main/java/org/openstreetmap/josm/plugins/mapillary/command/GenericCommand.java b/src/main/java/org/openstreetmap/josm/plugins/mapillary/command/GenericCommand.java index f2e27eaa4..78bcd3827 100644 --- a/src/main/java/org/openstreetmap/josm/plugins/mapillary/command/GenericCommand.java +++ b/src/main/java/org/openstreetmap/josm/plugins/mapillary/command/GenericCommand.java @@ -1,3 +1,4 @@ +// License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.plugins.mapillary.command; import java.util.Collection; diff --git a/src/main/java/org/openstreetmap/josm/plugins/mapillary/data/mapillary/MapillaryPrimitive.java b/src/main/java/org/openstreetmap/josm/plugins/mapillary/data/mapillary/MapillaryPrimitive.java index 0e2f6a67a..40b057ce0 100644 --- a/src/main/java/org/openstreetmap/josm/plugins/mapillary/data/mapillary/MapillaryPrimitive.java +++ b/src/main/java/org/openstreetmap/josm/plugins/mapillary/data/mapillary/MapillaryPrimitive.java @@ -1,3 +1,4 @@ +// License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.plugins.mapillary.data.mapillary; import java.util.Map; diff --git a/src/main/java/org/openstreetmap/josm/plugins/mapillary/data/mapillary/VectorDataSelectionListener.java b/src/main/java/org/openstreetmap/josm/plugins/mapillary/data/mapillary/VectorDataSelectionListener.java index aab5863ea..062faca95 100644 --- a/src/main/java/org/openstreetmap/josm/plugins/mapillary/data/mapillary/VectorDataSelectionListener.java +++ b/src/main/java/org/openstreetmap/josm/plugins/mapillary/data/mapillary/VectorDataSelectionListener.java @@ -1,3 +1,4 @@ +// License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.plugins.mapillary.data.mapillary; import org.openstreetmap.josm.data.osm.event.IDataSelectionListener; diff --git a/src/main/java/org/openstreetmap/josm/plugins/mapillary/gui/dialog/MapillaryFilterDialog.java b/src/main/java/org/openstreetmap/josm/plugins/mapillary/gui/dialog/MapillaryFilterDialog.java index 83355bdf7..2e8dff811 100644 --- a/src/main/java/org/openstreetmap/josm/plugins/mapillary/gui/dialog/MapillaryFilterDialog.java +++ b/src/main/java/org/openstreetmap/josm/plugins/mapillary/gui/dialog/MapillaryFilterDialog.java @@ -87,7 +87,7 @@ public final class MapillaryFilterDialog extends ToggleDialog private static final String[] TIME_LIST = { tr("Years"), tr("Months"), tr("Days") }; private static final long[] TIME_FACTOR = new long[] { 31_536_000_000L, // = 365 * 24 * 60 * 60 * 1000 = number of - // ms in a year + // ms in a year 2_592_000_000L, // = 30 * 24 * 60 * 60 * 1000 = number of ms in a month 86_400_000 // = 24 * 60 * 60 * 1000 = number of ms in a day }; diff --git a/src/main/java/org/openstreetmap/josm/plugins/mapillary/gui/layer/AdditionalActionPanel.java b/src/main/java/org/openstreetmap/josm/plugins/mapillary/gui/layer/AdditionalActionPanel.java index 3a5ec79d4..6bc440ede 100644 --- a/src/main/java/org/openstreetmap/josm/plugins/mapillary/gui/layer/AdditionalActionPanel.java +++ b/src/main/java/org/openstreetmap/josm/plugins/mapillary/gui/layer/AdditionalActionPanel.java @@ -1,3 +1,4 @@ +// License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.plugins.mapillary.gui.layer; import java.awt.Color; diff --git a/src/main/java/org/openstreetmap/josm/plugins/mapillary/gui/widget/DisableShortcutsOnFocusGainedJSpinner.java b/src/main/java/org/openstreetmap/josm/plugins/mapillary/gui/widget/DisableShortcutsOnFocusGainedJSpinner.java index 0ca9a33c0..ccc76fa2e 100644 --- a/src/main/java/org/openstreetmap/josm/plugins/mapillary/gui/widget/DisableShortcutsOnFocusGainedJSpinner.java +++ b/src/main/java/org/openstreetmap/josm/plugins/mapillary/gui/widget/DisableShortcutsOnFocusGainedJSpinner.java @@ -1,3 +1,4 @@ +// License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.plugins.mapillary.gui.widget; import java.util.ArrayList; diff --git a/src/main/java/org/openstreetmap/josm/plugins/mapillary/io/download/TileAddEventSource.java b/src/main/java/org/openstreetmap/josm/plugins/mapillary/io/download/TileAddEventSource.java index 17eea4f39..a717519f5 100644 --- a/src/main/java/org/openstreetmap/josm/plugins/mapillary/io/download/TileAddEventSource.java +++ b/src/main/java/org/openstreetmap/josm/plugins/mapillary/io/download/TileAddEventSource.java @@ -1,3 +1,4 @@ +// License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.plugins.mapillary.io.download; import org.openstreetmap.gui.jmapviewer.Tile; diff --git a/src/main/java/org/openstreetmap/josm/plugins/mapillary/io/download/TileAddListener.java b/src/main/java/org/openstreetmap/josm/plugins/mapillary/io/download/TileAddListener.java index 1a895f72e..059704058 100644 --- a/src/main/java/org/openstreetmap/josm/plugins/mapillary/io/download/TileAddListener.java +++ b/src/main/java/org/openstreetmap/josm/plugins/mapillary/io/download/TileAddListener.java @@ -1,3 +1,4 @@ +// License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.plugins.mapillary.io.download; import org.openstreetmap.gui.jmapviewer.Tile; diff --git a/src/main/java/org/openstreetmap/josm/plugins/mapillary/spi/preferences/IMapillaryUrlChange.java b/src/main/java/org/openstreetmap/josm/plugins/mapillary/spi/preferences/IMapillaryUrlChange.java index ea7eda386..77e8282f6 100644 --- a/src/main/java/org/openstreetmap/josm/plugins/mapillary/spi/preferences/IMapillaryUrlChange.java +++ b/src/main/java/org/openstreetmap/josm/plugins/mapillary/spi/preferences/IMapillaryUrlChange.java @@ -1,3 +1,4 @@ +// License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.plugins.mapillary.spi.preferences; /** diff --git a/src/main/java/org/openstreetmap/josm/plugins/mapillary/utils/MapillaryUserUtils.java b/src/main/java/org/openstreetmap/josm/plugins/mapillary/utils/MapillaryUserUtils.java index 480a1b1d6..41ab0f866 100644 --- a/src/main/java/org/openstreetmap/josm/plugins/mapillary/utils/MapillaryUserUtils.java +++ b/src/main/java/org/openstreetmap/josm/plugins/mapillary/utils/MapillaryUserUtils.java @@ -1,3 +1,4 @@ +// License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.plugins.mapillary.utils; /** diff --git a/src/main/java/org/openstreetmap/josm/plugins/mapillary/utils/SecurityManagerUtils.java b/src/main/java/org/openstreetmap/josm/plugins/mapillary/utils/SecurityManagerUtils.java index 4b47fa321..2e045cc79 100644 --- a/src/main/java/org/openstreetmap/josm/plugins/mapillary/utils/SecurityManagerUtils.java +++ b/src/main/java/org/openstreetmap/josm/plugins/mapillary/utils/SecurityManagerUtils.java @@ -1,3 +1,4 @@ +// License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.plugins.mapillary.utils; import org.openstreetmap.josm.plugins.mapillary.cache.Caches; diff --git a/test/unit/org/openstreetmap/josm/plugins/mapillary/command/DeleteCommandTest.java b/test/unit/org/openstreetmap/josm/plugins/mapillary/command/DeleteCommandTest.java index 5e4d66c2d..b755866fa 100644 --- a/test/unit/org/openstreetmap/josm/plugins/mapillary/command/DeleteCommandTest.java +++ b/test/unit/org/openstreetmap/josm/plugins/mapillary/command/DeleteCommandTest.java @@ -1,3 +1,4 @@ +// License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.plugins.mapillary.command; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/test/unit/org/openstreetmap/josm/plugins/mapillary/data/mapillary/MapillaryFilterModelTest.java b/test/unit/org/openstreetmap/josm/plugins/mapillary/data/mapillary/MapillaryFilterModelTest.java index e877d1c03..50d7c8611 100644 --- a/test/unit/org/openstreetmap/josm/plugins/mapillary/data/mapillary/MapillaryFilterModelTest.java +++ b/test/unit/org/openstreetmap/josm/plugins/mapillary/data/mapillary/MapillaryFilterModelTest.java @@ -1,3 +1,4 @@ +// License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.plugins.mapillary.data.mapillary; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; diff --git a/test/unit/org/openstreetmap/josm/plugins/mapillary/gui/imageinfo/AddTagToPrimitiveActionTest.java b/test/unit/org/openstreetmap/josm/plugins/mapillary/gui/imageinfo/AddTagToPrimitiveActionTest.java index ad4b811f7..2ff906f7d 100644 --- a/test/unit/org/openstreetmap/josm/plugins/mapillary/gui/imageinfo/AddTagToPrimitiveActionTest.java +++ b/test/unit/org/openstreetmap/josm/plugins/mapillary/gui/imageinfo/AddTagToPrimitiveActionTest.java @@ -1,3 +1,4 @@ +// License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.plugins.mapillary.gui.imageinfo; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; diff --git a/test/unit/org/openstreetmap/josm/plugins/mapillary/testutils/annotations/GuiWorkersStopper.java b/test/unit/org/openstreetmap/josm/plugins/mapillary/testutils/annotations/GuiWorkersStopper.java index d00210250..6913c181d 100644 --- a/test/unit/org/openstreetmap/josm/plugins/mapillary/testutils/annotations/GuiWorkersStopper.java +++ b/test/unit/org/openstreetmap/josm/plugins/mapillary/testutils/annotations/GuiWorkersStopper.java @@ -26,10 +26,12 @@ class MapillaryDownloader implements AfterEachCallback { @Override public void afterEach(ExtensionContext context) { AtomicBoolean done = new AtomicBoolean(); - new org.openstreetmap.josm.plugins.mapillary.gui.workers.MapillaryNodesDownloader(nodes -> done.set(true), 1).execute(); + new org.openstreetmap.josm.plugins.mapillary.gui.workers.MapillaryNodesDownloader(nodes -> done.set(true), + 1).execute(); Awaitility.await().atMost(Durations.FIVE_SECONDS).untilTrue(done); done.set(false); - new org.openstreetmap.josm.plugins.mapillary.gui.workers.MapillarySequenceDownloader("", chunks -> done.set(true)).execute(); + new org.openstreetmap.josm.plugins.mapillary.gui.workers.MapillarySequenceDownloader("", + chunks -> done.set(true)).execute(); Awaitility.await().atMost(Durations.FIVE_SECONDS).untilTrue(done); } } diff --git a/test/unit/org/openstreetmap/josm/plugins/mapillary/testutils/annotations/MapillaryCaches.java b/test/unit/org/openstreetmap/josm/plugins/mapillary/testutils/annotations/MapillaryCaches.java index 9115e9f2e..45647d6cb 100644 --- a/test/unit/org/openstreetmap/josm/plugins/mapillary/testutils/annotations/MapillaryCaches.java +++ b/test/unit/org/openstreetmap/josm/plugins/mapillary/testutils/annotations/MapillaryCaches.java @@ -1,3 +1,4 @@ +// License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.plugins.mapillary.testutils.annotations; import static org.junit.jupiter.api.Assertions.fail; diff --git a/test/unit/org/openstreetmap/josm/plugins/mapillary/testutils/annotations/MapillaryLayerAnnotation.java b/test/unit/org/openstreetmap/josm/plugins/mapillary/testutils/annotations/MapillaryLayerAnnotation.java index 760fbe219..922ad2c1f 100644 --- a/test/unit/org/openstreetmap/josm/plugins/mapillary/testutils/annotations/MapillaryLayerAnnotation.java +++ b/test/unit/org/openstreetmap/josm/plugins/mapillary/testutils/annotations/MapillaryLayerAnnotation.java @@ -1,3 +1,4 @@ +// License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.plugins.mapillary.testutils.annotations; import java.lang.annotation.Documented; diff --git a/test/unit/org/openstreetmap/josm/plugins/mapillary/testutils/annotations/MapillaryURLWireMock.java b/test/unit/org/openstreetmap/josm/plugins/mapillary/testutils/annotations/MapillaryURLWireMock.java index f1100a436..08bd34ba1 100644 --- a/test/unit/org/openstreetmap/josm/plugins/mapillary/testutils/annotations/MapillaryURLWireMock.java +++ b/test/unit/org/openstreetmap/josm/plugins/mapillary/testutils/annotations/MapillaryURLWireMock.java @@ -31,18 +31,6 @@ import javax.imageio.ImageIO; -import org.junit.jupiter.api.extension.AfterAllCallback; -import org.junit.jupiter.api.extension.AfterEachCallback; -import org.junit.jupiter.api.extension.BeforeAllCallback; -import org.junit.jupiter.api.extension.ExtendWith; -import org.junit.jupiter.api.extension.ExtensionContext; -import org.junit.platform.commons.support.AnnotationSupport; -import org.openstreetmap.josm.TestUtils; -import org.openstreetmap.josm.plugins.mapillary.spi.preferences.IMapillaryUrls; -import org.openstreetmap.josm.plugins.mapillary.spi.preferences.MapillaryConfig; -import org.openstreetmap.josm.plugins.mapillary.spi.preferences.MapillaryUrls; -import org.openstreetmap.josm.tools.Utils; - import com.github.tomakehurst.wiremock.WireMockServer; import com.github.tomakehurst.wiremock.client.WireMock; import com.github.tomakehurst.wiremock.common.TextFile; @@ -64,6 +52,17 @@ import jakarta.json.JsonReader; import jakarta.json.JsonString; import jakarta.json.JsonValue; +import org.junit.jupiter.api.extension.AfterAllCallback; +import org.junit.jupiter.api.extension.AfterEachCallback; +import org.junit.jupiter.api.extension.BeforeAllCallback; +import org.junit.jupiter.api.extension.ExtendWith; +import org.junit.jupiter.api.extension.ExtensionContext; +import org.junit.platform.commons.support.AnnotationSupport; +import org.openstreetmap.josm.TestUtils; +import org.openstreetmap.josm.plugins.mapillary.spi.preferences.IMapillaryUrls; +import org.openstreetmap.josm.plugins.mapillary.spi.preferences.MapillaryConfig; +import org.openstreetmap.josm.plugins.mapillary.spi.preferences.MapillaryUrls; +import org.openstreetmap.josm.tools.Utils; /** * Mock Mapillary API calls @@ -226,13 +225,10 @@ public Response transform(Response response, ServeEvent serveEvent) { if (request.queryParameter("image_ids").isPresent()) { // Not implemented currently since I don't know if I need to split on `,` or `%2C` final List imageIds = request.queryParameter("image_ids").values().stream() - .map(str -> str.split(",", -1)).flatMap(Stream::of).filter(Objects::nonNull) - .toList(); - final List imageText = imageIds.stream() - .map(image -> Path.of(TestUtils.getTestDataRoot(), "__files", "api", "v4", "responses", "graph", image + ".json")) - .map(Path::toUri) - .map(TextFile::new) - .toList(); + .map(str -> str.split(",", -1)).flatMap(Stream::of).filter(Objects::nonNull).toList(); + final List imageText = imageIds.stream().map(image -> Path.of(TestUtils.getTestDataRoot(), + "__files", "api", "v4", "responses", "graph", image + ".json")).map(Path::toUri) + .map(TextFile::new).toList(); // We need to get the actual bytes prior to returning, so we need to read the files. final String body = imageText.stream().map(TextFile::readContentsAsString) .collect(Collectors.joining(",", "{\"data\":[", "]}")); diff --git a/test/unit/org/openstreetmap/josm/plugins/mapillary/testutils/annotations/SecurityManagerTest.java b/test/unit/org/openstreetmap/josm/plugins/mapillary/testutils/annotations/SecurityManagerTest.java index e77b88d8f..53c616fb5 100644 --- a/test/unit/org/openstreetmap/josm/plugins/mapillary/testutils/annotations/SecurityManagerTest.java +++ b/test/unit/org/openstreetmap/josm/plugins/mapillary/testutils/annotations/SecurityManagerTest.java @@ -1,3 +1,4 @@ +// License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.plugins.mapillary.testutils.annotations; import java.security.Permission; From 7a3a633fe8a86639e9a6e75b9b7df38762b014d7 Mon Sep 17 00:00:00 2001 From: Taylor Smock Date: Mon, 17 Jun 2024 07:45:00 -0600 Subject: [PATCH 2/3] Fix #23676: Mapillary still has some non-numeric ids in their tiles Signed-off-by: Taylor Smock --- .../mapillary/utils/MapillaryImageUtils.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/openstreetmap/josm/plugins/mapillary/utils/MapillaryImageUtils.java b/src/main/java/org/openstreetmap/josm/plugins/mapillary/utils/MapillaryImageUtils.java index 6120ddc2b..6513cb0f0 100644 --- a/src/main/java/org/openstreetmap/josm/plugins/mapillary/utils/MapillaryImageUtils.java +++ b/src/main/java/org/openstreetmap/josm/plugins/mapillary/utils/MapillaryImageUtils.java @@ -255,12 +255,17 @@ public static long getKey(@Nullable IPrimitive image, boolean ignoreId) { } // This should always be a parseable integer according to API docs. By not checking that all characters are // digits, we save 55.6 MB of allocations in the test area during download. - if (image.hasKey(ImageProperties.ID.toString())) { - final var id = Long.parseLong(image.get(ImageProperties.ID.toString())); - if (id > 0) { - image.setOsmId(id, 1); + try { + if (image.hasKey(ImageProperties.ID.toString())) { + final var id = Long.parseLong(image.get(ImageProperties.ID.toString())); + if (id > 0) { + image.setOsmId(id, 1); + } + return id; } - return id; + } catch (NumberFormatException numberFormatException) { + // This does actually happen; see #23734 + Logging.error(numberFormatException); } } return 0; From aad66ecd2b965e6bd74616471cff60fa728641af Mon Sep 17 00:00:00 2001 From: Taylor Smock Date: Tue, 18 Jun 2024 12:03:44 -0600 Subject: [PATCH 3/3] Update build information Signed-off-by: Taylor Smock --- build.gradle.kts | 12 ++++++------ gradle.properties | 1 + pom.xml | 1 + 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index d929a4ebf..75c34c756 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -14,7 +14,7 @@ plugins { id("application") id("com.diffplug.spotless") version "6.25.0" id("com.github.ben-manes.versions") version "0.51.0" - id("com.github.spotbugs") version "6.0.12" + id("com.github.spotbugs") version "6.0.17" id("net.ltgt.errorprone") version "3.1.0" id("org.openstreetmap.josm") version "0.8.2" id("org.sonarqube") version "4.3.0.3225" @@ -57,24 +57,24 @@ java.targetCompatibility = JavaVersion.VERSION_17 val versions = mapOf( "awaitility" to "4.2.1", - "errorprone" to "2.26.1", + "errorprone" to "2.28.0", "jdatepicker" to "1.3.4", "jmockit" to "1.49", "junit" to "5.10.2", "pmd" to "6.42.0", - "spotbugs" to "4.8.4", - "wiremock" to "2.35.1" + "spotbugs" to "4.8.6", + "wiremock" to "3.6.0" ) dependencies { errorprone("com.google.errorprone:error_prone_core:${versions["errorprone"]}") testImplementation ("org.openstreetmap.josm:josm-unittest:SNAPSHOT"){ isChanging = true } - testImplementation("com.github.tomakehurst:wiremock-jre8:${versions["wiremock"]}") + testImplementation("org.wiremock:wiremock:${versions["wiremock"]}") testImplementation("org.junit.jupiter:junit-jupiter-api:${versions["junit"]}") testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${versions["junit"]}") - // This can be removed once JOSM drops all JUnit4 support. Nothing remaining in Mapillary uses JUnit4. testImplementation("org.junit.jupiter:junit-jupiter-params:${versions["junit"]}") + // This can be removed once JOSM drops all JUnit4 support. Nothing remaining in Mapillary uses JUnit4. testImplementation("org.junit.vintage:junit-vintage-engine:${versions["junit"]}") testImplementation("org.awaitility:awaitility:${versions["awaitility"]}") diff --git a/gradle.properties b/gradle.properties index 7ff6a9597..25d971220 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,6 +13,7 @@ plugin.main.version=18940 plugin.compile.version=18940 # The datepicker plugin is currently in the source tree. TODO fix plugin.requires=apache-commons +plugin.minimum.java.version=17 # Character encoding of Gradle files systemProp.file.encoding=utf-8 diff --git a/pom.xml b/pom.xml index b50d2aeba..618ec30a1 100644 --- a/pom.xml +++ b/pom.xml @@ -66,6 +66,7 @@ ${plugin.link} ${plugin.icon} ${plugin.canloadatruntime} + ${plugin.minimum.java.version}