From 0aae7e80fbc34a6df17ab4ff4481b26bb77bcb43 Mon Sep 17 00:00:00 2001 From: Martin Todorov Date: Mon, 4 Oct 2021 23:54:09 +0100 Subject: [PATCH] Code style fixes --- .../carlspring/cloud/storage/s3fs/S3FileSystemProvider.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/org/carlspring/cloud/storage/s3fs/S3FileSystemProvider.java b/src/main/java/org/carlspring/cloud/storage/s3fs/S3FileSystemProvider.java index 219743e1..f9717068 100644 --- a/src/main/java/org/carlspring/cloud/storage/s3fs/S3FileSystemProvider.java +++ b/src/main/java/org/carlspring/cloud/storage/s3fs/S3FileSystemProvider.java @@ -853,10 +853,14 @@ public void copy(Path source, if (exists(s3Target)) { if (!actualOptions.contains(StandardCopyOption.REPLACE_EXISTING)) + { throw new FileAlreadyExistsException(format("target already exists: %s", target)); + } if (Files.isDirectory(source)) + { delete(s3Target); + } } if (Files.isDirectory(source)) @@ -896,6 +900,7 @@ private String encodeUrl(final String bucketNameOrigin, { throw new UnsupportedEncodingException("URL could not be encoded: " + e.getMessage()); } + return encodedUrl; }