nus-yam/ex-repair huggingface dataset:
Program: 187869
Project: 187869
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case MENU_DELETE:
    deleteNote();
  finish();
break;
case MENU_DISCARD:
cancelNote();
break;
case MENU_REVERT:
cancelNote();
break;
case MENU_ENCRYPT:
encryptNote();
break;
case MENU_UNENCRYPT:
unencryptNote();
break;
}
return super.onOptionsItemSelected(item);
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case MENU_DELETE:
    deleteNote();
  finish();
break;
case MENU_DISCARD:
cancelNote();
break;
case MENU_REVERT:
cancelNote();
break;
case MENU_ENCRYPT:
encryptNote(true);
break;
case MENU_UNENCRYPT:
unencryptNote();
break;
}
return super.onOptionsItemSelected(item);
}
Program: 187870
Project: 187870
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  Intent i=getIntent();
  if (i != null && savedInstanceState == null) {
    int dialogId=i.getIntExtra(EXTRA_DIALOG_ID,0);
switch (dialogId) {
case DIALOG_ID_SAVE:
      Log.i(TAG,"String_Node_Str");
    saveFile();
  break;
case DIALOG_ID_OPEN:
Log.i(TAG,"String_Node_Str");
openFile();
break;
case DIALOG_ID_NO_FILE_MANAGER_AVAILABLE:
Log.i(TAG,"String_Node_Str");
showDialog(DIALOG_ID_NO_FILE_MANAGER_AVAILABLE);
case DIALOG_ID_ALLOW_EXTERNAL_ACCESS:
Log.i(TAG,"String_Node_Str");
showDialog(DIALOG_ID_ALLOW_EXTERNAL_ACCESS);
break;
case DIALOG_ID_FIRST_TIME_WARNING:
Log.i(TAG,"String_Node_Str");
showDialog(DIALOG_ID_FIRST_TIME_WARNING);
break;
}
}
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  if (debug)   Log.d(TAG,"String_Node_Str");
  Intent i=getIntent();
  if (i != null && savedInstanceState == null) {
    if (debug)     Log.d(TAG,"String_Node_Str");
    int dialogId=i.getIntExtra(EXTRA_DIALOG_ID,0);
switch (dialogId) {
case DIALOG_ID_SAVE:
      Log.i(TAG,"String_Node_Str");
    saveFile();
  break;
case DIALOG_ID_OPEN:
Log.i(TAG,"String_Node_Str");
openFile();
break;
case DIALOG_ID_NO_FILE_MANAGER_AVAILABLE:
Log.i(TAG,"String_Node_Str");
showDialog(DIALOG_ID_NO_FILE_MANAGER_AVAILABLE);
case DIALOG_ID_ALLOW_EXTERNAL_ACCESS:
Log.i(TAG,"String_Node_Str");
showDialog(DIALOG_ID_ALLOW_EXTERNAL_ACCESS);
break;
case DIALOG_ID_FIRST_TIME_WARNING:
Log.i(TAG,"String_Node_Str");
showDialog(DIALOG_ID_FIRST_TIME_WARNING);
break;
}
}
}
Program: 187871
Project: 187871
Buggy source:
@Override protected void onPrepareDialog(int id,Dialog dialog){
  FilenameDialog fd;
  dialog.setOnDismissListener(mDismissListener);
switch (id) {
case DIALOG_ID_SAVE:
    fd=(FilenameDialog)dialog;
  break;
case DIALOG_ID_OPEN:
fd=(FilenameDialog)dialog;
break;
case DIALOG_ID_NO_FILE_MANAGER_AVAILABLE:
Log.i(TAG,"String_Node_Str");
break;
}
}

Fixed version (ground truth):
@Override protected void onPrepareDialog(int id,Dialog dialog){
  super.onPrepareDialog(id,dialog);
  if (debug)   Log.d(TAG,"String_Node_Str");
switch (id) {
case DIALOG_ID_SAVE:
    break;
case DIALOG_ID_OPEN:
  break;
case DIALOG_ID_NO_FILE_MANAGER_AVAILABLE:
break;
}
}
Program: 187872
Project: 187872
Buggy source:
@Override protected Dialog onCreateDialog(int id){
switch (id) {
case DIALOG_ID_SAVE:
    return new FilenameDialog(this);
case DIALOG_ID_OPEN:
  return new FilenameDialog(this);
case DIALOG_ID_NO_FILE_MANAGER_AVAILABLE:
Log.i(TAG,"String_Node_Str");
return new GetFromMarketDialog(this,RD.string.filemanager_not_available,RD.string.filemanager_get_oi_filemanager,RD.string.filemanager_market_uri);
case DIALOG_ID_ALLOW_EXTERNAL_ACCESS:
return new AllowExternalAccessDialog(this);
case DIALOG_ID_FIRST_TIME_WARNING:
return new FirstTimeWarningDialog(this);
}
return null;
}

Fixed version (ground truth):
@Override protected Dialog onCreateDialog(int id){
  if (debug)   Log.d(TAG,"String_Node_Str");
  Dialog dialog=null;
switch (id) {
case DIALOG_ID_SAVE:
    dialog=new FilenameDialog(this);
  break;
case DIALOG_ID_OPEN:
dialog=new FilenameDialog(this);
break;
case DIALOG_ID_NO_FILE_MANAGER_AVAILABLE:
Log.i(TAG,"String_Node_Str");
dialog=new GetFromMarketDialog(this,RD.string.filemanager_not_available,RD.string.filemanager_get_oi_filemanager,RD.string.filemanager_market_uri);
break;
case DIALOG_ID_ALLOW_EXTERNAL_ACCESS:
dialog=new AllowExternalAccessDialog(this);
break;
case DIALOG_ID_FIRST_TIME_WARNING:
dialog=new FirstTimeWarningDialog(this);
break;
}
if (dialog == null) {
dialog=super.onCreateDialog(id);
}
if (dialog != null) {
dialog.setOnDismissListener(mDismissListener);
}
return dialog;
}
Program: 187873
Project: 187873
Buggy source:
public void onDismiss(DialogInterface dialoginterface){
  Log.i(TAG,"String_Node_Str");
  if (!mIsPausing) {
    DialogHostingActivity.this.finish();
  }
 else {
  }
}

Fixed version (ground truth):
public void onDismiss(DialogInterface dialoginterface){
  if (debug)   Log.d(TAG,"String_Node_Str" + mIsPausing);
  if (!mIsPausing) {
    if (debug)     Log.d(TAG,"String_Node_Str");
    DialogHostingActivity.this.finish();
  }
 else {
  }
}
Program: 187874
Project: 187874
Buggy source:
@Override protected void onSaveInstanceState(Bundle outState){
  super.onSaveInstanceState(outState);
  mIsPausing=true;
}

