nus-yam/ex-repair huggingface dataset:
Program: 187734
Project: 187734
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.infoactivity);
  mApplicationStrings=new String[mApplications.length];
  for (int i=0; i < mApplications.length; i++) {
    mApplicationStrings[i]=getString(mApplications[i]);
  }
  setListAdapter(new FontArrayAdapter<String>(this,android.R.layout.simple_list_item_1,mApplicationStrings));
  ListView listview=getListView();
  listview.setOnItemClickListener(this);
  TypedArray a=obtainStyledAttributes(mTheme,R.styleable.ShoppingList);
  String typefaceName=a.getString(R.styleable.ShoppingList_textTypeface);
  mTextSizeMedium=a.getDimensionPixelOffset(R.styleable.ShoppingList_textSizeMedium,23);
  mTextSizeLarge=a.getDimensionPixelOffset(R.styleable.ShoppingList_textSizeLarge,28);
  mTextColor=a.getColor(R.styleable.ShoppingList_textColor,Color.BLACK);
  Drawable background=a.getDrawable(R.styleable.ShoppingList_background);
  View v=findViewById(R.id.background);
  v.setBackgroundDrawable(background);
  mTypeface=Typeface.createFromAsset(getResources().getAssets(),typefaceName);
  TextView tv=(TextView)findViewById(R.id.text);
  tv.setTypeface(mTypeface);
  tv.setTextSize(mTextSizeMedium);
  tv.setTextColor(mTextColor);
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.infoactivity);
  mApplicationStrings=new String[mApplications.length];
  for (int i=0; i < mApplications.length; i++) {
    mApplicationStrings[i]=getString(mApplications[i]);
  }
  setListAdapter(new FontArrayAdapter<String>(this,android.R.layout.simple_list_item_1,mApplicationStrings));
  ListView listview=getListView();
  listview.setOnItemClickListener(this);
  TypedArray a=obtainStyledAttributes(mTheme,R.styleable.ShoppingList);
  String typefaceName=a.getString(R.styleable.ShoppingList_textTypeface);
  mTextSizeMedium=a.getDimensionPixelOffset(R.styleable.ShoppingList_textSizeMedium,23);
  mTextSizeLarge=a.getDimensionPixelOffset(R.styleable.ShoppingList_textSizeLarge,28);
  mTextColor=a.getColor(R.styleable.ShoppingList_textColor,Color.BLACK);
  Drawable background=a.getDrawable(R.styleable.ShoppingList_background);
  View v=findViewById(R.id.background);
  v.setBackgroundDrawable(background);
  mTypeface=Typeface.create(typefaceName,Typeface.NORMAL);
  TextView tv=(TextView)findViewById(R.id.text);
  tv.setTypeface(mTypeface);
  tv.setTextSize(mTextSizeMedium);
  tv.setTextColor(mTextColor);
}
Program: 187737
Project: 187737
Buggy source:
/** 
 * Return the Drawable that is associated with a specific mime type for the VIEW action.
 * @param mimetype
 * @return
 */
Drawable getDrawableForMimetype(File file,String mimetype){
  if (mimetype == null) {
    return null;
  }
  PackageManager pm=context.getPackageManager();
  if (mimetype.equals(MIME_APK)) {
    String path=file.getPath();
    PackageInfo pInfo=pm.getPackageArchiveInfo(path,PackageManager.GET_ACTIVITIES);
    ApplicationInfo aInfo=pInfo.applicationInfo;
    if (Build.VERSION.SDK_INT >= 8) {
      aInfo.sourceDir=path;
      aInfo.publicSourceDir=path;
    }
    return aInfo.loadIcon(pm);
  }
  Uri data=FileUtils.getUri(file);
  Intent intent=new Intent(Intent.ACTION_VIEW);
  intent.setDataAndType(data,mimetype);
  final List<ResolveInfo> lri=pm.queryIntentActivities(intent,PackageManager.MATCH_DEFAULT_ONLY);
  if (lri != null && lri.size() > 0) {
    int index=0;
    index=lri.size() - 1;
    final ResolveInfo ri=lri.get(index);
    return ri.loadIcon(pm);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Return the Drawable that is associated with a specific mime type for the VIEW action.
 * @param mimetype
 * @return
 */
Drawable getDrawableForMimetype(File file,String mimetype){
  if (mimetype == null) {
    return null;
  }
  PackageManager pm=context.getPackageManager();
  if (mimetype.equals(MIME_APK)) {
    String path=file.getPath();
    PackageInfo pInfo=pm.getPackageArchiveInfo(path,PackageManager.GET_ACTIVITIES);
    if (pInfo != null) {
      ApplicationInfo aInfo=pInfo.applicationInfo;
      if (Build.VERSION.SDK_INT >= 8) {
        aInfo.sourceDir=path;
        aInfo.publicSourceDir=path;
      }
      return aInfo.loadIcon(pm);
    }
  }
  Uri data=FileUtils.getUri(file);
  Intent intent=new Intent(Intent.ACTION_VIEW);
  intent.setDataAndType(data,mimetype);
  final List<ResolveInfo> lri=pm.queryIntentActivities(intent,PackageManager.MATCH_DEFAULT_ONLY);
  if (lri != null && lri.size() > 0) {
    int index=0;
    index=lri.size() - 1;
    final ResolveInfo ri=lri.get(index);
    return ri.loadIcon(pm);
  }
  return null;
}
Program: 187738
Project: 187738
Buggy source:
private static boolean usingListSpinner(){
  return (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB);
}

Fixed version (ground truth):
private boolean usingListSpinner(){
  return (findViewById(android.R.id.list) == null);
}
Program: 187739
Project: 187739
Buggy source:
private void addAction(final Action action){
  addSeparator();
  ImageButton actionButton=(ImageButton)inflate(R.layout.actionbar_button);
  actionButton.setImageResource(action.iconResId);
  actionButton.setScaleType(ImageView.ScaleType.FIT_START);
  actionButton.setAdjustViewBounds(true);
  actionButton.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View view){
      action.onClickListener.onClick(view);
    }
  }
);
  mContentView.addView(actionButton);
}

