Skip to content

Commit a43b758

Browse files
committed
SDK-2771: [MB] Address SonarQube quality concern surrounding use of regex
1 parent 6e6b374 commit a43b758

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

yoti-sdk-api/src/main/java/com/yoti/api/client/spi/remote/call/YotiHttpRequestBuilder.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,13 @@ public YotiHttpRequestBuilder forSignedRequest(KeyPair keyPair) {
107107
* @return the updated builder
108108
*/
109109
public YotiHttpRequestBuilder withBaseUrl(String baseUrl) {
110-
this.baseUrl = baseUrl.replaceAll("([/]+)$", "");
110+
int index;
111+
for (index = baseUrl.length() - 1; index >= 0; index--) {
112+
if (baseUrl.charAt(index) != '/') {
113+
break;
114+
}
115+
}
116+
this.baseUrl = baseUrl.substring(0, index + 1);
111117
return this;
112118
}
113119

0 commit comments

Comments
 (0)