Simplify exists check in CloudImpls:write

Switching if (exists(file) && !replace) to  if (!replace && exists(file))
This commit is contained in:
Julian Raufelder 2021-04-07 15:40:57 +02:00
parent 932ea09b62
commit 6df05fd95b
No known key found for this signature in database
GPG Key ID: 17EE71F6634E381D
6 changed files with 6 additions and 6 deletions

View File

@ -195,7 +195,7 @@ class DropboxImpl {
}
public DropboxFile write(DropboxFile file, DataSource data, final ProgressAware<UploadState> progressAware, boolean replace, long size) throws AuthenticationException, DbxException, IOException, CloudNodeAlreadyExistsException {
if (exists(file) && !replace) {
if (!replace && exists(file)) {
throw new CloudNodeAlreadyExistsException("CloudNode already exists and replace is false");
}

View File

@ -140,7 +140,7 @@ class LocalStorageImpl {
}
public LocalFile write(final CloudFile file, DataSource data, final ProgressAware<UploadState> progressAware, boolean replace, final long size) throws IOException, BackendException {
if (exists(file) && !replace) {
if (!replace && exists(file)) {
throw new CloudNodeAlreadyExistsException("CloudNode already exists and replace is false");
}

View File

@ -427,7 +427,7 @@ class LocalStorageAccessFrameworkImpl {
progressAware.onProgress(Progress.started(UploadState.upload(file)));
Optional<Uri> fileUri = existingFileUri(file);
if (fileUri.isPresent() && !replace) {
if (!replace && fileUri.isPresent()) {
throw new CloudNodeAlreadyExistsException("CloudNode already exists and replace is false");
}

View File

@ -242,7 +242,7 @@ class OnedriveImpl {
}
public OnedriveFile write(final OnedriveFile file, DataSource data, final ProgressAware<UploadState> progressAware, boolean replace, final long size) throws BackendException {
if (exists(file) && !replace) {
if (!replace && exists(file)) {
throw new CloudNodeAlreadyExistsException("CloudNode already exists and replace is false");
}

View File

@ -138,7 +138,7 @@ class WebDavImpl {
public WebDavFile write(final WebDavFile uploadFile, DataSource data, final ProgressAware<UploadState> progressAware, boolean replace, final long size) //
throws BackendException, IOException {
if (exists(uploadFile) && !replace) {
if (!replace && exists(uploadFile)) {
throw new CloudNodeAlreadyExistsException("CloudNode already exists and replace is false");
}

View File

@ -255,7 +255,7 @@ class GoogleDriveImpl {
public GoogleDriveFile write(final GoogleDriveFile file, DataSource data, final ProgressAware<UploadState> progressAware, boolean replace, final long size) //
throws IOException, BackendException {
if (exists(file) && !replace) {
if (!replace && exists(file)) {
throw new CloudNodeAlreadyExistsException("CloudNode already exists and replace is false");
}