Skip to content

Commit 0d36619

Browse files
committed
added annotations and applied format.sh exception classes
1 parent 6c607a8 commit 0d36619

File tree

5 files changed

+33
-13
lines changed

5 files changed

+33
-13
lines changed

java/src/org/openqa/selenium/NoSuchSessionException.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,20 @@
1717

1818
package org.openqa.selenium;
1919

20+
import org.jspecify.annotations.NullMarked;
21+
import org.jspecify.annotations.Nullable;
22+
2023
/** Thrown by any command being called after {@link WebDriver#quit() WebDriver.quit()}. */
24+
@NullMarked
2125
public class NoSuchSessionException extends WebDriverException {
2226

2327
public NoSuchSessionException() {}
2428

25-
public NoSuchSessionException(String reason) {
29+
public NoSuchSessionException(@Nullable String reason) {
2630
super(reason);
2731
}
2832

29-
public NoSuchSessionException(String reason, Throwable cause) {
33+
public NoSuchSessionException(@Nullable String reason, @Nullable Throwable cause) {
3034
super(reason, cause);
3135
}
3236
}

java/src/org/openqa/selenium/ScriptTimeoutException.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,24 @@
1717

1818
package org.openqa.selenium;
1919

20+
import org.jspecify.annotations.NullMarked;
21+
import org.jspecify.annotations.Nullable;
22+
2023
/** Thrown when an async execute script command does not complete in enough time. */
24+
@NullMarked
2125
public class ScriptTimeoutException extends WebDriverException {
2226

2327
public ScriptTimeoutException() {}
2428

25-
public ScriptTimeoutException(String message) {
29+
public ScriptTimeoutException(@Nullable String message) {
2630
super(message);
2731
}
2832

29-
public ScriptTimeoutException(Throwable cause) {
33+
public ScriptTimeoutException(@Nullable Throwable cause) {
3034
super(cause);
3135
}
3236

33-
public ScriptTimeoutException(String message, Throwable cause) {
37+
public ScriptTimeoutException(@Nullable String message, @Nullable Throwable cause) {
3438
super(message, cause);
3539
}
3640
}

java/src/org/openqa/selenium/SessionNotCreatedException.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,20 @@
1717

1818
package org.openqa.selenium;
1919

20+
import org.jspecify.annotations.NullMarked;
21+
import org.jspecify.annotations.Nullable;
22+
2023
/** Indicates that a session could not be created. */
24+
@NullMarked
2125
public class SessionNotCreatedException extends WebDriverException {
22-
public SessionNotCreatedException(String msg) {
26+
public SessionNotCreatedException(@Nullable String msg) {
2327
super(
2428
"Could not start a new session. "
2529
+ msg
2630
+ (msg != null && msg.contains("Host info") ? "" : " \n" + getHostInformation()));
2731
}
2832

29-
public SessionNotCreatedException(String msg, Throwable cause) {
33+
public SessionNotCreatedException(@Nullable String msg, @Nullable Throwable cause) {
3034
super(
3135
"Could not start a new session. "
3236
+ msg

java/src/org/openqa/selenium/TimeoutException.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,24 @@
1717

1818
package org.openqa.selenium;
1919

20+
import org.jspecify.annotations.NullMarked;
21+
import org.jspecify.annotations.Nullable;
22+
2023
/** Thrown when a command does not complete in enough time. */
24+
@NullMarked
2125
public class TimeoutException extends WebDriverException {
2226

2327
public TimeoutException() {}
2428

25-
public TimeoutException(String message) {
29+
public TimeoutException(@Nullable String message) {
2630
super(message);
2731
}
2832

29-
public TimeoutException(Throwable cause) {
33+
public TimeoutException(@Nullable Throwable cause) {
3034
super(cause);
3135
}
3236

33-
public TimeoutException(String message, Throwable cause) {
37+
public TimeoutException(@Nullable String message, @Nullable Throwable cause) {
3438
super(message, cause);
3539
}
3640
}

java/src/org/openqa/selenium/UnhandledAlertException.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,27 @@
2020
import java.util.Collections;
2121
import java.util.HashMap;
2222
import java.util.Map;
23+
import org.jspecify.annotations.NullMarked;
24+
import org.jspecify.annotations.Nullable;
2325

26+
@NullMarked
2427
public class UnhandledAlertException extends WebDriverException {
2528

26-
private final String alertText;
29+
@Nullable private final String alertText;
2730

28-
public UnhandledAlertException(String message) {
31+
public UnhandledAlertException(@Nullable String message) {
2932
this(message, null);
3033
}
3134

32-
public UnhandledAlertException(String message, String alertText) {
35+
public UnhandledAlertException(@Nullable String message, @Nullable String alertText) {
3336
super(message + ": " + alertText);
3437
this.alertText = alertText;
3538
}
3639

3740
/**
3841
* @return the text of the unhandled alert.
3942
*/
43+
@Nullable
4044
public String getAlertText() {
4145
return alertText;
4246
}

0 commit comments

Comments
 (0)