@Test void testGetVersionIdFromLocation() throws Exception { assertThat(getVersionIdFromLocation("s3: .isEqualTo("versionIdValue"); assertThat(getVersionIdFromLocation("s3: .isEqualTo("versionIdValue"); }
static String getVersionIdFromLocation(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 objectNameEndIndex = location.indexOf(VERSION_DELIMITER, S3_PROTOCOL_PREFIX.length()); if (objectNameEndIndex == -1 || location.endsWith(VERSION_DELIMITER)) { return null; } if (objectNameEndIndex == S3_PROTOCOL_PREFIX.length()) { throw new IllegalArgumentException("The location :'" + location + "' does not contain a valid bucket name"); } return location.substring(++objectNameEndIndex, location.length()); }
SimpleStorageNameUtils { static String getVersionIdFromLocation(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 objectNameEndIndex = location.indexOf(VERSION_DELIMITER, S3_PROTOCOL_PREFIX.length()); if (objectNameEndIndex == -1 || location.endsWith(VERSION_DELIMITER)) { return null; } if (objectNameEndIndex == S3_PROTOCOL_PREFIX.length()) { throw new IllegalArgumentException("The location :'" + location + "' does not contain a valid bucket name"); } return location.substring(++objectNameEndIndex, location.length()); } }
SimpleStorageNameUtils { static String getVersionIdFromLocation(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 objectNameEndIndex = location.indexOf(VERSION_DELIMITER, S3_PROTOCOL_PREFIX.length()); if (objectNameEndIndex == -1 || location.endsWith(VERSION_DELIMITER)) { return null; } if (objectNameEndIndex == S3_PROTOCOL_PREFIX.length()) { throw new IllegalArgumentException("The location :'" + location + "' does not contain a valid bucket name"); } return location.substring(++objectNameEndIndex, location.length()); } private  SimpleStorageNameUtils(); }
SimpleStorageNameUtils { static String getVersionIdFromLocation(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 objectNameEndIndex = location.indexOf(VERSION_DELIMITER, S3_PROTOCOL_PREFIX.length()); if (objectNameEndIndex == -1 || location.endsWith(VERSION_DELIMITER)) { return null; } if (objectNameEndIndex == S3_PROTOCOL_PREFIX.length()) { throw new IllegalArgumentException("The location :'" + location + "' does not contain a valid bucket name"); } return location.substring(++objectNameEndIndex, location.length()); } private  SimpleStorageNameUtils();  }
SimpleStorageNameUtils { static String getVersionIdFromLocation(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 objectNameEndIndex = location.indexOf(VERSION_DELIMITER, S3_PROTOCOL_PREFIX.length()); if (objectNameEndIndex == -1 || location.endsWith(VERSION_DELIMITER)) { return null; } if (objectNameEndIndex == S3_PROTOCOL_PREFIX.length()) { throw new IllegalArgumentException("The location :'" + location + "' does not contain a valid bucket name"); } return location.substring(++objectNameEndIndex, location.length()); } private  SimpleStorageNameUtils();   }