in jdbc/src/main/java/software/amazon/timestream/jdbc/TimestreamDriver.java [240:280]
private Properties parseUrl(String url, Properties info) throws SQLException {
if (null == url) {
// This should not occur, as there is a guard of acceptsURL before this call.
LOGGER.warning(
"The URL passed to TimestreamDriver#parseUrl is null. This should not be possible.");
return new Properties();
}
String trimmedUrl = url.trim().substring(Constants.URL_PREFIX.length());
if (!Strings.isNullOrEmpty(trimmedUrl)) {
trimmedUrl = trimmedUrl.substring(Constants.URL_BRIDGE.length());
}
final Properties allProperties = new Properties();
if (null != info) {
info.forEach((key, value) -> {
final String keyString = key.toString();
if (TimestreamConnectionProperty.isSupportedProperty(keyString)) {
allProperties.put(keyString, value);
} else {
LOGGER.warning("Ignored unsupported property: " + keyString);
}
});
}
if (!Strings.isNullOrEmpty(trimmedUrl)) {
for (final String keyValueStr : trimmedUrl.split(";")) {
final String[] keyValue = keyValueStr.trim().split("=");
if ((2 != keyValue.length) || keyValue[0].isEmpty()) {
throw Error.createSQLException(LOGGER, Error.INVALID_CONNECTION_PROPERTIES, url);
}
final String trimmedKeyStr = keyValue[0].trim();
if (TimestreamConnectionProperty.isSupportedProperty(trimmedKeyStr)) {
allProperties.put(trimmedKeyStr, keyValue[1]);
} else {
LOGGER.warning("Ignored unsupported property: " + trimmedKeyStr);
}
}
}
return allProperties;
}