Fixed version (ground truth):
private View addAction(final Action action){
  addSeparator();
  ImageButton actionButton=(ImageButton)inflate(R.layout.actionbar_button);
  actionButton.setImageResource(action.iconResId);
  actionButton.setScaleType(ImageView.ScaleType.FIT_START);
  actionButton.setAdjustViewBounds(true);
  actionButton.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View view){
      action.onClickListener.onClick(view);
    }
  }
);
  mContentView.addView(actionButton);
  return actionButton;
}
Program: 187740
Project: 187740
Buggy source:
public void setup(){
  if (mTitle == null) {
    addImage(R.drawable.actionbar_logo);
    addTitleAndSpacing();
  }
 else {
    addImage(R.drawable.actionbar_logo_short);
    addTitleAndSpacing();
    for (    Action a : mActions)     addAction(a);
  }
  Action actionMoreMenu=new Action(R.drawable.ic_menu_more,new OnClickListener(){
    public void onClick(    View v){
      ActionBarDropDownMenu dropDownMenu=new ActionBarDropDownMenu(mContext);
      MenuModel menuMore=new MoreMenuBuilder().build(mContext,inactiveMoreMenuFunction);
      dropDownMenu.setMenu(menuMore);
      dropDownMenu.show(mContentView);
    }
  }
);
  addAction(actionMoreMenu);
}

Fixed version (ground truth):
public void setup(){
  if (mTitle == null) {
    addImage(R.drawable.actionbar_logo);
    addTitleAndSpacing();
  }
 else {
    addImage(R.drawable.actionbar_logo_short);
    addTitleAndSpacing();
    for (    Action a : mActions)     addAction(a);
  }
  Action actionMoreMenu=new Action(R.drawable.ic_menu_more,new OnClickListener(){
    public void onClick(    View v){
      ActionBarDropDownMenu dropDownMenu=new ActionBarDropDownMenu(mContext);
      MenuModel menuMore=new MoreMenuBuilder().build(mContext,inactiveMoreMenuFunction);
      dropDownMenu.setMenu(menuMore);
      dropDownMenu.show(mMoreMenuAnchor);
    }
  }
);
  mMoreMenuAnchor=addAction(actionMoreMenu);
}
Program: 187741
Project: 187741
Buggy source:
/** 
 * Returns the controller component of a sensor by name. (by accessing mSensorSimulator.controller list with all controllers)
 * @param sensorName
 * @return
 */
private SensorController getSensorCtrlFromName(String sensorName){
  SensorSimulatorController ctrl=mSensorSimulator.controller;
  if (sensorName.compareTo(SensorModel.ACCELEROMETER) == 0)   return ctrl.getAccelerometer();
 else   if (sensorName.compareTo(SensorModel.MAGNETIC_FIELD) == 0)   return ctrl.getMagneticField();
 else   if (sensorName.compareTo(SensorModel.ORIENTATION) == 0)   return ctrl.getOrientation();
 else   if (sensorName.compareTo(SensorModel.TEMPERATURE) == 0)   return ctrl.getTemperature();
 else   if (sensorName.compareTo(SensorModel.BARCODE_READER) == 0)   return ctrl.getBarcodeReader();
 else   if (sensorName.compareTo(SensorModel.LIGHT) == 0)   return ctrl.getLight();
 else   if (sensorName.compareTo(SensorModel.PROXIMITY) == 0)   return ctrl.getProximity();
 else   if (sensorName.compareTo(SensorModel.PRESSURE) == 0)   return ctrl.getPressure();
 else   if (sensorName.compareTo(SensorModel.LINEAR_ACCELERATION) == 0)   return ctrl.getLinearAcceleration();
 else   if (sensorName.compareTo(SensorModel.GRAVITY) == 0)   return ctrl.getGravity();
 else   if (sensorName.compareTo(SensorModel.ROTATION_VECTOR) == 0)   return ctrl.getRotationVector();
  return null;
}

Fixed version (ground truth):
/** 
 * Returns the controller component of a sensor by name. (by accessing mSensorSimulator.controller list with all controllers)
 * @param sensorName
 * @return
 */
private SensorController getSensorCtrlFromName(String sensorName){
  SensorSimulatorController ctrl=mSensorSimulator.controller;
  if (sensorName.compareTo(SensorModel.ACCELEROMETER) == 0)   return ctrl.getAccelerometer();
 else   if (sensorName.compareTo(SensorModel.MAGNETIC_FIELD) == 0)   return ctrl.getMagneticField();
 else   if (sensorName.compareTo(SensorModel.ORIENTATION) == 0)   return ctrl.getOrientation();
 else   if (sensorName.compareTo(SensorModel.TEMPERATURE) == 0)   return ctrl.getTemperature();
 else   if (sensorName.compareTo(SensorModel.BARCODE_READER) == 0)   return ctrl.getBarcodeReader();
 else   if (sensorName.compareTo(SensorModel.LIGHT) == 0)   return ctrl.getLight();
 else   if (sensorName.compareTo(SensorModel.PROXIMITY) == 0)   return ctrl.getProximity();
 else   if (sensorName.compareTo(SensorModel.PRESSURE) == 0)   return ctrl.getPressure();
 else   if (sensorName.compareTo(SensorModel.LINEAR_ACCELERATION) == 0)   return ctrl.getLinearAcceleration();
 else   if (sensorName.compareTo(SensorModel.GRAVITY) == 0)   return ctrl.getGravity();
 else   if (sensorName.compareTo(SensorModel.ROTATION_VECTOR) == 0)   return ctrl.getRotationVector();
 else   if (sensorName.compareTo(SensorModel.GYROSCOPE) == 0)   return ctrl.getGyroscope();
  return null;
}
Program: 187742
Project: 187742
Buggy source:
/** 
 * Returns the model component of a sensor by name. (by accessing mSensorSimulator.modellist with all models)
 * @param sensorName
 * @return
 */
private SensorModel getSensorModelFromName(String sensorName){
  SensorSimulatorModel model=mSensorSimulator.model;
  if (sensorName.compareTo(SensorModel.ACCELEROMETER) == 0)   return model.getAccelerometer();
 else   if (sensorName.compareTo(SensorModel.MAGNETIC_FIELD) == 0)   return model.getMagneticField();
 else   if (sensorName.compareTo(SensorModel.ORIENTATION) == 0)   return model.getOrientation();
 else   if (sensorName.compareTo(SensorModel.TEMPERATURE) == 0)   return model.getTemperature();
 else   if (sensorName.compareTo(SensorModel.BARCODE_READER) == 0)   return model.getBarcodeReader();
 else   if (sensorName.compareTo(SensorModel.LIGHT) == 0)   return model.getLight();
 else   if (sensorName.compareTo(SensorModel.PROXIMITY) == 0)   return model.getProximity();
 else   if (sensorName.compareTo(SensorModel.PRESSURE) == 0)   return model.getPressure();
 else   if (sensorName.compareTo(SensorModel.LINEAR_ACCELERATION) == 0)   return model.getLinearAcceleration();
 else   if (sensorName.compareTo(SensorModel.GRAVITY) == 0)   return model.getGravity();
 else   if (sensorName.compareTo(SensorModel.ROTATION_VECTOR) == 0)   return model.getRotationVector();
  return null;
}

