Skip to content

Commit 036f174

Browse files
author
Alex Knop
committed
made functions void where their return values were never used
Signed-off-by: Alex Knop <[email protected]>
1 parent 886b41b commit 036f174

File tree

7 files changed

+26
-49
lines changed

7 files changed

+26
-49
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

+7-16
Original file line numberDiff line numberDiff line change
@@ -263,11 +263,10 @@ private int updateUploadInternal(Cursor c, UploadStatus status, UploadResult res
263263
* @param localPath path of the file to upload in the device storage
264264
* @return 1 if file status was updated, else 0.
265265
*/
266-
private int updateUploadStatus(long id, UploadStatus status, UploadResult result, String remotePath,
266+
private void updateUploadStatus(long id, UploadStatus status, UploadResult result, String remotePath,
267267
String localPath) {
268268
//Log_OC.v(TAG, "Updating "+filepath+" with uploadStatus="+status +" and result="+result);
269269

270-
int returnValue = 0;
271270
Cursor c = getDB().query(
272271
ProviderTableMeta.CONTENT_URI_UPLOADS,
273272
null,
@@ -281,14 +280,13 @@ private int updateUploadStatus(long id, UploadStatus status, UploadResult result
281280
Log_OC.e(TAG, c.getCount() + " items for id=" + id
282281
+ " available in UploadDb. Expected 1. Failed to update upload db.");
283282
} else {
284-
returnValue = updateUploadInternal(c, status, result, remotePath, localPath);
283+
updateUploadInternal(c, status, result, remotePath, localPath);
285284
}
286285
c.close();
287286
} else {
288287
Log_OC.e(TAG, "Cursor is null");
289288
}
290289

291-
return returnValue;
292290
}
293291

294292
/**
@@ -733,7 +731,7 @@ private ContentResolver getDB() {
733731
return contentResolver;
734732
}
735733

736-
public long clearFailedButNotDelayedUploads() {
734+
public void clearFailedButNotDelayedUploads() {
737735
User user = currentAccountProvider.getUser();
738736
final long deleted = getDB().delete(
739737
ProviderTableMeta.CONTENT_URI_UPLOADS,
@@ -753,7 +751,6 @@ public long clearFailedButNotDelayedUploads() {
753751
if (deleted > 0) {
754752
notifyObserversNow();
755753
}
756-
return deleted;
757754
}
758755

759756
public void clearCancelledUploadsForCurrentAccount() {
@@ -770,7 +767,7 @@ public void clearCancelledUploadsForCurrentAccount() {
770767
}
771768
}
772769

773-
public long clearSuccessfulUploads() {
770+
public void clearSuccessfulUploads() {
774771
User user = currentAccountProvider.getUser();
775772
final long deleted = getDB().delete(
776773
ProviderTableMeta.CONTENT_URI_UPLOADS,
@@ -782,7 +779,6 @@ public long clearSuccessfulUploads() {
782779
if (deleted > 0) {
783780
notifyObserversNow();
784781
}
785-
return deleted;
786782
}
787783

788784
/**
@@ -848,12 +844,7 @@ public void updateDatabaseUploadStart(UploadFileOperation upload) {
848844
? upload.getStoragePath() : null;
849845

850846
updateUploadStatus(
851-
upload.getOCUploadId(),
852-
UploadStatus.UPLOAD_IN_PROGRESS,
853-
UploadResult.UNKNOWN,
854-
upload.getRemotePath(),
855-
localPath
856-
);
847+
upload.getOCUploadId());
857848
}
858849

859850
/**
@@ -890,9 +881,9 @@ public int failInProgressUploads(UploadResult fail) {
890881
}
891882

892883
@VisibleForTesting
893-
public int removeAllUploads() {
884+
public void removeAllUploads() {
894885
Log_OC.v(TAG, "Delete all uploads!");
895-
return getDB().delete(
886+
getDB().delete(
896887
ProviderTableMeta.CONTENT_URI_UPLOADS,
897888
"",
898889
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)