Ignore:
Timestamp:
2024-04-19T16:21:11+02:00 (4 weeks ago)
Author:
taylor.smock
Message:

Dependency updates

ivy.xml

  • org.eclipse.parsson:parsson: 1.1.5 -> 1.1.6
  • org.apache.commons:commons-compress: 1.25.0 -> 1.26.1
    • Note: This deprecated some functions
  • ch.poole:OpeningHoursParser: 0.28.1 -> 0.28.2
  • org.jacoco:org.jacoco.ant: 0.8.11 -> 0.8.12
  • com.github.spotbugs:spotbugs-annotations: 4.8.3 -> 4.8.4
  • com.github.tomakehurst:wiremock: 2.35.0 -> 3.0.1
  • io.github.classgraph:classgraph: 4.8.165 -> 4.8.171
  • nl.jqno.equalsverifier:equalsverifier: 3.15.6 -> 3.16.1
  • org.awaitility:awaitility: 4.2.0 -> 4.2.1

tools/ivy.xml

  • com.puppycrawl.tools:checkstyle: 9.3 -> 10.15.0
  • com.github.spotbugs:spotbugs: 4.8.3 -> 4.8.4
  • com.google.errorprone: 2.(10.0|24.1) -> 2.26.1
  • net.sourceforge.pmd:pmd was not updated to 7.0.0 due to a significant number of false positives.

