Program: 36816
Project: 36816
Buggy source:
public void returnToken(MFRequester mfRequester,MFResponse mfResponse){
switch (mfRequester.getTypeOfTokenToReturn()) {
case NEW:
    GetSessionTokenResponse newSessionTokenResponse=mfResponse.getResponseObject(GetSessionTokenResponse.class);
  MFSessionToken newSessionToken=createNewSessionToken(newSessionTokenResponse);
MFConfiguration.getStaticMFLogger().v(TAG,"String_Node_Str" + newSessionToken.toString());
mfTokenFarmCallback.receiveNewSessionToken(newSessionToken);
break;
case V2:
ApiResponse apiResponse=mfResponse.getResponseObject(ApiResponse.class);
if (apiResponse.hasError() && apiResponse.getError() == 105 || apiResponse.getError() == 127) {
mfTokenFarmCallback.sessionTokenSpoiled((MFSessionToken)mfResponse.getOriginMFRequester().getToken());
}
 else {
if (apiResponse.needNewKey()) {
MFConfiguration.getStaticMFLogger().v(TAG,"String_Node_Str" + mfRequester.getToken().toString());
((MFSessionToken)mfRequester.getToken()).updateSessionToken();
MFConfiguration.getStaticMFLogger().v(TAG,"String_Node_Str" + mfRequester.getToken().toString());
}
mfTokenFarmCallback.returnSessionToken(((MFSessionToken)mfRequester.getToken()));
}
break;
case UPLOAD:
GetActionTokenResponse uploadActionTokenResponse=mfResponse.getResponseObject(GetActionTokenResponse.class);
if (uploadActionTokenResponse.hasError() && uploadActionTokenResponse.getError() == 105 || uploadActionTokenResponse.getError() == 127) {
mfTokenFarmCallback.sessionTokenSpoiled((MFSessionToken)mfResponse.getOriginMFRequester().getToken());
}
 else {
MFActionToken mfUploadActionToken=createActionToken(MFActionToken.Type.UPLOAD,uploadActionTokenResponse,mfRequester);
MFConfiguration.getStaticMFLogger().v(TAG,"String_Node_Str" + mfUploadActionToken.toString());
mfTokenFarmCallback.receiveNewUploadActionToken(mfUploadActionToken);
}
break;
case IMAGE:
GetActionTokenResponse imageActionTokenResponse=mfResponse.getResponseObject(GetActionTokenResponse.class);
if (imageActionTokenResponse.hasError() && imageActionTokenResponse.getError() == 105 || imageActionTokenResponse.getError() == 127) {
mfTokenFarmCallback.sessionTokenSpoiled((MFSessionToken)mfResponse.getOriginMFRequester().getToken());
}
 else {
MFActionToken mfImageActionToken=createActionToken(MFActionToken.Type.IMAGE,imageActionTokenResponse,mfRequester);
MFConfiguration.getStaticMFLogger().v(TAG,"String_Node_Str" + mfImageActionToken.toString());
mfTokenFarmCallback.receiveNewImageActionToken(mfImageActionToken);
}
break;
case NONE:
MFConfiguration.getStaticMFLogger().v(TAG,"String_Node_Str" + mfRequester.getTypeOfTokenToReturn().toString() + "String_Node_Str");
break;
}
}

Fixed version (ground truth):
public void returnToken(MFRequester mfRequester,MFResponse mfResponse) throws MFHttpException {
  MFConfiguration.getStaticMFLogger().w(TAG,"String_Node_Str" + mfRequester.getTypeOfTokenToReturn().toString() + "String_Node_Str");
  if (mfResponse == null || mfResponse.getResponseObject(ApiResponse.class) == null) {
    return;
  }
switch (mfRequester.getTypeOfTokenToReturn()) {
case NEW:
    GetSessionTokenResponse newSessionTokenResponse=mfResponse.getResponseObject(GetSessionTokenResponse.class);
  MFSessionToken newSessionToken=createNewSessionToken(newSessionTokenResponse);
mfTokenFarmCallback.receiveNewSessionToken(newSessionToken);
break;
case V2:
ApiResponse apiResponse=mfResponse.getResponseObject(ApiResponse.class);
if (apiResponse.hasError() && apiResponse.getError() == 105 || apiResponse.getError() == 127) {
MFConfiguration.getStaticMFLogger().w(TAG,"String_Node_Str" + mfRequester.getUri() + mfRequester.getRequestParameters().toString()+ "String_Node_Str"+ mfRequester.getToken().toString());
mfTokenFarmCallback.sessionTokenSpoiled((MFSessionToken)mfResponse.getOriginMFRequester().getToken());
}
 else {
if (apiResponse.needNewKey()) {
MFConfiguration.getStaticMFLogger().w(TAG,"String_Node_Str" + mfRequester.getUri() + mfRequester.getRequestParameters().toString()+ "String_Node_Str"+ mfRequester.getToken().toString());
((MFSessionToken)mfRequester.getToken()).updateSessionToken();
MFConfiguration.getStaticMFLogger().w(TAG,"String_Node_Str" + mfRequester.getToken().toString() + "String_Node_Str"+ mfRequester.getUri()+ mfRequester.getRequestParameters().toString());
}
mfTokenFarmCallback.returnSessionToken(((MFSessionToken)mfRequester.getToken()));
}
break;
case UPLOAD:
GetActionTokenResponse uploadActionTokenResponse=mfResponse.getResponseObject(GetActionTokenResponse.class);
if (uploadActionTokenResponse.hasError() && uploadActionTokenResponse.getError() == 105 || uploadActionTokenResponse.getError() == 127) {
mfTokenFarmCallback.sessionTokenSpoiled((MFSessionToken)mfResponse.getOriginMFRequester().getToken());
}
 else {
MFActionToken mfUploadActionToken=createActionToken(MFActionToken.Type.UPLOAD,uploadActionTokenResponse,mfRequester);
MFConfiguration.getStaticMFLogger().w(TAG,"String_Node_Str" + mfUploadActionToken.toString());
mfTokenFarmCallback.receiveNewUploadActionToken(mfUploadActionToken);
}
break;
case IMAGE:
GetActionTokenResponse imageActionTokenResponse=mfResponse.getResponseObject(GetActionTokenResponse.class);
if (imageActionTokenResponse.hasError() && imageActionTokenResponse.getError() == 105 || imageActionTokenResponse.getError() == 127) {
mfTokenFarmCallback.sessionTokenSpoiled((MFSessionToken)mfResponse.getOriginMFRequester().getToken());
}
 else {
MFActionToken mfImageActionToken=createActionToken(MFActionToken.Type.IMAGE,imageActionTokenResponse,mfRequester);
MFConfiguration.getStaticMFLogger().w(TAG,"String_Node_Str" + mfImageActionToken.toString());
mfTokenFarmCallback.receiveNewImageActionToken(mfImageActionToken);
}
break;
case NONE:
MFConfiguration.getStaticMFLogger().w(TAG,"String_Node_Str" + mfRequester.getUri() + mfRequester.getRequestParameters().toString());
break;
}
}