@Test(expected = AmazonClientException.class) public void noProviderGivesRegion_ThrowsAmazonClientException() { AwsRegionProviderChain chain = new AwsRegionProviderChain(new NeverAwsRegionProvider(), new NeverAwsRegionProvider(), new NeverAwsRegionProvider()); chain.getRegion(); }
@Override public String getRegion() throws SdkClientException { for (AwsRegionProvider provider : providers) { try { final String region = provider.getRegion(); if (region != null) { return region; } } catch (Exception e) { LOG.debug("Unable to load region from " + provider.toString() + ": " + e.getMessage()); } } throw new SdkClientException("Unable to load region information from any provider in the chain"); }
AwsRegionProviderChain extends AwsRegionProvider { @Override public String getRegion() throws SdkClientException { for (AwsRegionProvider provider : providers) { try { final String region = provider.getRegion(); if (region != null) { return region; } } catch (Exception e) { LOG.debug("Unable to load region from " + provider.toString() + ": " + e.getMessage()); } } throw new SdkClientException("Unable to load region information from any provider in the chain"); } }
AwsRegionProviderChain extends AwsRegionProvider { @Override public String getRegion() throws SdkClientException { for (AwsRegionProvider provider : providers) { try { final String region = provider.getRegion(); if (region != null) { return region; } } catch (Exception e) { LOG.debug("Unable to load region from " + provider.toString() + ": " + e.getMessage()); } } throw new SdkClientException("Unable to load region information from any provider in the chain"); } AwsRegionProviderChain(AwsRegionProvider... providers); }
AwsRegionProviderChain extends AwsRegionProvider { @Override public String getRegion() throws SdkClientException { for (AwsRegionProvider provider : providers) { try { final String region = provider.getRegion(); if (region != null) { return region; } } catch (Exception e) { LOG.debug("Unable to load region from " + provider.toString() + ": " + e.getMessage()); } } throw new SdkClientException("Unable to load region information from any provider in the chain"); } AwsRegionProviderChain(AwsRegionProvider... providers); @Override String getRegion(); }
AwsRegionProviderChain extends AwsRegionProvider { @Override public String getRegion() throws SdkClientException { for (AwsRegionProvider provider : providers) { try { final String region = provider.getRegion(); if (region != null) { return region; } } catch (Exception e) { LOG.debug("Unable to load region from " + provider.toString() + ": " + e.getMessage()); } } throw new SdkClientException("Unable to load region information from any provider in the chain"); } AwsRegionProviderChain(AwsRegionProvider... providers); @Override String getRegion();  }