Fixed version (ground truth):
/** 
 * Returns the model component of a sensor by name. (by accessing mSensorSimulator.modellist with all models)
 * @param sensorName
 * @return
 */
private SensorModel getSensorModelFromName(String sensorName){
  SensorSimulatorModel model=mSensorSimulator.model;
  if (sensorName.compareTo(SensorModel.ACCELEROMETER) == 0)   return model.getAccelerometer();
 else   if (sensorName.compareTo(SensorModel.MAGNETIC_FIELD) == 0)   return model.getMagneticField();
 else   if (sensorName.compareTo(SensorModel.ORIENTATION) == 0)   return model.getOrientation();
 else   if (sensorName.compareTo(SensorModel.TEMPERATURE) == 0)   return model.getTemperature();
 else   if (sensorName.compareTo(SensorModel.BARCODE_READER) == 0)   return model.getBarcodeReader();
 else   if (sensorName.compareTo(SensorModel.LIGHT) == 0)   return model.getLight();
 else   if (sensorName.compareTo(SensorModel.PROXIMITY) == 0)   return model.getProximity();
 else   if (sensorName.compareTo(SensorModel.PRESSURE) == 0)   return model.getPressure();
 else   if (sensorName.compareTo(SensorModel.LINEAR_ACCELERATION) == 0)   return model.getLinearAcceleration();
 else   if (sensorName.compareTo(SensorModel.GRAVITY) == 0)   return model.getGravity();
 else   if (sensorName.compareTo(SensorModel.ROTATION_VECTOR) == 0)   return model.getRotationVector();
 else   if (sensorName.compareTo(SensorModel.GYROSCOPE) == 0)   return model.getGyroscope();
  return null;
}
Program: 187743
Project: 187743
Buggy source:
/** 
 * Handles communication with the client. In a simple protocol, all Android Sensors class methods are received and answered. If necessary, exceptions are thrown as specified in the Sensors class.
 */
