Skip to content

Commit e8da284

Browse files
author
“robin.gupta”
committed
Fix for basePath appending logic to fix Issue#1660 AppiumDriverLocalService is not able to start - checkStatus is failing
1 parent d3ede46 commit e8da284

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/main/java/io/appium/java_client/service/local/AppiumDriverLocalService.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,23 @@ public static AppiumDriverLocalService buildService(AppiumServiceBuilder builder
9494
}
9595

9696
public AppiumDriverLocalService withBasePath(String basePath) {
97-
this.basePath = basePath;
97+
this.basePath = sanitizeBasePath(basePath);
9898
return this;
9999
}
100100

101+
@SneakyThrows private static String sanitizeBasePath(String basePath) {
102+
if (null == basePath) {
103+
LOG.warn("Base Path cannot be NULL -- ignoring the basepath configuration");
104+
return null;
105+
}
106+
basePath = basePath.trim();
107+
if (basePath.isBlank() || basePath.isEmpty()) {
108+
LOG.warn("Base Path cannot be Empty or Blank -- ignoring the basepath configuration");
109+
return null;
110+
}
111+
return (basePath.endsWith("/") ? basePath : basePath + "/");
112+
}
113+
101114
public String getBasePath() {
102115
return this.basePath;
103116
}

0 commit comments

Comments
 (0)