Fixed version (ground truth):
@Override protected void onSaveInstanceState(Bundle outState){
  super.onSaveInstanceState(outState);
  if (debug)   Log.d(TAG,"String_Node_Str");
  mIsPausing=true;
  if (debug)   Log.d(TAG,"String_Node_Str" + mIsPausing);
}
Program: 187877
Project: 187877
Buggy source:
public void onServiceConnected(ComponentName className,IBinder boundService){
  service=ServiceDispatch.Stub.asInterface((IBinder)boundService);
  boolean promptforpassword=getIntent().getBooleanExtra(CryptoIntents.EXTRA_PROMPT,true);
  if (debug)   Log.d(TAG,"String_Node_Str" + promptforpassword);
  try {
    if (service.getPassword() == null) {
      if (promptforpassword) {
        if (debug)         Log.d(TAG,"String_Node_Str");
        Intent askPass=new Intent(getApplicationContext(),AskPassword.class);
        final Intent thisIntent=getIntent();
        String inputBody=thisIntent.getStringExtra(CryptoIntents.EXTRA_TEXT);
        askPass.putExtra(CryptoIntents.EXTRA_TEXT,inputBody);
        askPass.putExtra(AskPassword.EXTRA_IS_LOCAL,askPassIsLocal);
        startActivityForResult(askPass,REQUEST_CODE_ASK_PASSWORD);
      }
 else {
        if (debug)         Log.d(TAG,"String_Node_Str");
        setResult(RESULT_CANCELED);
        finish();
      }
    }
 else {
      if (debug)       Log.d(TAG,"String_Node_Str");
      boolean externalAccess=mPreferences.getBoolean(Preferences.PREFERENCE_ALLOW_EXTERNAL_ACCESS,false);
      if (askPassIsLocal || externalAccess) {
        salt=service.getSalt();
        masterKey=service.getPassword();
        actionDispatch();
      }
 else {
        showDialogAllowExternalAccess();
      }
    }
  }
 catch (  RemoteException e) {
    Log.d(TAG,e.toString());
  }
  if (debug)   Log.d(TAG,"String_Node_Str");
}

Fixed version (ground truth):
public void onServiceConnected(ComponentName className,IBinder boundService){
  service=ServiceDispatch.Stub.asInterface((IBinder)boundService);
  boolean promptforpassword=getIntent().getBooleanExtra(CryptoIntents.EXTRA_PROMPT,true);
  if (debug)   Log.d(TAG,"String_Node_Str" + promptforpassword);
  try {
    if (service.getPassword() == null) {
      if (promptforpassword) {
        if (debug)         Log.d(TAG,"String_Node_Str");
        Intent askPass=new Intent(getApplicationContext(),AskPassword.class);
        final Intent thisIntent=getIntent();
        String inputBody=thisIntent.getStringExtra(CryptoIntents.EXTRA_TEXT);
        askPass.putExtra(CryptoIntents.EXTRA_TEXT,inputBody);
        askPass.putExtra(AskPassword.EXTRA_IS_LOCAL,askPassIsLocal);
        startActivityForResult(askPass,REQUEST_CODE_ASK_PASSWORD);
      }
 else {
        if (debug)         Log.d(TAG,"String_Node_Str");
        setResult(RESULT_CANCELED);
        finish();
      }
    }
 else {
      if (debug)       Log.d(TAG,"String_Node_Str");
      boolean externalAccess=mPreferences.getBoolean(Preferences.PREFERENCE_ALLOW_EXTERNAL_ACCESS,false);
      if (askPassIsLocal || externalAccess) {
        salt=service.getSalt();
        masterKey=service.getPassword();
        actionDispatch();
      }
 else {
        if (debug)         Log.d(TAG,"String_Node_Str");
        showDialogAllowExternalAccess();
      }
    }
  }
 catch (  RemoteException e) {
    Log.d(TAG,e.toString());
  }
  if (debug)   Log.d(TAG,"String_Node_Str");
}
Program: 187878
Project: 187878
Buggy source:
protected void onActivityResult(int requestCode,int resultCode,Intent data){
  if (resultCode == RESULT_OK) {
switch (requestCode) {
case REQUEST_CODE_ASK_PASSWORD:
      salt=data.getStringExtra("String_Node_Str");
    masterKey=data.getStringExtra("String_Node_Str");
  String timeout=mPreferences.getString(Preferences.PREFERENCE_LOCK_TIMEOUT,Preferences.PREFERENCE_LOCK_TIMEOUT_DEFAULT_VALUE);
int timeoutMinutes=5;
try {
timeoutMinutes=Integer.valueOf(timeout);
}
 catch (NumberFormatException e) {
Log.d(TAG,"String_Node_Str");
}
try {
service.setTimeoutMinutes(timeoutMinutes);
service.setSalt(salt);
service.setPassword(masterKey);
}
 catch (RemoteException e1) {
e1.printStackTrace();
}
boolean externalAccess=mPreferences.getBoolean(Preferences.PREFERENCE_ALLOW_EXTERNAL_ACCESS,false);
boolean isLocal=isIntentLocal();
if (isLocal || externalAccess) {
actionDispatch();
}
 else {
showDialogAllowExternalAccess();
}
break;
case REQUEST_CODE_ALLOW_EXTERNAL_ACCESS:
actionDispatch();
break;
}
}
 else {
setResult(RESULT_CANCELED);
finish();
}
}

Fixed version (ground truth):
protected void onActivityResult(int requestCode,int resultCode,Intent data){
  if (debug)   Log.d(TAG,"String_Node_Str" + requestCode + "String_Node_Str"+ resultCode);
switch (requestCode) {
case REQUEST_CODE_ASK_PASSWORD:
    if (resultCode == RESULT_OK) {
      salt=data.getStringExtra("String_Node_Str");
      masterKey=data.getStringExtra("String_Node_Str");
      String timeout=mPreferences.getString(Preferences.PREFERENCE_LOCK_TIMEOUT,Preferences.PREFERENCE_LOCK_TIMEOUT_DEFAULT_VALUE);
      int timeoutMinutes=5;
      try {
        timeoutMinutes=Integer.valueOf(timeout);
      }
 catch (      NumberFormatException e) {
        Log.d(TAG,"String_Node_Str");
      }
      try {
        service.setTimeoutMinutes(timeoutMinutes);
        service.setSalt(salt);
        service.setPassword(masterKey);
      }
 catch (      RemoteException e1) {
        e1.printStackTrace();
      }
      boolean externalAccess=mPreferences.getBoolean(Preferences.PREFERENCE_ALLOW_EXTERNAL_ACCESS,false);
      boolean isLocal=isIntentLocal();
      if (isLocal || externalAccess) {
        actionDispatch();
      }
 else {
        if (debug)         Log.d(TAG,"String_Node_Str");
        showDialogAllowExternalAccess();
      }
    }
 else {
      setResult(RESULT_CANCELED);
      finish();
    }
  break;
case REQUEST_CODE_ALLOW_EXTERNAL_ACCESS:
actionDispatch();
break;
}
}
Program: 187879
Project: 187879
Buggy source:
/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  mPreferences=PreferenceManager.getDefaultSharedPreferences(this);
  initService();
}