public void listenThread(){
  try {
    PrintWriter out=new PrintWriter(mClientSocket.getOutputStream(),true);
    BufferedReader in=new BufferedReader(new InputStreamReader(mClientSocket.getInputStream()));
    String inputLine, outputLine;
    outputLine="String_Node_Str";
    out.println(outputLine);
    mSensorSimulator.addMessage("String_Node_Str");
    while ((inputLine=in.readLine()) != null) {
      if (inputLine.compareTo("String_Node_Str") == 0) {
        String[] supportedSensors=getSupportedSensors();
        out.println(supportedSensors.length);
        for (int i=0; i < supportedSensors.length; i++) {
          out.println(supportedSensors[i]);
        }
      }
 else {
        executeCommand(out,in,inputLine);
      }
    }
    out.close();
    in.close();
    mClientSocket.close();
  }
 catch (  IOException e) {
    if (mTalking) {
      System.err.println("String_Node_Str");
      try {
        if (mClientSocket != null)         mClientSocket.close();
      }
 catch (      IOException e2) {
        System.err.println("String_Node_Str");
      }
    }
 else {
    }
  }
  if (mPreviousThread != null) {
    mPreviousThread.mNextThread=mNextThread;
  }
  if (mNextThread != null) {
    mNextThread.mPreviousThread=mPreviousThread;
  }
  mSensorSimulator.addMessage("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Handles communication with the client. In a simple protocol, all Android Sensors class methods are received and answered. If necessary, exceptions are thrown as specified in the Sensors class.
 */
public void listenThread(){
  try {
    PrintWriter out=new PrintWriter(mClientSocket.getOutputStream(),true);
    BufferedReader in=new BufferedReader(new InputStreamReader(mClientSocket.getInputStream()));
    String inputLine, outputLine;
    outputLine="String_Node_Str";
    out.println(outputLine);
    mSensorSimulator.addMessage("String_Node_Str");
    while ((inputLine=in.readLine()) != null) {
      if (inputLine.compareTo("String_Node_Str") == 0) {
        String[] supportedSensors=getSupportedSensors();
        out.println(supportedSensors.length);
        for (int i=0; i < supportedSensors.length; i++) {
          out.println(supportedSensors[i]);
        }
      }
 else {
        executeCommand(out,in,inputLine);
      }
    }
    out.close();
    in.close();
    mClientSocket.close();
  }
 catch (  IOException e) {
    if (mTalking) {
      System.err.println("String_Node_Str");
      try {
        if (mClientSocket != null) {
          mClientSocket.close();
        }
      }
 catch (      IOException e2) {
        System.err.println("String_Node_Str");
      }
    }
 else {
    }
  }
  if (mPreviousThread != null) {
    mPreviousThread.mNextThread=mNextThread;
  }
  if (mNextThread != null) {
    mNextThread.mPreviousThread=mPreviousThread;
  }
  mSensorSimulator.addMessage("String_Node_Str");
}
Program: 187744
Project: 187744
Buggy source:
/** 
 * Method to call only once thread.
 */
public void run(){
  listenThread();
}

Fixed version (ground truth):
/** 
 * Method to call only once thread.
 */
@Override public void run(){
  listenThread();
}
Program: 187745
Project: 187745
Buggy source:
/** 
 * Here each command is executed following the protocol between server and client application.
 * @param out OutputStream (to write in)
 * @param in InputStream (to read from)
 * @param cmd command to be executed
 * @throws IOException
 */
private void executeCommand(PrintWriter out,BufferedReader in,String cmd) throws IOException {
  String sensorName=in.readLine();
  SensorController sensorCtrl=getSensorCtrlFromName(sensorName);
  SensorModel sensorModel=getSensorModelFromName(sensorName);
  if (cmd.compareTo("String_Node_Str") == 0)   sensorModel.getNumSensorValues(out);
 else   if (cmd.compareTo("String_Node_Str") == 0) {
    String args=in.readLine();
    if (sensorModel.isEnabled()) {
      int updateDelay=Integer.parseInt(args);
      sensorCtrl.setCurrentUpdateRate(updateDelay);
      sensorModel.setSensorUpdateRate(out);
    }
 else {
      System.out.println(sensorName + "String_Node_Str");
      out.println("String_Node_Str");
    }
  }
 else   if (cmd.compareTo("String_Node_Str") == 0) {
    sensorModel.unsetSensorUpdateRate(out);
    sensorCtrl.setCurrentUpdateRate(sensorModel.getDefaultUpdateRate());
  }
 else   if (cmd.compareTo("String_Node_Str") == 0) {
    if (sensorCtrl != null) {
      sensorCtrl.readSensor(out);
      sensorCtrl.updateEmulatorRefresh(mSensorSimulator.view.getRefreshCount());
    }
 else {
      out.println("String_Node_Str");
      mSensorSimulator.addMessage("String_Node_Str" + cmd);
    }
  }
 else   out.println("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Here each command is executed following the protocol between server and client application.
 * @param out OutputStream (to write in)
 * @param in InputStream (to read from)
 * @param cmd command to be executed
 * @throws IOException
 */
private void executeCommand(PrintWriter out,BufferedReader in,String cmd) throws IOException {
  String sensorName=in.readLine();
  SensorController sensorCtrl=getSensorCtrlFromName(sensorName);
  SensorModel sensorModel=getSensorModelFromName(sensorName);
  if (cmd.compareTo("String_Node_Str") == 0) {
    sensorModel.getNumSensorValues(out);
  }
 else   if (cmd.compareTo("String_Node_Str") == 0) {
    String args=in.readLine();
    if (sensorModel.isEnabled()) {
      int updateDelay=Integer.parseInt(args);
      sensorCtrl.setCurrentUpdateRate(updateDelay);
      sensorModel.setSensorUpdateRate(out);
    }
 else {
      System.out.println(sensorName + "String_Node_Str");
      out.println("String_Node_Str");
    }
  }
 else   if (cmd.compareTo("String_Node_Str") == 0) {
    sensorModel.unsetSensorUpdateRate(out);
    sensorCtrl.setCurrentUpdateRate(sensorModel.getDefaultUpdateRate());
  }
 else   if (cmd.compareTo("String_Node_Str") == 0) {
    if (sensorCtrl != null) {
      sensorCtrl.readSensor(out);
      sensorCtrl.updateEmulatorRefresh(mSensorSimulator.view.getRefreshCount());
    }
 else {
      out.println("String_Node_Str");
      mSensorSimulator.addMessage("String_Node_Str" + cmd);
    }
  }
 else {
    out.println("String_Node_Str");
  }
}
Program: 187747
Project: 187747
Buggy source:
@Override protected void onResume(){
  if (debug)   Log.i(TAG,"String_Node_Str");
  super.onResume();
  if (debug)   Log.i(TAG,"String_Node_Str");
  initFromPreferences();
  mIsActive=true;
  if (mState == STATE_MAIN || mState == STATE_VIEW_LIST) {
  }
 else   if ((mState == STATE_PICK_ITEM) || (mState == STATE_GET_CONTENT_ITEM)) {
    setTitle(getText(R.string.pick_item));
    setTitleColor(0xFFAAAAFF);
  }
  getSelectedListId();
  setListTheme(loadListTheme());
  applyListTheme();
  mItemsView.onResume();
  mEditText.setKeyListener(PreferenceActivity.getCapitalizationKeyListenerFromPrefs(getApplicationContext()));
  if (!mUpdating) {
    mUpdating=true;
  }
  registerSensor();
  if (debug)   Log.i(TAG,"String_Node_Str");
}

Fixed version (ground truth):
@Override protected void onResume(){
  if (debug)   Log.i(TAG,"String_Node_Str");
  super.onResume();
  if (debug)   Log.i(TAG,"String_Node_Str");
  initFromPreferences();
  mIsActive=true;
  getSelectedListId();
  setListTheme(loadListTheme());
  applyListTheme();
  mItemsView.onResume();
  updateTitle();
  mEditText.setKeyListener(PreferenceActivity.getCapitalizationKeyListenerFromPrefs(getApplicationContext()));
  if (!mUpdating) {
    mUpdating=true;
  }
  registerSensor();
  if (debug)   Log.i(TAG,"String_Node_Str");
}
Program: 187748
Project: 187748
Buggy source:
private void onModeChanged(){
  if (debug)   Log.d(TAG,"String_Node_Str");
  fillItems(false);
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
    try {
      java.lang.reflect.Method method=Activity.class.getMethod("String_Node_Str");
      method.invoke(this);
    }
 catch (    Exception e) {
    }
  }
  if (mItemsView.mMode == MODE_IN_SHOP) {
    setTitle(getString(R.string.shopping_title,getCurrentListName()));
    registerSensor();
  }
 else {
    setTitle(getString(R.string.pick_items_titel,getCurrentListName()));
    unregisterSensor();
  }
}

Fixed version (ground truth):
private void onModeChanged(){
  if (debug)   Log.d(TAG,"String_Node_Str");
  fillItems(false);
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
    try {
      java.lang.reflect.Method method=Activity.class.getMethod("String_Node_Str");
      method.invoke(this);
    }
 catch (    Exception e) {
    }
  }
  updateTitle();
}
Program: 187749
Project: 187749
Buggy source:
private String getCurrentListName(){
  long listId=getSelectedListId();
  return mCursorShoppingLists.getString(mStringListFilterNAME);
}

Fixed version (ground truth):
private String getCurrentListName(){
  long listId=getSelectedListId();
  if (listId >= 0) {
    return mCursorShoppingLists.getString(mStringListFilterNAME);
  }
 else {
    return "String_Node_Str";
  }
}
Program: 187750
Project: 187750
Buggy source:
public void onItemSelected(AdapterView parent,View v,int position,long id){
  if (debug)   Log.d(TAG,"String_Node_Str");
  getSelectedListId();
  setListTheme(loadListTheme());
  fillItems(id == mItemsView.getListId());
  applyListTheme();
}

Fixed version (ground truth):
public void onItemSelected(AdapterView parent,View v,int position,long id){
  if (debug)   Log.d(TAG,"String_Node_Str");
  getSelectedListId();
  setListTheme(loadListTheme());
  fillItems(id == mItemsView.getListId());
  updateTitle();
  applyListTheme();
}
Program: 187751
Project: 187751
Buggy source:
public void run(){
  try {
    Writer writer;
    Encoding enc=(Encoding)mSpinnerEncoding.getSelectedItem();
    if (enc == null) {
      writer=new OutputStreamWriter(new FileOutputStream(file));
    }
 else {
      writer=new OutputStreamWriter(new FileOutputStream(file),enc.name());
    }
    doExport(writer);
    writer.close();
    dispatchSuccess(R.string.export_finished);
  }
 catch (  IOException e) {
    dispatchError(R.string.error_writing_file);
    Log.i(TAG,"String_Node_Str",e);
  }
  smHasWorkerThread=false;
}

Fixed version (ground truth):
public void run(){
  try {
    Writer writer;
    Encoding enc=getCurrentEncoding();
    if (enc == null) {
      writer=new OutputStreamWriter(new FileOutputStream(file));
    }
 else {
      writer=new OutputStreamWriter(new FileOutputStream(file),enc.name());
    }
    doExport(writer);
    writer.close();
    dispatchSuccess(R.string.export_finished);
  }
 catch (  IOException e) {
    dispatchError(R.string.error_writing_file);
    Log.i(TAG,"String_Node_Str",e);
  }
  smHasWorkerThread=false;
}
Program: 187752
Project: 187752
Buggy source:
@Override protected Encoding getDefaultEncoding(){
  if (1 == mSpinner.getSelectedItemId()) {
    return Encoding.ISO_8859_1;
  }
 else {
    return super.getDefaultEncoding();
  }
}

Fixed version (ground truth):
@Override protected Encoding getDefaultEncoding(){
  long id=mSpinner.getSelectedItemId();
  if (0 == id) {
    return Encoding.ISO_8859_1;
  }
 else   if (1 == id) {
    return Encoding.UTF_8;
  }
 else {
    return super.getDefaultEncoding();
  }
}
Program: 187754
Project: 187754
Buggy source:
private void sendFile(File file){
  String filename=file.getName();
  String content="String_Node_Str";
  Log.i(TAG,"String_Node_Str" + filename);
  Log.i(TAG,"String_Node_Str" + content);
  Intent i=new Intent();
  i.setAction(Intent.ACTION_SEND);
  i.setType(mMimeTypes.getMimeType(file.getName()));
  i.putExtra(Intent.EXTRA_SUBJECT,filename);
  i.putExtra(Intent.EXTRA_STREAM,Uri.parse("String_Node_Str" + FileManagerProvider.AUTHORITY + "String_Node_Str"+ file.getAbsolutePath()));
  i=Intent.createChooser(i,getString(R.string.menu_send));
  try {
    startActivity(i);
  }
 catch (  ActivityNotFoundException e) {
    Toast.makeText(this,R.string.send_not_available,Toast.LENGTH_SHORT).show();
    Log.e(TAG,"String_Node_Str");
  }
}

Fixed version (ground truth):
private void sendFile(File file){
  String filename=file.getName();
  String content="String_Node_Str";
  Log.i(TAG,"String_Node_Str" + filename);
  Log.i(TAG,"String_Node_Str" + content);
  Intent i=new Intent();
  i.setAction(Intent.ACTION_SEND);
  i.setType(mMimeTypes.getMimeType(file.getName()));
  i.putExtra(Intent.EXTRA_SUBJECT,filename);
  i.putExtra(Intent.EXTRA_STREAM,Uri.parse("String_Node_Str" + FileManagerProvider.AUTHORITY + file.getAbsolutePath()));
  i=Intent.createChooser(i,getString(R.string.menu_send));
  try {
    startActivity(i);
  }
 catch (  ActivityNotFoundException e) {
    Toast.makeText(this,R.string.send_not_available,Toast.LENGTH_SHORT).show();
    Log.e(TAG,"String_Node_Str");
  }
}
Program: 187755
Project: 187755
Buggy source:
/** 
 * @return
 */
public List<CategoryEntry> fetchAllCategoryRows(){
  ArrayList<CategoryEntry> ret=new ArrayList<CategoryEntry>();
  try {
    Cursor c=db.query(TABLE_CATEGORIES,new String[]{"String_Node_Str","String_Node_Str"},null,null,null,null,null);
    int numRows=c.getCount();
    c.moveToFirst();
    for (int i=0; i < numRows; ++i) {
      CategoryEntry row=new CategoryEntry();
      row.id=c.getLong(0);
      row.name=c.getString(1);
      ret.add(row);
      c.moveToNext();
    }
    c.close();
  }
 catch (  SQLException e) {
    Log.d(TAG,"String_Node_Str" + e.getLocalizedMessage());
  }
  return ret;
}

Fixed version (ground truth):
/** 
 * @return
 */
public List<CategoryEntry> fetchAllCategoryRows(){
  ArrayList<CategoryEntry> ret=new ArrayList<CategoryEntry>();
  if (db == null) {
    return ret;
  }
  try {
    Cursor c=db.query(TABLE_CATEGORIES,new String[]{"String_Node_Str","String_Node_Str"},null,null,null,null,null);
    int numRows=c.getCount();
    c.moveToFirst();
    for (int i=0; i < numRows; ++i) {
      CategoryEntry row=new CategoryEntry();
      row.id=c.getLong(0);
      row.name=c.getString(1);
      ret.add(row);
      c.moveToNext();
    }
    c.close();
  }
 catch (  SQLException e) {
    Log.d(TAG,"String_Node_Str" + e.getLocalizedMessage());
  }
  return ret;
}
Program: 187756
Project: 187756
Buggy source:
private long[] getRowsIds(){
  if (debug)   Log.d(TAG,"String_Node_Str" + rows);
  if (rows != null) {
    long[] ids=new long[rows.size()];
    Iterator<PassEntry> passIter=rows.iterator();
    int i=0;
    while (passIter.hasNext()) {
      ids[i]=passIter.next().id;
      i++;
    }
    return ids;
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
public static long[] getRowsIds(List<PassEntry> rows){
  if (debug)   Log.d(TAG,"String_Node_Str" + rows);
  if (rows != null) {
    long[] ids=new long[rows.size()];
    Iterator<PassEntry> passIter=rows.iterator();
    int i=0;
    while (passIter.hasNext()) {
      ids[i]=passIter.next().id;
      i++;
    }
    return ids;
  }
 else {
    return null;
  }
}
Program: 187757
Project: 187757
Buggy source:
private void viewPassword(int position){
  Intent vi=new Intent(this,PassView.class);
  vi.putExtra(KEY_ID,rows.get(position).id);
  vi.putExtra(KEY_CATEGORY_ID,CategoryId);
  vi.putExtra(KEY_ROWIDS,getRowsIds());
  vi.putExtra(KEY_LIST_POSITION,position);
  startActivityForResult(vi,REQUEST_VIEW_PASSWORD);
}

Fixed version (ground truth):
private void viewPassword(int position){
  Intent vi=new Intent(this,PassView.class);
  vi.putExtra(KEY_ID,rows.get(position).id);
  vi.putExtra(KEY_CATEGORY_ID,CategoryId);
  vi.putExtra(KEY_ROWIDS,getRowsIds(rows));
  vi.putExtra(KEY_LIST_POSITION,position);
  startActivityForResult(vi,REQUEST_VIEW_PASSWORD);
}
Program: 187758
Project: 187758
Buggy source:
protected void onListItemClick(ListView l,View v,int position,long id){
  super.onListItemClick(l,v,position,id);
  if (debug)   Log.d(TAG,"String_Node_Str" + position);
  if ((results == null) || (results.size() == 0)) {
    return;
  }
  Intent passView=new Intent(this,PassView.class);
  passView.putExtra(PassList.KEY_ID,results.get(position).id);
  if (debug)   Log.d(TAG,"String_Node_Str" + results.get(position).category);
  passView.putExtra(PassList.KEY_CATEGORY_ID,results.get(position).category);
  startActivityForResult(passView,REQUEST_VIEW_PASSWORD);
}

Fixed version (ground truth):
protected void onListItemClick(ListView l,View v,int position,long id){
  super.onListItemClick(l,v,position,id);
  if (debug)   Log.d(TAG,"String_Node_Str" + position);
  if ((results == null) || (results.size() == 0)) {
    return;
  }
  Intent passView=new Intent(this,PassView.class);
  passView.putExtra(PassList.KEY_ID,results.get(position).id);
  if (debug)   Log.d(TAG,"String_Node_Str" + results.get(position).category);
  passView.putExtra(PassList.KEY_CATEGORY_ID,results.get(position).category);
  passView.putExtra(PassList.KEY_ROWIDS,PassList.getRowsIds(results));
  passView.putExtra(PassList.KEY_LIST_POSITION,position);
  startActivityForResult(passView,REQUEST_VIEW_PASSWORD);
}
Program: 187759
Project: 187759
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) {
      if (debug)       Log.d(TAG,"String_Node_Str");
      if (service == null) {
        mServiceIntent=data;
        return;
      }
      setServiceParametersFromExtrasAndDispatchAction(data);
    }
 else {
      if (debug)       Log.d(TAG,"String_Node_Str");
      moveTaskToBack(true);
      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();
    if (debug)     Log.d(TAG,"String_Node_Str");
    actionDispatch();
  }
 catch (  RemoteException e) {
    Log.d(TAG,e.toString());
    finish();
  }
}
 else {
  if (debug)   Log.i(TAG,"String_Node_Str");
  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 (debug)       Log.d(TAG,"String_Node_Str");
      if (service == null) {
        mServiceIntent=data;
        delayedFinish=true;
        return;
      }
      setServiceParametersFromExtrasAndDispatchAction(data);
    }
 else {
      if (debug)       Log.d(TAG,"String_Node_Str");
      moveTaskToBack(true);
      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();
    if (debug)     Log.d(TAG,"String_Node_Str");
    actionDispatch();
  }
 catch (  RemoteException e) {
    Log.d(TAG,e.toString());
    finish();
  }
}
 else {
  if (debug)   Log.i(TAG,"String_Node_Str");
  actionDispatch();
}
break;
}
}
Program: 187760
Project: 187760
Buggy source:
@Override protected void onResume(){
  super.onResume();
  if (debug)   Log.d(TAG,"String_Node_Str");
  initService();
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  if (debug)   Log.d(TAG,"String_Node_Str");
  initService();
  if (delayedFinish == true) {
    delayedFinish=false;
    setResult(RESULT_OK);
    finish();
  }
}
Program: 187761
Project: 187761
Buggy source:
/** 
 */
