From 047f2c5cbe1ad0576256332eb8d8014eea98b6cc Mon Sep 17 00:00:00 2001 From: "taylor.smock" Date: Mon, 22 Jan 2024 21:31:23 +0000 Subject: [PATCH] ValidatorCLI: Fix an NPE when run prior to any call to Territories.initialize There is currently no good way to see if the Territories data is initialized. This does mean that tests will take a little bit longer. git-svn-id: https://josm.openstreetmap.de/svn/trunk@18950 0c6e7542-c601-0410-84e7-c038aed88b3b --- .../openstreetmap/josm/data/validation/ValidatorCLI.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/org/openstreetmap/josm/data/validation/ValidatorCLI.java b/src/org/openstreetmap/josm/data/validation/ValidatorCLI.java index f429e3dbb57..3fcdf355943 100644 --- a/src/org/openstreetmap/josm/data/validation/ValidatorCLI.java +++ b/src/org/openstreetmap/josm/data/validation/ValidatorCLI.java @@ -26,7 +26,6 @@ import java.util.logging.Level; import java.util.stream.Collectors; -import jakarta.json.JsonObject; import org.apache.commons.compress.utils.FileNameUtils; import org.openstreetmap.josm.actions.ExtensionFileFilter; import org.openstreetmap.josm.cli.CLIModule; @@ -64,6 +63,8 @@ import org.openstreetmap.josm.tools.Territories; import org.openstreetmap.josm.tools.Utils; +import jakarta.json.JsonObject; + /** * Add a validate command to the JOSM command line interface. * @author Taylor Smock @@ -355,9 +356,7 @@ void initialize() { Config.setUrlsProvider(JosmUrls.getInstance()); ProjectionRegistry.setProjection(Projections.getProjectionByCode("epsg:3857".toUpperCase(Locale.ROOT))); - if (Territories.getKnownIso3166Codes().isEmpty()) { - Territories.initializeInternalData(); - } + Territories.initializeInternalData(); // There is no current way to check to see if territories is already initialized OsmValidator.initialize(); MapPaintStyles.readFromPreferences(); }