mirror of
https://github.com/nextcloud/android.git
synced 2024-11-23 13:45:35 +03:00
codacy: A class which only has private constructors should be final
codacy: Avoid throwing raw exception types. Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
575be806e6
commit
fc156a72bc
4 changed files with 40 additions and 11 deletions
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Nextcloud Android client application
|
||||
*
|
||||
* @author Andy Scherzinger
|
||||
* Copyright (C) 2019 Andy Scherzinger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.owncloud.android.operations;
|
||||
|
||||
class UploadException extends Exception {
|
||||
UploadException() {
|
||||
super();
|
||||
}
|
||||
|
||||
UploadException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
|
@ -464,9 +464,9 @@ public class UploadFileOperation extends SyncOperation {
|
|||
mUpload.setFolderUnlockToken(token);
|
||||
uploadsStorageManager.updateUpload(mUpload);
|
||||
} else if (lockFileOperationResult.getHttpCode() == HttpStatus.SC_FORBIDDEN) {
|
||||
throw new Exception("Forbidden! Please try again later.)");
|
||||
throw new UploadException("Forbidden! Please try again later.)");
|
||||
} else {
|
||||
throw new Exception("Unknown error!");
|
||||
throw new UploadException("Unknown error!");
|
||||
}
|
||||
|
||||
// Update metadata
|
||||
|
@ -498,10 +498,10 @@ public class UploadFileOperation extends SyncOperation {
|
|||
metadata.getMetadata().getMetadataKeys().put(0, encryptedMetadataKey);
|
||||
} else {
|
||||
// TODO error
|
||||
throw new Exception("something wrong");
|
||||
throw new UploadException("something wrong");
|
||||
}
|
||||
|
||||
/***** E2E *****/
|
||||
/**** E2E *****/
|
||||
|
||||
// check name collision
|
||||
checkNameCollision(client, metadata, parentFile.isEncrypted());
|
||||
|
@ -646,7 +646,7 @@ public class UploadFileOperation extends SyncOperation {
|
|||
}
|
||||
|
||||
if (!uploadMetadataOperationResult.isSuccess()) {
|
||||
throw new Exception();
|
||||
throw new UploadException();
|
||||
}
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/**
|
||||
/*
|
||||
* Nextcloud Android client application
|
||||
*
|
||||
* Copyright (C) 2018 Edvard Holst
|
||||
|
@ -20,7 +20,7 @@ package com.owncloud.android.ui.activities.data.activities;
|
|||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
public class ActivityRepositories {
|
||||
public final class ActivityRepositories {
|
||||
|
||||
private ActivityRepositories() {
|
||||
// No instance
|
||||
|
@ -29,6 +29,4 @@ public class ActivityRepositories {
|
|||
public static synchronized ActivitiesRepository getRepository(@NonNull ActivitiesServiceApi activitiesServiceApi) {
|
||||
return new RemoteActivitiesRepository(activitiesServiceApi);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/**
|
||||
/*
|
||||
* Nextcloud Android client application
|
||||
*
|
||||
* Copyright (C) 2018 Edvard Holst
|
||||
|
@ -20,7 +20,7 @@ package com.owncloud.android.ui.activities.data.files;
|
|||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
public class FileRepositories {
|
||||
public final class FileRepositories {
|
||||
|
||||
private FileRepositories() {
|
||||
// No instance
|
||||
|
|
Loading…
Reference in a new issue