Skip to content

Commit 8f2ae95

Browse files
committed
Delete the deprecated SessionNotFoundException
1 parent f4a052e commit 8f2ae95

File tree

8 files changed

+13
-54
lines changed

8 files changed

+13
-54
lines changed

java/client/src/org/openqa/selenium/firefox/FirefoxDriver.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
import com.google.common.collect.ImmutableMap;
2929
import com.google.common.collect.Maps;
3030
import com.google.common.collect.Sets;
31-
import com.google.common.primitives.Booleans;
3231

3332
import org.openqa.selenium.Capabilities;
33+
import org.openqa.selenium.NoSuchSessionException;
3434
import org.openqa.selenium.OutputType;
3535
import org.openqa.selenium.Platform;
3636
import org.openqa.selenium.Proxy;
@@ -51,7 +51,6 @@
5151
import org.openqa.selenium.remote.FileDetector;
5252
import org.openqa.selenium.remote.RemoteWebDriver;
5353
import org.openqa.selenium.remote.Response;
54-
import org.openqa.selenium.remote.SessionNotFoundException;
5554
import org.openqa.selenium.remote.service.DriverCommandExecutor;
5655

5756
import java.io.File;
@@ -429,7 +428,7 @@ public Response execute(Command command) throws IOException {
429428
if (command.getName().equals(DriverCommand.QUIT)) {
430429
return new Response();
431430
}
432-
throw new SessionNotFoundException(
431+
throw new NoSuchSessionException(
433432
"The FirefoxDriver cannot be used after quit() was called.");
434433
}
435434
return connection.execute(command);

java/client/src/org/openqa/selenium/remote/BUCK

-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ java_library(name = 'remote-lib',
8686
'RemoteWebElement.java',
8787
'ResponseCodec.java',
8888
'ScreenshotException.java',
89-
'SessionNotFoundException.java',
9089
'SimplePropertyDescriptor.java',
9190
'UnreachableBrowserException.java',
9291
'UselessFileDetector.java',

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import org.openqa.selenium.NoAlertPresentException;
3030
import org.openqa.selenium.NoSuchElementException;
3131
import org.openqa.selenium.NoSuchFrameException;
32+
import org.openqa.selenium.NoSuchSessionException;
3233
import org.openqa.selenium.NoSuchWindowException;
3334
import org.openqa.selenium.SessionNotCreatedException;
3435
import org.openqa.selenium.StaleElementReferenceException;
@@ -142,7 +143,7 @@ public Class<? extends WebDriverException> getExceptionType(int statusCode) {
142143
case SUCCESS:
143144
return null;
144145
case NO_SUCH_SESSION:
145-
return SessionNotFoundException.class;
146+
return NoSuchSessionException.class;
146147
case INVALID_COOKIE_DOMAIN:
147148
return InvalidCookieDomainException.class;
148149
case UNABLE_TO_SET_COOKIE:

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
import com.google.common.collect.ImmutableMap;
2626

27+
import org.openqa.selenium.NoSuchSessionException;
2728
import org.openqa.selenium.UnsupportedCommandException;
2829
import org.openqa.selenium.WebDriverException;
2930
import org.openqa.selenium.logging.LocalLogs;
@@ -131,7 +132,7 @@ public Response execute(Command command) throws IOException {
131132
}
132133
if (!GET_ALL_SESSIONS.equals(command.getName())
133134
&& !NEW_SESSION.equals(command.getName())) {
134-
throw new SessionNotFoundException(
135+
throw new NoSuchSessionException(
135136
"Session ID is null. Using WebDriver after calling quit()?");
136137
}
137138
}

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import org.openqa.selenium.HasCapabilities;
3333
import org.openqa.selenium.JavascriptExecutor;
3434
import org.openqa.selenium.NoSuchFrameException;
35+
import org.openqa.selenium.NoSuchSessionException;
3536
import org.openqa.selenium.NoSuchWindowException;
3637
import org.openqa.selenium.OutputType;
3738
import org.openqa.selenium.Platform;
@@ -657,7 +658,7 @@ protected Response execute(String driverCommand, Map<String, ?> parameters) {
657658
// {"ELEMENT": id} to RemoteWebElements.
658659
Object value = converter.apply(response.getValue());
659660
response.setValue(value);
660-
} catch (SessionNotFoundException e) {
661+
} catch (NoSuchSessionException e) {
661662
throw e;
662663
} catch (Exception e) {
663664
log(sessionId, command.getName(), command, When.EXCEPTION);

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

-41
This file was deleted.

java/client/test/org/openqa/selenium/SessionHandlingTest.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
import org.junit.Test;
2121
import org.junit.runner.RunWith;
22-
import org.openqa.selenium.remote.SessionNotFoundException;
2322
import org.openqa.selenium.testing.Ignore;
2423
import org.openqa.selenium.testing.SeleniumTestRunner;
2524
import org.openqa.selenium.testing.drivers.WebDriverBuilder;
@@ -63,15 +62,15 @@ public void callingQuitAfterClosingTheLastWindowIsANoOp() {
6362
}
6463
}
6564

66-
@Test(expected = SessionNotFoundException.class)
65+
@Test(expected = NoSuchSessionException.class)
6766
@Ignore(value = {SAFARI}, reason = "Safari: throws UnreachableBrowserException")
6867
public void callingAnyOperationAfterQuitShouldThrowAnException() {
6968
WebDriver driver = new WebDriverBuilder().get();
7069
driver.quit();
7170
driver.getCurrentUrl();
7271
}
7372

74-
@Test(expected = SessionNotFoundException.class)
73+
@Test(expected = NoSuchSessionException.class)
7574
@Ignore(value = {FIREFOX, PHANTOMJS, SAFARI, MARIONETTE}, reason =
7675
"Firefox: can perform an operation after closing the last window,"
7776
+ "PhantomJS: throws NoSuchWindowException,"

java/server/src/org/openqa/selenium/remote/server/rest/ResultConfig.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020
import com.google.common.base.Optional;
2121
import com.google.common.collect.Lists;
2222

23+
import org.openqa.selenium.NoSuchSessionException;
2324
import org.openqa.selenium.WebDriverException;
2425
import org.openqa.selenium.remote.Command;
2526
import org.openqa.selenium.remote.DriverCommand;
2627
import org.openqa.selenium.remote.ErrorCodes;
2728
import org.openqa.selenium.remote.Response;
2829
import org.openqa.selenium.remote.SessionId;
29-
import org.openqa.selenium.remote.SessionNotFoundException;
3030
import org.openqa.selenium.remote.UnreachableBrowserException;
3131
import org.openqa.selenium.remote.server.DriverSessions;
3232
import org.openqa.selenium.remote.server.JsonParametersAware;
@@ -152,12 +152,12 @@ public Response handle(Command command) throws Exception {
152152
return response;
153153
}
154154

155-
private void throwUpIfSessionTerminated(SessionId sessId) throws SessionNotFoundException {
155+
private void throwUpIfSessionTerminated(SessionId sessId) throws NoSuchSessionException {
156156
if (sessId == null) return;
157157
Session session = sessions.get(sessId);
158158
final boolean isTerminated = session == null;
159159
if (isTerminated) {
160-
throw new SessionNotFoundException();
160+
throw new NoSuchSessionException();
161161
}
162162
}
163163

0 commit comments

Comments
 (0)