Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 95: Duplicate bucket name will now cause the server to fail regardless of case #96

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@

import java.io.File;
import java.io.FileNotFoundException;
import java.util.Set;
import java.util.function.Supplier;
import java.util.stream.Collectors;

import static java.util.Objects.requireNonNull;
import static com.facebook.presto.s3.S3Const.*;
Expand Down Expand Up @@ -65,6 +67,10 @@ public Map<SchemaTableName, S3Table> get() {

ImmutableMap.Builder<SchemaTableName, S3Table> builder = ImmutableMap.builder();
List<Bucket> listOfBuckets = this.accessObject.listBuckets();
Set<String> set = listOfBuckets.stream().map(Bucket::getName).map(String::toLowerCase).collect(Collectors.toSet());
if(set.size()<listOfBuckets.size()){
throw new IllegalArgumentException("Two or more buckets have been found with the same name, but different case of some of the letters");
}
for (Bucket bucket : listOfBuckets) {
JSONObject sources = new JSONObject();
S3Table table = this.objectDescriptionCodec.fromJson(
Expand Down