Fixed version (ground truth):
/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  mServiceIntent=null;
  mPreferences=PreferenceManager.getDefaultSharedPreferences(this);
  initService();
}
Program: 187881
Project: 187881
Buggy source:
protected void onActivityResult(int requestCode,int resultCode,Intent data){
  if (debug)   Log.d(TAG,"String_Node_Str" + requestCode + "String_Node_Str"+ resultCode);
switch (requestCode) {
case REQUEST_CODE_ASK_PASSWORD:
    if (resultCode == RESULT_OK) {
      salt=data.getStringExtra("String_Node_Str");
      masterKey=data.getStringExtra("String_Node_Str");
      String timeout=mPreferences.getString(Preferences.PREFERENCE_LOCK_TIMEOUT,Preferences.PREFERENCE_LOCK_TIMEOUT_DEFAULT_VALUE);
      int timeoutMinutes=5;
      try {
        timeoutMinutes=Integer.valueOf(timeout);
      }
 catch (      NumberFormatException e) {
        Log.d(TAG,"String_Node_Str");
      }
      if (service == null) {
        Log.d(TAG,"String_Node_Str");
        setResult(RESULT_CANCELED);
        finish();
        return;
      }
      try {
        service.setTimeoutMinutes(timeoutMinutes);
        service.setSalt(salt);
        service.setPassword(masterKey);
      }
 catch (      RemoteException e1) {
        e1.printStackTrace();
      }
      boolean externalAccess=mPreferences.getBoolean(Preferences.PREFERENCE_ALLOW_EXTERNAL_ACCESS,false);
      boolean isLocal=isIntentLocal();
      if (isLocal || externalAccess) {
        actionDispatch();
      }
 else {
        if (debug)         Log.d(TAG,"String_Node_Str");
        showDialogAllowExternalAccess();
      }
    }
 else {
      setResult(RESULT_CANCELED);
      finish();
    }
  break;
case REQUEST_CODE_ALLOW_EXTERNAL_ACCESS:
actionDispatch();
break;
}
}

Fixed version (ground truth):
protected void onActivityResult(int requestCode,int resultCode,Intent data){
  if (debug)   Log.d(TAG,"String_Node_Str" + requestCode + "String_Node_Str"+ resultCode);
switch (requestCode) {
case REQUEST_CODE_ASK_PASSWORD:
    if (resultCode == RESULT_OK) {
      if (service == null) {
        mServiceIntent=data;
        return;
      }
      setServiceParametersFromExtrasAndDispatchAction(data);
    }
 else {
      setResult(RESULT_CANCELED);
      finish();
    }
  break;
case REQUEST_CODE_ALLOW_EXTERNAL_ACCESS:
if (service == null) {
  if (debug)   Log.i(TAG,"String_Node_Str");
}
 else if (salt == null) {
  try {
    salt=service.getSalt();
    masterKey=service.getPassword();
    actionDispatch();
  }
 catch (  RemoteException e) {
    Log.d(TAG,e.toString());
    finish();
  }
}
 else {
  if (debug)   Log.i(TAG,"String_Node_Str");
  actionDispatch();
}
break;
}
}
Program: 187884
Project: 187884
Buggy source:
public void setPreferencesUsed(){
  PREFERENCE_FILENAME=PreferenceActivity.PREFS_SHOPPINGLIST_FILENAME;
  DEFAULT_FILENAME=getString(R.string.default_shoppinglist_path);
  PREFERENCE_FORMAT=PreferenceActivity.PREFS_SHOPPINGLIST_FILENAME;
  DEFAULT_FORMAT="String_Node_Str";
  RES_STRING_FILEMANAGER_TITLE=R.string.filemanager_title_shoppinglist;
  RES_ARRAY_CSV_FILE_FORMAT=R.array.shoppinglist_format;
  RES_ARRAY_CSV_FILE_FORMAT_VALUE=R.array.shoppinglist_format_value;
}

Fixed version (ground truth):
public void setPreferencesUsed(){
  PREFERENCE_FILENAME=PreferenceActivity.PREFS_SHOPPINGLIST_FILENAME;
  DEFAULT_FILENAME=getString(R.string.default_shoppinglist_path);
  PREFERENCE_FORMAT=PreferenceActivity.PREFS_SHOPPINGLIST_FORMAT;
  DEFAULT_FORMAT="String_Node_Str";
  RES_STRING_FILEMANAGER_TITLE=R.string.filemanager_title_shoppinglist;
  RES_ARRAY_CSV_FILE_FORMAT=R.array.shoppinglist_format;
  RES_ARRAY_CSV_FILE_FORMAT_VALUE=R.array.shoppinglist_format_value;
}
Program: 187885
Project: 187885
Buggy source:
/** 
 * @param reader
 * @throws IOException
 */
public void doImport(FileReader reader) throws IOException {
  ImportCsv ic=new ImportCsv(this);
  ic.importCsv(reader);
}

Fixed version (ground truth):
/** 
 * @param reader
 * @throws IOException
 */
public void doImport(FileReader reader) throws IOException, WrongFormatException {
  ImportCsv ic=new ImportCsv(this);
  ic.importCsv(reader);
}
Program: 187886
Project: 187886
Buggy source:
/** 
 * @param dis
 * @throws IOException
 */
public void importCsv(Reader reader) throws IOException {
  CSVReader csvreader=new CSVReader(reader);
  String[] nextLine;
  while ((nextLine=csvreader.readNext()) != null) {
    if (nextLine[1].equals(mContext.getString(R.string.header_percent_complete))) {
      continue;
    }
    String itemname=nextLine[0];
    long status=(nextLine[1].equals("String_Node_Str")) ? 1 : 0;
    String listname=nextLine[2];
    long listId=ShoppingUtils.getOrCreateListId(mContext,listname);
    long itemId=ShoppingUtils.getItemId(mContext,itemname);
    if (status == 1) {
      status=Shopping.Status.BOUGHT;
    }
 else {
      status=Shopping.Status.WANT_TO_BUY;
    }
    ShoppingUtils.addItemToList(mContext,itemId,listId,status);
  }
}

Fixed version (ground truth):
/** 
 * @param dis
 * @throws IOException
 */
