Skip to content

Commit 89f1f08

Browse files
iampopovichdiemol
andauthored
[java] simplified some control flows logic and removed unused imports (#11974)
* simplified some loops logic and removed unused imports * Update CompletionCommand.java fix imports after conflict * Applying formatter --------- Co-authored-by: Diego Molina <[email protected]> Co-authored-by: Diego Molina <[email protected]>
1 parent 69ccfe4 commit 89f1f08

File tree

3 files changed

+5
-11
lines changed

3 files changed

+5
-11
lines changed

java/src/org/openqa/selenium/grid/distributor/local/LocalDistributor.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -593,19 +593,15 @@ public Either<SessionNotCreatedException, CreateSessionResponse> newSession(
593593
AttributeKey.EXCEPTION_MESSAGE.getKey(),
594594
EventAttribute.setValue("Will retry session " + request.getRequestId()));
595595

596-
span.setAttribute(AttributeKey.ERROR.getKey(), true);
597-
span.setStatus(Status.ABORTED);
598-
span.addEvent(AttributeKey.EXCEPTION_EVENT.getKey(), attributeMap);
599596
} else {
600597
EXCEPTION.accept(attributeMap, lastFailure);
601598
attributeMap.put(
602599
AttributeKey.EXCEPTION_MESSAGE.getKey(),
603600
EventAttribute.setValue("Unable to create session: " + lastFailure.getMessage()));
604-
605-
span.setAttribute(AttributeKey.ERROR.getKey(), true);
606-
span.setStatus(Status.ABORTED);
607-
span.addEvent(AttributeKey.EXCEPTION_EVENT.getKey(), attributeMap);
608601
}
602+
span.setAttribute(AttributeKey.ERROR.getKey(), true);
603+
span.setStatus(Status.ABORTED);
604+
span.addEvent(AttributeKey.EXCEPTION_EVENT.getKey(), attributeMap);
609605
return Either.left(lastFailure);
610606
} catch (SessionNotCreatedException e) {
611607
span.setAttribute(AttributeKey.ERROR.getKey(), true);

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ public Response throwIfResponseFailed(Response response, long duration) throws R
107107
try {
108108
rawErrorData = (Map<String, Object>) rawErrorData.get("value");
109109
} catch (ClassCastException cce) {
110+
message = String.valueOf(cce);
110111
}
111112
}
112113
try {

java/src/org/openqa/selenium/support/ui/Quotes.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,7 @@ public class Quotes {
3636
@SuppressWarnings("JavaDoc")
3737
public static String escape(String toEscape) {
3838
if (toEscape.contains("\"") && toEscape.contains("'")) {
39-
boolean quoteIsLast = false;
40-
if (toEscape.lastIndexOf("\"") == toEscape.length() - 1) {
41-
quoteIsLast = true;
42-
}
39+
boolean quoteIsLast = toEscape.lastIndexOf("\"") == toEscape.length() - 1;
4340
String[] substringsWithoutQuotes = toEscape.split("\"");
4441

4542
StringBuilder quoted = new StringBuilder("concat(");

0 commit comments

Comments
 (0)