Ticket #16680: v1-0002-PluginServer-ensure-jar-relative-path-is-stringif.patch

File v1-0002-PluginServer-ensure-jar-relative-path-is-stringif.patch, 1.7 KB (added by ris, 7 months ago)
  • test/unit/org/openstreetmap/josm/testutils/PluginServer.java

    From c8c99d2292a525d6a0ea0b5ad45d6e794fd27db7 Mon Sep 17 00:00:00 2001
    From: Robert Scott <code@humanleg.org.uk>
    Date: Tue, 21 Aug 2018 23:20:29 +0100
    Subject: [PATCH v1 2/2] PluginServer: ensure jar relative path is stringified
     with forward-slashes even on windows
    
    as we're going to be joining it into a url
    ---
     test/unit/org/openstreetmap/josm/testutils/PluginServer.java | 4 +++-
     1 file changed, 3 insertions(+), 1 deletion(-)
    
    diff --git a/test/unit/org/openstreetmap/josm/testutils/PluginServer.java b/test/unit/org/openstreetmap/josm/testutils/PluginServer.java
    index 79543e4f5..a8aceb2ca 100644
    a b import com.github.tomakehurst.wiremock.client.WireMock; 
    2525import com.github.tomakehurst.wiremock.core.Options;
    2626import com.github.tomakehurst.wiremock.junit.WireMockRule;
    2727import com.google.common.collect.ImmutableList;
     28import com.google.common.collect.Streams;
    2829
    2930public class PluginServer {
    3031    public static class RemotePlugin {
    public class PluginServer { 
    117118                final Path filesRootPath = new File(TestUtils.getTestDataRoot()).toPath().toAbsolutePath().resolve("__files").normalize();
    118119
    119120                if (jarPath.startsWith(filesRootPath)) {
    120                     return filesRootPath.relativize(jarPath).toString();
     121                    // would just use .toString() but need to force use of *forward slash* path separators on all platforms
     122                    return Streams.stream(filesRootPath.relativize(jarPath)).map(p -> p.toString()).collect(Collectors.joining("/"));
    121123                }
    122124            }
    123125            return null;