@Override protected void onActivityResult(int requestCode,int resultCode,Intent i){
  super.onActivityResult(requestCode,resultCode,i);
  if (debug)   Log.d(TAG,"String_Node_Str");
  if (requestCode == REQUEST_EDIT_PASS) {
    if (resultCode == PassEdit.RESULT_DELETED) {
      entryEdited=true;
      finish();
    }
    if ((resultCode == RESULT_OK) || (PassEdit.entryEdited)) {
      View current=this.flipper.getCurrentView();
      populateFields(RowId,current);
      entryEdited=true;
    }
  }
}

Fixed version (ground truth):
/** 
 */
@Override protected void onActivityResult(int requestCode,int resultCode,Intent i){
  super.onActivityResult(requestCode,resultCode,i);
  if (debug)   Log.d(TAG,"String_Node_Str");
  if (requestCode == REQUEST_EDIT_PASS) {
    if (resultCode == PassEdit.RESULT_DELETED) {
      entryEdited=true;
      finish();
    }
    if ((resultCode == RESULT_OK) || (PassEdit.entryEdited)) {
      if (flipper != null) {
        View current=this.flipper.getCurrentView();
        populateFields(RowId,current);
      }
      entryEdited=true;
    }
  }
}
Program: 187762
Project: 187762
Buggy source:
@Override protected void onResume(){
  super.onResume();
  if (debug)   Log.d(TAG,"String_Node_Str");
  if (CategoryList.isSignedIn() == false) {
    startActivity(frontdoor);
    return;
  }
  IntentFilter filter=new IntentFilter(CryptoIntents.ACTION_CRYPTO_LOGGED_OUT);
  registerReceiver(mIntentReceiver,filter);
  Passwords.Initialize(this);
  if (flipper == null) {
    initFlipper();
  }
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  if (debug)   Log.d(TAG,"String_Node_Str");
  if (CategoryList.isSignedIn() == false) {
    startActivity(frontdoor);
    return;
  }
  IntentFilter filter=new IntentFilter(CryptoIntents.ACTION_CRYPTO_LOGGED_OUT);
  registerReceiver(mIntentReceiver,filter);
  Passwords.Initialize(this);
  if (flipper == null) {
    initFlipper();
  }
  if (entryEdited) {
    View current=this.flipper.getCurrentView();
    populateFields(RowId,current);
  }
}
Program: 187764
Project: 187764
Buggy source:
@Override protected void onActivityResult(int requestCode,int resultCode,Intent i){
  super.onActivityResult(requestCode,resultCode,i);
  if (((requestCode == REQUEST_VIEW_PASSWORD) && (PassView.entryEdited)) || (resultCode == RESULT_OK)) {
    searchThreadStart();
  }
}

