Skip to content

Commit 34a4d83

Browse files
authored
Merge pull request #2513 from ClickHouse/fix_using_new_api
fix using isBlank() from newer API
2 parents 6fe7a92 + 11df159 commit 34a4d83

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

jdbc-v2/src/main/java/com/clickhouse/jdbc/internal/JdbcConfiguration.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,26 +184,27 @@ private Map<String, String> parseUrl(String url) throws SQLException {
184184
}
185185
properties.put(PARSE_URL_CONN_URL_PROP, uri.getScheme() + "://"
186186
+ uri.getRawAuthority()); // will be parsed again later
187+
187188
if (uri.getPath() != null
188-
&& !uri.getPath().isBlank()
189+
&& !uri.getPath().trim().isEmpty()
189190
&& !"/".equals(uri.getPath()))
190191
{
191192
properties.put(
192193
ClientConfigProperties.DATABASE.getKey(),
193194
uri.getPath().substring(1));
194195
}
195-
if (uri.getQuery() != null && !uri.getQuery().isBlank()) {
196+
if (uri.getQuery() != null && !uri.getQuery().trim().isEmpty()) {
196197
for (String pair : uri.getRawQuery().split("&")) {
197198
String[] p = pair.split("=", 2);
198199
if (p.length != 2 || p[0] == null || p[1] == null) {
199200
throw new SQLException("Invalid query parameter '" + pair + "'");
200201
}
201202
String key = URLDecoder.decode(p[0], StandardCharsets.UTF_8);
202-
if (key == null || key.isBlank() || !PATTERN_HTTP_TOKEN.matcher(key).matches()) {
203+
if (key == null || key.trim().isEmpty() || !PATTERN_HTTP_TOKEN.matcher(key).matches()) {
203204
throw new SQLException("Invalid query parameter key in pair'" + pair + "'");
204205
}
205206
String value = URLDecoder.decode(p[1], StandardCharsets.UTF_8);
206-
if (value == null || value.isBlank() || "=".equals(value)) {
207+
if (value == null || value.trim().isEmpty() || "=".equals(value)) {
207208
throw new SQLException("Invalid query parameter value in pair '" + pair + "'");
208209
}
209210
properties.put(key.trim(), value);

0 commit comments

Comments
 (0)