@Test void testGetBucketNameFromLocation() throws Exception { assertThat(getBucketNameFromLocation("s3: assertThat(getBucketNameFromLocation("s3: assertThat(getBucketNameFromLocation("s3: assertThat(getBucketNameFromLocation("s3: assertThat(getBucketNameFromLocation("s3: .isEqualTo("foo"); }
static String getBucketNameFromLocation(String location) { Assert.notNull(location, "Location must not be null"); if (!isSimpleStorageResource(location)) { throw new IllegalArgumentException( "The location :'" + location + "' is not a valid S3 location"); } int bucketEndIndex = location.indexOf(PATH_DELIMITER, S3_PROTOCOL_PREFIX.length()); if (bucketEndIndex == -1 || bucketEndIndex == S3_PROTOCOL_PREFIX.length()) { throw new IllegalArgumentException("The location :'" + location + "' does not contain a valid bucket name"); } return location.substring(S3_PROTOCOL_PREFIX.length(), bucketEndIndex); }
SimpleStorageNameUtils { static String getBucketNameFromLocation(String location) { Assert.notNull(location, "Location must not be null"); if (!isSimpleStorageResource(location)) { throw new IllegalArgumentException( "The location :'" + location + "' is not a valid S3 location"); } int bucketEndIndex = location.indexOf(PATH_DELIMITER, S3_PROTOCOL_PREFIX.length()); if (bucketEndIndex == -1 || bucketEndIndex == S3_PROTOCOL_PREFIX.length()) { throw new IllegalArgumentException("The location :'" + location + "' does not contain a valid bucket name"); } return location.substring(S3_PROTOCOL_PREFIX.length(), bucketEndIndex); } }
SimpleStorageNameUtils { static String getBucketNameFromLocation(String location) { Assert.notNull(location, "Location must not be null"); if (!isSimpleStorageResource(location)) { throw new IllegalArgumentException( "The location :'" + location + "' is not a valid S3 location"); } int bucketEndIndex = location.indexOf(PATH_DELIMITER, S3_PROTOCOL_PREFIX.length()); if (bucketEndIndex == -1 || bucketEndIndex == S3_PROTOCOL_PREFIX.length()) { throw new IllegalArgumentException("The location :'" + location + "' does not contain a valid bucket name"); } return location.substring(S3_PROTOCOL_PREFIX.length(), bucketEndIndex); } private  SimpleStorageNameUtils(); }
SimpleStorageNameUtils { static String getBucketNameFromLocation(String location) { Assert.notNull(location, "Location must not be null"); if (!isSimpleStorageResource(location)) { throw new IllegalArgumentException( "The location :'" + location + "' is not a valid S3 location"); } int bucketEndIndex = location.indexOf(PATH_DELIMITER, S3_PROTOCOL_PREFIX.length()); if (bucketEndIndex == -1 || bucketEndIndex == S3_PROTOCOL_PREFIX.length()) { throw new IllegalArgumentException("The location :'" + location + "' does not contain a valid bucket name"); } return location.substring(S3_PROTOCOL_PREFIX.length(), bucketEndIndex); } private  SimpleStorageNameUtils();  }
SimpleStorageNameUtils { static String getBucketNameFromLocation(String location) { Assert.notNull(location, "Location must not be null"); if (!isSimpleStorageResource(location)) { throw new IllegalArgumentException( "The location :'" + location + "' is not a valid S3 location"); } int bucketEndIndex = location.indexOf(PATH_DELIMITER, S3_PROTOCOL_PREFIX.length()); if (bucketEndIndex == -1 || bucketEndIndex == S3_PROTOCOL_PREFIX.length()) { throw new IllegalArgumentException("The location :'" + location + "' does not contain a valid bucket name"); } return location.substring(S3_PROTOCOL_PREFIX.length(), bucketEndIndex); } private  SimpleStorageNameUtils();   }