codope commented on a change in pull request #3097: URL: https://github.com/apache/hudi/pull/3097#discussion_r659151072
########## File path: hudi-utilities/src/main/java/org/apache/hudi/utilities/schema/SchemaRegistryProvider.java ########## @@ -48,19 +54,40 @@ "hoodie.deltastreamer.schemaprovider.registry.targetUrl"; } - private static String fetchSchemaFromRegistry(String registryUrl) throws IOException { - URL registry = new URL(registryUrl); + 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(); + setAuthorizationHeader(matcher.group(1), connection); + } else { + registry = new URL(registryUrl); + connection = (HttpURLConnection) registry.openConnection(); + } ObjectMapper mapper = new ObjectMapper(); - JsonNode node = mapper.readTree(registry.openStream()); + JsonNode node = mapper.readTree(getStream(connection)); return node.get("schema").asText(); } + public void setAuthorizationHeader(String creds, HttpURLConnection connection) { Review comment: Probably because it's being used in tests. If that's the only reason then maybe we can make the method package-private? -- 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: commits-unsubscr...@hudi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org