Skip to content

Commit c724384

Browse files
committed
server: InvalidParameterException is expected
Logging the original exception in this case is confusing when reading the test results as they look like real issues. Because InvalidParameterException is expected, it's OK to not log.
1 parent 5fcb57f commit c724384

File tree

2 files changed

+5
-19
lines changed

2 files changed

+5
-19
lines changed

java/server/src/org/openqa/grid/internal/BaseRemoteProxy.java

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
Copyright 2011 Selenium committers
3-
Copyright 2011 - 2012 Software Freedom Conservancy
3+
Copyright 2011-2015 Software Freedom Conservancy
44
55
Licensed under the Apache License, Version 2.0 (the "License");
66
you may not use this file except in compliance with the License.
@@ -408,8 +408,8 @@ public boolean isBusy() {
408408
* @return a new instance built from the request.
409409
*/
410410
@SuppressWarnings("unchecked")
411-
public static <T extends RemoteProxy> T getNewInstance(RegistrationRequest request,
412-
Registry registry) {
411+
public static <T extends RemoteProxy> T getNewInstance(
412+
RegistrationRequest request, Registry registry) {
413413
try {
414414
String proxyClass = request.getRemoteProxyClass();
415415
if (proxyClass == null) {
@@ -428,13 +428,9 @@ public static <T extends RemoteProxy> T getNewInstance(RegistrationRequest reque
428428
} else {
429429
throw new InvalidParameterException("Error: " + proxy.getClass() + " isn't a remote proxy");
430430
}
431-
432431
} catch (InvocationTargetException e) {
433-
log.log(Level.SEVERE, e.getTargetException().getMessage(), e.getTargetException());
434432
throw new InvalidParameterException("Error: " + e.getTargetException().getMessage());
435-
436433
} catch (Exception e) {
437-
log.log(Level.SEVERE, e.getMessage(), e);
438434
throw new InvalidParameterException("Error: " + e.getMessage());
439435
}
440436
}

java/server/test/org/openqa/grid/plugin/RemoteProxyInheritanceTest.java

+2-12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
Copyright 2011 Selenium committers
3-
Copyright 2011 Software Freedom Conservancy
3+
Copyright 2011-2015 Software Freedom Conservancy
44
55
Licensed under the Apache License, Version 2.0 (the "License");
66
you may not use this file except in compliance with the License.
@@ -33,23 +33,18 @@
3333
import java.util.HashMap;
3434
import java.util.Map;
3535

36-
3736
public class RemoteProxyInheritanceTest {
38-
3937
private Registry registry = Registry.newInstance();
4038

4139
@Test
4240
public void defaultToRemoteProxy() {
43-
44-
4541
RegistrationRequest req = RegistrationRequest.localWebdriverNoCapabilities();
4642

4743
Map<String, Object> app1 = new HashMap<String, Object>();
4844
Map<String, Object> config = new HashMap<String, Object>();
4945
app1.put(APP, "app1");
5046
config.put(ID, "abc");
5147

52-
5348
req.addDesiredCapability(app1);
5449
req.setConfiguration(config);
5550

@@ -58,7 +53,6 @@ public void defaultToRemoteProxy() {
5853
assertEquals(BaseRemoteProxy.class, p.getClass());
5954
}
6055

61-
6256
@Test
6357
public void existing() {
6458
Map<String, Object> app1 = new HashMap<String, Object>();
@@ -82,7 +76,6 @@ public void existing() {
8276
assertEquals("B", myRemoteProxy.getCustom2());
8377
assertEquals("A", myRemoteProxy.getConfig().get("Custom1"));
8478
assertEquals("B", myRemoteProxy.getConfig().get("Custom2"));
85-
8679
}
8780

8881
@Test(expected = InvalidParameterException.class)
@@ -106,7 +99,6 @@ public void notExtendingProxyExisting() {
10699
app1.put(APP, "app1");
107100
config.put(PROXY_CLASS, "java.lang.String");
108101

109-
110102
RegistrationRequest req = new RegistrationRequest();
111103
req.addDesiredCapability(app1);
112104
req.setConfiguration(config);
@@ -130,10 +122,8 @@ public void badConfig() {
130122
BaseRemoteProxy.getNewInstance(req, registry);
131123
}
132124

133-
134125
@After
135-
public void tearDown(){
126+
public void tearDown() {
136127
registry.stop();
137128
}
138-
139129
}

0 commit comments

Comments
 (0)