Skip to content

Commit

Permalink
Delete the deprecated SessionNotFoundException
Browse files Browse the repository at this point in the history
  • Loading branch information
shs96c committed Aug 19, 2016
1 parent f4a052e commit 8f2ae95
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.google.common.primitives.Booleans;

import org.openqa.selenium.Capabilities;
import org.openqa.selenium.NoSuchSessionException;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.Platform;
import org.openqa.selenium.Proxy;
Expand All @@ -51,7 +51,6 @@
import org.openqa.selenium.remote.FileDetector;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.remote.Response;
import org.openqa.selenium.remote.SessionNotFoundException;
import org.openqa.selenium.remote.service.DriverCommandExecutor;

import java.io.File;
Expand Down Expand Up @@ -429,7 +428,7 @@ public Response execute(Command command) throws IOException {
if (command.getName().equals(DriverCommand.QUIT)) {
return new Response();
}
throw new SessionNotFoundException(
throw new NoSuchSessionException(
"The FirefoxDriver cannot be used after quit() was called.");
}
return connection.execute(command);
Expand Down
1 change: 0 additions & 1 deletion java/client/src/org/openqa/selenium/remote/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ java_library(name = 'remote-lib',
'RemoteWebElement.java',
'ResponseCodec.java',
'ScreenshotException.java',
'SessionNotFoundException.java',
'SimplePropertyDescriptor.java',
'UnreachableBrowserException.java',
'UselessFileDetector.java',
Expand Down
3 changes: 2 additions & 1 deletion java/client/src/org/openqa/selenium/remote/ErrorCodes.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.openqa.selenium.NoAlertPresentException;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.NoSuchFrameException;
import org.openqa.selenium.NoSuchSessionException;
import org.openqa.selenium.NoSuchWindowException;
import org.openqa.selenium.SessionNotCreatedException;
import org.openqa.selenium.StaleElementReferenceException;
Expand Down Expand Up @@ -142,7 +143,7 @@ public Class<? extends WebDriverException> getExceptionType(int statusCode) {
case SUCCESS:
return null;
case NO_SUCH_SESSION:
return SessionNotFoundException.class;
return NoSuchSessionException.class;
case INVALID_COOKIE_DOMAIN:
return InvalidCookieDomainException.class;
case UNABLE_TO_SET_COOKIE:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

import com.google.common.collect.ImmutableMap;

import org.openqa.selenium.NoSuchSessionException;
import org.openqa.selenium.UnsupportedCommandException;
import org.openqa.selenium.WebDriverException;
import org.openqa.selenium.logging.LocalLogs;
Expand Down Expand Up @@ -131,7 +132,7 @@ public Response execute(Command command) throws IOException {
}
if (!GET_ALL_SESSIONS.equals(command.getName())
&& !NEW_SESSION.equals(command.getName())) {
throw new SessionNotFoundException(
throw new NoSuchSessionException(
"Session ID is null. Using WebDriver after calling quit()?");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.openqa.selenium.HasCapabilities;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.NoSuchFrameException;
import org.openqa.selenium.NoSuchSessionException;
import org.openqa.selenium.NoSuchWindowException;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.Platform;
Expand Down Expand Up @@ -657,7 +658,7 @@ protected Response execute(String driverCommand, Map<String, ?> parameters) {
// {"ELEMENT": id} to RemoteWebElements.
Object value = converter.apply(response.getValue());
response.setValue(value);
} catch (SessionNotFoundException e) {
} catch (NoSuchSessionException e) {
throw e;
} catch (Exception e) {
log(sessionId, command.getName(), command, When.EXCEPTION);
Expand Down

This file was deleted.

5 changes: 2 additions & 3 deletions java/client/test/org/openqa/selenium/SessionHandlingTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import org.junit.Test;
import org.junit.runner.RunWith;
import org.openqa.selenium.remote.SessionNotFoundException;
import org.openqa.selenium.testing.Ignore;
import org.openqa.selenium.testing.SeleniumTestRunner;
import org.openqa.selenium.testing.drivers.WebDriverBuilder;
Expand Down Expand Up @@ -63,15 +62,15 @@ public void callingQuitAfterClosingTheLastWindowIsANoOp() {
}
}

@Test(expected = SessionNotFoundException.class)
@Test(expected = NoSuchSessionException.class)
@Ignore(value = {SAFARI}, reason = "Safari: throws UnreachableBrowserException")
public void callingAnyOperationAfterQuitShouldThrowAnException() {
WebDriver driver = new WebDriverBuilder().get();
driver.quit();
driver.getCurrentUrl();
}

@Test(expected = SessionNotFoundException.class)
@Test(expected = NoSuchSessionException.class)
@Ignore(value = {FIREFOX, PHANTOMJS, SAFARI, MARIONETTE}, reason =
"Firefox: can perform an operation after closing the last window,"
+ "PhantomJS: throws NoSuchWindowException,"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
import com.google.common.base.Optional;
import com.google.common.collect.Lists;

import org.openqa.selenium.NoSuchSessionException;
import org.openqa.selenium.WebDriverException;
import org.openqa.selenium.remote.Command;
import org.openqa.selenium.remote.DriverCommand;
import org.openqa.selenium.remote.ErrorCodes;
import org.openqa.selenium.remote.Response;
import org.openqa.selenium.remote.SessionId;
import org.openqa.selenium.remote.SessionNotFoundException;
import org.openqa.selenium.remote.UnreachableBrowserException;
import org.openqa.selenium.remote.server.DriverSessions;
import org.openqa.selenium.remote.server.JsonParametersAware;
Expand Down Expand Up @@ -152,12 +152,12 @@ public Response handle(Command command) throws Exception {
return response;
}

private void throwUpIfSessionTerminated(SessionId sessId) throws SessionNotFoundException {
private void throwUpIfSessionTerminated(SessionId sessId) throws NoSuchSessionException {
if (sessId == null) return;
Session session = sessions.get(sessId);
final boolean isTerminated = session == null;
if (isTerminated) {
throw new SessionNotFoundException();
throw new NoSuchSessionException();
}
}

Expand Down

0 comments on commit 8f2ae95

Please sign in to comment.