public void importCsv(Reader reader) throws IOException, WrongFormatException {
  CSVReader csvreader=new CSVReader(reader);
  String[] nextLine;
  while ((nextLine=csvreader.readNext()) != null) {
    if (nextLine.length != 3) {
      throw new WrongFormatException();
    }
    String statusstring=nextLine[1];
    if (statusstring.equals(mContext.getString(R.string.header_percent_complete))) {
      continue;
    }
    String itemname=nextLine[0];
    long status=(statusstring.equals("String_Node_Str")) ? 1 : 0;
    String listname=nextLine[2];
    long listId=ShoppingUtils.getOrCreateListId(mContext,listname);
    long itemId=ShoppingUtils.getItemId(mContext,itemname);
    if (status == 1) {
      status=Shopping.Status.BOUGHT;
    }
 else {
      status=Shopping.Status.WANT_TO_BUY;
    }
    ShoppingUtils.addItemToList(mContext,itemId,listId,status);
  }
}
Program: 187888
Project: 187888
Buggy source:
private void saveState(){
  PassEntry entry=new PassEntry();
  String passwordPlain=passwordText.getText().toString();
  String notePlain=noteText.getText().toString();
  String usernamePlain=usernameText.getText().toString();
  String websitePlain=websiteText.getText().toString();
  String descPlain=descriptionText.getText().toString();
  try {
    entry.category=PassList.getCategoryId();
    entry.description=ch.encrypt(descPlain);
    entry.username=ch.encrypt(usernamePlain);
    entry.password=ch.encrypt(passwordPlain);
    entry.note=ch.encrypt(notePlain);
    entry.website=ch.encrypt(websitePlain);
  }
 catch (  CryptoHelperException e) {
    Log.e(TAG,e.toString());
  }
  if (RowId == null || RowId == -1) {
    dbHelper.addPassword(entry);
  }
 else {
    PassEntry storedEntry=dbHelper.fetchPassword(RowId);
    entry.uniqueName=storedEntry.uniqueName;
    dbHelper.updatePassword(RowId,entry);
  }
}

Fixed version (ground truth):
private void saveState(){
  PassEntry entry=new PassEntry();
  String passwordPlain=passwordText.getText().toString();
  String notePlain=noteText.getText().toString();
  String usernamePlain=usernameText.getText().toString();
  String websitePlain=websiteText.getText().toString();
  String descPlain=descriptionText.getText().toString();
  try {
    entry.category=PassList.getCategoryId();
    entry.description=ch.encrypt(descPlain);
    entry.username=ch.encrypt(usernamePlain);
    entry.password=ch.encrypt(passwordPlain);
    entry.note=ch.encrypt(notePlain);
    entry.website=ch.encrypt(websitePlain);
  }
 catch (  CryptoHelperException e) {
    Log.e(TAG,e.toString());
  }
  if (RowId == null || RowId == -1) {
    RowId=dbHelper.addPassword(entry);
  }
 else {
    PassEntry storedEntry=dbHelper.fetchPassword(RowId);
    entry.uniqueName=storedEntry.uniqueName;
    dbHelper.updatePassword(RowId,entry);
  }
}
Program: 187889
Project: 187889
Buggy source:
protected void actionDispatch(){
  final Intent thisIntent=getIntent();
  final String action=thisIntent.getAction();
  Intent callbackIntent=getIntent();
  int callbackResult=RESULT_CANCELED;
  PassList.setMasterKey(masterKey);
  CategoryList.setMasterKey(masterKey);
  if (ch == null) {
    ch=new CryptoHelper(CryptoHelper.EncryptionMedium);
    ch.setPassword(masterKey);
  }
  boolean externalAccess=mPreferences.getBoolean("String_Node_Str",false);
  if (action == null || action.equals(Intent.ACTION_MAIN)) {
    Intent i=new Intent(getApplicationContext(),CategoryList.class);
    startActivity(i);
  }
 else   if (externalAccess) {
    if (action.equals(CryptoIntents.ACTION_ENCRYPT)) {
      callbackResult=encryptIntent(thisIntent,callbackIntent);
    }
 else     if (action.equals(CryptoIntents.ACTION_DECRYPT)) {
      callbackResult=decryptIntent(thisIntent,callbackIntent);
    }
 else     if (action.equals(CryptoIntents.ACTION_GET_PASSWORD) || action.equals(CryptoIntents.ACTION_SET_PASSWORD)) {
      try {
        callbackIntent=getSetPassword(thisIntent,callbackIntent);
        callbackResult=RESULT_OK;
      }
 catch (      CryptoHelperException e) {
        Log.e(TAG,e.toString());
        Toast.makeText(FrontDoor.this,"String_Node_Str" + e.getMessage(),Toast.LENGTH_SHORT).show();
      }
catch (      Exception e) {
        Log.e(TAG,e.toString());
        Toast.makeText(FrontDoor.this,"String_Node_Str" + e.getMessage(),Toast.LENGTH_SHORT).show();
      }
    }
    setResult(callbackResult,callbackIntent);
  }
  finish();
}

Fixed version (ground truth):
protected void actionDispatch(){
  final Intent thisIntent=getIntent();
  final String action=thisIntent.getAction();
  Intent callbackIntent=getIntent();
  int callbackResult=RESULT_CANCELED;
  PassList.setMasterKey(masterKey);
  CategoryList.setMasterKey(masterKey);
  if (ch == null) {
    ch=new CryptoHelper(CryptoHelper.EncryptionMedium);
    ch.setPassword(masterKey);
  }
  boolean externalAccess=mPreferences.getBoolean("String_Node_Str",false);
  if (action == null || action.equals(Intent.ACTION_MAIN)) {
    Intent i=new Intent(getApplicationContext(),CategoryList.class);
    startActivity(i);
  }
 else   if (externalAccess) {
    if (action.equals(CryptoIntents.ACTION_ENCRYPT)) {
      callbackResult=encryptIntent(thisIntent,callbackIntent);
    }
 else     if (action.equals(CryptoIntents.ACTION_DECRYPT)) {
      callbackResult=decryptIntent(thisIntent,callbackIntent);
    }
 else     if (action.equals(CryptoIntents.ACTION_GET_PASSWORD) || action.equals(CryptoIntents.ACTION_SET_PASSWORD)) {
      try {
        callbackIntent=getSetPassword(thisIntent,callbackIntent);
        callbackResult=RESULT_OK;
      }
 catch (      CryptoHelperException e) {
        Log.e(TAG,e.toString(),e);
        Toast.makeText(FrontDoor.this,"String_Node_Str" + e.getMessage(),Toast.LENGTH_SHORT).show();
      }
catch (      Exception e) {
        Log.e(TAG,e.toString(),e);
        Toast.makeText(FrontDoor.this,"String_Node_Str" + e.getMessage(),Toast.LENGTH_SHORT).show();
      }
    }
    setResult(callbackResult,callbackIntent);
  }
  finish();
}
Program: 187891
Project: 187891
Buggy source:
private void browseTo(final File aDirectory){
  Log.i(TAG,"String_Node_Str" + aDirectory.getAbsoluteFile());
  if (aDirectory.isDirectory()) {
    if (aDirectory.equals(currentDirectory)) {
      showDirectoryInput(true);
    }
 else {
      File previousDirectory=currentDirectory;
      currentDirectory=aDirectory;
      refreshList();
      selectInList(previousDirectory);
      refreshDirectoryPanel();
    }
  }
 else {
    if (mState == STATE_BROWSE) {
      openFile(aDirectory);
    }
 else     if (mState == STATE_PICK) {
      mEditFilename.setText(aDirectory.getName());
    }
  }
}