There were some additional changes to cleanup new warnings and remove some
additional Java 8 files. There are more warnings that need to be cleaned up.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/validation/ValidatorCLI.java

    r18950 r19048  
    1111import java.nio.charset.StandardCharsets;
    1212import java.nio.file.Files;
    13 import java.nio.file.Path;
    1413import java.nio.file.Paths;
    1514import java.util.ArrayList;
     
    2726import java.util.stream.Collectors;
    2827
    29 import org.apache.commons.compress.utils.FileNameUtils;
     28import org.apache.commons.io.FilenameUtils;
    3029import org.openstreetmap.josm.actions.ExtensionFileFilter;
    3130import org.openstreetmap.josm.cli.CLIModule;
    3231import org.openstreetmap.josm.data.Preferences;
    33 import org.openstreetmap.josm.data.osm.DataSet;
    3432import org.openstreetmap.josm.data.preferences.JosmBaseDirectories;
    3533import org.openstreetmap.josm.data.preferences.JosmUrls;
     
    176174            }
    177175            this.initialize();
    178             final ProgressMonitor fileMonitor = progressMonitorFactory.get();
     176            final var fileMonitor = progressMonitorFactory.get();
    179177            fileMonitor.beginTask(tr("Processing files..."), this.input.size());
    180178            for (String inputFile : this.input) {
     
    202200     */
    203201    private static void processMapcssFile(final String inputFile) throws ParseException {
    204         final MapCSSStyleSource styleSource = new MapCSSStyleSource(new File(inputFile).toURI().getPath(), inputFile, inputFile);
     202        final var styleSource = new MapCSSStyleSource(new File(inputFile).toURI().getPath(), inputFile, inputFile);
    205203        styleSource.loadStyleSource();
    206204        if (!styleSource.getErrors().isEmpty()) {
     
    221219        // Check asserts
    222220        Config.getPref().putBoolean("validator.check_assert_local_rules", true);
    223         final MapCSSTagChecker mapCSSTagChecker = new MapCSSTagChecker();
    224         final Collection<String> assertionErrors = new ArrayList<>();
     221        final var mapCSSTagChecker = new MapCSSTagChecker();
     222        final var assertionErrors = new ArrayList<String>();
    225223        final MapCSSTagChecker.ParseResult result = mapCSSTagChecker.addMapCSS(new File(inputFile).toURI().getPath(),
    226224                assertionErrors::add);
     
    247245     */
    248246    private void processFile(final String inputFile) throws IllegalDataException, IOException {
    249         final File inputFileFile = new File(inputFile);
     247        final var inputFileFile = new File(inputFile);
    250248        final List<FileImporter> inputFileImporters = ExtensionFileFilter.getImporters().stream()
    251249                .filter(importer -> importer.acceptFile(inputFileFile)).collect(Collectors.toList());
    252         final Stopwatch stopwatch = Stopwatch.createStarted();
     250        final var stopwatch = Stopwatch.createStarted();
    253251        if (inputFileImporters.stream().noneMatch(fileImporter ->
    254252                fileImporter.importDataHandleExceptions(inputFileFile, progressMonitorFactory.get()))) {
     
    263261                    .stream().filter(layer -> inputFileFile.equals(layer.getAssociatedFile()))
    264262                    .findFirst().orElseThrow(() -> new JosmRuntimeException(tr("Could not find a layer for {0}", inputFile)));
    265             final DataSet dataSet = dataLayer.getDataSet();
     263            final var dataSet = dataLayer.getDataSet();
    266264            if (this.changeFiles.containsKey(inputFile)) {
    267                 ProgressMonitor changeFilesMonitor = progressMonitorFactory.get();
     265                final var changeFilesMonitor = progressMonitorFactory.get();
    268266                for (String changeFile : this.changeFiles.getOrDefault(inputFile, Collections.emptyList())) {
    269                     try (InputStream changeStream = Compression.getUncompressedFileInputStream(Paths.get(changeFile))) {
     267                    try (var changeStream = Compression.getUncompressedFileInputStream(Paths.get(changeFile))) {
    270268                        dataSet.mergeFrom(OsmChangeReader.parseDataSet(changeStream, changeFilesMonitor));
    271269                    }
    272270                }
    273271            }
    274             Path path = Paths.get(outputFile);
     272            final var path = Paths.get(outputFile);
    275273            if (path.toFile().isFile() && !Files.deleteIfExists(path)) {
    276274                Logging.error("Could not delete {0}, attempting to append", outputFile);
    277275            }
    278             GeoJSONMapRouletteWriter geoJSONMapRouletteWriter = new GeoJSONMapRouletteWriter(dataSet);
     276            final var geoJSONMapRouletteWriter = new GeoJSONMapRouletteWriter(dataSet);
    279277            OsmValidator.initializeTests();
    280278
    281             try (OutputStream fileOutputStream = Files.newOutputStream(path)) {
     279            try (var fileOutputStream = Files.newOutputStream(path)) {
    282280                // The first writeErrors catches anything that was written, for whatever reason. This is probably never
    283281                // going to be called.
    284                 ValidationTask validationTask = new ValidationTask(errors -> writeErrors(geoJSONMapRouletteWriter, fileOutputStream, errors),
     282                final var validationTask = new ValidationTask(errors -> writeErrors(geoJSONMapRouletteWriter, fileOutputStream, errors),
    285283                        progressMonitorFactory.get(), OsmValidator.getEnabledTests(false),
    286284                        dataSet.allPrimitives(), Collections.emptyList(), false);
     
    320318     */
    321319    private static String getDefaultOutputName(final String inputString) {
    322         final String extension = FileNameUtils.getExtension(inputString);
     320        final String extension = FilenameUtils.getExtension(inputString);
    323321        if (!Arrays.asList("zip", "bz", "xz", "geojson").contains(extension)) {
    324             return FileNameUtils.getBaseName(inputString) + ".geojson";
     322            return FilenameUtils.getBaseName(inputString) + ".geojson";
    325323        } else if ("geojson".equals(extension)) {
    326324            // Account for geojson input files
    327             return FileNameUtils.getBaseName(inputString) + ".validated.geojson";
    328         }
    329         return FileNameUtils.getBaseName(FileNameUtils.getBaseName(inputString)) + ".geojson";
     325            return FilenameUtils.getBaseName(inputString) + ".validated.geojson";
     326        }
     327        return FilenameUtils.getBaseName(FilenameUtils.getBaseName(inputString)) + ".geojson";
    330328    }
    331329
     
    348346    /**
    349347     * Initialize everything that might be needed
    350      *
     348     * <p>
    351349     * Arguments may need to be parsed first.
    352350     */
     
    369367        Logging.setLogLevel(Level.INFO);
    370368
    371         OptionParser parser = new OptionParser("JOSM validate");
    372         final AtomicReference<String> currentInput = new AtomicReference<>(null);
     369        final var parser = new OptionParser("JOSM validate");
     370        final var currentInput = new AtomicReference<String>(null);
    373371        for (Option o : Option.values()) {
    374372            if (o.requiresArgument()) {
     
    425423            break;
    426424        case LOAD_PREFERENCES:
    427             final Preferences tempPreferences = new Preferences();
     425            final var tempPreferences = new Preferences();
    428426            tempPreferences.enableSaveOnPut(false);
    429             CustomConfigurator.XMLCommandProcessor config = new CustomConfigurator.XMLCommandProcessor(tempPreferences);
     427            final var config = new CustomConfigurator.XMLCommandProcessor(tempPreferences);
    430428            try (InputStream is = Utils.openStream(new File(argument).toURI().toURL())) {
    431429                config.openAndReadXML(is);
     
    435433            final IPreferences pref = Config.getPref();
    436434            if (pref instanceof MemoryPreferences) {
    437                 final MemoryPreferences memoryPreferences = (MemoryPreferences) pref;
     435                final var memoryPreferences = (MemoryPreferences) pref;
    438436                tempPreferences.getAllSettings().forEach(memoryPreferences::putSetting);
    439437            } else {
     
    454452
    455453    private static String getHelp() {
    456         final String helpPadding = "\t                          ";
     454        final var helpPadding = "\t                          ";
    457455        // CHECKSTYLE.OFF: SingleSpaceSeparator
    458456        return tr("JOSM Validation command line interface") + "\n\n" +
Note: See TracChangeset for help on using the changeset viewer.