Handle NoSuchBucketException in S3

This commit is contained in:
Julian Raufelder 2021-04-30 11:49:41 +02:00
parent b6b3cd2d9b
commit 3e36de814d
No known key found for this signature in database
GPG Key ID: 17EE71F6634E381D
4 changed files with 10 additions and 8 deletions

View File

@ -175,7 +175,7 @@ class S3CloudContentRepository extends InterceptingCloudContentRepository<S3Clou
@Override
public String checkAuthenticationAndRetrieveCurrentAccount(S3Cloud cloud) throws BackendException {
return this.cloud.currentAccount();
return this.cloud.checkAuthenticationAndRetrieveCurrentAccount();
}
@Override

View File

@ -118,12 +118,6 @@ class S3Impl {
return S3CloudNodeFactory.folder(parent, name, parent.getKey() + name);
}
public void bucketExists() throws BackendException {
if (!client().doesBucketExist(cloud.s3Bucket())) {
throw new NoSuchBucketException(cloud.s3Bucket());
}
}
public boolean exists(S3Node node) {
String key = node.getKey();
@ -384,9 +378,14 @@ class S3Impl {
}
}
public String currentAccount() {
public String checkAuthenticationAndRetrieveCurrentAccount() throws NoSuchBucketException {
if (!client().doesBucketExist(cloud.s3Bucket())) {
throw new NoSuchBucketException(cloud.s3Bucket());
}
Owner currentAccount = client() //
.getS3AccountOwner();
return currentAccount.getDisplayName();
}

View File

@ -8,6 +8,7 @@ import org.cryptomator.domain.di.PerView
import org.cryptomator.domain.exception.CloudAlreadyExistsException
import org.cryptomator.domain.exception.CloudNodeAlreadyExistsException
import org.cryptomator.domain.exception.NetworkConnectionException
import org.cryptomator.domain.exception.NoSuchBucketException
import org.cryptomator.domain.exception.NoSuchCloudFileException
import org.cryptomator.domain.exception.UnableToDecryptWebdavPasswordException
import org.cryptomator.domain.exception.VaultAlreadyExistException
@ -45,6 +46,7 @@ class ExceptionHandlers @Inject constructor(private val context: Context, defaul
staticHandler(NoLicenseAvailableException::class.java, R.string.dialog_enter_license_no_content)
staticHandler(GeneralUpdateErrorException::class.java, R.string.error_general_update)
staticHandler(SSLHandshakePreAndroid5UpdateCheckException::class.java, R.string.error_general_update)
staticHandler(NoSuchBucketException::class.java, R.string.error_no_such_bucket)
exceptionHandlers.add(MissingCryptorExceptionHandler())
exceptionHandlers.add(CancellationExceptionHandler())
exceptionHandlers.add(NoSuchVaultExceptionHandler())

View File

@ -33,6 +33,7 @@
<string name="error_play_services_not_available">Play Services not installed</string>
<string name="error_biometric_auth_aborted">Biometric authentication aborted</string>
<string name="error_file_not_found_after_opening_using_3party">Local file isn\'t present anymore after switching back to Cryptomator. Possible changes cannot be propagated back to the cloud.</string>
<string name="error_no_such_bucket">No such bucket</string>
<!-- # clouds -->