From: masensio Date: Wed, 15 Jan 2014 09:52:06 +0000 (+0100) Subject: OC-2465: review code X-Git-Tag: oc-android-1.5.5~73^2~6 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/ea18765828292e6b0937498e867a65a774e79538 OC-2465: review code --- diff --git a/src/com/owncloud/android/authentication/AuthenticatorActivity.java b/src/com/owncloud/android/authentication/AuthenticatorActivity.java index dd918e61..c07b0026 100644 --- a/src/com/owncloud/android/authentication/AuthenticatorActivity.java +++ b/src/com/owncloud/android/authentication/AuthenticatorActivity.java @@ -1181,7 +1181,7 @@ implements OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList } else if (AccountTypeUtils.getAuthTokenTypeSamlSessionCookie(MainApp.getAccountType()).equals(mAuthTokenType)) { - String username= getUserNameForSaml(mHostBaseUrl); + String username= getUserNameForSaml(); if (username == null) return false; @@ -1224,7 +1224,7 @@ implements OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList Uri uri = Uri.parse(mHostBaseUrl); String username = mUsernameInput.getText().toString().trim(); if (isSaml) { - username = getUserNameForSaml(mHostBaseUrl); + username = getUserNameForSaml(); if (username == null) return false; @@ -1653,15 +1653,13 @@ implements OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList * Asynchronous task to get the SAML User name from OCS-API * */ - private class GetUserNameTask extends AsyncTask{ + private class GetUserNameTask extends AsyncTask{ @Override - protected String doInBackground(String... params) { + protected String doInBackground(Void... params) { - String hostUrl = (String)params[0]; - - GetUserNameRemoteOperation getUserOperation = new GetUserNameRemoteOperation(hostUrl, mAuthToken); - WebdavClient client = OwnCloudClientFactory.createOwnCloudClient(Uri.parse(hostUrl), getApplicationContext(), true); + GetUserNameRemoteOperation getUserOperation = new GetUserNameRemoteOperation(mHostBaseUrl, mAuthToken); + WebdavClient client = OwnCloudClientFactory.createOwnCloudClient(Uri.parse(mHostBaseUrl), getApplicationContext(), true); RemoteOperationResult result = getUserOperation.execute(client); return result.getUserName(); @@ -1671,15 +1669,14 @@ implements OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList /** * Get the user name form OCS-API - * @param hostUrl * @return username */ - private String getUserNameForSaml(String hostUrl){ + private String getUserNameForSaml(){ GetUserNameTask getUserTask = new GetUserNameTask(); String username = null; try { - username = getUserTask.execute(mHostBaseUrl).get(); + username = getUserTask.execute().get(); } catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) {