diff --git a/java/src/org/openqa/selenium/grid/node/relay/RelayOptions.java b/java/src/org/openqa/selenium/grid/node/relay/RelayOptions.java index 28cbef2cd2c8d..34d827ce3f2e0 100644 --- a/java/src/org/openqa/selenium/grid/node/relay/RelayOptions.java +++ b/java/src/org/openqa/selenium/grid/node/relay/RelayOptions.java @@ -105,20 +105,26 @@ public URI getServiceStatusUri() { } public String getServiceProtocolVersion() { - String protocolVersion = config.get(RELAY_SECTION, "protocol-version").orElse(""); + String rawProtocolVersion = config.get(RELAY_SECTION, "protocol-version").orElse(""); + String protocolVersion = rawProtocolVersion; if (protocolVersion.isEmpty()) { return protocolVersion; } else { - // Support input in the form of "http/1.1" or "HTTP/1.1" - protocolVersion = protocolVersion.toUpperCase().replaceAll("/", "_").replaceAll("\\.", "_"); + protocolVersion = normalizeProtocolVersion(protocolVersion); } try { return Version.valueOf(protocolVersion).toString(); } catch (IllegalArgumentException e) { - throw new ConfigException("Unable to determine the service protocol version", e); + LOG.info("Unsupported protocol version: " + protocolVersion); + throw new ConfigException("Unsupported protocol version provided: " + rawProtocolVersion, e); } } + private String normalizeProtocolVersion(String protocolVersion) { + // Support input in the form of "http/1.1" or "HTTP/1.1" + return protocolVersion.toUpperCase().replaceAll("/", "_").replaceAll("\\.", "_"); + } + // Method being used in SessionSlot @SuppressWarnings("unused") private boolean isServiceUp(HttpClient client) { diff --git a/java/test/org/openqa/selenium/grid/node/relay/RelayOptionsTest.java b/java/test/org/openqa/selenium/grid/node/relay/RelayOptionsTest.java index c48f79f54d888..8b02b1e595f7c 100644 --- a/java/test/org/openqa/selenium/grid/node/relay/RelayOptionsTest.java +++ b/java/test/org/openqa/selenium/grid/node/relay/RelayOptionsTest.java @@ -140,7 +140,8 @@ void protocolVersionThrowsConfigException() { .isThrownBy( () -> { relayOptions.getServiceProtocolVersion(); - }); + }) + .withMessageContaining("Unsupported protocol version provided: HTTP/0.9"); } @Test