Skip to content

Commit

Permalink
FTS processQueue fails if some indexed text file is missed in AWS s3 …
Browse files Browse the repository at this point in the history
  • Loading branch information
subbotin committed Feb 25, 2020
1 parent 2a82265 commit 7b8294c
Showing 1 changed file with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.event.EventListener;
import software.amazon.awssdk.auth.credentials.*;
import software.amazon.awssdk.core.exception.SdkClientException;
import software.amazon.awssdk.core.exception.SdkException;
import software.amazon.awssdk.core.sync.RequestBody;
import software.amazon.awssdk.core.sync.ResponseTransformer;
import software.amazon.awssdk.regions.Region;
Expand Down Expand Up @@ -132,7 +132,7 @@ public void saveFile(FileDescriptor fileDescr, byte[] data) throws FileStorageEx
.uploadId(response.uploadId())
.multipartUpload(completedMultipartUpload).build();
s3Client.completeMultipartUpload(completeMultipartUploadRequest);
} catch (SdkClientException e) {
} catch (SdkException e) {
String message = String.format("Could not save file %s.", getFileName(fileDescr));
throw new FileStorageException(FileStorageException.Type.IO_EXCEPTION, message);
}
Expand All @@ -153,7 +153,7 @@ public void removeFile(FileDescriptor fileDescr) throws FileStorageException {
.key(resolveFileName(fileDescr))
.build();
s3Client.deleteObject(deleteObjectRequest);
} catch (SdkClientException e) {
} catch (SdkException e) {
String message = String.format("Could not delete file %s.", getFileName(fileDescr));
throw new FileStorageException(FileStorageException.Type.IO_EXCEPTION, message);
}
Expand All @@ -169,7 +169,7 @@ public InputStream openStream(FileDescriptor fileDescr) throws FileStorageExcept
.key(resolveFileName(fileDescr))
.build();
is = s3Client.getObject(getObjectRequest, ResponseTransformer.toInputStream());
} catch (SdkClientException e) {
} catch (SdkException e) {
String message = String.format("Could not load file %s.", getFileName(fileDescr));
throw new FileStorageException(FileStorageException.Type.IO_EXCEPTION, message);
}
Expand Down Expand Up @@ -227,10 +227,6 @@ protected String getFileName(FileDescriptor fileDescriptor) {
}
}

protected String getS3StorageClass() {
return "REDUCED_REDUNDANCY";
}

protected String getRegionName() {
return amazonS3Config.getRegionName();
}
Expand Down

0 comments on commit 7b8294c

Please sign in to comment.