use of java.util.UnknownFormatConversionException in project azure-tools-for-java by Microsoft.
the class WasbUri method parse.
public static WasbUri parse(final String blobUri) {
Matcher matcher;
if (StringUtils.startsWithIgnoreCase(blobUri, "wasb")) {
matcher = WASB_URI_PATTERN.matcher(blobUri);
} else if (StringUtils.startsWithIgnoreCase(blobUri, "http")) {
matcher = HTTP_URI_PATTERN.matcher(blobUri);
} else {
throw new UnknownFormatConversionException("Unsupported Azure blob URI Scheme: " + blobUri);
}
if (matcher.matches()) {
final WasbUri wasbUri = new WasbUri(URI.create(blobUri));
wasbUri.container.set(matcher.group("container"));
wasbUri.storageAccount.set(matcher.group("storageAccount"));
wasbUri.endpointSuffix.set(matcher.group("endpointSuffix"));
final String pathMatched = matcher.group("path");
final String relativePathMatched = URI.create("/" + (pathMatched == null ? "" : pathMatched)).getPath();
wasbUri.path.set(URI.create(relativePathMatched));
return wasbUri;
}
throw new UnknownFormatConversionException("Unmatched Azure blob URI: " + blobUri);
}
Aggregations