File tree Expand file tree Collapse file tree
java/client/src/org/openqa/selenium/remote/service Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -89,9 +89,12 @@ public Response execute(Command command) throws IOException {
8989 return super .execute (command );
9090 } catch (Throwable t ) {
9191 Throwable rootCause = Throwables .getRootCause (t );
92- if (rootCause instanceof ConnectException &&
93- "Connection refused" .equals (rootCause .getMessage ()) &&
94- !service .isRunning ()) {
92+ if (rootCause instanceof IllegalStateException
93+ && "Closed" .equals (rootCause .getMessage ())) {
94+ return null ;
95+ }
96+ if (rootCause instanceof ConnectException
97+ && "Connection refused" .equals (rootCause .getMessage ())) {
9598 throw new WebDriverException ("The driver server has unexpectedly died!" , t );
9699 }
97100 Throwables .throwIfUnchecked (t );
@@ -107,12 +110,8 @@ public Response execute(Command command) throws IOException {
107110 try {
108111 Response response = (Response ) CompletableFuture .anyOf (commandComplete , processFinished )
109112 .get (service .getTimeout ().toMillis () * 2 , TimeUnit .MILLISECONDS );
110- if (response != null ) {
111- service .stop ();
112- return response ;
113- } else {
114- return null ;
115- }
113+ service .stop ();
114+ return response ;
116115 } catch (ExecutionException | TimeoutException e ) {
117116 throw new WebDriverException ("Timed out waiting for driver server to stop." , e );
118117 } catch (InterruptedException e ) {
You can’t perform that action at this time.
0 commit comments