Search in sources :

Example 16 with UnknownFormatConversionException

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);
}
Also used : UnknownFormatConversionException(java.util.UnknownFormatConversionException) Matcher(java.util.regex.Matcher)

Aggregations

UnknownFormatConversionException (java.util.UnknownFormatConversionException)16 Formatter (java.util.Formatter)8 FormatFlagsConversionMismatchException (java.util.FormatFlagsConversionMismatchException)5 IllegalFormatFlagsException (java.util.IllegalFormatFlagsException)5 MissingFormatWidthException (java.util.MissingFormatWidthException)5 IllegalFormatPrecisionException (java.util.IllegalFormatPrecisionException)4 BigInteger (java.math.BigInteger)3 Map (java.util.Map)3 Matcher (java.util.regex.Matcher)3 BufferedReader (java.io.BufferedReader)2 IOException (java.io.IOException)2 InputStreamReader (java.io.InputStreamReader)2 ParameterizedType (java.lang.reflect.ParameterizedType)2 Type (java.lang.reflect.Type)2 BigDecimal (java.math.BigDecimal)2 IllegalFormatConversionException (java.util.IllegalFormatConversionException)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 ConcurrentMap (java.util.concurrent.ConcurrentMap)2 IdaException (com.google.security.zynamics.zylib.system.IdaException)1 ExecutionException (com.intellij.execution.ExecutionException)1