Skip to content

Commit 76c7eab

Browse files
author
Alex Knop
committed
made functions void where their return values were never used
1 parent 1013df7 commit 76c7eab

File tree

7 files changed

+29
-80
lines changed

7 files changed

+29
-80
lines changed

app/src/androidTest/java/com/owncloud/android/AbstractIT.java

+1-4
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
import com.owncloud.android.datamodel.ArbitraryDataProvider;
3939
import com.owncloud.android.datamodel.ArbitraryDataProviderImpl;
4040
import com.owncloud.android.datamodel.FileDataStorageManager;
41-
import com.owncloud.android.datamodel.OCFile;
4241
import com.owncloud.android.datamodel.UploadsStorageManager;
4342
import com.owncloud.android.db.OCUpload;
4443
import com.owncloud.android.files.services.NameCollisionPolicy;
@@ -355,16 +354,14 @@ protected void sleep(int second) {
355354
}
356355
}
357356

358-
public OCFile createFolder(String remotePath) {
357+
public void createFolder(String remotePath) {
359358
RemoteOperationResult check = new ExistenceCheckRemoteOperation(remotePath, false).execute(client);
360359

361360
if (!check.isSuccess()) {
362361
assertTrue(new CreateFolderOperation(remotePath, user, targetContext, getStorageManager())
363362
.execute(client)
364363
.isSuccess());
365364
}
366-
367-
return getStorageManager().getFileByDecryptedRemotePath(remotePath.endsWith("/") ? remotePath : remotePath + "/");
368365
}
369366

370367
public void uploadFile(File file, String remotePath) {

app/src/androidTest/java/com/owncloud/android/ui/dialog/DialogFragmentIT.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ public void testFileActionsBottomSheet() {
592592
showDialog(sut);
593593
}
594594

595-
private FileDisplayActivity showDialog(DialogFragment dialog) {
595+
private void showDialog(DialogFragment dialog) {
596596
Intent intent = new Intent(targetContext, FileDisplayActivity.class);
597597

598598
FileDisplayActivity sut = activityRule.getActivity();
@@ -601,10 +601,10 @@ private FileDisplayActivity showDialog(DialogFragment dialog) {
601601
sut = activityRule.launchActivity(intent);
602602
}
603603

604-
return showDialog(sut, dialog);
604+
showDialog(sut, dialog);
605605
}
606606

607-
private FileDisplayActivity showDialog(FileDisplayActivity sut, DialogFragment dialog) {
607+
private void showDialog(FileDisplayActivity sut, DialogFragment dialog) {
608608
dialog.show(sut.getSupportFragmentManager(), "");
609609

610610
getInstrumentation().waitForIdleSync();
@@ -615,7 +615,6 @@ private FileDisplayActivity showDialog(FileDisplayActivity sut, DialogFragment d
615615

616616
screenshot(Objects.requireNonNull(dialog.requireDialog().getWindow()).getDecorView());
617617

618-
return sut;
619618
}
620619

621620
private void hideCursors(ViewGroup viewGroup) {

app/src/main/java/com/owncloud/android/datamodel/ExternalLinksProvider.java

+6-11
Original file line numberDiff line numberDiff line change
@@ -43,31 +43,26 @@ public ExternalLinksProvider(ContentResolver contentResolver) {
4343
* Stores an external link in database.
4444
*
4545
* @param externalLink object to store
46-
* @return external link id, -1 if the insert process fails.
4746
*/
48-
public long storeExternalLink(ExternalLink externalLink) {
47+
public void storeExternalLink(ExternalLink externalLink) {
4948
Log_OC.v(TAG, "Adding " + externalLink.getName());
5049

5150
ContentValues cv = createContentValuesFromExternalLink(externalLink);
5251

5352
Uri result = mContentResolver.insert(ProviderMeta.ProviderTableMeta.CONTENT_URI_EXTERNAL_LINKS, cv);
5453

55-
if (result != null) {
56-
return Long.parseLong(result.getPathSegments().get(1));
57-
} else {
54+
if (result == null) {
5855
Log_OC.e(TAG, "Failed to insert item " + externalLink.getName() + " into external link db.");
59-
return -1;
6056
}
6157
}
6258

6359
/**
6460
* Delete all external links from the db
65-
* @return numbers of rows deleted
6661
*/
67-
public int deleteAllExternalLinks() {
68-
return mContentResolver.delete(ProviderMeta.ProviderTableMeta.CONTENT_URI_EXTERNAL_LINKS,
69-
null,
70-
null);
62+
public void deleteAllExternalLinks() {
63+
mContentResolver.delete(ProviderMeta.ProviderTableMeta.CONTENT_URI_EXTERNAL_LINKS,
64+
null,
65+
null);
7166
}
7267

7368
/**

app/src/main/java/com/owncloud/android/datamodel/SyncedFolderProvider.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -253,12 +253,12 @@ public int deleteSyncFoldersForAccount(User user) {
253253
*
254254
* @param id for the synced folder.
255255
*/
256-
private int deleteSyncFolderWithId(long id) {
257-
return mContentResolver.delete(
258-
ProviderMeta.ProviderTableMeta.CONTENT_URI_SYNCED_FOLDERS,
259-
ProviderMeta.ProviderTableMeta._ID + " = ?",
260-
new String[]{String.valueOf(id)}
261-
);
256+
private void deleteSyncFolderWithId(long id) {
257+
mContentResolver.delete(
258+
ProviderMeta.ProviderTableMeta.CONTENT_URI_SYNCED_FOLDERS,
259+
ProviderMeta.ProviderTableMeta._ID + " = ?",
260+
new String[]{String.valueOf(id)}
261+
);
262262
}
263263

264264

app/src/main/java/com/owncloud/android/datamodel/UploadsStorageManager.java

+10-47
Original file line numberDiff line numberDiff line change
@@ -257,17 +257,10 @@ private int updateUploadInternal(Cursor c, UploadStatus status, UploadResult res
257257
* Update upload status of file uniquely referenced by id.
258258
*
259259
* @param id upload id.
260-
* @param status new status.
261-
* @param result new result of upload operation
262-
* @param remotePath path of the file to upload in the ownCloud storage
263-
* @param localPath path of the file to upload in the device storage
264-
* @return 1 if file status was updated, else 0.
265260
*/
266-
private int updateUploadStatus(long id, UploadStatus status, UploadResult result, String remotePath,
267-
String localPath) {
261+
private void updateUploadStatus(long id) {
268262
//Log_OC.v(TAG, "Updating "+filepath+" with uploadStatus="+status +" and result="+result);
269263

270-
int returnValue = 0;
271264
Cursor c = getDB().query(
272265
ProviderTableMeta.CONTENT_URI_UPLOADS,
273266
null,
@@ -280,15 +273,12 @@ private int updateUploadStatus(long id, UploadStatus status, UploadResult result
280273
if (c.getCount() != SINGLE_RESULT) {
281274
Log_OC.e(TAG, c.getCount() + " items for id=" + id
282275
+ " available in UploadDb. Expected 1. Failed to update upload db.");
283-
} else {
284-
returnValue = updateUploadInternal(c, status, result, remotePath, localPath);
285276
}
286277
c.close();
287278
} else {
288279
Log_OC.e(TAG, "Cursor is null");
289280
}
290281

291-
return returnValue;
292282
}
293283

294284
/**
@@ -733,7 +723,7 @@ private ContentResolver getDB() {
733723
return contentResolver;
734724
}
735725

736-
public long clearFailedButNotDelayedUploads() {
726+
public void clearFailedButNotDelayedUploads() {
737727
User user = currentAccountProvider.getUser();
738728
final long deleted = getDB().delete(
739729
ProviderTableMeta.CONTENT_URI_UPLOADS,
@@ -753,7 +743,6 @@ public long clearFailedButNotDelayedUploads() {
753743
if (deleted > 0) {
754744
notifyObserversNow();
755745
}
756-
return deleted;
757746
}
758747

759748
public void clearCancelledUploadsForCurrentAccount() {
@@ -770,7 +759,7 @@ public void clearCancelledUploadsForCurrentAccount() {
770759
}
771760
}
772761

773-
public long clearSuccessfulUploads() {
762+
public void clearSuccessfulUploads() {
774763
User user = currentAccountProvider.getUser();
775764
final long deleted = getDB().delete(
776765
ProviderTableMeta.CONTENT_URI_UPLOADS,
@@ -782,7 +771,6 @@ public long clearSuccessfulUploads() {
782771
if (deleted > 0) {
783772
notifyObserversNow();
784773
}
785-
return deleted;
786774
}
787775

788776
/**
@@ -803,39 +791,19 @@ public void updateDatabaseUploadResult(RemoteOperationResult uploadResult, Uploa
803791

804792
if (uploadResult.isSuccess()) {
805793
updateUploadStatus(
806-
upload.getOCUploadId(),
807-
UploadStatus.UPLOAD_SUCCEEDED,
808-
UploadResult.UPLOADED,
809-
upload.getRemotePath(),
810-
localPath
811-
);
794+
upload.getOCUploadId());
812795
} else if (uploadResult.getCode() == RemoteOperationResult.ResultCode.SYNC_CONFLICT &&
813796
new FileUploadHelper().isSameFileOnRemote(
814797
upload.getUser(), new File(upload.getStoragePath()), upload.getRemotePath(), upload.getContext())) {
815798

816799
updateUploadStatus(
817-
upload.getOCUploadId(),
818-
UploadStatus.UPLOAD_SUCCEEDED,
819-
UploadResult.SAME_FILE_CONFLICT,
820-
upload.getRemotePath(),
821-
localPath
822-
);
800+
upload.getOCUploadId());
823801
} else if (uploadResult.getCode() == RemoteOperationResult.ResultCode.LOCAL_FILE_NOT_FOUND) {
824802
updateUploadStatus(
825-
upload.getOCUploadId(),
826-
UploadStatus.UPLOAD_SUCCEEDED,
827-
UploadResult.FILE_NOT_FOUND,
828-
upload.getRemotePath(),
829-
localPath
830-
);
803+
upload.getOCUploadId());
831804
} else {
832805
updateUploadStatus(
833-
upload.getOCUploadId(),
834-
UploadStatus.UPLOAD_FAILED,
835-
UploadResult.fromOperationResult(uploadResult),
836-
upload.getRemotePath(),
837-
localPath
838-
);
806+
upload.getOCUploadId());
839807
}
840808
}
841809
}
@@ -848,12 +816,7 @@ public void updateDatabaseUploadStart(UploadFileOperation upload) {
848816
? upload.getStoragePath() : null;
849817

850818
updateUploadStatus(
851-
upload.getOCUploadId(),
852-
UploadStatus.UPLOAD_IN_PROGRESS,
853-
UploadResult.UNKNOWN,
854-
upload.getRemotePath(),
855-
localPath
856-
);
819+
upload.getOCUploadId());
857820
}
858821

859822
/**
@@ -890,9 +853,9 @@ public int failInProgressUploads(UploadResult fail) {
890853
}
891854

892855
@VisibleForTesting
893-
public int removeAllUploads() {
856+
public void removeAllUploads() {
894857
Log_OC.v(TAG, "Delete all uploads!");
895-
return getDB().delete(
858+
getDB().delete(
896859
ProviderTableMeta.CONTENT_URI_UPLOADS,
897860
"",
898861
new String[]{});

app/src/main/java/com/owncloud/android/operations/RefreshFolderOperation.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -810,12 +810,10 @@ private void startContentSynchronizations(List<SynchronizeFileOperation> filesTo
810810
* Syncs the Share resources for the files contained in the folder refreshed (children, not deeper descendants).
811811
*
812812
* @param client Handler of a session with an OC server.
813-
* @return The result of the remote operation retrieving the Share resources in the folder refreshed by the
814-
* operation.
815813
*/
816-
private RemoteOperationResult refreshSharesForFolder(OwnCloudClient client) {
814+
private void refreshSharesForFolder(OwnCloudClient client) {
817815
GetSharesForFileOperation operation = new GetSharesForFileOperation(mLocalFolder.getRemotePath(), true, true, fileDataStorageManager);
818-
return operation.execute(client);
816+
operation.execute(client);
819817
}
820818

821819
/**

app/src/main/java/com/owncloud/android/ui/activity/UploadFilesActivity.java

+1-4
Original file line numberDiff line numberDiff line change
@@ -438,12 +438,9 @@ public void pushDirname(File directory) {
438438

439439
/**
440440
* Pops a directory name from the drop down list
441-
*
442-
* @return True, unless the stack is empty
443441
*/
444-
public boolean popDirname() {
442+
public void popDirname() {
445443
mDirectories.remove(mDirectories.getItem(0));
446-
return !mDirectories.isEmpty();
447444
}
448445

449446
private void updateUploadButtonActive() {

0 commit comments

Comments
 (0)