Fixed version (ground truth):
private void browseTo(final File aDirectory){
  if (aDirectory.isDirectory()) {
    if (aDirectory.equals(currentDirectory)) {
      showDirectoryInput(true);
    }
 else {
      File previousDirectory=currentDirectory;
      currentDirectory=aDirectory;
      refreshList();
      selectInList(previousDirectory);
      refreshDirectoryPanel();
    }
  }
 else {
    if (mState == STATE_BROWSE) {
      openFile(aDirectory);
    }
 else     if (mState == STATE_PICK) {
      mEditFilename.setText(aDirectory.getName());
    }
  }
}
Program: 187893
Project: 187893
Buggy source:
/** 
 * Returns the path only (without file name).
 * @param file
 * @return
 */
public static File getPathWithoutFilename(File file){
  if (file != null) {
    String filename=file.getName();
    String filepath=file.getAbsolutePath();
    String pathwithoutname=filepath.substring(0,filepath.length() - filename.length());
    if (pathwithoutname.endsWith("String_Node_Str")) {
      pathwithoutname=pathwithoutname.substring(0,pathwithoutname.length() - 1);
    }
    return new File(pathwithoutname);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns the path only (without file name).
 * @param file
 * @return
 */
public static File getPathWithoutFilename(File file){
  if (file != null) {
    if (file.isDirectory()) {
      return file;
    }
 else {
      String filename=file.getName();
      String filepath=file.getAbsolutePath();
      String pathwithoutname=filepath.substring(0,filepath.length() - filename.length());
      if (pathwithoutname.endsWith("String_Node_Str")) {
        pathwithoutname=pathwithoutname.substring(0,pathwithoutname.length() - 1);
      }
      return new File(pathwithoutname);
    }
  }
  return null;
}
Program: 187894
Project: 187894
Buggy source:
/** 
 * Opens the file manager.
 */
private void openFileManager(){
  String fileName=mEditText.getText().toString();
  Intent intent=new Intent(FileManagerIntents.ACTION_PICK_FILE);
  intent.setData(Uri.parse("String_Node_Str" + fileName));
  intent.putExtra(FileManagerIntents.EXTRA_TITLE,getString(R.string.open_title));
  intent.putExtra(FileManagerIntents.EXTRA_BUTTON_TEXT,getString(R.string.open_button));
  try {
    startActivityForResult(intent,REQUEST_CODE_PICK_FILE);
  }
 catch (  ActivityNotFoundException e) {
    Toast.makeText(this,R.string.no_filemanager_installed,Toast.LENGTH_SHORT).show();
  }
}

Fixed version (ground truth):
/** 
 * Opens the file manager.
 */
private void openFileManager(){
  String fileName=mEditText.getText().toString();
  Intent intent=new Intent(FileManagerIntents.ACTION_PICK_FILE);
  intent.setData(Uri.parse("String_Node_Str" + fileName));
  intent.putExtra(FileManagerIntents.EXTRA_TITLE,getString(R.string.open_title));
  intent.putExtra(FileManagerIntents.EXTRA_BUTTON_TEXT,getString(R.string.open_button));
  intent.putExtra(FileManagerIntents.EXTRA_TITLE,"String_Node_Str");
  intent.putExtra(FileManagerIntents.EXTRA_BUTTON_TEXT,"String_Node_Str");
  try {
    startActivityForResult(intent,REQUEST_CODE_PICK_FILE);
  }
 catch (  ActivityNotFoundException e) {
    Toast.makeText(this,R.string.no_filemanager_installed,Toast.LENGTH_SHORT).show();
  }
}
Program: 187895
Project: 187895
Buggy source:
@Override public boolean onCreateOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  menu.add(0,MENU_ITEM_INSERT,0,R.string.menu_insert).setShortcut('3','a').setIcon(android.R.drawable.ic_menu_add);
  UpdateMenu.addUpdateMenu(this,menu,0,MENU_UPDATE,0,R.string.update);
  menu.add(0,MENU_ABOUT,0,R.string.about).setIcon(android.R.drawable.ic_menu_info_details).setShortcut('0','a');
  Intent intent=new Intent(null,getIntent().getData());
  intent.addCategory(Intent.CATEGORY_ALTERNATIVE);
  MenuIntentOptionsWithIcons menu2=new MenuIntentOptionsWithIcons(this,menu);
  menu2.addIntentOptions(Menu.CATEGORY_ALTERNATIVE,0,0,new ComponentName(this,NotesList.class),null,intent,0,null);
  return true;
}

Fixed version (ground truth):
@Override public boolean onCreateOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  menu.add(0,MENU_ITEM_INSERT,0,R.string.menu_insert).setShortcut('3','a').setIcon(android.R.drawable.ic_menu_add);
  UpdateMenu.addUpdateMenu(this,menu,0,MENU_UPDATE,0,R.string.update);
  menu.add(0,MENU_ABOUT,0,R.string.about).setIcon(android.R.drawable.ic_menu_info_details).setShortcut('0','a');
  Intent intent=new Intent(null,getIntent().getData());
  Log.i(TAG,"String_Node_Str" + intent.getDataString());
  intent.addCategory(Intent.CATEGORY_ALTERNATIVE);
  MenuIntentOptionsWithIcons menu2=new MenuIntentOptionsWithIcons(this,menu);
  menu2.addIntentOptions(CATEGORY_ALTERNATIVE_GLOBAL,0,0,new ComponentName(this,NotesList.class),null,intent,0,null);
  return true;
}
Program: 187896
Project: 187896
Buggy source:
@Override protected void onPause(){
  super.onPause();
  if (mCursor != null) {
    ContentValues values=new ContentValues();
    long now=System.currentTimeMillis();
    values.put(Durations.MODIFIED_DATE,now);
    String text=mText.getText().toString();
    values.put(Durations.TITLE,text);
    mDuration=mDurationPicker.getDuration();
    values.put(Durations.DURATION,mDuration);
    values.put(Durations.DEADLINE_DATE,mDeadline);
    values.put(Durations.RING,mRing);
    Log.i(TAG,"String_Node_Str" + mRing);
    String uristring=null;
    if (mRingtoneUri != null) {
      uristring=mRingtoneUri.toString();
    }
    values.put(Durations.RINGTONE,uristring);
    Log.i(TAG,"String_Node_Str" + uristring);
    values.put(Durations.VIBRATE,mVibrate);
    Log.i(TAG,"String_Node_Str" + mVibrate);
    getContentResolver().update(mUri,values,null,null);
  }
}

Fixed version (ground truth):
@Override protected void onPause(){
  super.onPause();
  if (mCursor != null) {
    ContentValues values=new ContentValues();
    long now=System.currentTimeMillis();
    values.put(Durations.MODIFIED_DATE,now);
    String text=mText.getText().toString();
    values.put(Durations.TITLE,text);
    mDuration=mDurationPicker.getDuration();
    values.put(Durations.DURATION,mDuration);
    values.put(Durations.DEADLINE_DATE,mDeadline);
    values.put(Durations.RING,mRing);
    Log.i(TAG,"String_Node_Str" + mRing);
    String uristring=null;
    if (mRingtoneUri != null) {
      uristring=mRingtoneUri.toString();
    }
    values.put(Durations.RINGTONE,uristring);
    Log.i(TAG,"String_Node_Str" + uristring);
    values.put(Durations.VIBRATE,mVibrate);
    Log.i(TAG,"String_Node_Str" + mVibrate);
    getContentResolver().update(mUri,values,null,null);
  }
  mHandler.removeMessages(MSG_UPDATE_DISPLAY);
}
Program: 187897
Project: 187897
Buggy source:
@Override public void onCheckedChanged(CompoundButton view,boolean checked){
  if (checked) {
    mVibrate=CHECKED;
  }
 else {
    mVibrate=UNCHECKED;
  }
}

