diff --git a/java/client/src/org/openqa/selenium/remote/http/netty/NettyDomainSocketClient.java b/java/client/src/org/openqa/selenium/remote/http/netty/NettyDomainSocketClient.java index ad39b8c35cbda..c345599ae6609 100644 --- a/java/client/src/org/openqa/selenium/remote/http/netty/NettyDomainSocketClient.java +++ b/java/client/src/org/openqa/selenium/remote/http/netty/NettyDomainSocketClient.java @@ -60,6 +60,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.UncheckedIOException; +import java.io.UnsupportedEncodingException; import java.net.URI; import java.net.URLEncoder; import java.util.ArrayList; @@ -111,7 +112,14 @@ public HttpResponse execute(HttpRequest req) throws UncheckedIOException { List queryPairs = new ArrayList<>(); req.getQueryParameterNames().forEach( name -> req.getQueryParameters(name).forEach( - value -> queryPairs.add(URLEncoder.encode(name, UTF_8) + "=" + URLEncoder.encode(value, UTF_8)))); + value -> { + try { + queryPairs.add(URLEncoder.encode(name, UTF_8.toString()) + "=" + URLEncoder.encode(value, UTF_8.toString())); + } catch (UnsupportedEncodingException e) { + Thread.currentThread().interrupt(); + throw new RuntimeException(e); + } + })); if (!queryPairs.isEmpty()) { uri.append("?"); Joiner.on('&').appendTo(uri, queryPairs);