Skip to content

Commit 8135e70

Browse files
committed
Shortening string representation of capabilities in exceptions thrown by grid
1 parent e0bdd6b commit 8135e70

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

Diff for: java/server/src/org/openqa/grid/common/exception/CapabilityNotPresentOnTheGridException.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
package org.openqa.grid.common.exception;
1919

20+
import org.openqa.selenium.remote.DesiredCapabilities;
21+
2022
import java.util.Map;
2123

2224
public class CapabilityNotPresentOnTheGridException extends GridException {
@@ -28,6 +30,6 @@ public CapabilityNotPresentOnTheGridException(String msg) {
2830
}
2931

3032
public CapabilityNotPresentOnTheGridException(Map<String, Object> capabilities) {
31-
super("cannot find : " + capabilities);
33+
super("cannot find : " + new DesiredCapabilities(capabilities));
3234
}
3335
}

Diff for: java/server/src/org/openqa/grid/internal/ProxySet.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
import org.openqa.grid.common.exception.CapabilityNotPresentOnTheGridException;
2323
import org.openqa.grid.common.exception.GridException;
24+
import org.openqa.selenium.remote.DesiredCapabilities;
2425

2526
import java.util.ArrayList;
2627
import java.util.Collections;
@@ -152,7 +153,8 @@ public int size() {
152153
public void verifyAbilityToHandleDesiredCapabilities(Map<String, Object> desiredCapabilities) {
153154
if (proxies.isEmpty()) {
154155
if (throwOnCapabilityNotPresent) {
155-
throw new GridException("Empty pool of VM for setup " + desiredCapabilities);
156+
throw new GridException("Empty pool of VM for setup "
157+
+ new DesiredCapabilities(desiredCapabilities));
156158
} else {
157159
log.warning("Empty pool of nodes.");
158160
}
@@ -162,7 +164,7 @@ public void verifyAbilityToHandleDesiredCapabilities(Map<String, Object> desired
162164
if (throwOnCapabilityNotPresent) {
163165
throw new CapabilityNotPresentOnTheGridException(desiredCapabilities);
164166
} else {
165-
log.warning("grid doesn't contain " + desiredCapabilities +
167+
log.warning("grid doesn't contain " + new DesiredCapabilities(desiredCapabilities) +
166168
" at the moment.");
167169
}
168170

0 commit comments

Comments
 (0)