codacy: remove unused code, fix java warnings

This commit is contained in:
AndyScherzinger 2017-12-20 10:08:44 +01:00
parent 1ae12e2531
commit 096ff43004
No known key found for this signature in database
GPG key ID: 6CADC7E3523C308B

View file

@ -1,4 +1,4 @@
/**
/*
* ownCloud Android client application
*
* Copyright (C) 2015 ownCloud Inc.
@ -54,7 +54,7 @@ public class OAuth2GetAccessToken extends RemoteOperation {
mRedirectUri = redirectUri;
mGrantType = grantType;
mOAuth2AuthorizationResponse = oAuth2AuthorizationResponse;
mOAuth2ParsedAuthorizationResponse = new HashMap<String, String>();
mOAuth2ParsedAuthorizationResponse = new HashMap<>();
mResultTokenMap = null;
}
@ -90,7 +90,7 @@ public class OAuth2GetAccessToken extends RemoteOperation {
postMethod = new PostMethod(client.getWebdavUri().toString());
postMethod.setRequestBody(nameValuePairs);
int status = client.executeMethod(postMethod);
client.executeMethod(postMethod);
String response = postMethod.getResponseBodyAsString();
if (response != null && response.length() > 0) {
@ -122,7 +122,8 @@ public class OAuth2GetAccessToken extends RemoteOperation {
final String code = "code";
final String oauth_token_request = "OAuth2 TOKEN REQUEST with auth code ";
if (result != null && result.isSuccess()) {
if (result != null) {
if (result.isSuccess()) {
Log_OC.i(TAG, oauth_token_request + mOAuth2ParsedAuthorizationResponse.get(code) + " to " + client.getWebdavUri() + ": " + result.getLogMessage());
} else if (result.getException() != null) {
Log_OC.e(TAG, oauth_token_request + mOAuth2ParsedAuthorizationResponse.get(code) + " to " + client.getWebdavUri() + ": " + result.getLogMessage(), result.getException());
@ -132,6 +133,7 @@ public class OAuth2GetAccessToken extends RemoteOperation {
Log_OC.e(TAG, oauth_token_request + mOAuth2ParsedAuthorizationResponse.get(code) + " to " + client.getWebdavUri() + ": " + result.getLogMessage());
}
}
}
return result;
}
@ -141,7 +143,7 @@ public class OAuth2GetAccessToken extends RemoteOperation {
String[] pairs = mOAuth2AuthorizationResponse.split("&");
int i = 0;
String key = "";
String value = "";
String value;
while (pairs.length > i) {
int j = 0;
String[] part = pairs[i].split("=");
@ -162,7 +164,7 @@ public class OAuth2GetAccessToken extends RemoteOperation {
private void parseAccessTokenResult (JSONObject tokenJson) throws JSONException {
mResultTokenMap = new HashMap<String, String>();
mResultTokenMap = new HashMap<>();
if (tokenJson.has(OAuth2Constants.KEY_ACCESS_TOKEN)) {
mResultTokenMap.put(OAuth2Constants.KEY_ACCESS_TOKEN, tokenJson.getString(OAuth2Constants.KEY_ACCESS_TOKEN));