/** * Synchronously executes the remote operation * * Do not call this method from the main thread. * * @param client Client object to reach an ownCloud server during the execution of * the operation. * @return Result of the operation. */ public RemoteOperationResult execute(OwnCloudClient client, boolean useNextcloudUserAgent) { if (client == null) throw new IllegalArgumentException("Trying to execute a remote operation with a NULL " + "OwnCloudClient"); mClient = client; mClient.setUseNextcloudUserAgent(useNextcloudUserAgent); return run(client); }
/** * Run operation for asynchronous or synchronous 'onExecute' method. * * Considers and performs silent refresh of account credentials if possible, and if * {@link RemoteOperation#setSilentRefreshOfAccountCredentials(boolean)} was called with * parameter 'true' before the execution. * * @return Remote operation result */ private RemoteOperationResult<T> runOperation() { RemoteOperationResult<T> result; try { grantOwnCloudClient(); result = run(mClient); } catch (AccountsException | IOException e) { Log_OC.e(TAG, "Error while trying to access to " + mAccount.name, e); result = new RemoteOperationResult<>(e); } return result; }
return new RemoteOperationResult(e); return run(mClient);
result = run(mClient);