Skip to content

Commit 9334e41

Browse files
committed
More robust handling of garbage responses during the protocol handshake.
1 parent c150589 commit 9334e41

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

java/client/src/org/openqa/selenium/remote/ProtocolHandshake.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,12 @@ private Optional<Result> createSession(HttpClient client, Map<String, Object> pa
9797
HttpResponse response = client.execute(request, true);
9898

9999
Map<?, ?> jsonBlob = null;
100+
String resultString = response.getContentString();
100101
try {
101-
String resultString = response.getContentString();
102102
jsonBlob = new JsonToBeanConverter().convert(Map.class, resultString);
103+
} catch (ClassCastException e) {
104+
LOG.info("Unable to parse response from server: " + resultString);
105+
return Optional.empty();
103106
} catch (JsonException e) {
104107
// Fine. Handle that below
105108
}

0 commit comments

Comments
 (0)