Skip to content

Commit f7b68e7

Browse files
committed
Be paranoid about exceptions in the WebDriverException itself
1 parent cb00152 commit f7b68e7

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

java/client/src/org/openqa/selenium/WebDriverException.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,9 @@
2020
import org.openqa.selenium.internal.BuildInfo;
2121

2222
import java.io.BufferedReader;
23-
import java.io.IOException;
2423
import java.io.InputStreamReader;
2524
import java.net.InetAddress;
2625
import java.net.NetworkInterface;
27-
import java.net.SocketException;
28-
import java.net.UnknownHostException;
2926
import java.util.Enumeration;
3027
import java.util.HashMap;
3128
import java.util.Map;
@@ -67,18 +64,18 @@ public class WebDriverException extends RuntimeException {
6764
host = reader.readLine();
6865
}
6966
}
70-
} catch (IOException ignored) {
71-
// Do nothing and fall through
7267
} catch (InterruptedException e) {
7368
Thread.currentThread().interrupt();
7469
throw new RuntimeException(e);
70+
} catch (Exception e) {
71+
// fall through
7572
}
7673
}
7774
if (host == null) {
7875
// Give up.
7976
try {
8077
host = InetAddress.getLocalHost().getHostName();
81-
} catch (UnknownHostException e) {
78+
} catch (Exception e) {
8279
host = "Unknown"; // At least we tried.
8380
}
8481
}
@@ -96,15 +93,15 @@ public class WebDriverException extends RuntimeException {
9693
address = inetAddress.getHostAddress();
9794
break;
9895
}
99-
} catch (SocketException e) {
96+
} catch (Exception e) {
10097
// Fall through and go the slow way.
10198
}
10299
}
103100
if (address == null) {
104101
// Alright. I give up.
105102
try {
106103
address = InetAddress.getLocalHost().getHostAddress();
107-
} catch (UnknownHostException e) {
104+
} catch (Exception e) {
108105
address = "Unknown";
109106
}
110107
}

0 commit comments

Comments
 (0)