Fixed version (ground truth):
@Override protected void onActivityResult(int requestCode,int resultCode,Intent i){
  super.onActivityResult(requestCode,resultCode,i);
  if (((requestCode == REQUEST_VIEW_PASSWORD) && (PassView.entryEdited)) || (resultCode == RESULT_OK)) {
    searchCriteria=etSearchCriteria.getText().toString().trim().toLowerCase();
    searchThreadStart();
  }
}
Program: 187765
Project: 187765
Buggy source:
/** 
 * @return
 */
public List<PassEntry> fetchAllRows(Long CategoryId){
  ArrayList<PassEntry> ret=new ArrayList<PassEntry>();
  try {
    Cursor c;
    if (CategoryId == 0) {
      c=db.query(TABLE_PASSWORDS,new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"},null,null,null,null,null);
    }
 else {
      c=db.query(TABLE_PASSWORDS,new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"},"String_Node_Str" + CategoryId,null,null,null,null);
    }
    int numRows=c.getCount();
    c.moveToFirst();
    for (int i=0; i < numRows; ++i) {
      PassEntry row=new PassEntry();
      row.id=c.getLong(0);
      row.password=c.getString(1);
      row.description=c.getString(2);
      row.username=c.getString(3);
      row.website=c.getString(4);
      row.note=c.getString(5);
      row.category=c.getLong(6);
      row.uniqueName=c.getString(7);
      row.lastEdited=c.getString(8);
      ret.add(row);
      c.moveToNext();
    }
    c.close();
  }
 catch (  SQLException e) {
    Log.d(TAG,"String_Node_Str" + e.getLocalizedMessage());
  }
  return ret;
}

Fixed version (ground truth):
/** 
 * @return
 */
public List<PassEntry> fetchAllRows(Long CategoryId){
  ArrayList<PassEntry> ret=new ArrayList<PassEntry>();
  if (db == null) {
    return ret;
  }
  try {
    Cursor c;
    if (CategoryId == 0) {
      c=db.query(TABLE_PASSWORDS,new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"},null,null,null,null,null);
    }
 else {
      c=db.query(TABLE_PASSWORDS,new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"},"String_Node_Str" + CategoryId,null,null,null,null);
    }
    int numRows=c.getCount();
    c.moveToFirst();
    for (int i=0; i < numRows; ++i) {
      PassEntry row=new PassEntry();
      row.id=c.getLong(0);
      row.password=c.getString(1);
      row.description=c.getString(2);
      row.username=c.getString(3);
      row.website=c.getString(4);
      row.note=c.getString(5);
      row.category=c.getLong(6);
      row.uniqueName=c.getString(7);
      row.lastEdited=c.getString(8);
      ret.add(row);
      c.moveToNext();
    }
    c.close();
  }
 catch (  SQLException e) {
    Log.d(TAG,"String_Node_Str" + e.getLocalizedMessage());
  }
  return ret;
}
Program: 187766
Project: 187766
Buggy source:
@Override public boolean onCreateOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  menu.add(0,MENU_NEW_FOLDER,0,R.string.menu_new_folder).setIcon(android.R.drawable.ic_menu_add).setShortcut('0','f');
  mIncludeMediaScanMenuItem=menu.add(0,MENU_INCLUDE_IN_MEDIA_SCAN,0,R.string.menu_include_in_media_scan).setShortcut('1','s').setIcon(android.R.drawable.ic_menu_gallery);
  mExcludeMediaScanMenuItem=menu.add(0,MENU_EXCLUDE_FROM_MEDIA_SCAN,0,R.string.menu_exclude_from_media_scan).setShortcut('1','s').setIcon(android.R.drawable.ic_menu_gallery);
  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');
  return true;
}

Fixed version (ground truth):
@Override public boolean onCreateOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  menu.add(0,MENU_NEW_FOLDER,0,R.string.menu_new_folder).setIcon(android.R.drawable.ic_menu_add).setShortcut('0','f');
  mIncludeMediaScanMenuItem=menu.add(0,MENU_INCLUDE_IN_MEDIA_SCAN,0,R.string.menu_include_in_media_scan).setShortcut('1','s').setIcon(android.R.drawable.ic_menu_gallery);
  mExcludeMediaScanMenuItem=menu.add(0,MENU_EXCLUDE_FROM_MEDIA_SCAN,0,R.string.menu_exclude_from_media_scan).setShortcut('1','s').setIcon(android.R.drawable.ic_menu_gallery);
  UpdateMenu.addUpdateMenu(this,menu,0,MENU_UPDATE,0,R.string.menu_update);
  menu.add(0,MENU_ABOUT,0,R.string.about).setIcon(android.R.drawable.ic_menu_info_details).setShortcut('0','a');
  return true;
}
Program: 187767
Project: 187767
Buggy source:
@Override public boolean onCreateOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  menu.add(0,MENU_COLOR,0,R.string.color).setIcon(android.R.drawable.ic_menu_manage).setShortcut('3','c');
  menu.add(0,MENU_SETTINGS,0,R.string.preferences).setIcon(android.R.drawable.ic_menu_preferences).setShortcut('4','p');
  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');
  return true;
}

Fixed version (ground truth):
@Override public boolean onCreateOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  menu.add(0,MENU_COLOR,0,R.string.color).setIcon(android.R.drawable.ic_menu_manage).setShortcut('3','c');
  menu.add(0,MENU_SETTINGS,0,R.string.preferences).setIcon(android.R.drawable.ic_menu_preferences).setShortcut('4','p');
  UpdateMenu.addUpdateMenu(this,menu,0,MENU_UPDATE,0,R.string.menu_update);
  menu.add(0,MENU_ABOUT,0,R.string.about).setIcon(android.R.drawable.ic_menu_info_details).setShortcut('0','a');
  return true;
}
Program: 187768
Project: 187768
Buggy source:
@Override public boolean onCreateOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  if (mExtraItems != null) {
    menu.add(0,MENU_INSERT_FROM_EXTRAS,0,R.string.menu_auto_add).setIcon(android.R.drawable.ic_menu_upload);
  }
  menu.add(0,MENU_NEW_LIST,0,R.string.new_list).setIcon(R.drawable.ic_menu_add_list).setShortcut('0','n');
  menu.add(0,MENU_CLEAN_UP_LIST,0,R.string.clean_up_list).setIcon(R.drawable.ic_menu_clean_up).setShortcut('1','c');
  ;
  menu.add(0,MENU_PICK_ITEMS,0,R.string.menu_pick_items).setIcon(android.R.drawable.ic_menu_add).setShortcut('2','p');
  ;
  menu.add(0,MENU_THEME,0,R.string.theme).setIcon(android.R.drawable.ic_menu_manage).setShortcut('3','t');
  menu.add(0,MENU_PREFERENCES,0,R.string.preferences).setIcon(android.R.drawable.ic_menu_preferences).setShortcut('4','p');
  menu.add(0,MENU_RENAME_LIST,0,R.string.rename_list).setIcon(android.R.drawable.ic_menu_edit).setShortcut('5','r');
  menu.add(0,MENU_DELETE_LIST,0,R.string.delete_list).setIcon(android.R.drawable.ic_menu_delete).setShortcut('6','d');
  menu.add(0,MENU_SEND,0,R.string.send).setIcon(android.R.drawable.ic_menu_send).setShortcut('7','s');
  if (addLocationAlertPossible()) {
    menu.add(0,MENU_ADD_LOCATION_ALERT,0,R.string.shopping_add_alert).setIcon(android.R.drawable.ic_menu_mylocation).setShortcut('8','l');
  }
  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');
  return true;
}

Fixed version (ground truth):
@Override public boolean onCreateOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  if (mExtraItems != null) {
    menu.add(0,MENU_INSERT_FROM_EXTRAS,0,R.string.menu_auto_add).setIcon(android.R.drawable.ic_menu_upload);
  }
  menu.add(0,MENU_NEW_LIST,0,R.string.new_list).setIcon(R.drawable.ic_menu_add_list).setShortcut('0','n');
  menu.add(0,MENU_CLEAN_UP_LIST,0,R.string.clean_up_list).setIcon(R.drawable.ic_menu_clean_up).setShortcut('1','c');
  ;
  menu.add(0,MENU_PICK_ITEMS,0,R.string.menu_pick_items).setIcon(android.R.drawable.ic_menu_add).setShortcut('2','p');
  ;
  menu.add(0,MENU_THEME,0,R.string.theme).setIcon(android.R.drawable.ic_menu_manage).setShortcut('3','t');
  menu.add(0,MENU_PREFERENCES,0,R.string.preferences).setIcon(android.R.drawable.ic_menu_preferences).setShortcut('4','p');
  menu.add(0,MENU_RENAME_LIST,0,R.string.rename_list).setIcon(android.R.drawable.ic_menu_edit).setShortcut('5','r');
  menu.add(0,MENU_DELETE_LIST,0,R.string.delete_list).setIcon(android.R.drawable.ic_menu_delete).setShortcut('6','d');
  menu.add(0,MENU_SEND,0,R.string.send).setIcon(android.R.drawable.ic_menu_send).setShortcut('7','s');
  if (addLocationAlertPossible()) {
    menu.add(0,MENU_ADD_LOCATION_ALERT,0,R.string.shopping_add_alert).setIcon(android.R.drawable.ic_menu_mylocation).setShortcut('8','l');
  }
  UpdateMenu.addUpdateMenu(this,menu,0,MENU_UPDATE,0,R.string.menu_update);
  menu.add(0,MENU_ABOUT,0,R.string.about).setIcon(android.R.drawable.ic_menu_info_details).setShortcut('0','a');
  return true;
}
Program: 187769
Project: 187769
Buggy source:
@Override public boolean onCreateOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  menu.add(0,MENU_ITEM_INSERT,0,R.string.menu_insert).setShortcut('1','i').setIcon(android.R.drawable.ic_menu_add);
  menu.add(0,MENU_SEARCH,0,R.string.menu_search).setShortcut('2','s').setIcon(android.R.drawable.ic_menu_search);
  menu.add(0,MENU_OPEN,0,R.string.menu_open_from_sdcard).setShortcut('3','o').setIcon(R.drawable.ic_menu_folder);
  UpdateMenu.addUpdateMenu(this,menu,0,MENU_UPDATE,0,R.string.update);
  menu.add(0,MENU_SETTINGS,0,R.string.settings).setIcon(android.R.drawable.ic_menu_preferences).setShortcut('9','s');
  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());
  if (debug)   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;
}

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('1','i').setIcon(android.R.drawable.ic_menu_add);
  menu.add(0,MENU_SEARCH,0,R.string.menu_search).setShortcut('2','s').setIcon(android.R.drawable.ic_menu_search);
  menu.add(0,MENU_OPEN,0,R.string.menu_open_from_sdcard).setShortcut('3','o').setIcon(R.drawable.ic_menu_folder);
  UpdateMenu.addUpdateMenu(this,menu,0,MENU_UPDATE,0,R.string.menu_update);
  menu.add(0,MENU_SETTINGS,0,R.string.settings).setIcon(android.R.drawable.ic_menu_preferences).setShortcut('9','s');
  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());
  if (debug)   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: 187770