Fixed version (ground truth):
@Override public void onCheckedChanged(CompoundButton view,boolean checked){
  setVibrate(checked);
}
Program: 187898
Project: 187898
Buggy source:
private final void cont(){
  mCountdownState=STATE_COUNTDOWN_RUNNING;
  mStartCountdown=true;
  long now=System.currentTimeMillis();
  mDuration=mDurationPicker.getDuration();
  mDeadline=now + mDuration;
  mDuration=mOriginalDuration;
  mDurationPicker.setDuration(mDuration);
  cancelAlarm();
  mHandler.removeMessages(MSG_UPDATE_DISPLAY);
  setAlarm(mDeadline);
  updateViews();
}

Fixed version (ground truth):
private final void cont(){
  mCountdownState=STATE_COUNTDOWN_RUNNING;
  long now=System.currentTimeMillis();
  mDuration=mDurationPicker.getDuration();
  mDeadline=now + mDuration;
  mDuration=mOriginalDuration;
  mDurationPicker.setDuration(mDuration);
  cancelAlarm();
  mHandler.removeMessages(MSG_UPDATE_DISPLAY);
  setAlarm(mDeadline);
  updateViews();
}
Program: 187899
Project: 187899
Buggy source:
/** 
 */
private void updateCountdown(){
  long now=System.currentTimeMillis();
  long delta=mDeadline - now;
  if (mCountdownState == STATE_COUNTDOWN_MODIFY) {
    mDurationPicker.setVisibility(View.VISIBLE);
    mCountdownView.setVisibility(View.INVISIBLE);
  }
 else   if (delta > 0) {
    mCountdownState=STATE_COUNTDOWN_RUNNING;
    mDurationPicker.setVisibility(View.INVISIBLE);
    mCountdownView.setVisibility(View.VISIBLE);
    mCountdownView.setText("String_Node_Str" + CountdownUtils.getDurationString(delta));
    mCountdownView.setTextAppearance(this,android.R.style.TextAppearance_Large);
    mCountdownView.setTextSize(64);
    mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_UPDATE_DISPLAY),1000);
  }
 else   if (delta > -3000) {
    mCountdownState=STATE_COUNTDOWN_RUNNING;
    mDurationPicker.setVisibility(View.INVISIBLE);
    mCountdownView.setVisibility(View.VISIBLE);
    mCountdownView.setText("String_Node_Str" + CountdownUtils.getDurationString(0));
    mCountdownView.setTextColor(0xffff0000);
    mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_UPDATE_DISPLAY),1000);
  }
 else {
    mCountdownState=STATE_COUNTDOWN_IDLE;
    mDurationPicker.setVisibility(View.VISIBLE);
    mCountdownView.setVisibility(View.INVISIBLE);
  }
}

Fixed version (ground truth):
/** 
 */
private void updateCountdown(){
  long now=System.currentTimeMillis();
  long delta=mDeadline - now;
  if (mCountdownState == STATE_COUNTDOWN_MODIFY) {
    mDurationPicker.setVisibility(View.VISIBLE);
    mCountdownView.setVisibility(View.INVISIBLE);
  }
 else   if (delta > 0) {
    mCountdownState=STATE_COUNTDOWN_RUNNING;
    mDurationPicker.setVisibility(View.INVISIBLE);
    mCountdownView.setVisibility(View.VISIBLE);
    mCountdownView.setText("String_Node_Str" + CountdownUtils.getDurationString(delta));
    mCountdownView.setTextAppearance(this,android.R.style.TextAppearance_Large);
    mCountdownView.setTextSize(64);
    mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_UPDATE_DISPLAY),1000);
    if (delta < 2000) {
      ContentValues values=new ContentValues();
      values.put(Durations.TITLE,mText.getText().toString());
      getContentResolver().update(mUri,values,null,null);
      mCursor.requery();
    }
  }
 else   if (delta > -3000) {
    mCountdownState=STATE_COUNTDOWN_RUNNING;
    mDurationPicker.setVisibility(View.INVISIBLE);
    mCountdownView.setVisibility(View.VISIBLE);
    mCountdownView.setText("String_Node_Str" + CountdownUtils.getDurationString(0));
    mCountdownView.setTextColor(0xffff0000);
    mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_UPDATE_DISPLAY),1000);
  }
 else {
    mCountdownState=STATE_COUNTDOWN_IDLE;
    mDurationPicker.setVisibility(View.VISIBLE);
    mCountdownView.setVisibility(View.INVISIBLE);
  }
}
Program: 187901
Project: 187901
Buggy source:
private final void start(){
  mCountdownState=STATE_COUNTDOWN_RUNNING;
  mStartCountdown=true;
  long now=System.currentTimeMillis();
  mDuration=mDurationPicker.getDuration();
  mDeadline=now + mDuration;
  setAlarm(mDeadline);
  updateViews();
}

Fixed version (ground truth):
private final void start(){
  mCountdownState=STATE_COUNTDOWN_RUNNING;
  long now=System.currentTimeMillis();
  mDuration=mDurationPicker.getDuration();
  mDeadline=now + mDuration;
  setAlarm(mDeadline);
  updateViews();
}
Program: 187902
Project: 187902
Buggy source:
/** 
 * Modify the current time. Note that the countdown continues to run in the background. One can see this by pressing the "back" button, then entering again.
 */
private final void modify(){
  mCountdownState=STATE_COUNTDOWN_MODIFY;
  long now=System.currentTimeMillis();
  long temporaryDuration=mDeadline - now;
  if (temporaryDuration < 0) {
    temporaryDuration=0;
  }
  mOriginalDuration=mDuration;
  mDurationPicker.setDuration(temporaryDuration);
  mStartCountdown=true;
  updateViews();
}

Fixed version (ground truth):
/** 
 * Modify the current time. Note that the countdown continues to run in the background. One can see this by pressing the "back" button, then entering again.
 */
