RED-5293: added catch block for URISyntaxExceptions
This commit is contained in:
parent
e51581c6d2
commit
f8b6d033ac
@ -1,6 +1,7 @@
|
||||
package com.iqser.red.service.peristence.v1.server.service;
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.util.List;
|
||||
@ -133,12 +134,16 @@ public class TenantManagementService {
|
||||
@SneakyThrows
|
||||
private void validateJdbcUrl(String jdbcUrl) {
|
||||
|
||||
// just create a URI object to check if the string is a valid URI
|
||||
var uri = new URI(jdbcUrl);
|
||||
var subUri = new URI(uri.getSchemeSpecificPart());
|
||||
try {
|
||||
// just create a URI object to check if the string is a valid URI
|
||||
var uri = new URI(jdbcUrl);
|
||||
var subUri = new URI(uri.getSchemeSpecificPart());
|
||||
|
||||
if (uri.getScheme() == null || subUri.getScheme() == null || !uri.getScheme().equals("jdbc") || !SUPPORTED_DATABASES.contains(subUri.getScheme())) {
|
||||
throw new IllegalArgumentException("Your jdbcUrl is not valid.");
|
||||
if (uri.getScheme() == null || subUri.getScheme() == null || !uri.getScheme().equals("jdbc") || !SUPPORTED_DATABASES.contains(subUri.getScheme())) {
|
||||
throw new IllegalArgumentException("Your jdbcUrl is not valid.");
|
||||
}
|
||||
} catch (URISyntaxException e) {
|
||||
throw new IllegalArgumentException("Your jdbcUrl is not valid.", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user