Project: 187770
Buggy source:
private void openFile(File aFile){
  if (!aFile.exists()) {
    Toast.makeText(this,R.string.error_file_does_not_exists,Toast.LENGTH_SHORT).show();
    return;
  }
  Intent intent=new Intent(android.content.Intent.ACTION_VIEW);
  Uri data=FileUtils.getUri(aFile);
  String type=mMimeTypes.getMimeType(aFile.getName());
  intent.setDataAndType(data,type);
  Intent originalIntent=getIntent();
  if (originalIntent != null && originalIntent.getAction() != null && originalIntent.getAction().equals(Intent.ACTION_GET_CONTENT)) {
    setResult(RESULT_OK,intent);
    finish();
    return;
  }
  try {
    startActivity(intent);
  }
 catch (  ActivityNotFoundException e) {
    Toast.makeText(this,R.string.application_not_available,Toast.LENGTH_SHORT).show();
  }
  ;
}

Fixed version (ground truth):
private void openFile(File aFile){
  if (!aFile.exists()) {
    Toast.makeText(this,R.string.error_file_does_not_exists,Toast.LENGTH_SHORT).show();
    return;
  }
  Intent intent=new Intent(android.content.Intent.ACTION_VIEW);
  Uri data=FileUtils.getUri(aFile);
  String type=mMimeTypes.getMimeType(aFile.getName());
  intent.setDataAndType(data,type);
  Intent originalIntent=getIntent();
  if (originalIntent != null && originalIntent.getAction() != null && originalIntent.getAction().equals(Intent.ACTION_GET_CONTENT)) {
    intent.setData(Uri.parse(FileManagerProvider.MIME_TYPE_PREFIX + aFile));
    setResult(RESULT_OK,intent);
    finish();
    return;
  }
  try {
    startActivity(intent);
  }
 catch (  ActivityNotFoundException e) {
    Toast.makeText(this,R.string.application_not_available,Toast.LENGTH_SHORT).show();
  }
  ;
}