Program: 42435
Project: 42435
Buggy source:
/** 
 * This convenience helper combines the functionality of  {@link #getAccountsByTypeAndFeatures},   {@link #getAuthToken}, and  {@link #addAccount}. <p>This method gets a list of the accounts matching the specified type and feature set; if there is exactly one, it is used; if there are more than one, the user is prompted to pick one; if there are none, the user is prompted to add one.  Finally, an auth token is acquired for the chosen account. <p>This method may be called from any thread, but the returned  {@link AccountManagerFuture} must not be used on the main thread.<p>This method requires the caller to hold the permission {@link android.Manifest.permission#MANAGE_ACCOUNTS}.
 * @param accountType The account type required(see  {@link getAccountsByType}), must not be null
 * @param authTokenType The desired auth token type(see  {@link #getAuthToken}), must not be null
 * @param features Required features for the account(see  {@link #getAccountsByTypeAndFeatures}), may be null or empty
 * @param activity The {@link Activity} context to use for launching newsub-Activities to prompt to add an account, select an account, and/or enter a password, as necessary; used only to call startActivity(); should not be null
 * @param addAccountOptions Authenticator-specific options to use foradding new accounts; may be null or empty
 * @param getAuthTokenOptions Authenticator-specific options to use forgetting auth tokens; may be null or empty
 * @param callback Callback to invoke when the request completes,null for no callback
 * @param handler {@link Handler} identifying the callback thread,null for the main thread
 * @return An {@link AccountManagerFuture} which resolves to a Bundle withat least the following fields: <ul> <li>  {@link #KEY_ACCOUNT_NAME} - the name of the account<li>  {@link #KEY_ACCOUNT_TYPE} - the type of the account<li>  {@link #KEY_AUTHTOKEN} - the auth token you wanted</ul> <p>If an error occurred,  {@link AccountManagerFuture#getResult()} throws:<ul> <li>  {@link AuthenticatorException} if no authenticator was registered forthis account type or the authenticator failed to respond <li>  {@link OperationCanceledException} if the operation was canceled forany reason, including the user canceling any operation <li>  {@link IOException} if the authenticator experienced an I/O problemupdating settings, usually because of network trouble </ul>
 */
public AccountManagerFuture<Bundle> getAuthTokenByFeatures(final String accountType,final String authTokenType,final String[] features,final Activity activity,final Bundle addAccountOptions,final Bundle getAuthTokenOptions,final AccountManagerCallback<Bundle> callback,final Handler handler){
  if (accountType == null)   throw new IllegalArgumentException("String_Node_Str");
  if (authTokenType == null)   throw new IllegalArgumentException("String_Node_Str");
  final GetAuthTokenByTypeAndFeaturesTask task=new GetAuthTokenByTypeAndFeaturesTask(accountType,authTokenType,features,activity,addAccountOptions,getAuthTokenOptions,callback,handler);
  task.start();
  return task;
}

Fixed version (ground truth):
/** 
 * This convenience helper combines the functionality of  {@link #getAccountsByTypeAndFeatures},   {@link #getAuthToken}, and  {@link #addAccount}. <p>This method gets a list of the accounts matching the specified type and feature set; if there is exactly one, it is used; if there are more than one, the user is prompted to pick one; if there are none, the user is prompted to add one.  Finally, an auth token is acquired for the chosen account. <p>This method may be called from any thread, but the returned  {@link AccountManagerFuture} must not be used on the main thread.<p>This method requires the caller to hold the permission {@link android.Manifest.permission#MANAGE_ACCOUNTS}.
 * @param accountType The account type required(see  {@link #getAccountsByType}), must not be null
 * @param authTokenType The desired auth token type(see  {@link #getAuthToken}), must not be null
 * @param features Required features for the account(see  {@link #getAccountsByTypeAndFeatures}), may be null or empty
 * @param activity The {@link Activity} context to use for launching newsub-Activities to prompt to add an account, select an account, and/or enter a password, as necessary; used only to call startActivity(); should not be null
 * @param addAccountOptions Authenticator-specific options to use foradding new accounts; may be null or empty
 * @param getAuthTokenOptions Authenticator-specific options to use forgetting auth tokens; may be null or empty
 * @param callback Callback to invoke when the request completes,null for no callback
 * @param handler {@link Handler} identifying the callback thread,null for the main thread
 * @return An {@link AccountManagerFuture} which resolves to a Bundle withat least the following fields: <ul> <li>  {@link #KEY_ACCOUNT_NAME} - the name of the account<li>  {@link #KEY_ACCOUNT_TYPE} - the type of the account<li>  {@link #KEY_AUTHTOKEN} - the auth token you wanted</ul> <p>If an error occurred,  {@link AccountManagerFuture#getResult()} throws:<ul> <li>  {@link AuthenticatorException} if no authenticator was registered forthis account type or the authenticator failed to respond <li>  {@link OperationCanceledException} if the operation was canceled forany reason, including the user canceling any operation <li>  {@link IOException} if the authenticator experienced an I/O problemupdating settings, usually because of network trouble </ul>
 */
public AccountManagerFuture<Bundle> getAuthTokenByFeatures(final String accountType,final String authTokenType,final String[] features,final Activity activity,final Bundle addAccountOptions,final Bundle getAuthTokenOptions,final AccountManagerCallback<Bundle> callback,final Handler handler){
  if (accountType == null)   throw new IllegalArgumentException("String_Node_Str");
  if (authTokenType == null)   throw new IllegalArgumentException("String_Node_Str");
  final GetAuthTokenByTypeAndFeaturesTask task=new GetAuthTokenByTypeAndFeaturesTask(accountType,authTokenType,features,activity,addAccountOptions,getAuthTokenOptions,callback,handler);
  task.start();
  return task;
}