Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

made functions void where their return values were never used #14582

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import com.owncloud.android.datamodel.ArbitraryDataProvider;
import com.owncloud.android.datamodel.ArbitraryDataProviderImpl;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.datamodel.UploadsStorageManager;
import com.owncloud.android.db.OCUpload;
import com.owncloud.android.files.services.NameCollisionPolicy;
Expand Down Expand Up @@ -355,16 +354,14 @@ protected void sleep(int second) {
}
}

public OCFile createFolder(String remotePath) {
public void createFolder(String remotePath) {
RemoteOperationResult check = new ExistenceCheckRemoteOperation(remotePath, false).execute(client);

if (!check.isSuccess()) {
assertTrue(new CreateFolderOperation(remotePath, user, targetContext, getStorageManager())
.execute(client)
.isSuccess());
}

return getStorageManager().getFileByDecryptedRemotePath(remotePath.endsWith("/") ? remotePath : remotePath + "/");
}

public void uploadFile(File file, String remotePath) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ public void testFileActionsBottomSheet() {
showDialog(sut);
}

private FileDisplayActivity showDialog(DialogFragment dialog) {
private void showDialog(DialogFragment dialog) {
Intent intent = new Intent(targetContext, FileDisplayActivity.class);

FileDisplayActivity sut = activityRule.getActivity();
Expand All @@ -601,10 +601,10 @@ private FileDisplayActivity showDialog(DialogFragment dialog) {
sut = activityRule.launchActivity(intent);
}

return showDialog(sut, dialog);
showDialog(sut, dialog);
}

private FileDisplayActivity showDialog(FileDisplayActivity sut, DialogFragment dialog) {
private void showDialog(FileDisplayActivity sut, DialogFragment dialog) {
dialog.show(sut.getSupportFragmentManager(), "");

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

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

return sut;
}

private void hideCursors(ViewGroup viewGroup) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,31 +43,26 @@ public ExternalLinksProvider(ContentResolver contentResolver) {
* Stores an external link in database.
*
* @param externalLink object to store
* @return external link id, -1 if the insert process fails.
*/
public long storeExternalLink(ExternalLink externalLink) {
public void storeExternalLink(ExternalLink externalLink) {
Log_OC.v(TAG, "Adding " + externalLink.getName());

ContentValues cv = createContentValuesFromExternalLink(externalLink);

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

if (result != null) {
return Long.parseLong(result.getPathSegments().get(1));
} else {
if (result == null) {
Log_OC.e(TAG, "Failed to insert item " + externalLink.getName() + " into external link db.");
return -1;
}
}

/**
* Delete all external links from the db
* @return numbers of rows deleted
*/
public int deleteAllExternalLinks() {
return mContentResolver.delete(ProviderMeta.ProviderTableMeta.CONTENT_URI_EXTERNAL_LINKS,
null,
null);
public void deleteAllExternalLinks() {
mContentResolver.delete(ProviderMeta.ProviderTableMeta.CONTENT_URI_EXTERNAL_LINKS,
null,
null);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,12 +253,12 @@ public int deleteSyncFoldersForAccount(User user) {
*
* @param id for the synced folder.
*/
private int deleteSyncFolderWithId(long id) {
return mContentResolver.delete(
ProviderMeta.ProviderTableMeta.CONTENT_URI_SYNCED_FOLDERS,
ProviderMeta.ProviderTableMeta._ID + " = ?",
new String[]{String.valueOf(id)}
);
private void deleteSyncFolderWithId(long id) {
mContentResolver.delete(
ProviderMeta.ProviderTableMeta.CONTENT_URI_SYNCED_FOLDERS,
ProviderMeta.ProviderTableMeta._ID + " = ?",
new String[]{String.valueOf(id)}
);
}


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

int returnValue = 0;
Cursor c = getDB().query(
ProviderTableMeta.CONTENT_URI_UPLOADS,
null,
Expand All @@ -281,14 +280,13 @@ private int updateUploadStatus(long id, UploadStatus status, UploadResult result
Log_OC.e(TAG, c.getCount() + " items for id=" + id
+ " available in UploadDb. Expected 1. Failed to update upload db.");
} else {
returnValue = updateUploadInternal(c, status, result, remotePath, localPath);
updateUploadInternal(c, status, result, remotePath, localPath);
}
c.close();
} else {
Log_OC.e(TAG, "Cursor is null");
}

return returnValue;
}

/**
Expand Down Expand Up @@ -733,7 +731,7 @@ private ContentResolver getDB() {
return contentResolver;
}

public long clearFailedButNotDelayedUploads() {
public void clearFailedButNotDelayedUploads() {
User user = currentAccountProvider.getUser();
final long deleted = getDB().delete(
ProviderTableMeta.CONTENT_URI_UPLOADS,
Expand All @@ -753,7 +751,6 @@ public long clearFailedButNotDelayedUploads() {
if (deleted > 0) {
notifyObserversNow();
}
return deleted;
}

public void clearCancelledUploadsForCurrentAccount() {
Expand All @@ -770,7 +767,7 @@ public void clearCancelledUploadsForCurrentAccount() {
}
}

public long clearSuccessfulUploads() {
public void clearSuccessfulUploads() {
User user = currentAccountProvider.getUser();
final long deleted = getDB().delete(
ProviderTableMeta.CONTENT_URI_UPLOADS,
Expand All @@ -782,7 +779,6 @@ public long clearSuccessfulUploads() {
if (deleted > 0) {
notifyObserversNow();
}
return deleted;
}

/**
Expand Down Expand Up @@ -890,9 +886,9 @@ public int failInProgressUploads(UploadResult fail) {
}

@VisibleForTesting
public int removeAllUploads() {
public void removeAllUploads() {
Log_OC.v(TAG, "Delete all uploads!");
return getDB().delete(
getDB().delete(
ProviderTableMeta.CONTENT_URI_UPLOADS,
"",
new String[]{});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -810,12 +810,10 @@ private void startContentSynchronizations(List<SynchronizeFileOperation> filesTo
* Syncs the Share resources for the files contained in the folder refreshed (children, not deeper descendants).
*
* @param client Handler of a session with an OC server.
* @return The result of the remote operation retrieving the Share resources in the folder refreshed by the
* operation.
*/
private RemoteOperationResult refreshSharesForFolder(OwnCloudClient client) {
private void refreshSharesForFolder(OwnCloudClient client) {
GetSharesForFileOperation operation = new GetSharesForFileOperation(mLocalFolder.getRemotePath(), true, true, fileDataStorageManager);
return operation.execute(client);
operation.execute(client);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -438,12 +438,9 @@ public void pushDirname(File directory) {

/**
* Pops a directory name from the drop down list
*
* @return True, unless the stack is empty
*/
public boolean popDirname() {
public void popDirname() {
mDirectories.remove(mDirectories.getItem(0));
return !mDirectories.isEmpty();
}

private void updateUploadButtonActive() {
Expand Down
Loading