Skip to content

Commit

Permalink
Dependency updates
Browse files Browse the repository at this point in the history
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.

git-svn-id: https://josm.openstreetmap.de/svn/trunk@19048 0c6e7542-c601-0410-84e7-c038aed88b3b
  • Loading branch information
taylor.smock committed Apr 19, 2024
1 parent df8fa8d commit 6677750
Show file tree
Hide file tree
Showing 23 changed files with 454 additions and 485 deletions.
3 changes: 2 additions & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,7 @@ Build-Date: ${build.tstamp}
<target name="pmd" depends="init" description="Run PMD on the source files">
<ivy:cachepath log="download-only" file="${tools.ivy}" pathid="pmd.classpath" conf="pmd"/>
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpathref="pmd.classpath"/>
<pmd shortFilenames="true" cacheLocation="${pmd.dir}/cache" encoding="UTF-8">
<pmd cacheLocation="${pmd.dir}/cache" encoding="UTF-8">
<sourceLanguage name="java" version="${java.lang.version}" />
<ruleset>${pmd.dir}/josm-ruleset.xml</ruleset>
<formatter type="text" toConsole="true" />
Expand All @@ -917,6 +917,7 @@ Build-Date: ${build.tstamp}
<exclude name="org/openstreetmap/josm/gui/mappaint/mapcss/parsergen/*.java" />
</fileset>
<fileset dir="${base.dir}/scripts" includes="**/*.java"/>
<relativizePathsWith><path path="${base.dir}"/></relativizePathsWith>
</pmd>
</target>

