Simplify exists check in CloudImpls:write
Switching if (exists(file) && !replace) to if (!replace && exists(file))
This commit is contained in:
parent
932ea09b62
commit
6df05fd95b
@ -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");
|
||||
}
|
||||
|
||||
|
@ -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");
|
||||
}
|
||||
|
||||
|
@ -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");
|
||||
}
|
||||
|
||||
|
@ -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");
|
||||
}
|
||||
|
||||
|
@ -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");
|
||||
}
|
||||
|
||||
|
@ -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");
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user