From 78e4e904508559319bc1861a01c1d089eb9532b4 Mon Sep 17 00:00:00 2001 From: Seva Lotoshnikov Date: Thu, 10 Apr 2014 18:44:05 -0700 Subject: [PATCH] Strictly NO-OP code cleanups Signed-off-by: Andreas Tolfsen --- java/client/src/com/thoughtworks/selenium/Wait.java | 4 ++-- .../com/thoughtworks/selenium/webdriven/Windows.java | 2 +- java/client/src/org/openqa/selenium/ContextAware.java | 4 ++-- .../org/openqa/selenium/NoSuchContextException.java | 4 ++-- .../org/openqa/selenium/browserlaunchers/Proxies.java | 2 +- .../openqa/selenium/ie/InternetExplorerDriver.java | 3 ++- .../src/org/openqa/selenium/remote/Augmenter.java | 6 +++--- .../openqa/selenium/remote/HttpCommandExecutor.java | 3 ++- java/client/src/org/openqa/selenium/remote/build.desc | 1 + .../test/org/openqa/selenium/FrameSwitchingTest.java | 2 +- .../openqa/selenium/server/BrowserSessionFactory.java | 2 +- .../org/openqa/selenium/server/ClassPathResource.java | 2 +- .../selenium/server/FrameGroupCommandQueueSet.java | 6 +++--- .../openqa/selenium/server/FutureFileResource.java | 2 +- .../selenium/server/htmlrunner/HTMLLauncher.java | 2 +- javascript/firefox-driver/js/files.js | 11 +++++++---- javascript/firefox-driver/js/wdsession.js | 2 +- 17 files changed, 32 insertions(+), 26 deletions(-) diff --git a/java/client/src/com/thoughtworks/selenium/Wait.java b/java/client/src/com/thoughtworks/selenium/Wait.java index 41b5a7e82e9f4..fe1cefc999b13 100644 --- a/java/client/src/com/thoughtworks/selenium/Wait.java +++ b/java/client/src/com/thoughtworks/selenium/Wait.java @@ -47,10 +47,10 @@ public Wait(String messageToShowIfTimeout) { public abstract boolean until(); /** The amount of time to wait before giving up; the default is 30 seconds */ - public static final long DEFAULT_TIMEOUT = 30000l; + public static final long DEFAULT_TIMEOUT = 30000L; /** The interval to pause between checking; the default is 500 milliseconds */ - public static final long DEFAULT_INTERVAL = 500l; + public static final long DEFAULT_INTERVAL = 500L; /** * Wait until the "until" condition returns true or time runs out. diff --git a/java/client/src/com/thoughtworks/selenium/webdriven/Windows.java b/java/client/src/com/thoughtworks/selenium/webdriven/Windows.java index 11489dabca34a..83cdbdeaa8cf9 100644 --- a/java/client/src/com/thoughtworks/selenium/webdriven/Windows.java +++ b/java/client/src/com/thoughtworks/selenium/webdriven/Windows.java @@ -74,7 +74,7 @@ public void selectPopUp(WebDriver driver, String windowID) { if ("null".equals(windowID) || "".equals(windowID)) { Set windowHandles = driver.getWindowHandles(); windowHandles.remove(originalWindowHandle); - if (windowHandles.size() > 0) { + if (!windowHandles.isEmpty()) { driver.switchTo().window(windowHandles.iterator().next()); } else { throw new SeleniumException("Unable to find a popup window"); diff --git a/java/client/src/org/openqa/selenium/ContextAware.java b/java/client/src/org/openqa/selenium/ContextAware.java index 3d7b2b815be29..a73714ce83db2 100644 --- a/java/client/src/org/openqa/selenium/ContextAware.java +++ b/java/client/src/org/openqa/selenium/ContextAware.java @@ -44,8 +44,8 @@ public interface ContextAware { Set getContextHandles(); /** - * Return an opaque handle to this context that uniquely identifies it within this driver instance. - * This can be used to switch to this context at a later date + * Return an opaque handle to this context that uniquely identifies it within this driver + * instance. This can be used to switch to this context at a later date */ String getContext(); } diff --git a/java/client/src/org/openqa/selenium/NoSuchContextException.java b/java/client/src/org/openqa/selenium/NoSuchContextException.java index 069db2b23670a..912bae916ce3f 100644 --- a/java/client/src/org/openqa/selenium/NoSuchContextException.java +++ b/java/client/src/org/openqa/selenium/NoSuchContextException.java @@ -17,8 +17,8 @@ package org.openqa.selenium; /** - * Thrown by {@link org.openqa.selenium.WebDriver.TargetLocator#context(String) WebDriver.switchTo().context(String - * name)}. + * Thrown by {@link org.openqa.selenium.WebDriver.TargetLocator#context(String) + * WebDriver.switchTo().context(String name)}. */ public class NoSuchContextException extends NotFoundException { diff --git a/java/client/src/org/openqa/selenium/browserlaunchers/Proxies.java b/java/client/src/org/openqa/selenium/browserlaunchers/Proxies.java index 3db69b4be2fb8..b02377b9a6b92 100644 --- a/java/client/src/org/openqa/selenium/browserlaunchers/Proxies.java +++ b/java/client/src/org/openqa/selenium/browserlaunchers/Proxies.java @@ -80,7 +80,7 @@ public static File makeProxyPAC(File parentDir, int port, String configuredProxy } /** - * @Deprecated Use Proxy.extractFrom(Capabilities) + * @deprecated Use Proxy.extractFrom(Capabilities) */ @Deprecated @SuppressWarnings({"unchecked"}) diff --git a/java/client/src/org/openqa/selenium/ie/InternetExplorerDriver.java b/java/client/src/org/openqa/selenium/ie/InternetExplorerDriver.java index 24c59b895b442..d36b5c6a48dfb 100644 --- a/java/client/src/org/openqa/selenium/ie/InternetExplorerDriver.java +++ b/java/client/src/org/openqa/selenium/ie/InternetExplorerDriver.java @@ -162,7 +162,8 @@ public InternetExplorerDriver(InternetExplorerDriverService service, Capabilitie this(service, capabilities, DEFAULT_PORT); } - public InternetExplorerDriver(InternetExplorerDriverService service, Capabilities capabilities, int port) { + public InternetExplorerDriver(InternetExplorerDriverService service, Capabilities capabilities, + int port) { if (capabilities == null) { capabilities = DesiredCapabilities.internetExplorer(); } diff --git a/java/client/src/org/openqa/selenium/remote/Augmenter.java b/java/client/src/org/openqa/selenium/remote/Augmenter.java index d69b60241303a..c73003c28d02d 100644 --- a/java/client/src/org/openqa/selenium/remote/Augmenter.java +++ b/java/client/src/org/openqa/selenium/remote/Augmenter.java @@ -62,9 +62,9 @@ protected X create(RemoteWebDriver driver, @Override protected RemoteWebDriver extractRemoteWebDriver(WebDriver driver) { - if (driver.getClass().isAnnotationPresent(Augmentable.class) - || driver.getClass().getName().startsWith("org.openqa.selenium.remote.RemoteWebDriver$$EnhancerByCGLIB")) - { + if (driver.getClass().isAnnotationPresent(Augmentable.class) || + driver.getClass().getName().startsWith( + "org.openqa.selenium.remote.RemoteWebDriver$$EnhancerByCGLIB")) { return (RemoteWebDriver) driver; } else { diff --git a/java/client/src/org/openqa/selenium/remote/HttpCommandExecutor.java b/java/client/src/org/openqa/selenium/remote/HttpCommandExecutor.java index 56c3a40a09e39..546f5443e4bec 100644 --- a/java/client/src/org/openqa/selenium/remote/HttpCommandExecutor.java +++ b/java/client/src/org/openqa/selenium/remote/HttpCommandExecutor.java @@ -276,7 +276,8 @@ public Response execute(Command command) throws IOException { } if (!GET_ALL_SESSIONS.equals(command.getName()) && !NEW_SESSION.equals(command.getName())) { - throw new SessionNotFoundException("Session ID is null. Using WebDriver after calling quit()?"); + throw new SessionNotFoundException( + "Session ID is null. Using WebDriver after calling quit()?"); } } diff --git a/java/client/src/org/openqa/selenium/remote/build.desc b/java/client/src/org/openqa/selenium/remote/build.desc index 44f36e4c7449d..c60a3493ab13e 100644 --- a/java/client/src/org/openqa/selenium/remote/build.desc +++ b/java/client/src/org/openqa/selenium/remote/build.desc @@ -65,6 +65,7 @@ java_library(name = "augmenter", "html5/AddWebStorage.java", ], deps = [ + ":api", ":remote", "//third_party/java/cglib", "//third_party/java/guava-libraries", diff --git a/java/client/test/org/openqa/selenium/FrameSwitchingTest.java b/java/client/test/org/openqa/selenium/FrameSwitchingTest.java index 2a5b18794cf2c..dcc36458dc67a 100644 --- a/java/client/test/org/openqa/selenium/FrameSwitchingTest.java +++ b/java/client/test/org/openqa/selenium/FrameSwitchingTest.java @@ -486,7 +486,7 @@ public void testShouldNotBeAbleToDoAnythingTheFrameIsDeletedFromUnderUs() { WebElement killIframe = driver.findElement(By.id("killIframe")); killIframe.click(); - + try { driver.findElement(By.id("killIframe")).click(); fail("NoSuchFrameException should be thrown"); diff --git a/java/server/src/org/openqa/selenium/server/BrowserSessionFactory.java b/java/server/src/org/openqa/selenium/server/BrowserSessionFactory.java index be3b058ddfe6d..f0f535999c305 100644 --- a/java/server/src/org/openqa/selenium/server/BrowserSessionFactory.java +++ b/java/server/src/org/openqa/selenium/server/BrowserSessionFactory.java @@ -398,7 +398,7 @@ protected BrowserSessionInfo createNewRemoteSession(String browserString, String perSessionLogHandler.attachToCurrentThread(new SessionId(sessionId)); try { launcher.launchRemoteSession(startURL); - queueSet.waitForLoad(configuration.getTimeoutInSeconds() * 1000l); + queueSet.waitForLoad(configuration.getTimeoutInSeconds() * 1000L); // TODO DGF log4j only // NDC.push("sessionId="+sessionId); diff --git a/java/server/src/org/openqa/selenium/server/ClassPathResource.java b/java/server/src/org/openqa/selenium/server/ClassPathResource.java index 202941a3a4993..42e51b81209df 100644 --- a/java/server/src/org/openqa/selenium/server/ClassPathResource.java +++ b/java/server/src/org/openqa/selenium/server/ClassPathResource.java @@ -83,7 +83,7 @@ public boolean isDirectory() { */ @Override public long lastModified() { - return System.currentTimeMillis() + 1000l * 3600l * 24l * 365l; + return System.currentTimeMillis() + 1000L * 3600L * 24L * 365L; } @Override diff --git a/java/server/src/org/openqa/selenium/server/FrameGroupCommandQueueSet.java b/java/server/src/org/openqa/selenium/server/FrameGroupCommandQueueSet.java index c52974aaf3ba2..97c5606a95a7d 100644 --- a/java/server/src/org/openqa/selenium/server/FrameGroupCommandQueueSet.java +++ b/java/server/src/org/openqa/selenium/server/FrameGroupCommandQueueSet.java @@ -347,7 +347,7 @@ public String doCommand(String command, String arg, String value) throws RemoteC // an exception then we should simply return the // command result uniqueId = - waitForLoad(waitingForThisWindowName, "top", (int) (timeoutInMilliseconds / 1000l)); + waitForLoad(waitingForThisWindowName, "top", (int) (timeoutInMilliseconds / 1000L)); // if (!result.equals("OK")) { // return result; @@ -371,7 +371,7 @@ public String doCommand(String command, String arg, String value) throws RemoteC try { result = waitForLoad(currentWindowName, waitingForThisFrameName, - (int) (timeoutInMilliseconds / 1000l)); + (int) (timeoutInMilliseconds / 1000L)); } catch (RemoteCommandException e) { return e.getMessage(); } @@ -530,7 +530,7 @@ private String getRemoteString(CommandQueue queue, String command, String arg1, public String waitForLoad(long timeoutInMilliseconds) throws RemoteCommandException { final String uniqueId; - int timeoutInSeconds = (int) (timeoutInMilliseconds / 1000l); + int timeoutInSeconds = (int) (timeoutInMilliseconds / 1000L); if (timeoutInSeconds == 0) { timeoutInSeconds = 1; } diff --git a/java/server/src/org/openqa/selenium/server/FutureFileResource.java b/java/server/src/org/openqa/selenium/server/FutureFileResource.java index 099d67092eee0..e6cf7212dbb6f 100644 --- a/java/server/src/org/openqa/selenium/server/FutureFileResource.java +++ b/java/server/src/org/openqa/selenium/server/FutureFileResource.java @@ -210,7 +210,7 @@ public boolean exists() { */ @Override public long lastModified() { - return System.currentTimeMillis() + (1000l * 3600l * 24l * 365l * 12l); + return System.currentTimeMillis() + (1000L * 3600L * 24L * 365L * 12L); } /* -------------------------------------------------------- */ diff --git a/java/server/src/org/openqa/selenium/server/htmlrunner/HTMLLauncher.java b/java/server/src/org/openqa/selenium/server/htmlrunner/HTMLLauncher.java index 09558e76f4bd8..e54164ebe50e5 100644 --- a/java/server/src/org/openqa/selenium/server/htmlrunner/HTMLLauncher.java +++ b/java/server/src/org/openqa/selenium/server/htmlrunner/HTMLLauncher.java @@ -118,7 +118,7 @@ private String runHTMLSuite(String browser, String browserURL, String suiteURL, if (!outputFile.canWrite()) { throw new IOException("Can't write to outputFile: " + outputFile.getAbsolutePath()); } - long timeoutInMs = 1000l * timeoutInSeconds; + long timeoutInMs = 1000L * timeoutInSeconds; if (timeoutInMs < 0) { log.warning("Looks like the timeout overflowed, so resetting it to the maximum."); timeoutInMs = Long.MAX_VALUE; diff --git a/javascript/firefox-driver/js/files.js b/javascript/firefox-driver/js/files.js index baead0288f1d7..72409428549a8 100644 --- a/javascript/firefox-driver/js/files.js +++ b/javascript/firefox-driver/js/files.js @@ -43,7 +43,8 @@ fxdriver.files.createTempFile = function(opt_prefix, opt_suffix) { file.append(path); exists = file.exists(); } - file.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0666); + file.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, + parseInt('666', 8)); return new fxdriver.files.File(file); }; @@ -77,7 +78,8 @@ fxdriver.files.getLocalFile_ = function(path) { get('ProfD', Components.interfaces.nsILocalFile); file.initWithPath(path); if (!file.exists()) { - file.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0666); + file.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, + parseInt('666', 8)); } return file; }; @@ -122,7 +124,8 @@ fxdriver.files.READ_MODE_ = 0x01; fxdriver.files.File.prototype.append = function(toAppend) { var ostream = Components.classes['@mozilla.org/network/file-output-stream;1'] .createInstance(Components.interfaces['nsIFileOutputStream']); - ostream.init(this.nsIFile_, fxdriver.files.APPEND_MODE_, 0666, 0); + ostream.init(this.nsIFile_, fxdriver.files.APPEND_MODE_, + parseInt('666', 8), 0); var converter = Components.classes['@mozilla.org/intl/converter-output-stream;1'] @@ -143,7 +146,7 @@ fxdriver.files.File.prototype.append = function(toAppend) { fxdriver.files.File.prototype.read = function() { var istream = Components.classes['@mozilla.org/network/file-input-stream;1'] .createInstance(Components.interfaces['nsIFileInputStream']); - istream.init(this.nsIFile_, fxdriver.files.READ_MODE_, 0666, 0); + istream.init(this.nsIFile_, fxdriver.files.READ_MODE_, parseInt('666', 8), 0); var converter = Components.classes['@mozilla.org/intl/converter-input-stream;1'] diff --git a/javascript/firefox-driver/js/wdsession.js b/javascript/firefox-driver/js/wdsession.js index 020ecc870be84..3514a9e360ad2 100644 --- a/javascript/firefox-driver/js/wdsession.js +++ b/javascript/firefox-driver/js/wdsession.js @@ -230,7 +230,7 @@ wdSession.prototype.getWindow = function() { }; -/** @return @return {?nsIDOMWindow} This session's top window. */ +/** @return {?nsIDOMWindow} This session's top window. */ wdSession.prototype.getTopWindow = function() { return this.getWindow().top; };