Program: 187848
Project: 187848
Buggy source:
/** 
 * Called when the activity is first created.
 */
@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  if (!EulaActivity.checkEula(this)) {
    return;
  }
  setContentView(R.layout.shopping);
  mGTalkSender=new GTalkSender(this);
  mUpdateInterval=2000;
  mUpdating=false;
  mListUri=Shopping.Lists.CONTENT_URI;
  mItemUri=Shopping.Items.CONTENT_URI;
  int defaultShoppingList=initFromPreferences();
  final Intent intent=getIntent();
  final String type=intent.resolveType(this);
  final String action=intent.getAction();
  if (action == null) {
    mState=STATE_MAIN;
    mListUri=Uri.withAppendedPath(Shopping.Lists.CONTENT_URI,"String_Node_Str" + defaultShoppingList);
    intent.setData(mListUri);
  }
 else   if (Intent.ACTION_MAIN.equals(action)) {
    mState=STATE_MAIN;
    mListUri=Uri.withAppendedPath(Shopping.Lists.CONTENT_URI,"String_Node_Str" + defaultShoppingList);
    intent.setData(mListUri);
  }
 else   if (Intent.ACTION_VIEW.equals(action)) {
    mState=STATE_VIEW_LIST;
    if (Shopping.ITEM_TYPE.equals(type)) {
      mListUri=Shopping.getListForItem(this,intent.getData().getLastPathSegment());
    }
 else     if (intent.getData() != null) {
      mListUri=intent.getData();
    }
  }
 else   if (Intent.ACTION_INSERT.equals(action)) {
    mState=STATE_VIEW_LIST;
    if (Shopping.ITEM_TYPE.equals(type)) {
      mListUri=Shopping.getListForItem(getApplicationContext(),intent.getData().getLastPathSegment());
    }
 else     if (intent.getData() != null) {
      mListUri=intent.getData();
    }
  }
 else   if (Intent.ACTION_PICK.equals(action)) {
    mState=STATE_PICK_ITEM;
    mListUri=Uri.withAppendedPath(Shopping.Lists.CONTENT_URI,"String_Node_Str" + defaultShoppingList);
  }
 else   if (Intent.ACTION_GET_CONTENT.equals(action)) {
    mState=STATE_GET_CONTENT_ITEM;
    mListUri=Uri.withAppendedPath(Shopping.Lists.CONTENT_URI,"String_Node_Str" + defaultShoppingList);
  }
 else {
    Log.e(TAG,"String_Node_Str");
    finish();
    return;
  }
  createView();
  fillListFilter();
  int selectList;
  try {
    selectList=Integer.parseInt(mListUri.getLastPathSegment());
  }
 catch (  NumberFormatException e) {
    selectList=defaultShoppingList;
  }
  setSelectedListId(selectList);
  mSensorManager=(SensorManager)getSystemService(SENSOR_SERVICE);
  bindGTalkIfNeeded();
  if (icicle != null) {
    String prevText=icicle.getString(ORIGINAL_ITEM);
    if (prevText != null) {
      mEditText.setTextKeepState(prevText);
    }
    mTextEntryMenu=icicle.getInt(BUNDLE_TEXT_ENTRY_MENU);
  }
  mEditText.requestFocus();
  initFromPreferences();
  onModeChanged();
}

Fixed version (ground truth):
/** 
 * Called when the activity is first created.
 */
@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  if (!EulaActivity.checkEula(this)) {
    return;
  }
  setContentView(R.layout.shopping);
  mEditItemPosition=-1;
  mGTalkSender=new GTalkSender(this);
  mUpdateInterval=2000;
  mUpdating=false;
  mListUri=Shopping.Lists.CONTENT_URI;
  mItemUri=Shopping.Items.CONTENT_URI;
  int defaultShoppingList=initFromPreferences();
  final Intent intent=getIntent();
  final String type=intent.resolveType(this);
  final String action=intent.getAction();
  if (action == null) {
    mState=STATE_MAIN;
    mListUri=Uri.withAppendedPath(Shopping.Lists.CONTENT_URI,"String_Node_Str" + defaultShoppingList);
    intent.setData(mListUri);
  }
 else   if (Intent.ACTION_MAIN.equals(action)) {
    mState=STATE_MAIN;
    mListUri=Uri.withAppendedPath(Shopping.Lists.CONTENT_URI,"String_Node_Str" + defaultShoppingList);
    intent.setData(mListUri);
  }
 else   if (Intent.ACTION_VIEW.equals(action)) {
    mState=STATE_VIEW_LIST;
    if (Shopping.ITEM_TYPE.equals(type)) {
      mListUri=Shopping.getListForItem(this,intent.getData().getLastPathSegment());
    }
 else     if (intent.getData() != null) {
      mListUri=intent.getData();
    }
  }
 else   if (Intent.ACTION_INSERT.equals(action)) {
    mState=STATE_VIEW_LIST;
    if (Shopping.ITEM_TYPE.equals(type)) {
      mListUri=Shopping.getListForItem(getApplicationContext(),intent.getData().getLastPathSegment());
    }
 else     if (intent.getData() != null) {
      mListUri=intent.getData();
    }
  }
 else   if (Intent.ACTION_PICK.equals(action)) {
    mState=STATE_PICK_ITEM;
    mListUri=Uri.withAppendedPath(Shopping.Lists.CONTENT_URI,"String_Node_Str" + defaultShoppingList);
  }
 else   if (Intent.ACTION_GET_CONTENT.equals(action)) {
    mState=STATE_GET_CONTENT_ITEM;
    mListUri=Uri.withAppendedPath(Shopping.Lists.CONTENT_URI,"String_Node_Str" + defaultShoppingList);
  }
 else {
    Log.e(TAG,"String_Node_Str");
    finish();
    return;
  }
  createView();
  fillListFilter();
  int selectList;
  try {
    selectList=Integer.parseInt(mListUri.getLastPathSegment());
  }
 catch (  NumberFormatException e) {
    selectList=defaultShoppingList;
  }
  setSelectedListId(selectList);
  mSensorManager=(SensorManager)getSystemService(SENSOR_SERVICE);
  bindGTalkIfNeeded();
  if (icicle != null) {
    String prevText=icicle.getString(ORIGINAL_ITEM);
    if (prevText != null) {
      mEditText.setTextKeepState(prevText);
    }
    mTextEntryMenu=icicle.getInt(BUNDLE_TEXT_ENTRY_MENU);
    mEditItemPosition=icicle.getInt(BUNDLE_CURSOR_ITEMS_POSITION);
  }
  mEditText.requestFocus();
  initFromPreferences();
  onModeChanged();
}