Skip to content

Commit 198f1f2

Browse files
iampopovichdiemol
andauthored
[java] minor code style and typos improvements (#12127)
* function style for expressions * inspect and fix typos with spellchecker * Update DefaultNodeConfig.java --------- Co-authored-by: Diego Molina <[email protected]>
1 parent 0b1cca9 commit 198f1f2

15 files changed

Lines changed: 19 additions & 21 deletions

File tree

java/src/org/openqa/selenium/By.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public static By className(String className) {
101101

102102
/**
103103
* Find elements via the driver's underlying W3C Selector engine. If the browser does not
104-
* implement the Selector API, a best effort is made to emulate the API. In this case, we strive
104+
* implement the Selector API, the best effort is made to emulate the API. In this case, we strive
105105
* for at least CSS2 support, but offer no guarantees.
106106
*
107107
* @param cssSelector CSS expression.

java/src/org/openqa/selenium/Capabilities.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ default String getBrowserVersion() {
7171

7272
/**
7373
* @param capabilityName The capability to check.
74-
* @return Whether or not the value is not null and not false.
74+
* @return Whether the value is not null and not false.
7575
* @see org.openqa.selenium.remote.CapabilityType
7676
*/
7777
default boolean is(String capabilityName) {

java/src/org/openqa/selenium/grid/distributor/selector/DefaultSlotSelector.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public Set<SlotId> selectSlot(Capabilities capabilities, Set<NodeStatus> nodes)
3939
// First, filter the Nodes that support the required capabilities. Then, the filtered Nodes
4040
// get ordered in ascendant order by the number of browsers they support.
4141
// With this, Nodes with diverse configurations (supporting many browsers, e.g. Chrome,
42-
// Firefox, Safari) are placed at the bottom so they have more availability when a session
42+
// Firefox, Safari) are placed at the bottom, so they have more availability when a session
4343
// requests a browser supported only by a few Nodes (e.g. Safari only supported on macOS
4444
// Nodes).
4545
// After that, Nodes are ordered by their load, last session creation, and their id.

java/src/org/openqa/selenium/grid/graphql/SessionNotFoundException.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,7 @@ public SessionNotFoundException(String message, String sessionId) {
4444
@Override
4545
public Map<String, Object> getExtensions() {
4646
Map<String, Object> customAttributes = new LinkedHashMap<>();
47-
if (sessionId.isPresent()) {
48-
customAttributes.put("sessionId", sessionId.get());
49-
}
47+
sessionId.ifPresent(s -> customAttributes.put("sessionId", s));
5048
return customAttributes;
5149
}
5250

java/src/org/openqa/selenium/interactions/Coordinates.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public interface Coordinates {
5252
/**
5353
* Gets coordinates on the element relative to the top-left corner of the page.
5454
*
55-
* @return coordinates on the element relative to the top-left corner of the the page.
55+
* @return coordinates on the element relative to the top-left corner of the page.
5656
*/
5757
Point onPage();
5858

java/src/org/openqa/selenium/internal/Debug.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import java.lang.management.ManagementFactory;
2121
import java.util.logging.Level;
2222

23-
/** Used to provide information about whether or not Selenium is running under debug mode. */
23+
/** Used to provide information about whether Selenium is running under debug mode. */
2424
public class Debug {
2525

2626
private static boolean IS_DEBUG;

java/src/org/openqa/selenium/remote/CommandCodec.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
/**
2424
* Converts {@link Command} objects to and from another representation.
2525
*
26-
* @param <T> The type of an encoded command.
26+
* @param <T> The type of encoded command.
2727
*/
2828
public interface CommandCodec<T> {
2929

java/src/org/openqa/selenium/remote/codec/AbstractHttpResponseCodec.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public abstract class AbstractHttpResponseCodec implements ResponseCodec<HttpRes
4848
private final Json json = new Json();
4949

5050
/**
51-
* Encodes the given response as a HTTP response message. This method is guaranteed not to throw.
51+
* Encodes the given response as an HTTP response message. This method is guaranteed not to throw.
5252
*
5353
* @param response The response to encode.
5454
* @return The encoded response.

java/src/org/openqa/selenium/support/pagefactory/AbstractAnnotations.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@
2727
public abstract class AbstractAnnotations {
2828

2929
/**
30-
* Defines how to transform given object (field, class, etc) into {@link org.openqa.selenium.By}
30+
* Defines how to transform given object (field, class, etc.) into {@link org.openqa.selenium.By}
3131
* class used by webdriver to locate elements.
3232
*
3333
* @return By object
3434
*/
3535
public abstract By buildBy();
3636

3737
/**
38-
* Defines whether or not given element should be returned from cache on further calls.
38+
* Defines whether given element should be returned from cache on further calls.
3939
*
4040
* @return boolean if lookup cached
4141
*/

java/src/org/openqa/selenium/support/pagefactory/AjaxElementLocator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,15 +118,15 @@ protected long sleepFor() {
118118

119119
/**
120120
* By default, elements are considered "found" if they are in the DOM. Override this method in
121-
* order to change whether or not you consider the element loaded. For example, perhaps you need
121+
* order to change whether you consider the element loaded. For example, perhaps you need
122122
* the element to be displayed:
123123
*
124124
* <pre>{@code
125125
* return element.isDisplayed();
126126
* }</pre>
127127
*
128128
* @param element The element to use
129-
* @return Whether or not it meets your criteria for "found"
129+
* @return Whether it meets your criteria for "found"
130130
*/
131131
protected boolean isElementUsable(WebElement element) {
132132
return true;

0 commit comments

Comments
 (0)