Skip to content

Commit

Permalink
Migrate HintException to OCP
Browse files Browse the repository at this point in the history
Signed-off-by: Gary Kim <[email protected]>
  • Loading branch information
gary-kim committed Jun 30, 2021
1 parent 6da9ccc commit b78f3a5
Show file tree
Hide file tree
Showing 60 changed files with 185 additions and 134 deletions.
2 changes: 1 addition & 1 deletion apps/encryption/lib/Command/FixEncryptedVersion.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
namespace OCA\Encryption\Command;

use OC\Files\View;
use OC\HintException;
use OCA\Encryption\Util;
use OCP\Files\IRootFolder;
use OCP\HintException;
use OCP\IConfig;
use OCP\ILogger;
use OCP\IUserManager;
Expand Down
2 changes: 1 addition & 1 deletion apps/federatedfilesharing/lib/AddressHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
*/
namespace OCA\FederatedFileSharing;

use OC\HintException;
use OCP\Federation\ICloudIdManager;
use OCP\HintException;
use OCP\IL10N;
use OCP\IURLGenerator;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@
*/
namespace OCA\FederatedFileSharing\Controller;

use OC\HintException;
use OCA\FederatedFileSharing\AddressHandler;
use OCA\FederatedFileSharing\FederatedShareProvider;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\JSONResponse;
use OCP\Constants;
use OCP\Federation\ICloudIdManager;
use OCP\HintException;
use OCP\Http\Client\IClientService;
use OCP\IL10N;
use OCP\ILogger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public function reShare($id) {
* @return Http\DataResponse
* @throws OCSException
* @throws ShareNotFound
* @throws \OC\HintException
* @throws \OCP\HintException
*/
public function acceptShare($id) {
$token = isset($_POST['token']) ? $_POST['token'] : null;
Expand Down
6 changes: 3 additions & 3 deletions apps/federatedfilesharing/lib/FederatedShareProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ public function update(IShare $share) {
*
* @param IShare $share
* @throws ShareNotFound
* @throws \OC\HintException
* @throws \OCP\HintException
*/
protected function sendPermissionUpdate(IShare $share) {
$remoteId = $this->getRemoteId($share);
Expand Down Expand Up @@ -550,7 +550,7 @@ public function getChildren(IShare $parent) {
*
* @param IShare $share
* @throws ShareNotFound
* @throws \OC\HintException
* @throws \OCP\HintException
*/
public function delete(IShare $share) {
[, $remote] = $this->addressHandler->splitUserRemote($share->getSharedWith());
Expand All @@ -577,7 +577,7 @@ public function delete(IShare $share) {
* @param IShare $share
* @param bool $isOwner the user can either be the owner or the user who re-sahred it
* @throws ShareNotFound
* @throws \OC\HintException
* @throws \OCP\HintException
*/
protected function revokeShare($share, $isOwner) {
if ($this->userManager->userExists($share->getShareOwner()) && $this->userManager->userExists($share->getSharedBy())) {
Expand Down
6 changes: 3 additions & 3 deletions apps/federatedfilesharing/lib/Notifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
use OCP\Federation\ICloudFederationFactory;
use OCP\Federation\ICloudFederationProviderManager;
use OCP\Http\Client\IClientService;
use OCP\OCS\IDiscoveryService;
use OCP\ILogger;
use OCP\OCS\IDiscoveryService;

class Notifications {
public const RESPONSE_FORMAT = 'json'; // default response format for ocs calls
Expand Down Expand Up @@ -97,7 +97,7 @@ public function __construct(
* @param string $sharedByFederatedId
* @param int $shareType (can be a remote user or group share)
* @return bool
* @throws \OC\HintException
* @throws \OCP\HintException
* @throws \OC\ServerNotAvailableException
*/
public function sendRemoteShare($token, $shareWith, $name, $remoteId, $owner, $ownerFederatedId, $sharedBy, $sharedByFederatedId, $shareType) {
Expand Down Expand Up @@ -156,7 +156,7 @@ public function sendRemoteShare($token, $shareWith, $name, $remoteId, $owner, $o
* @param int $permission
* @param string $filename
* @return array|false
* @throws \OC\HintException
* @throws \OCP\HintException
* @throws \OC\ServerNotAvailableException
*/
public function requestReShare($token, $id, $shareId, $remote, $shareWith, $permission, $filename) {
Expand Down
2 changes: 1 addition & 1 deletion apps/federatedfilesharing/lib/Notifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
*/
namespace OCA\FederatedFileSharing;

use OC\HintException;
use OCP\Contacts\IManager;
use OCP\Federation\ICloudId;
use OCP\Federation\ICloudIdManager;
use OCP\HintException;
use OCP\IURLGenerator;
use OCP\L10N\IFactory;
use OCP\Notification\INotification;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

use OC\AppFramework\Http;
use OC\Files\Filesystem;
use OC\HintException;
use OCA\FederatedFileSharing\AddressHandler;
use OCA\FederatedFileSharing\FederatedShareProvider;
use OCA\Files_Sharing\Activity\Providers\RemoteShares;
Expand All @@ -48,14 +47,14 @@
use OCP\Federation\ICloudFederationShare;
use OCP\Federation\ICloudIdManager;
use OCP\Files\NotFoundException;
use OCP\HintException;
use OCP\IConfig;
use OCP\IDBConnection;
use OCP\IGroupManager;
use OCP\ILogger;
use OCP\IURLGenerator;
use OCP\IUserManager;
use OCP\Notification\IManager as INotificationManager;
use OCP\Share;
use OCP\Share\Exceptions\ShareNotFound;
use OCP\Share\IManager;
use OCP\Share\IShare;
Expand Down Expand Up @@ -176,7 +175,7 @@ public function getShareType() {
*
* @throws ProviderCouldNotAddShareException
* @throws \OCP\AppFramework\QueryException
* @throws \OC\HintException
* @throws HintException
* @since 14.0.0
*/
public function shareReceived(ICloudFederationShare $share) {
Expand Down Expand Up @@ -305,7 +304,7 @@ public function shareReceived(ICloudFederationShare $share) {
* @throws ActionNotSupportedException
* @throws AuthenticationFailedException
* @throws BadRequestException
* @throws \OC\HintException
* @throws HintException
* @since 14.0.0
*/
public function notificationReceived($notificationType, $providerId, array $notification) {
Expand Down Expand Up @@ -373,7 +372,7 @@ private function notifyAboutNewShare($shareWith, $shareId, $ownerFederatedId, $s
* @throws ActionNotSupportedException
* @throws AuthenticationFailedException
* @throws BadRequestException
* @throws \OC\HintException
* @throws HintException
*/
private function shareAccepted($id, array $notification) {
if (!$this->isS2SEnabled()) {
Expand Down Expand Up @@ -442,7 +441,7 @@ protected function executeAcceptShare(IShare $share) {
* @throws AuthenticationFailedException
* @throws BadRequestException
* @throws ShareNotFound
* @throws \OC\HintException
* @throws HintException
*
*/
protected function shareDeclined($id, array $notification) {
Expand Down
2 changes: 1 addition & 1 deletion apps/federatedfilesharing/tests/AddressHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public function dataTestSplitUserRemoteError() {
* @param string $id
*/
public function testSplitUserRemoteError($id) {
$this->expectException(\OC\HintException::class);
$this->expectException(\OCP\HintException::class);

$this->addressHandler->splitUserRemote($id);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@
namespace OCA\FederatedFileSharing\Tests\Controller;

use OC\Federation\CloudIdManager;
use OC\HintException;
use OCA\FederatedFileSharing\AddressHandler;
use OCA\FederatedFileSharing\Controller\MountPublicLinkController;
use OCA\FederatedFileSharing\FederatedShareProvider;
use OCP\AppFramework\Http;
use OCP\Contacts\IManager as IContactsManager;
use OCP\Federation\ICloudIdManager;
use OCP\Files\IRootFolder;
use OCP\HintException;
use OCP\Http\Client\IClientService;
use OCP\IL10N;
use OCP\IRequest;
Expand Down
2 changes: 1 addition & 1 deletion apps/federation/lib/Controller/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
*/
namespace OCA\Federation\Controller;

use OC\HintException;
use OCA\Federation\TrustedServers;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\DataResponse;
use OCP\HintException;
use OCP\IL10N;
use OCP\IRequest;

Expand Down
2 changes: 1 addition & 1 deletion apps/federation/lib/DbHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
namespace OCA\Federation;

use OC\Files\Filesystem;
use OC\HintException;
use OCP\HintException;
use OCP\IDBConnection;
use OCP\IL10N;

Expand Down
2 changes: 1 addition & 1 deletion apps/federation/lib/Middleware/AddServerMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
*/
namespace OCA\Federation\Middleware;

use OC\HintException;
use OCA\Federation\Controller\SettingsController;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\JSONResponse;
use OCP\AppFramework\Middleware;
use OCP\HintException;
use OCP\IL10N;
use OCP\ILogger;

Expand Down
2 changes: 1 addition & 1 deletion apps/federation/lib/TrustedServers.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
*/
namespace OCA\Federation;

use OC\HintException;
use OCA\Federation\BackgroundJob\RequestSharedSecret;
use OCP\AppFramework\Http;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\IJobList;
use OCP\HintException;
use OCP\Http\Client\IClientService;
use OCP\IConfig;
use OCP\ILogger;
Expand Down
4 changes: 2 additions & 2 deletions apps/federation/tests/Controller/SettingsControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function testAddServer() {
* @param bool $isOwnCloud
*/
public function testAddServerFail($isTrustedServer, $isOwnCloud) {
$this->expectException(\OC\HintException::class);
$this->expectException(\OCP\HintException::class);

$this->trustedServers
->expects($this->any())
Expand Down Expand Up @@ -136,7 +136,7 @@ public function testCheckServer() {
* @param bool $isOwnCloud
*/
public function testCheckServerFail($isTrustedServer, $isOwnCloud) {
$this->expectException(\OC\HintException::class);
$this->expectException(\OCP\HintException::class);

$this->trustedServers
->expects($this->any())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
*/
namespace OCA\Federation\Tests\Middleware;

use OC\HintException;
use OCA\Federation\Controller\SettingsController;
use OCA\Federation\Middleware\AddServerMiddleware;
use OCP\AppFramework\Http;
use OCP\HintException;
use OCP\IL10N;
use OCP\ILogger;
use Test\TestCase;
Expand Down
2 changes: 1 addition & 1 deletion apps/federation/tests/TrustedServersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ public function dataTestCheckOwnCloudVersion() {
* @dataProvider dataTestCheckOwnCloudVersionTooLow
*/
public function testCheckOwnCloudVersionTooLow($status) {
$this->expectException(\OC\HintException::class);
$this->expectException(\OCP\HintException::class);
$this->expectExceptionMessage('Remote server version is too low. 9.0 is required.');

$this->invokePrivate($this->trustedServers, 'checkOwnCloudVersion', [$status]);
Expand Down
4 changes: 2 additions & 2 deletions apps/files_sharing/lib/Controller/ShareController.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
*/
namespace OCA\Files_Sharing\Controller;

use OC\Security\CSP\ContentSecurityPolicy;
use OC_Files;
use OC_Util;
use OC\Security\CSP\ContentSecurityPolicy;
use OCA\FederatedFileSharing\FederatedShareProvider;
use OCA\Files_Sharing\Activity\Providers\Downloads;
use OCA\Files_Sharing\Event\BeforeTemplateRenderedEvent;
Expand Down Expand Up @@ -242,7 +242,7 @@ protected function authFailed() {
* otherwise token
* @param int $errorCode
* @param string $errorMessage
* @throws \OC\HintException
* @throws \OCP\HintException
* @throws \OC\ServerNotAvailableException
*/
protected function emitAccessShareHook($share, $errorCode = 200, $errorMessage = '') {
Expand Down
6 changes: 3 additions & 3 deletions apps/provisioning_api/lib/Controller/UsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
use libphonenumber\PhoneNumberFormat;
use libphonenumber\PhoneNumberUtil;
use OC\Authentication\Token\RemoteWipe;
use OC\HintException;
use OC\KnownUser\KnownUserService;
use OC\User\Backend;
use OCA\Settings\Mailer\NewUserMailHelper;
Expand All @@ -59,6 +58,8 @@
use OCP\AppFramework\OCS\OCSException;
use OCP\AppFramework\OCS\OCSForbiddenException;
use OCP\AppFramework\OCSController;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\HintException;
use OCP\IConfig;
use OCP\IGroup;
use OCP\IGroupManager;
Expand All @@ -68,9 +69,8 @@
use OCP\IUserManager;
use OCP\IUserSession;
use OCP\L10N\IFactory;
use OCP\Security\ISecureRandom;
use OCP\Security\Events\GenerateSecurePasswordEvent;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Security\ISecureRandom;
use OCP\User\Backend\ISetDisplayNameBackend;
use Psr\Log\LoggerInterface;

Expand Down
2 changes: 1 addition & 1 deletion apps/settings/lib/Controller/ChangePasswordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@
namespace OCA\Settings\Controller;

use OC\Group\Manager as GroupManager;
use OC\HintException;
use OC\User\Session;
use OCP\App\IAppManager;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\JSONResponse;
use OCP\HintException;
use OCP\IGroupManager;
use OCP\IL10N;
use OCP\IRequest;
Expand Down
2 changes: 1 addition & 1 deletion apps/sharebymail/lib/ShareByMailProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
*/
namespace OCA\ShareByMail;

use OC\HintException;
use OC\Share20\Exception\InvalidShare;
use OC\Share20\Share;
use OC\User\NoUserException;
Expand All @@ -52,6 +51,7 @@
use OCP\Files\Folder;
use OCP\Files\IRootFolder;
use OCP\Files\Node;
use OCP\HintException;
use OCP\IDBConnection;
use OCP\IL10N;
use OCP\ILogger;
Expand Down
2 changes: 1 addition & 1 deletion apps/sharebymail/tests/ShareByMailProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ public function testCreateMailShare() {


public function testCreateMailShareFailed() {
$this->expectException(\OC\HintException::class);
$this->expectException(\OCP\HintException::class);

$this->share->expects($this->any())->method('getToken')->willReturn('token');
$this->share->expects($this->once())->method('setToken')->with('token');
Expand Down
2 changes: 1 addition & 1 deletion apps/user_ldap/lib/Access.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
namespace OCA\User_LDAP;

use DomainException;
use OC\HintException;
use OC\Hooks\PublicEmitter;
use OC\ServerNotAvailableException;
use OCA\User_LDAP\Exceptions\ConstraintViolationException;
Expand All @@ -56,6 +55,7 @@
use OCA\User_LDAP\Mapping\UserMapping;
use OCA\User_LDAP\User\Manager;
use OCA\User_LDAP\User\OfflineUser;
use OCP\HintException;
use OCP\IConfig;
use OCP\ILogger;
use OCP\IUserManager;
Expand Down
Loading

0 comments on commit b78f3a5

Please sign in to comment.