> @Provides
> @Singleton
> @Storage
> - protected Supplier<URI>
> provideStorageUrl(RegionIdToURISupplier.Factory factory, @ApiVersion String
> apiVersion) {
> - return
> getLastValueInMap(factory.createForApiTypeAndVersion(ServiceType.OBJECT_STORE,
> apiVersion));
> + protected Supplier<URI>
> provideStorageUrl(RegionIdToURISupplier.Factory factory,
> + @ApiVersion String apiVersion,
> + @Named(LocationConstants.PROPERTY_REGION) String region) {
> +
> + //Get the URI's keyed by their region name
> + Supplier<Map<String, Supplier<URI>>> endpointsSupplier =
> factory.createForApiTypeAndVersion(ServiceType.OBJECT_STORE, apiVersion);
> +
> + //Pick the matching region name (if any) otherwise just return an
> arbitrary URL if no region name is set
> + //NOTE: The region string should never be null (it can be empty) if
> this object was instantiated via guice
> + // as it pulls these named strings from a Properties object.
> That being said, there's no real reason we
> + // should treat a null string differently to an empty string.
> + if (!Strings.isNullOrEmpty(region)) {
If `region` cannot be `null`, how about just `if (!region.equals("")...`..?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/31/files#r4937945