CTTY commented on code in PR #7576:
URL: https://github.com/apache/hudi/pull/7576#discussion_r1071718398
##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/schema/SchemaRegistryProvider.java:
##########
@@ -64,24 +81,32 @@ public static class Config {
* @throws IOException
*/
public String fetchSchemaFromRegistry(String registryUrl) throws IOException
{
- URL registry;
HttpURLConnection connection;
Matcher matcher = Pattern.compile("://(.*?)@").matcher(registryUrl);
if (matcher.find()) {
String creds = matcher.group(1);
String urlWithoutCreds = registryUrl.replace(creds + "@", "");
- registry = new URL(urlWithoutCreds);
- connection = (HttpURLConnection) registry.openConnection();
+ connection = getConnection(urlWithoutCreds);
setAuthorizationHeader(matcher.group(1), connection);
} else {
- registry = new URL(registryUrl);
- connection = (HttpURLConnection) registry.openConnection();
+ connection = getConnection(registryUrl);
}
ObjectMapper mapper = new ObjectMapper();
JsonNode node = mapper.readTree(getStream(connection));
return node.get("schema").asText();
}
+ protected HttpURLConnection getConnection(String url) throws IOException {
+ URL registry = new URL(url);
+ if (sslSocketFactory != null) {
+ // we cannot cast to HttpsURLConnection if url is http so only cast when
sslSocketFactory is set
+ HttpsURLConnection connection = (HttpsURLConnection)
registry.openConnection();
+ connection.setSSLSocketFactory((sslSocketFactory));
Review Comment:
Why do we need double parentheses here?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]