mirror of
https://github.com/nextcloud/android.git
synced 2024-11-27 09:39:25 +03:00
codacy: Avoid reassigning parameters such as 'remotePath'
Switch statements should have a default label
This commit is contained in:
parent
58b7f33a48
commit
275ec70658
1 changed files with 5 additions and 3 deletions
|
@ -668,6 +668,7 @@ public class UploadFileOperation extends SyncOperation {
|
||||||
|
|
||||||
switch (mLocalBehaviour) {
|
switch (mLocalBehaviour) {
|
||||||
case FileUploader.LOCAL_BEHAVIOUR_FORGET:
|
case FileUploader.LOCAL_BEHAVIOUR_FORGET:
|
||||||
|
default:
|
||||||
String temporalPath = FileStorageUtils.getTemporalPath(mAccount.name) + mFile.getRemotePath();
|
String temporalPath = FileStorageUtils.getTemporalPath(mAccount.name) + mFile.getRemotePath();
|
||||||
if (mOriginalStoragePath.equals(temporalPath)) {
|
if (mOriginalStoragePath.equals(temporalPath)) {
|
||||||
// delete local file is was pre-copied in temporary folder (see .ui.helpers.UriUploader)
|
// delete local file is was pre-copied in temporary folder (see .ui.helpers.UriUploader)
|
||||||
|
@ -1046,15 +1047,16 @@ public class UploadFileOperation extends SyncOperation {
|
||||||
int pos = remotePath.lastIndexOf('.');
|
int pos = remotePath.lastIndexOf('.');
|
||||||
String suffix = "";
|
String suffix = "";
|
||||||
String extension = "";
|
String extension = "";
|
||||||
|
String remotePathWithoutExtension = "";
|
||||||
if (pos >= 0) {
|
if (pos >= 0) {
|
||||||
extension = remotePath.substring(pos + 1);
|
extension = remotePath.substring(pos + 1);
|
||||||
remotePath = remotePath.substring(0, pos);
|
remotePathWithoutExtension = remotePath.substring(0, pos);
|
||||||
}
|
}
|
||||||
int count = 2;
|
int count = 2;
|
||||||
do {
|
do {
|
||||||
suffix = " (" + count + ")";
|
suffix = " (" + count + ")";
|
||||||
if (pos >= 0) {
|
if (pos >= 0) {
|
||||||
check = existsFile(wc, remotePath + suffix + "." + extension, metadata, encrypted);
|
check = existsFile(wc, remotePathWithoutExtension + suffix + "." + extension, metadata, encrypted);
|
||||||
} else {
|
} else {
|
||||||
check = existsFile(wc, remotePath + suffix, metadata, encrypted);
|
check = existsFile(wc, remotePath + suffix, metadata, encrypted);
|
||||||
}
|
}
|
||||||
|
@ -1062,7 +1064,7 @@ public class UploadFileOperation extends SyncOperation {
|
||||||
} while (check);
|
} while (check);
|
||||||
|
|
||||||
if (pos >= 0) {
|
if (pos >= 0) {
|
||||||
return remotePath + suffix + "." + extension;
|
return remotePathWithoutExtension + suffix + "." + extension;
|
||||||
} else {
|
} else {
|
||||||
return remotePath + suffix;
|
return remotePath + suffix;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue