public static String readExternalUrlRef(String file, RefFormat refFormat, List<AuthorizationValue> auths,
String rootPath) {
if (!RefUtils.isAnExternalRefFormat(refFormat)) {
throw new RuntimeException("Ref is not external");
}
String result;
try {
if (refFormat == RefFormat.URL) {
result = RemoteUrl.urlToString(file, auths);
} else {
String url = buildUrl(rootPath, file);
return readExternalRef(url, RefFormat.URL, auths, null);
}
} catch (Exception e) {
throw new RuntimeException("Unable to load " + refFormat + " ref: " + file + " path:" + rootPath, e);
}
return result;
}