private final void modify(){
  mCountdownState=STATE_COUNTDOWN_MODIFY;
  long now=System.currentTimeMillis();
  long temporaryDuration=mDeadline - now;
  if (temporaryDuration < 0) {
    temporaryDuration=0;
  }
  mOriginalDuration=mDuration;
  mDurationPicker.setDuration(temporaryDuration);
  updateViews();
}
Program: 187903
Project: 187903
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  final Intent intent=getIntent();
  final String action=intent.getAction();
  if (Intent.ACTION_EDIT.equals(action) || Intent.ACTION_VIEW.equals(action)) {
    mState=STATE_EDIT;
    mUri=intent.getData();
  }
 else   if (Intent.ACTION_INSERT.equals(action)) {
    mState=STATE_INSERT;
    mUri=getContentResolver().insert(intent.getData(),null);
    intent.setAction(Intent.ACTION_EDIT);
    setIntent(intent);
    if (mUri == null) {
      Log.e(TAG,"String_Node_Str" + getIntent().getData());
      finish();
      return;
    }
    setResult(RESULT_OK,(new Intent()).setAction(mUri.toString()));
  }
 else {
    Log.e(TAG,"String_Node_Str");
    finish();
    return;
  }
  setContentView(R.layout.note_editor);
  mText=(EditText)findViewById(R.id.note);
  mCursor=managedQuery(mUri,PROJECTION,null,null,null);
  if (savedInstanceState != null) {
    mOriginalContent=savedInstanceState.getString(ORIGINAL_CONTENT);
  }
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  final Intent intent=getIntent();
  final String action=intent.getAction();
  if (Intent.ACTION_EDIT.equals(action) || Intent.ACTION_VIEW.equals(action)) {
    mState=STATE_EDIT;
    mUri=intent.getData();
  }
 else   if (Intent.ACTION_INSERT.equals(action)) {
    mState=STATE_INSERT;
    mUri=getContentResolver().insert(intent.getData(),null);
    intent.setAction(Intent.ACTION_EDIT);
    intent.setData(mUri);
    setIntent(intent);
    if (mUri == null) {
      Log.e(TAG,"String_Node_Str" + getIntent().getData());
      finish();
      return;
    }
    setResult(RESULT_OK,(new Intent()).setAction(mUri.toString()));
  }
 else {
    Log.e(TAG,"String_Node_Str");
    finish();
    return;
  }
  setContentView(R.layout.note_editor);
  mText=(EditText)findViewById(R.id.note);
  mCursor=managedQuery(mUri,PROJECTION,null,null,null);
  if (savedInstanceState != null) {
    mOriginalContent=savedInstanceState.getString(ORIGINAL_CONTENT);
  }
}
Program: 187904
Project: 187904
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.title_editor);
  mUri=getIntent().getData();
  mCursor=managedQuery(mUri,PROJECTION,null,null,null);
  mText=(EditText)this.findViewById(R.id.title);
  mText.setOnClickListener(this);
  Button b=(Button)findViewById(R.id.ok);
  b.setOnClickListener(this);
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.title_editor);
  mUri=getIntent().getData();
  mCursor=managedQuery(mUri,PROJECTION,null,null,null);
  mText=(EditText)this.findViewById(R.id.title);
  Button b=(Button)findViewById(R.id.ok);
  b.setOnClickListener(this);
}
Program: 187905
Project: 187905
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  final Intent intent=getIntent();
  final String action=intent.getAction();
  if (Intent.ACTION_EDIT.equals(action) || Intent.ACTION_VIEW.equals(action)) {
    mState=STATE_EDIT;
    mUri=intent.getData();
  }
 else   if (Intent.ACTION_INSERT.equals(action)) {
    mState=STATE_INSERT;
    mUri=getContentResolver().insert(intent.getData(),null);
    if (mUri == null) {
      Log.e(TAG,"String_Node_Str" + getIntent().getData());
      finish();
      return;
    }
    setResult(RESULT_OK,(new Intent()).setAction(mUri.toString()));
  }
 else {
    Log.e(TAG,"String_Node_Str");
    finish();
    return;
  }
  setContentView(R.layout.note_editor);
  mText=(EditText)findViewById(R.id.note);
  mCursor=managedQuery(mUri,PROJECTION,null,null,null);
  if (savedInstanceState != null) {
    mOriginalContent=savedInstanceState.getString(ORIGINAL_CONTENT);
  }
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  final Intent intent=getIntent();
  final String action=intent.getAction();
  if (Intent.ACTION_EDIT.equals(action) || Intent.ACTION_VIEW.equals(action)) {
    mState=STATE_EDIT;
    mUri=intent.getData();
  }
 else   if (Intent.ACTION_INSERT.equals(action)) {
    mState=STATE_INSERT;
    mUri=getContentResolver().insert(intent.getData(),null);
    intent.setAction(Intent.ACTION_EDIT);
    setIntent(intent);
    if (mUri == null) {
      Log.e(TAG,"String_Node_Str" + getIntent().getData());
      finish();
      return;
    }
    setResult(RESULT_OK,(new Intent()).setAction(mUri.toString()));
  }
 else {
    Log.e(TAG,"String_Node_Str");
    finish();
    return;
  }
  setContentView(R.layout.note_editor);
  mText=(EditText)findViewById(R.id.note);
  mCursor=managedQuery(mUri,PROJECTION,null,null,null);
  if (savedInstanceState != null) {
    mOriginalContent=savedInstanceState.getString(ORIGINAL_CONTENT);
  }
}
Program: 187906
Project: 187906
Buggy source:
@Override public boolean onCreateOptionsMenu(Menu menu){
  boolean superResult=super.onCreateOptionsMenu(menu);
  menu.add(0,MENU_USE_CENTER,R.string.locations_use_center,R.drawable.location_center001a);
  menu.add(0,MENU_RESTORE_VALUES,R.string.locations_restore_values,R.drawable.restore001a);
  menu.add(0,MENU_ABOUT,R.string.about,R.drawable.about001a);
  return superResult;
}

Fixed version (ground truth):
@Override public boolean onCreateOptionsMenu(Menu menu){
  boolean superResult=super.onCreateOptionsMenu(menu);
  menu.add(0,MENU_USE_CENTER,0,R.string.locations_use_center).setIcon(R.drawable.location_center001a);
  menu.add(0,MENU_RESTORE_VALUES,0,R.string.locations_restore_values).setIcon(R.drawable.restore001a);
  menu.add(0,MENU_ABOUT,0,R.string.about).setIcon(R.drawable.about001a);
  return superResult;
}
Program: 187907
Project: 187907
Buggy source:
/** 
 * Creates the menu structure.
 */
@Override public boolean onCreateOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  menu.add(0,MENU_ABOUT,R.string.about,R.drawable.about001a).setShortcut('0','a');
  Intent intent=new Intent(null,getIntent().getData());
  intent.addCategory(Intent.CATEGORY_ALTERNATIVE);
  menu.addIntentOptions(Menu.CATEGORY_ALTERNATIVE,0,0,new ComponentName(this,OpenIntentsView.class),null,intent,0,null);
  return true;
}

Fixed version (ground truth):
/** 
 * Creates the menu structure.
 */
