Skip to content

Commit

Permalink
Space before curly bracket (#2143)
Browse files Browse the repository at this point in the history
  • Loading branch information
asashour authored and lukeis committed May 21, 2016
1 parent c9e6405 commit 1c33929
Show file tree
Hide file tree
Showing 32 changed files with 45 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public void replaceAlertMethod(WebDriver driver) {
);
}

private void checkOverridesEnabled(){
private void checkOverridesEnabled() {
checkState(enableOverrides,
"Selenium alert overrides have been disabled; please use the underlying WebDriver API");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,23 +148,23 @@ private boolean getBooleanPreference(Preferences prefs, String key, boolean defa

public String getStringPreference(String key, String defaultValue) {
Object preference = additionalPrefs.getPreference(key);
if(preference != null && preference instanceof String){
if(preference != null && preference instanceof String) {
return (String) preference;
}
return defaultValue;
}

public int getIntegerPreference(String key, int defaultValue) {
Object preference = additionalPrefs.getPreference(key);
if(preference != null && preference instanceof Integer){
if(preference != null && preference instanceof Integer) {
return (Integer) preference;
}
return defaultValue;
}

public boolean getBooleanPreference(String key, boolean defaultValue) {
Object preference = additionalPrefs.getPreference(key);
if(preference != null && preference instanceof Boolean){
if(preference != null && preference instanceof Boolean) {
return (Boolean) preference;
}
return defaultValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ private boolean isLockFree(InetSocketAddress address) throws IOException {
* Gets the port number that is being-locked.
* @return port locked
*/
public int getLockPort(){
public int getLockPort() {
return this.address.getPort();
}
}
2 changes: 1 addition & 1 deletion java/client/src/org/openqa/selenium/net/PortProber.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class PortProber {

if (current.is(Platform.LINUX)) {
ephemeralRangeDetector = LinuxEphemeralPortRangeDetector.getInstance();
} else if (current.is(Platform.XP)){
} else if (current.is(Platform.XP)) {
ephemeralRangeDetector = new OlderWindowsVersionEphemeralPortDetector();
} else {
ephemeralRangeDetector = new FixedIANAPortRange();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ protected Response execute(String driverCommand, Map<String, ?> parameters) {
// {"ELEMENT": id} to RemoteWebElements.
Object value = converter.apply(response.getValue());
response.setValue(value);
} catch (SessionNotFoundException e){
} catch (SessionNotFoundException e) {
throw e;
} catch (Exception e) {
log(sessionId, command.getName(), command, When.EXCEPTION);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl
method.invoke(eventListener, args);
}
return null;
} catch (InvocationTargetException e){
} catch (InvocationTargetException e) {
throw e.getTargetException();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public List<WebElement> findElements() {
}

@Override
public String toString(){
public String toString() {
return this.getClass().getSimpleName() + " '" + by + "'";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response)
String.format(RESPONSE_STRING_FORMAT, duration));
}

private void reallySleep(long timeout){
private void reallySleep(long timeout) {
long start = System.currentTimeMillis();
try {
Thread.sleep( timeout);
while ( (System.currentTimeMillis() - start) < timeout){
Thread.sleep(timeout);
while ( (System.currentTimeMillis() - start) < timeout) {
Thread.sleep( 20);
}
} catch (InterruptedException ignore) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void decodeEphemeralPorts() throws Exception {
}

@Test
public void currentValues(){
public void currentValues() {
LinuxEphemeralPortRangeDetector detector = LinuxEphemeralPortRangeDetector.getInstance();
assertTrue( detector.getLowestEphemeralPort() > 1024);
assertTrue( detector.getHighestEphemeralPort() < 65536);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
public enum SeleniumProtocol {
Selenium, WebDriver;

public boolean isSelenium(){
public boolean isSelenium() {
return Selenium.equals(this);
}
}
4 changes: 2 additions & 2 deletions java/server/src/org/openqa/grid/internal/BaseRemoteProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ private void cleanUpSlot(TestSlot slot) {
+ " has TIMED OUT due to client inactivity and will be released.");
try {
((TimeoutListener) proxy).beforeRelease(session);
} catch(IllegalStateException ignore){
} catch(IllegalStateException ignore) {
log.log(Level.WARNING, ignore.getMessage());
}
registry.terminate(session, SessionTerminationReason.TIMEOUT);
Expand All @@ -304,7 +304,7 @@ private void cleanUpSlot(TestSlot slot) {
"session " + session + " has been ORPHANED and will be released");
try {
((TimeoutListener) proxy).beforeRelease(session);
} catch(IllegalStateException ignore){
} catch(IllegalStateException ignore) {
log.log(Level.WARNING, ignore.getMessage());
}
registry.terminate(session, SessionTerminationReason.ORPHAN);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* Provides access to System time.
*/
public class DefaultTimeSource implements TimeSource {
public long currentTimeInMillis(){
public long currentTimeInMillis() {
return System.currentTimeMillis();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public int hashCode() {
return key.hashCode();
}

public static ExternalSessionKey fromSe1Request(String piece){
public static ExternalSessionKey fromSe1Request(String piece) {
if (piece.startsWith("sessionId=")) {
return new ExternalSessionKey(piece.replace("sessionId=", ""));
}
Expand All @@ -73,7 +73,7 @@ public static ExternalSessionKey fromSe1Request(String piece){
* @param path The path to the session
* @return the ExternalSessionKey provided by the remote., or null if the url didn't contain a session id
*/
public static ExternalSessionKey fromWebDriverRequest(String path){
public static ExternalSessionKey fromWebDriverRequest(String path) {
int sessionIndex = path.indexOf("/session/");
if (sessionIndex != -1) {
sessionIndex += "/session/".length();
Expand Down Expand Up @@ -123,11 +123,11 @@ public static ExternalSessionKey fromResponseBody(String responseBody) throws Ne
throw new NewSessionException("The server returned an error : "+responseBody);
}

public static ExternalSessionKey fromString(String keyString){
public static ExternalSessionKey fromString(String keyString) {
return new ExternalSessionKey(keyString);
}

public static ExternalSessionKey fromJSON(String keyString){
public static ExternalSessionKey fromJSON(String keyString) {
return new ExternalSessionKey(keyString);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public synchronized int getNewSessionRequestCount() {
return newSessionRequests.size();
}

public synchronized void stop(){
public synchronized void stop() {
for (RequestHandler newSessionRequest : newSessionRequests) {
newSessionRequest.stop();
}
Expand Down
2 changes: 1 addition & 1 deletion java/server/src/org/openqa/grid/internal/TestSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ public String toString() {
private HttpClient getClient() {
Registry reg = slot.getProxy().getRegistry();
int browserTimeout = reg.getConfiguration().browserTimeout;
if (browserTimeout > 0){
if (browserTimeout > 0) {
final int selenium_server_cleanup_cycle = browserTimeout / 10;
browserTimeout += (selenium_server_cleanup_cycle + MAX_NETWORK_LATENCY);
browserTimeout *=2; // Lets not let this happen too often
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public SelfRegisteringRemote(RegistrationRequest config) {

try {
GridHubConfiguration hubConfiguration = getHubConfiguration();
if (hubConfiguration.timeout != null){
if (hubConfiguration.timeout != null) {
nodeConfig.getConfiguration().timeout = hubConfiguration.timeout;
}
if (hubConfiguration.browserTimeout != null) {
Expand Down
2 changes: 1 addition & 1 deletion java/server/src/org/openqa/grid/web/Hub.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public Hub(GridHubConfiguration gridHubConfiguration) {

private void initServer() {
try {
if (config.jettyMaxThreads>0){
if (config.jettyMaxThreads>0) {
QueuedThreadPool pool = new QueuedThreadPool();
pool.setMaxThreads(config.jettyMaxThreads);
server = new Server(pool);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ private JsonObject getResponse(HttpServletRequest request) throws IOException {

Registry registry = getRegistry();
JsonElement config = registry.getConfiguration().toJson();
for (Map.Entry<String, JsonElement> entry : config.getAsJsonObject().entrySet()){
for (Map.Entry<String, JsonElement> entry : config.getAsJsonObject().entrySet()) {
if (keysToReturn == null || keysToReturn.isEmpty() || keysToReturn.contains(entry.getKey())) {
res.add(entry.getKey(), entry.getValue());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public void process() {
} catch (ClientGoneException e) {
log.log(Level.WARNING, "The client is gone for session " + session + ", terminating");
registry.terminate(session, SessionTerminationReason.CLIENT_GONE);
} catch (SocketTimeoutException e){
} catch (SocketTimeoutException e) {
log.log(Level.SEVERE, "Socket timed out for session " + session + ", " + e.getMessage());
registry.terminate(session, SessionTerminationReason.SO_TIMEOUT);
} catch (Throwable t) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public void setBody(byte[] content) {
setAttribute("Content-Length", content.length);
}

public long getCreationTime(){
public long getCreationTime() {
return timestamp;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public SeleniumBasedResponse(HttpServletResponse response) {
}

public String getForwardedContent() {
if (forwardedContent == null){
if (forwardedContent == null) {
return null;
}
Charset charset = Charset.forName(encoding);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public void close() {


public <X> X execute(final FutureTask<X> future) throws Exception {
/* if (executor.isShutdown()){
/* if (executor.isShutdown()) {
throw new WebDriverException(sessionId + " is closed for further execution");
} */
executor.execute(new Runnable() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public Object invoke(Object object, Method method, Object[] objects) throws Thro
} else {
try {
return method.invoke(element, objects);
} catch (InvocationTargetException e){
} catch (InvocationTargetException e) {
throw e.getTargetException();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ class SessionCleaner extends Thread { // Thread safety reviewed
this.clientGoneTimeout = clientGoneTimeout;
this.insideBrowserTimeout = insideBrowserTimeout;
this.driverSessions = driverSessions;
if (clientGoneTimeout == 0 && insideBrowserTimeout == 0){
if (clientGoneTimeout == 0 && insideBrowserTimeout == 0) {
throw new IllegalStateException("SessionCleaner not supposed to start when no timeouts specified");
}
if (insideBrowserTimeout > 0 && insideBrowserTimeout < 60000){
if (insideBrowserTimeout > 0 && insideBrowserTimeout < 60000) {
log.warning("The specified browser timeout is TOO LOW for safe operations and may have " +
"other side-effects\n. Please specify a slightly higher browserTimeout.");
}
Expand Down Expand Up @@ -95,7 +95,7 @@ void checkExpiry() {
}
if (inUse && session.isTimedOut(insideBrowserTimeout)) {
WebDriver driver = session.getDriver();
if (driver instanceof EventFiringWebDriver){
if (driver instanceof EventFiringWebDriver) {
driver = ((EventFiringWebDriver)driver).getWrappedDriver();
}
if (driver instanceof Killable) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ private void throwUpIfSessionTerminated(SessionId sessId) throws SessionNotFound
if (sessId == null) return;
Session session = sessions.get(sessId);
final boolean isTerminated = session == null;
if (isTerminated){
if (isTerminated) {
throw new SessionNotFoundException();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public void testWebDriverTimesOut() throws InterruptedException, MalformedURLExc

try {
driver.get(url);
} catch(WebDriverException ignore){
} catch(WebDriverException ignore) {
} finally {
RegistryTestHelper.waitForActiveTestSessionCount(hub.getRegistry(), 0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void testGetTerminatedSession() throws Exception {
try {
activeTestSessions.getExistingSession(testSession.getExternalKey());
fail("should have thrown a session has been orphaned.");
} catch (GridException e){
} catch (GridException e) {
assertTrue(e.getMessage().contains(SessionTerminationReason.ORPHAN.toString()));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public void newSessionSpreadOnAllProxiesAccordingToTheResource() {


//release and check the resource are freed.
for (TestSession session : sessions){
for (TestSession session : sessions) {
registry.terminateSynchronousFOR_TEST_ONLY(session);
}
assertEquals(50, proxy1.getResourceUsageInPercent(), 0f);
Expand Down
4 changes: 2 additions & 2 deletions java/server/test/org/openqa/grid/internal/ProxySetTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public void testProxySortingByIdle() throws Exception {

}

public StubbedRemoteProxy buildStubbedRemoteProxy(Registry registry, int totalUsed){
public StubbedRemoteProxy buildStubbedRemoteProxy(Registry registry, int totalUsed) {
GridNodeConfiguration config = new GridNodeConfiguration();
config.host = "remote_host";
config.port = totalUsed;
Expand Down Expand Up @@ -123,7 +123,7 @@ public StubbedRemoteProxy(RegistrationRequest request,
}


public void setTotalUsed(int count){
public void setTotalUsed(int count) {
this.testsRunning = count;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void run() {

public void waitUntilDone(int done) {
int i = 0;
while (done != completed.get() && i++ < 20){
while (done != completed.get() && i++ < 20) {
if (i > 20) throw new RuntimeException("Time out waiting for completion");
try {
Thread.sleep(50);
Expand All @@ -72,7 +72,7 @@ public void waitUntilDone(int done) {

public void waitUntilStarted(int num) {
int i = 0;
while (num != started.get() && i++ < 20){
while (num != started.get() && i++ < 20) {
if (i > 20) throw new RuntimeException("Time out waiting for completion");
try {
Thread.sleep(50);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public MockedRequestHandler(
super(request, response, registry);
}

public void setSession(TestSession session){
public void setSession(TestSession session) {
super.setSession(session);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ public void testCleanupWithTimedOutKillableDriver() throws Exception {
private Runnable getRunnableThatMakesSessionBusy(final Session session,
final CountDownLatch started,
final CountDownLatch testDone) {
return new Runnable(){
public void run(){
return new Runnable() {
public void run() {
try {
session.execute(new FutureTask<Object>(new Callable<Object>()
{
Expand Down

0 comments on commit 1c33929

Please sign in to comment.