Skip to content
Commits on Source (5)
josm (0.0.svn15806+dfsg-2~bpo10+1) buster-backports; urgency=medium
* Rebuild for buster-backports.
-- Bas Couwenberg <sebastic@debian.org> Sat, 22 Feb 2020 08:33:00 +0100
josm (0.0.svn15806+dfsg-2) unstable; urgency=medium
* Bump minimum required jmapviewer version to 2.13.
* Add upstream patches for jmapviewer 2.13 support.
-- Bas Couwenberg <sebastic@debian.org> Mon, 17 Feb 2020 09:37:23 +0100
josm (0.0.svn15806+dfsg-1~bpo10+1) buster-backports; urgency=medium
* Rebuild for buster-backports.
......
......@@ -11,7 +11,7 @@ Build-Depends: debhelper (>= 9~),
ant-contrib,
gettext,
javacc,
jmapviewer (>= 2.12),
jmapviewer (>= 2.13),
libcommons-compress-java,
libcommons-logging-java,
libgettext-ant-tasks-java,
......@@ -28,7 +28,7 @@ Package: josm
Architecture: all
Depends: default-jre (>= 2:1.9) | java9-runtime,
fonts-noto,
jmapviewer (>= 2.12),
jmapviewer (>= 2.13),
libcommons-compress-java,
libcommons-logging-java,
libgettext-commons-java (>= 0.9.6),
......
......@@ -7,3 +7,7 @@
07-use_system_fonts.patch
08-use_noto_font.patch
09-no-java-8.patch
svn-r15853.patch
svn-r15855.patch
svn-r15868.patch
svn-r15871.patch
Description: non-blocking warning in case of invalid TMS entries
Bug: https://josm.openstreetmap.de/ticket/18440
Origin: https://josm.openstreetmap.de/changeset/15853/josm
--- a/src/org/openstreetmap/josm/gui/bbox/JosmMapViewer.java
+++ b/src/org/openstreetmap/josm/gui/bbox/JosmMapViewer.java
@@ -1,8 +1,6 @@
// License: GPL. For details, see LICENSE file.
package org.openstreetmap.josm.gui.bbox;
-import static org.openstreetmap.josm.tools.I18n.tr;
-
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -26,6 +24,7 @@ import org.openstreetmap.josm.data.image
import org.openstreetmap.josm.data.imagery.TileLoaderFactory;
import org.openstreetmap.josm.data.preferences.StringProperty;
import org.openstreetmap.josm.gui.MainApplication;
+import org.openstreetmap.josm.gui.Notification;
import org.openstreetmap.josm.gui.layer.AbstractCachedTileSourceLayer;
import org.openstreetmap.josm.gui.layer.ImageryLayer;
import org.openstreetmap.josm.gui.layer.TMSLayer;
@@ -75,11 +74,10 @@ public class JosmMapViewer extends JMapV
sources.add(source);
}
} catch (IllegalArgumentException ex) {
- Logging.warn(ex);
+ Logging.trace(ex);
+ Logging.warn(ex.getMessage());
if (ex.getMessage() != null && !ex.getMessage().isEmpty()) {
- JOptionPane.showMessageDialog(MainApplication.getMainFrame(),
- ex.getMessage(), tr("Warning"),
- JOptionPane.WARNING_MESSAGE);
+ new Notification(ex.getMessage()).setIcon(JOptionPane.WARNING_MESSAGE).show();
}
}
}
Description: Fetch imagery API keys from JOSM website. Restore access to Maxar imagery. Requires JMapViewer 2.13
Bug: https://josm.openstreetmap.de/ticket/18440
Origin: https://josm.openstreetmap.de/changeset/15855/josm
--- a/src/org/openstreetmap/josm/gui/MainInitialization.java
+++ b/src/org/openstreetmap/josm/gui/MainInitialization.java
@@ -29,6 +29,7 @@ import org.openstreetmap.josm.io.FileWat
import org.openstreetmap.josm.io.OsmApi;
import org.openstreetmap.josm.io.OsmApiInitializationException;
import org.openstreetmap.josm.io.OsmTransferCanceledException;
+import org.openstreetmap.josm.io.imagery.ApiKeyProvider;
import org.openstreetmap.josm.spi.lifecycle.InitializationSequence;
import org.openstreetmap.josm.spi.lifecycle.InitializationTask;
import org.openstreetmap.josm.spi.preferences.Config;
@@ -142,6 +143,7 @@ public class MainInitialization implemen
return Arrays.asList(
new InitializationTask(tr("Updating user interface"), () -> GuiHelper.runInEDTAndWait(() -> {
// hooks for the jmapviewer component
+ FeatureAdapter.registerApiKeyAdapter(ApiKeyProvider::retrieveApiKey);
FeatureAdapter.registerBrowserAdapter(OpenBrowser::displayUrl);
FeatureAdapter.registerImageAdapter(ImageProvider::read);
FeatureAdapter.registerTranslationAdapter(I18n::tr);
--- /dev/null
+++ b/src/org/openstreetmap/josm/io/imagery/ApiKeyProvider.java
@@ -0,0 +1,50 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.io.imagery;
+
+import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.Collections;
+import java.util.List;
+
+import org.openstreetmap.josm.data.Preferences;
+import org.openstreetmap.josm.spi.preferences.Config;
+import org.openstreetmap.josm.tools.HttpClient;
+import org.openstreetmap.josm.tools.HttpClient.Response;
+import org.openstreetmap.josm.tools.Utils;
+
+/**
+ * Provider of confidential imagery API keys.
+ * @since 15855
+ */
+public final class ApiKeyProvider {
+
+ private ApiKeyProvider() {
+ // Hide public constructor
+ }
+
+ private static List<String> getApiKeySites() {
+ return Preferences.main().getList("apikey.sites",
+ Collections.singletonList(Config.getUrls().getJOSMWebsite()+"/mapkey/"));
+ }
+
+ /**
+ * Retrieves the API key for the given imagery id.
+ * @param imageryId imagery id
+ * @return the API key for the given imagery id
+ * @throws IOException in case of I/O error
+ */
+ public static String retrieveApiKey(String imageryId) throws IOException {
+ for (String siteUrl : getApiKeySites()) {
+ Response response = HttpClient.create(new URL(siteUrl + imageryId)).connect();
+ try {
+ if (response.getResponseCode() == HttpURLConnection.HTTP_OK) {
+ return Utils.strip(response.fetchContent());
+ }
+ } finally {
+ response.disconnect();
+ }
+ }
+ return null;
+ }
+}
Description: cache API keys in memory
Bug: https://josm.openstreetmap.de/ticket/18440
Origin: https://josm.openstreetmap.de/changeset/15868/josm
--- a/src/org/openstreetmap/josm/io/imagery/ApiKeyProvider.java
+++ b/src/org/openstreetmap/josm/io/imagery/ApiKeyProvider.java
@@ -5,7 +5,9 @@ import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.openstreetmap.josm.data.Preferences;
import org.openstreetmap.josm.spi.preferences.Config;
@@ -19,6 +21,8 @@ import org.openstreetmap.josm.tools.Util
*/
public final class ApiKeyProvider {
+ private static final Map<String, String> CACHE = new HashMap<>();
+
private ApiKeyProvider() {
// Hide public constructor
}
@@ -35,11 +39,16 @@ public final class ApiKeyProvider {
* @throws IOException in case of I/O error
*/
public static String retrieveApiKey(String imageryId) throws IOException {
+ if (CACHE.containsKey(imageryId)) {
+ return CACHE.get(imageryId);
+ }
for (String siteUrl : getApiKeySites()) {
Response response = HttpClient.create(new URL(siteUrl + imageryId)).connect();
try {
if (response.getResponseCode() == HttpURLConnection.HTTP_OK) {
- return Utils.strip(response.fetchContent());
+ String key = Utils.strip(response.fetchContent());
+ CACHE.put(imageryId, key);
+ return key;
}
} finally {
response.disconnect();
Description: register API key provider in integration test
Bug: https://josm.openstreetmap.de/ticket/18440
Origin: https://josm.openstreetmap.de/changeset/15871/josm
--- a/test/unit/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreferenceTestIT.java
+++ b/test/unit/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreferenceTestIT.java
@@ -30,6 +30,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized.Parameters;
import org.openstreetmap.gui.jmapviewer.Coordinate;
+import org.openstreetmap.gui.jmapviewer.FeatureAdapter;
import org.openstreetmap.gui.jmapviewer.TileXY;
import org.openstreetmap.gui.jmapviewer.interfaces.ICoordinate;
import org.openstreetmap.gui.jmapviewer.tilesources.AbstractTileSource;
@@ -56,6 +57,7 @@ import org.openstreetmap.josm.data.image
import org.openstreetmap.josm.data.projection.Projection;
import org.openstreetmap.josm.data.projection.ProjectionRegistry;
import org.openstreetmap.josm.data.projection.Projections;
+import org.openstreetmap.josm.io.imagery.ApiKeyProvider;
import org.openstreetmap.josm.io.imagery.WMSImagery.WMSGetCapabilitiesException;
import org.openstreetmap.josm.testutils.JOSMTestRules;
import org.openstreetmap.josm.testutils.ParallelParameterized;
@@ -100,6 +102,7 @@ public class ImageryPreferenceTestIT {
*/
@BeforeClass
public static void beforeClass() throws IOException {
+ FeatureAdapter.registerApiKeyAdapter(ApiKeyProvider::retrieveApiKey);
helper = new TMSCachedTileLoaderJob(null, null, new CacheAccess<>(null), new TileJobOptions(0, 0, null, 0), null);
errorsToIgnore.addAll(TestUtils.getIgnoredErrorMessages(ImageryPreferenceTestIT.class));
notIgnoredErrors.addAll(errorsToIgnore);