File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
src/main/java/io/appium/java_client/service/local Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -94,10 +94,23 @@ public static AppiumDriverLocalService buildService(AppiumServiceBuilder builder
94
94
}
95
95
96
96
public AppiumDriverLocalService withBasePath (String basePath ) {
97
- this .basePath = basePath ;
97
+ this .basePath = sanitizeBasePath ( basePath ) ;
98
98
return this ;
99
99
}
100
100
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
+
101
114
public String getBasePath () {
102
115
return this .basePath ;
103
116
}
You can’t perform that action at this time.
0 commit comments