Skip to content

Commit

Permalink
ValidatorCLI: Fix an NPE when run prior to any call to Territories.in…
Browse files Browse the repository at this point in the history
…itialize

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
  • Loading branch information
taylor.smock committed Jan 22, 2024
1 parent 6c4dc05 commit 047f2c5
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/org/openstreetmap/josm/data/validation/ValidatorCLI.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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();
}
Expand Down

0 comments on commit 047f2c5

Please sign in to comment.