fix: Possible NPE in initBiDi() by panchenko · Pull Request #2325 · appium/java-client
Change list
Make sure httpClientFactory in AppiumCommandExecutor is not null.
Types of changes
- No changes in production code.
- Bugfix (non-breaking change which fixes an issue)
- New feature (non-breaking change which adds functionality)
- Breaking change (fix or feature that would cause existing functionality to not work as expected)
Details
version 9.5.0, code is like below
DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability("webSocketUrl", true); driver = new AndroidDriver(AppiumClientConfig.defaultConfig().baseUri(URI.create(url)), capabilities);
throws
Exception in thread "main" java.lang.NullPointerException:
Cannot invoke "org.openqa.selenium.remote.http.HttpClient$Factory.createClient(org.openqa.selenium.remote.http.ClientConfig)"
because the return value of "io.appium.java_client.remote.AppiumCommandExecutor.getHttpClientFactory()" is null
at io.appium.java_client.AppiumDriver.initBiDi(AppiumDriver.java:423)
at io.appium.java_client.AppiumDriver.startSession(AppiumDriver.java:344)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:173)
at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:101)
at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:109)
at io.appium.java_client.android.AndroidDriver.<init>(AndroidDriver.java:223)