Expand Down
24 changes: 12 additions & 12 deletions ivy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,48 +26,48 @@
<dependency conf="api->default" org="org.glassfish" name="javax.json" rev="1.1.4"/>
<dependency conf="api->default" org="jakarta.json" name="jakarta.json-api" rev="2.1.3"/>
<!-- parsson is an implementation for jakarta.json -->
<dependency conf="runtimeOnly->default" org="org.eclipse.parsson" name="parsson" rev="1.1.5"/>
<dependency conf="runtimeOnly->default" org="org.eclipse.parsson" name="parsson" rev="1.1.6"/>
<dependency conf="api->default" org="org.apache.commons" name="commons-jcs3-core" rev="3.2"/>
<dependency conf="api->default" org="org.apache.commons" name="commons-compress" rev="1.25.0"/>
<dependency conf="api->default" org="org.apache.commons" name="commons-compress" rev="1.26.1"/>
<dependency conf="api->default" org="jakarta.annotation" name="jakarta.annotation-api" rev="2.1.1" />
<!-- jsr305 has some source files with non-free CC-BY-2.5 license. Remove after 2024-06-01 to give plugins time to migrate. See #23220 for details -->
<dependency conf="api->default" org="com.google.code.findbugs" name="jsr305" rev="3.0.2"/>
<dependency conf="api->default" org="org.tukaani" name="xz" rev="1.9"/>
<dependency conf="api->default" org="com.adobe.xmp" name="xmpcore" rev="6.1.11"/>
<dependency conf="api->default" org="com.drewnoakes" name="metadata-extractor" rev="2.19.0" transitive="false"/>
<dependency conf="api->default" org="com.formdev" name="svgSalamander" rev="1.1.4"/>
<dependency conf="api->default" org="ch.poole" name="OpeningHoursParser" rev="0.28.1"/>
<dependency conf="api->default" org="ch.poole" name="OpeningHoursParser" rev="0.28.2"/>
<!-- Don't forget to update org.openstreetmap.josm.tools.Tag2Link#PREF_SOURCE -->
<dependency conf="api->default" org="org.webjars.npm" name="tag2link" rev="2024.2.8"/>
<!-- sources->sources -->
<dependency conf="sources->sources" org="org.openstreetmap.jmapviewer" name="jmapviewer" rev="2.19"/>
<dependency conf="sources->sources" org="javax.json" name="javax.json-api" rev="1.1.4"/>
<dependency conf="sources->sources" org="org.glassfish" name="javax.json" rev="1.1.4"/>
<dependency conf="sources->sources" org="jakarta.json" name="jakarta.json-api" rev="2.1.3"/>
<dependency conf="sources->sources" org="org.eclipse.parsson" name="parsson" rev="1.1.5"/>
<dependency conf="sources->sources" org="org.eclipse.parsson" name="parsson" rev="1.1.6"/>
<dependency conf="sources->sources" org="org.apache.commons" name="commons-jcs3-core" rev="3.2"/>
<dependency conf="sources->sources" org="org.apache.commons" name="commons-compress" rev="1.25.0"/>
<dependency conf="sources->sources" org="org.apache.commons" name="commons-compress" rev="1.26.1"/>
<dependency conf="sources->sources" org="jakarta.annotation" name="jakarta.annotation-api" rev="2.1.1" />
<!-- jsr305 has some source files with non-free CC-BY-2.5 license. Remove after 2024-06-01 to give plugins time to migrate. See #23220 for details -->
<dependency conf="sources->sources" org="com.google.code.findbugs" name="jsr305" rev="3.0.2"/>
<dependency conf="sources->sources" org="org.tukaani" name="xz" rev="1.9"/>
<dependency conf="sources->sources" org="com.adobe.xmp" name="xmpcore" rev="6.1.11"/>
<dependency conf="sources->sources" org="com.drewnoakes" name="metadata-extractor" rev="2.19.0" transitive="false"/>
<dependency conf="sources->sources" org="com.formdev" name="svgSalamander" rev="1.1.4"/>
<dependency conf="sources->sources" org="ch.poole" name="OpeningHoursParser" rev="0.28.1"/>
<dependency conf="sources->sources" org="ch.poole" name="OpeningHoursParser" rev="0.28.2"/>
<dependency conf="sources->default" org="org.webjars.npm" name="tag2link" rev="2024.2.8"/><!-- sources->default sic! (tag2link-sources.jar is empty, see #19335) -->
<!-- commonslang->default -->
<dependency conf="commonslang->default" org="org.apache.commons" name="commons-lang3" rev="3.14.0"/>
<!-- jacocoant->default -->
<dependency conf="jacocoant->default" org="org.jacoco" name="org.jacoco.ant" rev="0.8.11">
<dependency conf="jacocoant->default" org="org.jacoco" name="org.jacoco.ant" rev="0.8.12">
<artifact name="org.jacoco.ant" type="jar" maven:classifier="nodeps"/>
</dependency>
<dependency conf="jmockit->default" org="org.jmockit" name="jmockit" rev="1.49.a"/>
<!-- test->default -->
<dependency conf="test->default" org="com.github.spotbugs" name="spotbugs-annotations" rev="4.8.3"/>
<dependency conf="test->default" org="com.github.spotbugs" name="spotbugs-annotations" rev="4.8.4"/>
<dependency conf="test->default" org="com.ginsberg" name="junit5-system-exit" rev="1.1.2"/>
<dependency conf="test->default" org="com.github.tomakehurst" name="wiremock-jre8" rev="2.35.0"/>
<dependency conf="test->default" org="io.github.classgraph" name="classgraph" rev="4.8.165"/>
<dependency conf="test->default" org="com.github.tomakehurst" name="wiremock" rev="3.0.1"/>
<dependency conf="test->default" org="io.github.classgraph" name="classgraph" rev="4.8.171"/>
<dependency conf="test->default" org="org.junit.platform" name="junit-platform-launcher" rev="1.10.2"/>
<dependency conf="test->default" org="org.junit.platform" name="junit-platform-suite" rev="1.10.2"/>
<dependency conf="test->default" org="org.junit.vintage" name="junit-vintage-engine" rev="5.10.2"/>
Expand All @@ -76,8 +76,8 @@
<dependency conf="test->default" org="org.junit.jupiter" name="junit-jupiter-engine" rev="5.10.2"/>
<dependency conf="test->default" org="org.junit.jupiter" name="junit-jupiter-migrationsupport" rev="5.10.2"/>
<dependency conf="test->default" org="net.trajano.commons" name="commons-testing" rev="2.1.0"/>
<dependency conf="test->default" org="nl.jqno.equalsverifier" name="equalsverifier" rev="3.15.6"/>
<dependency conf="test->default" org="nl.jqno.equalsverifier" name="equalsverifier" rev="3.16.1"/>
<dependency conf="test->default" org="org.apache.commons" name="commons-lang3" rev="3.14.0"/>
<dependency conf="test->default" org="org.awaitility" name="awaitility" rev="4.2.0"/>
<dependency conf="test->default" org="org.awaitility" name="awaitility" rev="4.2.1"/>
</dependencies>
</ivy-module>
3 changes: 0 additions & 3 deletions ivysettings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,4 @@
<resolvers>
<ibiblio name="josm-nexus" m2compatible="true" root="https://josm.openstreetmap.de/nexus/content/repositories/public/" />
</resolvers>
<!-- Remove error_prone 2.10.0 specific statements in build.xml when we drop Java 8 as a build platform -->
<property name="versions.error_prone" value="2.10.0" unlessset="isJava11"/>
<property name="versions.error_prone" value="2.24.1" ifset="isJava11"/>
</ivysettings>
64 changes: 31 additions & 33 deletions src/org/openstreetmap/josm/actions/AddImageryLayerAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@

import java.awt.Dimension;
import java.awt.GraphicsEnvironment;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.io.IOException;
import java.net.MalformedURLException;
import java.nio.file.InvalidPathException;
import java.time.Year;
import java.time.ZoneOffset;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.function.Function;
Expand All @@ -25,8 +25,6 @@
import javax.swing.JPanel;
import javax.swing.JScrollPane;

import org.openstreetmap.josm.data.coor.LatLon;
import org.openstreetmap.josm.data.imagery.DefaultLayer;
import org.openstreetmap.josm.data.imagery.ImageryInfo;
import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType;
import org.openstreetmap.josm.data.imagery.LayerDetails;
Expand Down Expand Up @@ -61,11 +59,11 @@ public class AddImageryLayerAction extends JosmAction implements AdaptableAction
static class SelectWmsLayersDialog extends ExtendedDialog {
SelectWmsLayersDialog(WMSLayerTree tree, JComboBox<String> formats) {
super(MainApplication.getMainFrame(), tr("Select WMS layers"), tr("Add layers"), tr("Cancel"));
final JScrollPane scrollPane = new JScrollPane(tree.getLayerTree());
final var scrollPane = new JScrollPane(tree.getLayerTree());
scrollPane.setPreferredSize(new Dimension(400, 400));
final JPanel panel = new JPanel(new GridBagLayout());
final var panel = new JPanel(new GridBagLayout());
panel.add(scrollPane, GBC.eol().fill());
panel.add(formats, GBC.eol().fill(GBC.HORIZONTAL));
panel.add(formats, GBC.eol().fill(GridBagConstraints.HORIZONTAL));
setContent(panel);
}
}
Expand All @@ -83,7 +81,7 @@ public AddImageryLayerAction(ImageryInfo info) {
installAdapters();

// change toolbar icon from if specified
String icon = info.getIcon();
var icon = info.getIcon();
if (icon != null) {
new ImageProvider(icon).setOptional(true).getResourceAsync(result -> {
if (result != null) {
Expand All @@ -102,10 +100,10 @@ public AddImageryLayerAction(ImageryInfo info) {
private static ImageryInfo convertImagery(ImageryInfo info) {
try {
if (info.getUrl() != null && info.getUrl().contains("{time}")) {
final String instant = Year.now(ZoneOffset.UTC).atDay(1).atStartOfDay(ZoneOffset.UTC).toInstant().toString();
final String example = String.join("/", instant, instant);
final String initialSelectionValue = info.getDate() != null ? info.getDate() : example;
final String userDate = JOptionPane.showInputDialog(MainApplication.getMainFrame(),
final var instant = Year.now(ZoneOffset.UTC).atDay(1).atStartOfDay(ZoneOffset.UTC).toInstant().toString();
final var example = String.join("/", instant, instant);
final var initialSelectionValue = info.getDate() != null ? info.getDate() : example;
final var userDate = JOptionPane.showInputDialog(MainApplication.getMainFrame(),
tr("Time filter for \"{0}\" such as \"{1}\"", info.getName(), example),
initialSelectionValue);
if (userDate == null) {
Expand All @@ -114,7 +112,7 @@ private static ImageryInfo convertImagery(ImageryInfo info) {
info.setDate(userDate);
// TODO persist new {time} value (via ImageryLayerInfo.save?)
}
switch(info.getImageryType()) {
switch (info.getImageryType()) {
case WMS_ENDPOINT:
// convert to WMS type
if (Utils.isEmpty(info.getDefaultLayers())) {
Expand All @@ -125,12 +123,12 @@ private static ImageryInfo convertImagery(ImageryInfo info) {
case WMTS:
// specify which layer to use
if (Utils.isEmpty(info.getDefaultLayers())) {
WMTSTileSource tileSource = new WMTSTileSource(info);
DefaultLayer layerId = tileSource.userSelectLayer();
var tileSource = new WMTSTileSource(info);
var layerId = tileSource.userSelectLayer();
if (layerId != null) {
ImageryInfo copy = new ImageryInfo(info);
var copy = new ImageryInfo(info);
copy.setDefaultLayers(Collections.singletonList(layerId));
String layerName = tileSource.getLayers().stream()
var layerName = tileSource.getLayers().stream()
.filter(x -> x.getIdentifier().equals(layerId.getLayerName()))
.map(Layer::getUserTitle)
.findFirst()
Expand Down Expand Up @@ -164,7 +162,7 @@ public void actionPerformed(ActionEvent e) {
if (!isEnabled()) return;
ImageryLayer layer = null;
try {
final ImageryInfo infoToAdd = convertImagery(info);
final var infoToAdd = convertImagery(info);
if (infoToAdd != null) {
layer = ImageryLayer.create(infoToAdd);
getLayerManager().addLayer(layer);
Expand Down Expand Up @@ -206,16 +204,16 @@ public LayerSelection(List<LayerDetails> layers, String format, boolean transpar
}

private static LayerSelection askToSelectLayers(WMSImagery wms) {
final WMSLayerTree tree = new WMSLayerTree();
final var tree = new WMSLayerTree();

Collection<String> wmsFormats = wms.getFormats();
final JComboBox<String> formats = new JComboBox<>(wmsFormats.toArray(new String[0]));
var wmsFormats = wms.getFormats();
final var formats = new JComboBox<String>(wmsFormats.toArray(new String[0]));
formats.setSelectedItem(wms.getPreferredFormat());
formats.setToolTipText(tr("Select image format for WMS layer"));

JCheckBox checkBounds = new JCheckBox(tr("Show only layers for current view"), true);
var checkBounds = new JCheckBox(tr("Show only layers for current view"), true);
Runnable updateTree = () -> {
LatLon latLon = checkBounds.isSelected() && MainApplication.isDisplayingMapView()
var latLon = checkBounds.isSelected() && MainApplication.isDisplayingMapView()
? MainApplication.getMap().mapView.getProjection().eastNorth2latlon(MainApplication.getMap().mapView.getCenter())
: null;
tree.setCheckBounds(latLon);
Expand All @@ -226,14 +224,14 @@ private static LayerSelection askToSelectLayers(WMSImagery wms) {
updateTree.run();

if (!GraphicsEnvironment.isHeadless()) {
ExtendedDialog dialog = new ExtendedDialog(MainApplication.getMainFrame(),
var dialog = new ExtendedDialog(MainApplication.getMainFrame(),
tr("Select WMS layers"), tr("Add layers"), tr("Cancel"));
final JScrollPane scrollPane = new JScrollPane(tree.getLayerTree());
final var scrollPane = new JScrollPane(tree.getLayerTree());
scrollPane.setPreferredSize(new Dimension(400, 400));
final JPanel panel = new JPanel(new GridBagLayout());
final var panel = new JPanel(new GridBagLayout());
panel.add(scrollPane, GBC.eol().fill());
panel.add(checkBounds, GBC.eol().fill(GBC.HORIZONTAL));
panel.add(formats, GBC.eol().fill(GBC.HORIZONTAL));
panel.add(checkBounds, GBC.eol().fill(GridBagConstraints.HORIZONTAL));
panel.add(formats, GBC.eol().fill(GridBagConstraints.HORIZONTAL));
dialog.setContent(panel);

if (dialog.showDialog().getValue() != 1) {
Expand Down Expand Up @@ -282,25 +280,25 @@ public static ImageryInfo getWMSLayerInfo(ImageryInfo info, Function<WMSImagery,
throws IOException, WMSGetCapabilitiesException {
CheckParameterUtil.ensureThat(ImageryType.WMS_ENDPOINT == info.getImageryType(), "wms_endpoint imagery type expected");
// We need to get the URL with {apikey} replaced. See #22642.
final TemplatedWMSTileSource tileSource = new TemplatedWMSTileSource(info, ProjectionRegistry.getProjection());
final WMSImagery wms = new WMSImagery(tileSource.getBaseUrl(), info.getCustomHttpHeaders());
LayerSelection selection = choice.apply(wms);
final var tileSource = new TemplatedWMSTileSource(info, ProjectionRegistry.getProjection());
final var wms = new WMSImagery(tileSource.getBaseUrl(), info.getCustomHttpHeaders());
var selection = choice.apply(wms);
if (selection == null) {
return null;
}

final String url = wms.buildGetMapUrl(
final var url = wms.buildGetMapUrl(
selection.layers.stream().map(LayerDetails::getName).collect(Collectors.toList()),
(List<String>) null,
selection.format,
selection.transparent
);

String selectedLayers = selection.layers.stream()
var selectedLayers = selection.layers.stream()
.map(LayerDetails::getName)
.collect(Collectors.joining(", "));
// Use full copy of original Imagery info to copy all attributes. Only overwrite what's different
ImageryInfo ret = new ImageryInfo(info);
var ret = new ImageryInfo(info);
ret.setUrl(url);
ret.setImageryType(ImageryType.WMS);
ret.setName(info.getName() + " - " + selectedLayers);
Expand Down
Loading

0 comments on commit 6677750

Please sign in to comment.