|
17 | 17 |
|
18 | 18 | package org.openqa.selenium.firefox.internal;
|
19 | 19 |
|
20 |
| -import com.google.common.base.Optional; |
| 20 | +import static org.openqa.selenium.firefox.FirefoxProfile.PORT_PREFERENCE; |
| 21 | +import static org.openqa.selenium.internal.SocketLock.DEFAULT_PORT; |
21 | 22 |
|
22 | 23 | import org.openqa.selenium.WebDriverException;
|
23 | 24 | import org.openqa.selenium.firefox.ExtensionConnection;
|
|
26 | 27 | import org.openqa.selenium.firefox.FirefoxProfile;
|
27 | 28 | import org.openqa.selenium.firefox.NotConnectedException;
|
28 | 29 | import org.openqa.selenium.internal.Lock;
|
| 30 | +import org.openqa.selenium.io.CircularOutputStream; |
29 | 31 | import org.openqa.selenium.io.MultiOutputStream;
|
30 | 32 | import org.openqa.selenium.logging.LocalLogs;
|
31 | 33 | import org.openqa.selenium.logging.NeedsLocalLogs;
|
32 | 34 | import org.openqa.selenium.net.NetworkUtils;
|
33 | 35 | import org.openqa.selenium.remote.Command;
|
34 | 36 | import org.openqa.selenium.remote.HttpCommandExecutor;
|
35 | 37 | import org.openqa.selenium.remote.Response;
|
36 |
| -import org.openqa.selenium.io.CircularOutputStream; |
37 | 38 |
|
38 | 39 | import java.io.File;
|
39 | 40 | import java.io.FileOutputStream;
|
|
44 | 45 | import java.net.URI;
|
45 | 46 | import java.net.URISyntaxException;
|
46 | 47 | import java.net.URL;
|
47 |
| - |
48 |
| -import static org.openqa.selenium.firefox.FirefoxProfile.PORT_PREFERENCE; |
49 |
| -import static org.openqa.selenium.internal.SocketLock.DEFAULT_PORT; |
| 48 | +import java.util.Optional; |
50 | 49 |
|
51 | 50 | public class NewProfileExtensionConnection implements ExtensionConnection, NeedsLocalLogs {
|
52 | 51 |
|
@@ -139,16 +138,16 @@ protected void addWebDriverExtensionIfNeeded() {
|
139 | 138 | if (profile.containsWebDriverExtension()) {
|
140 | 139 | return;
|
141 | 140 | }
|
142 |
| - profile.addExtension("webdriver", loadCustomExtension().or(loadDefaultExtension())); |
| 141 | + profile.addExtension("webdriver", loadCustomExtension().orElse(loadDefaultExtension())); |
143 | 142 | }
|
144 | 143 |
|
145 | 144 | private static Optional<Extension> loadCustomExtension() {
|
146 | 145 | String xpiProperty = System.getProperty(FirefoxDriver.SystemProperty.DRIVER_XPI_PROPERTY);
|
147 | 146 | if (xpiProperty != null) {
|
148 | 147 | File xpi = new File(xpiProperty);
|
149 |
| - return Optional.of((Extension) new FileExtension(xpi)); |
| 148 | + return Optional.of(new FileExtension(xpi)); |
150 | 149 | }
|
151 |
| - return Optional.absent(); |
| 150 | + return Optional.empty(); |
152 | 151 | }
|
153 | 152 |
|
154 | 153 | private static Extension loadDefaultExtension() {
|
|
0 commit comments