> +
> +   @Override
> +   public URI apply(@Nullable Object from) {
> +      checkArgument(from != null && from instanceof String, "you must 
> specify a region, as a String argument");
> +      Map<String, Supplier<URI>> regionToEndpoint = 
> regionToEndpointSupplier.get();
> +      checkState(!regionToEndpoint.isEmpty(), "no region name to endpoint 
> mappings configured!");
> +      checkArgument(regionToEndpoint.containsKey(from),
> +               "requested location %s, which is not in the configured 
> locations: %s", from, regionToEndpoint);
> +      String uri = regionToEndpoint.get(from).get().toString();
> +
> +      /**
> +       * A quick fix to ensure Neutron works with endpoint definitions that 
> are not version-agnostic.
> +       */
> +      if (uri.endsWith("/v2.0")) {
> +         try {
> +            return new URI(uri.substring(0, uri.length() - 5));

URI.create and you don't need to swallow the exception!

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-openstack/pull/169/files#r20174902

Reply via email to