diff --git a/java/server/test/org/openqa/selenium/docker/v1_40/ListImagesTest.java b/java/server/test/org/openqa/selenium/docker/v1_40/ListImagesTest.java index e0de0ecab33ed..5af258100331b 100644 --- a/java/server/test/org/openqa/selenium/docker/v1_40/ListImagesTest.java +++ b/java/server/test/org/openqa/selenium/docker/v1_40/ListImagesTest.java @@ -26,6 +26,7 @@ import org.openqa.selenium.remote.http.HttpHandler; import org.openqa.selenium.remote.http.HttpResponse; +import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.util.Map; import java.util.Set; @@ -41,24 +42,29 @@ public void shouldReturnImageIfTagIsPresent() { HttpHandler handler = req -> { String filters = req.getQueryParameter("filters"); - String decoded = URLDecoder.decode(filters, UTF_8); - Map raw = new Json().toType(decoded, MAP_TYPE); + try { + String decoded = URLDecoder.decode(filters, "UTF-8"); + Map raw = new Json().toType(decoded, MAP_TYPE); - System.out.println(decoded); - System.out.println(raw); + System.out.println(decoded); + System.out.println(raw); - Map rawRef = (Map) raw.get("reference"); - assertThat(rawRef.get("selenium/standalone-firefox:latest")).isEqualTo(true); + Map rawRef = (Map) raw.get("reference"); + assertThat(rawRef.get("selenium/standalone-firefox:latest")).isEqualTo(true); - return new HttpResponse() - .addHeader("Content-Type", "application/json") - .setContent(Contents.utf8String( - "[{\"Containers\":-1,\"Created\":1581716253," + - "\"Id\":\"sha256:bc24341497a00a3afbf04c518cb4bf98834d933ae331d1c5d3cd6f52c079049e\"," + - "\"Labels\":{\"authors\":\"SeleniumHQ\"},\"ParentId\":\"\"," + - "\"RepoDigests\":null," + - "\"RepoTags\":[\"selenium/standalone-firefox:latest\"]," + - "\"SharedSize\":-1,\"Size\":765131593,\"VirtualSize\":765131593}]")); + return new HttpResponse() + .addHeader("Content-Type", "application/json") + .setContent(Contents.utf8String( + "[{\"Containers\":-1,\"Created\":1581716253," + + "\"Id\":\"sha256:bc24341497a00a3afbf04c518cb4bf98834d933ae331d1c5d3cd6f52c079049e\"," + + + "\"Labels\":{\"authors\":\"SeleniumHQ\"},\"ParentId\":\"\"," + + "\"RepoDigests\":null," + + "\"RepoTags\":[\"selenium/standalone-firefox:latest\"]," + + "\"SharedSize\":-1,\"Size\":765131593,\"VirtualSize\":765131593}]")); + } catch (UnsupportedEncodingException ignore) { + return null; + } }; Reference reference = Reference.parse(