@Override public boolean onCreateOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  menu.add(0,MENU_ABOUT,0,R.string.about).setIcon(R.drawable.about001a).setShortcut('0','a');
  Intent intent=new Intent(null,getIntent().getData());
  intent.addCategory(Intent.CATEGORY_ALTERNATIVE);
  menu.addIntentOptions(Menu.CATEGORY_ALTERNATIVE,0,0,new ComponentName(this,OpenIntentsView.class),null,intent,0,null);
  return true;
}
Program: 187908
Project: 187908
Buggy source:
@Override public boolean onCreateOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  menu.add(0,MENU_OPEN_AUDIO,R.string.open_audio,R.drawable.music001a).setShortcut('0','o');
  menu.add(0,MENU_OPEN_VIDEO,R.string.open_video,R.drawable.video002a).setShortcut('0','o');
  Intent intent=new Intent(null,getIntent().getData());
  intent.addCategory(Intent.CATEGORY_ALTERNATIVE);
  menu.addIntentOptions(Menu.CATEGORY_ALTERNATIVE,0,0,new ComponentName(this,ShoppingView.class),null,intent,0,null);
  return true;
}

Fixed version (ground truth):
@Override public boolean onCreateOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  menu.add(0,MENU_OPEN_AUDIO,0,R.string.open_audio).setIcon(R.drawable.music001a).setShortcut('0','o');
  menu.add(0,MENU_OPEN_VIDEO,0,R.string.open_video).setIcon(R.drawable.video002a).setShortcut('0','o');
  Intent intent=new Intent(null,getIntent().getData());
  intent.addCategory(Intent.CATEGORY_ALTERNATIVE);
  menu.addIntentOptions(Menu.CATEGORY_ALTERNATIVE,0,0,new ComponentName(this,ShoppingView.class),null,intent,0,null);
  return true;
}
Program: 187909
Project: 187909
Buggy source:
public void onCreateContextMenu(ContextMenu contextmenu,View view,ContextMenuInfo info){
  contextmenu.add(0,MENU_MARK_ITEM,R.string.mark_item,R.drawable.shoppinglistcleanup001b).setShortcut('1','m');
  contextmenu.add(0,MENU_EDIT_ITEM,R.string.edit_item,R.drawable.shoppinglistrename001b).setShortcut('2','e');
  contextmenu.add(0,MENU_DELETE_ITEM,R.string.delete_item,R.drawable.shoppinglistdelete001b).setShortcut('3','d');
}

Fixed version (ground truth):
public void onCreateContextMenu(ContextMenu contextmenu,View view,ContextMenuInfo info){
  contextmenu.add(0,MENU_MARK_ITEM,0,R.string.mark_item).setIcon(R.drawable.shoppinglistcleanup001b).setShortcut('1','m');
  contextmenu.add(0,MENU_EDIT_ITEM,0,R.string.edit_item).setIcon(R.drawable.shoppinglistrename001b).setShortcut('2','e');
  contextmenu.add(0,MENU_DELETE_ITEM,0,R.string.delete_item).setIcon(R.drawable.shoppinglistdelete001b).setShortcut('3','d');
}
Program: 187911
Project: 187911
Buggy source:
@Override public boolean onCreateOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  menu.add(0,MENU_NEW_LIST,R.string.new_list,R.drawable.shoppinglistnew001b).setShortcut('0','n');
  menu.add(0,MENU_CLEAN_UP_LIST,R.string.clean_up_list,R.drawable.shoppinglistcleanup001b).setShortcut('1','c');
  menu.add(0,MENU_RENAME_LIST,R.string.rename_list,R.drawable.shoppinglistrename001b).setShortcut('2','r');
  ;
  menu.add(0,MENU_DELETE_LIST,R.string.delete_list,R.drawable.shoppinglistdelete001b).setShortcut('3','d');
  menu.add(0,MENU_SHARE,R.string.share,R.drawable.contact_share001a).setShortcut('4','s');
  menu.add(0,MENU_THEME,R.string.theme,R.drawable.shoppinglisttheme001a).setShortcut('5','t');
  menu.add(0,MENU_ADD_LOCATION_ALERT,R.string.shopping_add_alert,R.drawable.locations_add_alert001a).setShortcut('6','l');
  menu.add(0,MENU_SENSOR_SERVICE,R.string.shake_control,R.drawable.mobile_shake001a).setShortcut('0','s');
  return true;
}

Fixed version (ground truth):
@Override public boolean onCreateOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  menu.add(0,MENU_NEW_LIST,0,R.string.new_list).setIcon(R.drawable.shoppinglistnew001b).setShortcut('0','n');
  menu.add(0,MENU_CLEAN_UP_LIST,0,R.string.clean_up_list).setIcon(R.drawable.shoppinglistcleanup001b).setShortcut('1','c');
  menu.add(0,MENU_RENAME_LIST,0,R.string.rename_list).setIcon(R.drawable.shoppinglistrename001b).setShortcut('2','r');
  ;
  menu.add(0,MENU_DELETE_LIST,0,R.string.delete_list).setIcon(R.drawable.shoppinglistdelete001b).setShortcut('3','d');
  menu.add(0,MENU_SHARE,0,R.string.share).setIcon(R.drawable.contact_share001a).setShortcut('4','s');
  menu.add(0,MENU_THEME,0,R.string.theme).setIcon(R.drawable.shoppinglisttheme001a).setShortcut('5','t');
  menu.add(0,MENU_ADD_LOCATION_ALERT,0,R.string.shopping_add_alert).setIcon(R.drawable.locations_add_alert001a).setShortcut('6','l');
  menu.add(0,MENU_SENSOR_SERVICE,0,R.string.shake_control).setIcon(R.drawable.mobile_shake001a).setShortcut('0','s');
  return true;
}
Program: 187912
Project: 187912
Buggy source:
@Override public boolean onCreateOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  menu.add(0,PACKAGE_ADD_ID,R.string.menu_package_add,R.drawable.new_doc).setShortcut('3','i');
  return true;
}

Fixed version (ground truth):
@Override public boolean onCreateOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  menu.add(0,PACKAGE_ADD_ID,0,R.string.menu_package_add).setIcon(R.drawable.new_doc).setShortcut('3','i');
  return true;
}
Program: 187913
Project: 187913
Buggy source:
/** 
 * Returns an array of Strings containing the supported sensor types.
 * @return array of Strings containing the supported sensor types
 */
public static String[] getSupportedSensors(){
  if (mClient.connected) {
    return mClient.getSupportedSensors();
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Returns an array of Strings containing the supported sensor types.
 * @return array of Strings containing the supported sensor types
 */
public static String[] getSupportedSensors(){
  if (mClient.connected) {
    return mClient.getSupportedSensors();
  }
 else {
    return new String[]{};
  }
}
Program: 187914
Project: 187914
Buggy source:
/** 
 * Confirm 'delete list' command by AlertDialog.
 */
private void deleteListConfirm(){
}

Fixed version (ground truth):
/** 
 * Confirm 'delete list' command by AlertDialog.
 */
private void deleteListConfirm(){
  new AlertDialog.Builder(this).setTitle(R.string.delete_list).setPositiveButton(R.string.ok,new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int whichButton){
      deleteList();
    }
  }
).setNegativeButton(R.string.cancel,new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int whichButton){
    }
  }
).show();
}