nus-yam/ex-repair huggingface dataset:
Program: 114695
Project: 114695
Buggy source:
private void selectItem(int position){
  currentSelectedPosition=position;
  if (drawerListView != null) {
    drawerListView.setItemChecked(position,true);
  }
  if (drawerLayout != null) {
    drawerLayout.closeDrawer(fragmentContainerView);
  }
  if (callbacks != null) {
    callbacks.onNavigationDrawerItemSelected(position);
  }
}

Fixed version (ground truth):
private void selectItem(int position){
  currentSelectedPosition=position;
  if (drawerListView != null) {
    drawerListView.setItemChecked(position,true);
  }
  if (drawerLayout != null) {
    drawerLayout.closeDrawer(fragmentContainerView);
  }
  if (navigationDrawerCallbacks != null) {
    navigationDrawerCallbacks.onNavigationDrawerItemSelected(position);
  }
}
Program: 114696
Project: 114696
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View rootView=inflater.inflate(R.layout.fragment_navigation_drawer,container,false);
  initUI(rootView);
  initListeners();
  NavigationDrawerAdapter navigationDrawerAdapter=new NavigationDrawerAdapter(baseActivity,getNavigationDrawerItems());
  drawerListView.setAdapter(navigationDrawerAdapter);
  drawerListView.setItemChecked(currentSelectedPosition,true);
  QBUser user=App.getInstance().getUser();
  if (user != null) {
    fullnameTextView.setText(user.getFullName());
  }
  return rootView;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View rootView=inflater.inflate(R.layout.fragment_navigation_drawer,container,false);
  initUI(rootView);
  initListeners();
  NavigationDrawerAdapter navigationDrawerAdapter=new NavigationDrawerAdapter(baseActivity,getNavigationDrawerItems());
  drawerListView.setAdapter(navigationDrawerAdapter);
  drawerListView.setItemChecked(currentSelectedPosition,true);
  return rootView;
}
Program: 114697
Project: 114697
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_friend_details);
  avatarImageView=_findViewById(R.id.avatarImageView);
  nameTextView=_findViewById(R.id.nameTextView);
  onlineImageView=_findViewById(R.id.onlineImageView);
  onlineStatusTextView=_findViewById(R.id.onlineStatusTextView);
  phoneTextView=_findViewById(R.id.phoneTextView);
  phoneView=_findViewById(R.id.phoneView);
  addAction(QBServiceConsts.REMOVE_FRIEND_SUCCESS_ACTION,new RemoveFriendSuccessAction());
  addAction(QBServiceConsts.REMOVE_FRIEND_FAIL_ACTION,failAction);
  addAction(QBServiceConsts.GET_FILE_FAIL_ACTION,failAction);
  updateBroadcastActionList();
  friend=(Friend)getIntent().getExtras().getSerializable(EXTRA_FRIEND);
  fillUI(friend);
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_friend_details);
  avatarImageView=_findViewById(R.id.avatarImageView);
  nameTextView=_findViewById(R.id.nameTextView);
  onlineImageView=_findViewById(R.id.onlineImageView);
  onlineStatusTextView=_findViewById(R.id.onlineStatusTextView);
  phoneTextView=_findViewById(R.id.phoneTextView);
  phoneView=_findViewById(R.id.phoneView);
  addAction(QBServiceConsts.REMOVE_FRIEND_SUCCESS_ACTION,new RemoveFriendSuccessAction());
  addAction(QBServiceConsts.REMOVE_FRIEND_FAIL_ACTION,failAction);
  addAction(QBServiceConsts.GET_FILE_FAIL_ACTION,failAction);
  updateBroadcastActionList();
  friend=(Friend)getIntent().getExtras().getSerializable(EXTRA_FRIEND);
  initFriendsFields(friend);
}
Program: 114698
Project: 114698
Buggy source:
public static Cursor getAllPrivateChatMessagesBySenderId(Context context,int senderId){
  return context.getContentResolver().query(FriendTable.CONTENT_URI,null,null,null,PrivateChatMessagesTable.Cols.ID + "String_Node_Str" + PrivateChatMessagesTable.Cols.SENDER_NAME+ "String_Node_Str");
}

Fixed version (ground truth):
public static Cursor getAllPrivateChatMessagesBySenderId(Context context,int senderId){
  return context.getContentResolver().query(PrivateChatMessagesTable.CONTENT_URI,null,PrivateChatMessagesTable.Cols.SENDER_ID + "String_Node_Str" + senderId,null,null);
}
Program: 114699
Project: 114699
Buggy source:
public static void savePrivateChatMessage(Context context,ChatMessage message){
  ContentValues values=new ContentValues();
  values.put(PrivateChatMessagesTable.Cols.ID,message.getId());
  values.put(PrivateChatMessagesTable.Cols.SUBJECT,message.getSubject());
  values.put(PrivateChatMessagesTable.Cols.BODY,message.getBody());
  values.put(PrivateChatMessagesTable.Cols.SENDER_NAME,message.getSenderName());
  values.put(PrivateChatMessagesTable.Cols.SENDER_ID,message.getSenderId());
  values.put(PrivateChatMessagesTable.Cols.TIME,DateUtils.dateToLong(message.getTime()));
  values.put(PrivateChatMessagesTable.Cols.INCOMING,message.isIncoming());
  context.getContentResolver().insert(PrivateChatMessagesTable.CONTENT_URI,values);
}

Fixed version (ground truth):
public static void savePrivateChatMessage(Context context,ChatMessage message){
  ContentValues values=new ContentValues();
  values.put(PrivateChatMessagesTable.Cols.SUBJECT,message.getSubject());
  values.put(PrivateChatMessagesTable.Cols.BODY,message.getBody());
  values.put(PrivateChatMessagesTable.Cols.SENDER_NAME,message.getSenderName());
  values.put(PrivateChatMessagesTable.Cols.SENDER_ID,message.getSenderId());
  values.put(PrivateChatMessagesTable.Cols.TIME,message.getTime());
  values.put(PrivateChatMessagesTable.Cols.INCOMING,message.isIncoming());
  context.getContentResolver().insert(PrivateChatMessagesTable.CONTENT_URI,values);
}
Program: 114700
Project: 114700
Buggy source:
public Date getTime(){
  return time;
}

Fixed version (ground truth):
public long getTime(){
  return time;
}
Program: 114701
Project: 114701
Buggy source:
public void setTime(Date time){
  this.time=time;
}

Fixed version (ground truth):
public void setTime(long time){
  this.time=time;
}
Program: 114702
Project: 114702
Buggy source:
private void initChat(){
  QBChatService qbChatService;
  QBPrivateChatManager qbPrivateChatManager;
  qbChatService=QBChatService.getInstance();
  try {
    qbChatService.login(App.getInstance().getUser());
  }
 catch (  XMPPException e) {
    e.printStackTrace();
  }
catch (  IOException e) {
    e.printStackTrace();
  }
catch (  SmackException e) {
    e.printStackTrace();
  }
  qbPrivateChatManager=qbChatService.getPrivateChatManager();
  qbPrivateChatManager.addPrivateChatManagerListener(this);
  qbPrivateChat=qbPrivateChatManager.createChat(opponentFriend.getId(),this);
}

Fixed version (ground truth):
private void initChat(){
  QBPrivateChatManager qbPrivateChatManager;
  qbChatService=QBChatService.getInstance();
  if (!qbChatService.isLoggedIn()) {
    loginToChat();
  }
  qbPrivateChatManager=qbChatService.getPrivateChatManager();
  qbPrivateChatManager.addPrivateChatManagerListener(this);
  qbPrivateChat=qbPrivateChatManager.createChat(opponentFriend.getId(),this);
}
Program: 114703
Project: 114703
Buggy source:
public void sendMessageOnClick(View view){
  Message message=getMessage();
  try {
    qbPrivateChat.sendMessage(message);
    saveMessageToCache(message);
  }
 catch (  XMPPException e) {
    e.printStackTrace();
  }
catch (  SmackException.NotConnectedException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void sendMessageOnClick(View view){
  Message message=getMessage();
  try {
    qbPrivateChat.sendMessage(message);
  }
 catch (  XMPPException e) {
    e.printStackTrace();
  }
catch (  SmackException.NotConnectedException e) {
    e.printStackTrace();
  }
  saveMessageToCache(message);
  messageEditText.setText("String_Node_Str");
}
Program: 114704
Project: 114704
Buggy source:
protected BaseAdapter getMessagesAdapter(){
  Cursor cursor=getAllPrivateChatMessagesBySenderId();
  if (cursor != null) {
    return new PrivateChatMessagesAdapter(this,getAllPrivateChatMessagesBySenderId());
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
protected BaseAdapter getMessagesAdapter(){
  return new PrivateChatMessagesAdapter(this,getAllPrivateChatMessages());
}
Program: 114705
Project: 114705
Buggy source:
private void saveMessageToCache(Message message){
  ChatMessage chatMessage=new ChatMessage();
  chatMessage.setSubject(message.getSubject());
  chatMessage.setBody(message.getBody());
  chatMessage.setSenderName(opponentFriend.getEmail());
  chatMessage.setSenderId(opponentFriend.getId());
  chatMessage.setTime(new Date(System.currentTimeMillis()));
  DatabaseManager.savePrivateChatMessage(this,chatMessage);
}

Fixed version (ground truth):
private void saveMessageToCache(Message message){
  ChatMessage chatMessage=new ChatMessage();
  chatMessage.setSubject(message.getSubject());
  chatMessage.setBody(message.getBody());
  chatMessage.setSenderName(opponentFriend.getEmail());
  chatMessage.setSenderId(opponentFriend.getId());
  chatMessage.setTime(System.currentTimeMillis());
  DatabaseManager.savePrivateChatMessage(this,chatMessage);
}
Program: 114706
Project: 114706
Buggy source:
@Override public void bindView(View view,Context context,Cursor cursor){
  ViewHolder holder=(ViewHolder)view.getTag();
  String subject=cursor.getString(cursor.getColumnIndex(PrivateChatMessagesTable.Cols.SUBJECT));
  String body=cursor.getString(cursor.getColumnIndex(PrivateChatMessagesTable.Cols.BODY));
  String senderName=cursor.getString(cursor.getColumnIndex(PrivateChatMessagesTable.Cols.SENDER_NAME));
  String time=cursor.getString(cursor.getColumnIndex(PrivateChatMessagesTable.Cols.TIME));
  holder.messageTextView.setText(body);
  holder.nameTextView.setText(senderName);
  holder.timeTextView.setText(time);
}

Fixed version (ground truth):
@Override public void bindView(View view,Context context,Cursor cursor){
  ViewHolder holder=(ViewHolder)view.getTag();
  String subject=cursor.getString(cursor.getColumnIndex(PrivateChatMessagesTable.Cols.SUBJECT));
  String body=cursor.getString(cursor.getColumnIndex(PrivateChatMessagesTable.Cols.BODY));
  String senderName=cursor.getString(cursor.getColumnIndex(PrivateChatMessagesTable.Cols.SENDER_NAME));
  long time=cursor.getLong(cursor.getColumnIndex(PrivateChatMessagesTable.Cols.TIME));
  holder.messageTextView.setText(body);
  holder.nameTextView.setText(senderName);
  holder.timeTextView.setText(DateUtils.longToMessageDate(time));
}
Program: 114707
Project: 114707
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setHasOptionsMenu(true);
  title=getString(R.string.nvd_title_friends);
  state=State.FRIENDS_LIST;
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  title=getString(R.string.nvd_title_friends);
  state=State.FRIENDS_LIST;
}
Program: 114708
Project: 114708
Buggy source:
@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  addActionsAddFriend();
}

Fixed version (ground truth):
@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  addActionsAddFriend();
  setHasOptionsMenu(true);
}
Program: 114709
Project: 114709
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  title=getString(R.string.nvd_title_friends);
  state=State.FRIENDS_LIST;
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setHasOptionsMenu(true);
  title=getString(R.string.nvd_title_friends);
  state=State.FRIENDS_LIST;
}
Program: 114710
Project: 114710
Buggy source:
@Override public void onItemClick(AdapterView<?> parent,final View view,int position,long id){
  Cursor selectedItem=(Cursor)friendsListAdapter.getItem(position - headersAndFootersCounter);
  FriendDetailsActivity.start(baseActivity,DatabaseManager.getFriendFromCursor(selectedItem));
}

Fixed version (ground truth):
@Override public void onItemClick(AdapterView<?> parent,final View view,int position,long id){
  if (position == Consts.ZERO_VALUE) {
    return;
  }
  Cursor selectedItem=(Cursor)friendsListAdapter.getItem(position - headersAndFootersCounter);
  FriendDetailsActivity.start(baseActivity,DatabaseManager.getFriendFromCursor(selectedItem));
}
Program: 114711
Project: 114711
Buggy source:
public void hideProgress(){
  if (progress != null) {
    progress.dismissAllowingStateLoss();
  }
}

Fixed version (ground truth):
public void hideProgress(){
  if (progress != null && progress.isVisible()) {
    progress.dismissAllowingStateLoss();
  }
}
Program: 114712
Project: 114712
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setHasOptionsMenu(true);
  title=getString(R.string.nvd_title_friends);
  state=State.FRIENDS_LIST;
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  title=getString(R.string.nvd_title_friends);
  state=State.FRIENDS_LIST;
}
Program: 114713
Project: 114713
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View rootView=inflater.inflate(R.layout.fragment_navigation_drawer,container,false);
  drawerListView=(ListView)rootView.findViewById(R.id.navigationList);
  drawerListView.setOnItemClickListener(new AdapterView.OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      selectItem(position);
    }
  }
);
  drawerListView.setAdapter(new ArrayAdapter<String>(baseActivity.getActionBar().getThemedContext(),R.layout.list_item_navigation_drawler,R.id.textView,new String[]{getString(R.string.nvd_title_friends),getString(R.string.nvd_title_chats),getString(R.string.nvd_title_settings),getString(R.string.nvd_title_invite_friends)}));
  drawerListView.setItemChecked(currentSelectedPosition,true);
  logoutButton=(ImageButton)rootView.findViewById(R.id.logoutButton);
  logoutButton.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      logout();
    }
  }
);
  fullName=(TextView)rootView.findViewById(R.id.fullname);
  QBUser user=App.getInstance().getUser();
  if (user != null) {
    fullName.setText(user.getFullName());
  }
  return rootView;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View rootView=inflater.inflate(R.layout.fragment_navigation_drawer,container,false);
  drawerListView=(ListView)rootView.findViewById(R.id.navigationList);
  drawerListView.setOnItemClickListener(new AdapterView.OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      selectItem(position);
    }
  }
);
  drawerListView.setAdapter(new ArrayAdapter<String>(baseActivity.getActionBar().getThemedContext(),R.layout.list_item_navigation_drawler,R.id.textView,new String[]{getString(R.string.nvd_title_friends),getString(R.string.nvd_title_chats),getString(R.string.nvd_title_settings),getString(R.string.nvd_title_invite_friends)}));
  drawerListView.setItemChecked(currentSelectedPosition,true);
  logoutButton=(ImageButton)rootView.findViewById(R.id.logoutImageButton);
  logoutButton.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      logout();
    }
  }
);
  fullName=(TextView)rootView.findViewById(R.id.fullnameTextView);
  QBUser user=App.getInstance().getUser();
  if (user != null) {
    fullName.setText(user.getFullName());
  }
  return rootView;
}
Program: 114714
Project: 114714
Buggy source:
@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  setHasOptionsMenu(true);
  baseActivity.addAction(QBServiceConsts.LOGOUT_SUCCESS_ACTION,new LogoutSuccessAction());
  baseActivity.addAction(QBServiceConsts.LOGOUT_FAIL_ACTION,new BaseActivity.FailAction(baseActivity));
  baseActivity.updateBroadcastActionList();
}

Fixed version (ground truth):
@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  setHasOptionsMenu(true);
  baseActivity.addAction(QBServiceConsts.LOGOUT_SUCCESS_ACTION,new LogoutSuccessAction());
  baseActivity.addAction(QBServiceConsts.LOGOUT_FAIL_ACTION,new BaseActivity.FailAction(baseActivity));
  baseActivity.updateBroadcastActionList();
  baseActivity.getActionBar().setIcon(android.R.color.transparent);
  baseActivity.getActionBar().setDisplayShowHomeEnabled(true);
}
Program: 114717
Project: 114717
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  useDoubleBackPressed=true;
  NavigationDrawerFragment navigationDrawerFragment=(NavigationDrawerFragment)getFragmentManager().findFragmentById(R.id.navigation_drawer);
  if (!isImportInitialized) {
    showProgress();
    facebookHelper=new FacebookHelper(this,savedInstanceState,new FacebookSessionStatusCallback());
    importFriends=new ImportFriends(MainActivity.this,facebookHelper);
  }
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  useDoubleBackPressed=true;
  isImportInitialized=App.getInstance().getPrefsHelper().getPref(PrefsHelper.PREF_IMPORT_INITIALIZED,false);
  initNavigationDrawer();
  if (!isImportInitialized) {
    showProgress();
    facebookHelper=new FacebookHelper(this,savedInstanceState,new FacebookSessionStatusCallback());
    importFriends=new ImportFriends(MainActivity.this,facebookHelper);
  }
}
Program: 114718
Project: 114718
Buggy source:
@Override public void onNavigationDrawerItemSelected(int position){
  Fragment fragment=null;
switch (position) {
case ID_FRIEND_LIST_FRAGMENT:
    fragment=FriendListFragment.newInstance();
  break;
case ID_CHAT_LIST_FRAGMENT:
fragment=ChatsListFragment.newInstance();
break;
case ID_SETTINGS_FRAGMENT:
fragment=SettingsFragment.newInstance();
break;
case ID_INVITE_FRIENDS_FRAGMENT:
fragment=InviteFriendsFragment.newInstance();
break;
}
setCurrentFragment(fragment);
}

Fixed version (ground truth):
@Override public void onNavigationDrawerItemSelected(int position){
  Fragment fragment=null;
switch (position) {
case ID_FRIEND_LIST_FRAGMENT:
    fragment=FriendListFragment.newInstance();
  break;
case ID_CHATS_LIST_FRAGMENT:
fragment=ChatsListFragment.newInstance();
break;
case ID_SETTINGS_FRAGMENT:
fragment=SettingsFragment.newInstance();
break;
case ID_INVITE_FRIENDS_FRAGMENT:
fragment=InviteFriendsFragment.newInstance();
break;
}
setCurrentFragment(fragment);
}
Program: 114719
Project: 114719
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_profile);
  findViewById(this);
  linearLayoutChangeAvatar.setOnClickListener(linearLayoutChangeAvatarOnClickListener);
  textViewChangeFullName.setOnClickListener(textViewChangeFullNameOnClickListener);
  textViewChangeEmail.setOnClickListener(textViewChangeEmailOnClickListener);
  textViewChangeStatusMessage.setOnClickListener(textViewChangeStatusMessageOnClickListener);
  actionBar.setDisplayHomeAsUpEnabled(true);
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_profile);
  findViewById(this);
  linearLayoutChangeAvatar.setOnClickListener(linearLayoutChangeAvatarOnClickListener);
  textViewChangeFullName.setOnClickListener(textViewChangeFullNameOnClickListener);
  textViewChangeEmail.setOnClickListener(textViewChangeEmailOnClickListener);
  textViewChangeStatusMessage.setOnClickListener(textViewChangeStatusMessageOnClickListener);
  imageHelper=new ImageHelper(this);
}
Program: 114720
Project: 114720
Buggy source:
@Override protected void onActivityResult(int requestCode,int resultCode,Intent data){
  if (requestCode == REQUEST_CODE && resultCode == Activity.RESULT_OK)   try {
    pathToImage=getPath(data.getData());
    if (bitmap != null) {
      bitmap.recycle();
    }
    InputStream stream=getContentResolver().openInputStream(data.getData());
    bitmap=BitmapFactory.decodeStream(stream);
    stream.close();
    imageViewAvatar.setImageBitmap(bitmap);
  }
 catch (  FileNotFoundException e) {
    e.printStackTrace();
  }
catch (  IOException e) {
    e.printStackTrace();
  }
  super.onActivityResult(requestCode,resultCode,data);
}

Fixed version (ground truth):
@Override protected void onActivityResult(int requestCode,int resultCode,Intent data){
  if (requestCode == ImageHelper.REQUEST_CODE && resultCode == Activity.RESULT_OK)   try {
    pathToImage=imageHelper.getPath(data.getData());
    if (bitmap != null) {
      bitmap.recycle();
    }
    InputStream stream=getContentResolver().openInputStream(data.getData());
    bitmap=BitmapFactory.decodeStream(stream);
    stream.close();
    imageViewAvatar.setImageBitmap(bitmap);
  }
 catch (  FileNotFoundException e) {
    e.printStackTrace();
  }
catch (  IOException e) {
    e.printStackTrace();
  }
  super.onActivityResult(requestCode,resultCode,data);
}
Program: 114721
Project: 114721
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case android.R.id.home:
    NavUtils.navigateUpFromSameTask(this);
  return true;
case R.id.action_audio_call:
DialogUtils.show(this,getString(R.string.comming_soon));
return true;
case R.id.action_video_call:
DialogUtils.show(this,getString(R.string.comming_soon));
return true;
}
return super.onOptionsItemSelected(item);
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case android.R.id.home:
    NavUtils.navigateUpFromSameTask(this);
  return true;
}
return super.onOptionsItemSelected(item);
}
Program: 114722
Project: 114722
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_registration);
  useDoubleBackPressed=true;
  fullname=_findViewById(R.id.fullnameEdit);
  avatarLayout=_findViewById(R.id.avatarLayout);
  email=_findViewById(R.id.emailEdit);
  password=_findViewById(R.id.password);
  avatarImageView=_findViewById(R.id.avatarImageView);
  registerButton=_findViewById(R.id.signUpButton);
  initListeners();
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_registration);
  useDoubleBackPressed=true;
  fullname=_findViewById(R.id.fullnameEdit);
  avatarLayout=_findViewById(R.id.avatarLayout);
  email=_findViewById(R.id.emailEdit);
  password=_findViewById(R.id.password);
  avatarImageView=_findViewById(R.id.avatarImageView);
  registerButton=_findViewById(R.id.signUpButton);
  imageHelper=new ImageHelper(this);
  initListeners();
}
Program: 114723
Project: 114723
Buggy source:
private void initListeners(){
  avatarLayout.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      getImage();
    }
  }
);
  registerButton.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      register();
    }
  }
);
}

Fixed version (ground truth):
private void initListeners(){
  avatarLayout.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      imageHelper.getImage();
    }
  }
);
  registerButton.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      register();
    }
  }
);
}
Program: 114724
Project: 114724
Buggy source:
@Override protected void onActivityResult(int requestCode,int resultCode,Intent data){
  if (requestCode == REQUEST_CODE && resultCode == Activity.RESULT_OK)   try {
    pathToImage=getPath(data.getData());
    if (bitmap != null) {
      bitmap.recycle();
    }
    InputStream stream=getContentResolver().openInputStream(data.getData());
    bitmap=BitmapFactory.decodeStream(stream);
    stream.close();
    avatarImageView.setImageBitmap(bitmap);
  }
 catch (  FileNotFoundException e) {
    e.printStackTrace();
  }
catch (  IOException e) {
    e.printStackTrace();
  }
  super.onActivityResult(requestCode,resultCode,data);
}

Fixed version (ground truth):
@Override protected void onActivityResult(int requestCode,int resultCode,Intent data){
  if (requestCode == ImageHelper.REQUEST_CODE && resultCode == Activity.RESULT_OK)   try {
    pathToImage=imageHelper.getPath(data.getData());
    if (bitmap != null) {
      bitmap.recycle();
    }
    InputStream stream=getContentResolver().openInputStream(data.getData());
    bitmap=BitmapFactory.decodeStream(stream);
    stream.close();
    avatarImageView.setImageBitmap(bitmap);
  }
 catch (  FileNotFoundException e) {
    e.printStackTrace();
  }
catch (  IOException e) {
    e.printStackTrace();
  }
  super.onActivityResult(requestCode,resultCode,data);
}
Program: 114725
Project: 114725
Buggy source:
public void isEqualTo(Object expected){
  assertEquals(expected,objectUnderTest);
}

Fixed version (ground truth):
public void isEqualTo(Object expected){
}
Program: 114726
Project: 114726
Buggy source:
public void isEmpty(){
  assertTrue(objectUnderTest.isEmpty());
}

Fixed version (ground truth):
public void isEmpty(){
}
Program: 114727
Project: 114727
Buggy source:
@When("String_Node_Str") public void handleFill(Fill fill){
  Order order=fill.getOrder();
  if (order.getParentOrder() != null) {
switch (order.getParentOrder().getFillType()) {
case GOOD_TIL_CANCELLED:
      break;
case GTC_OR_MARGIN_CAP:
    break;
case CANCEL_REMAINDER:
  break;
case LIMIT:
break;
case STOP_LIMIT:
break;
case TRAILING_STOP_LIMIT:
break;
case STOP_LOSS:
OrderBuilder.CommonOrderBuilder orderBuilder=buildStopLimitOrder(fill);
if (orderBuilder != null) {
Order stopOrder=orderBuilder.getOrder();
placeOrder(stopOrder);
}
break;
}
}
if (log.isInfoEnabled()) log.info("String_Node_Str" + fill);
OrderState state=orderStateMap.get(order);
if (state == null) {
log.warn("String_Node_Str" + order);
state=OrderState.PLACED;
}
if (state == OrderState.NEW) log.warn("String_Node_Str");
if (state.isOpen()) {
OrderState newState=order.isFilled() ? OrderState.FILLED : OrderState.PARTFILLED;
updateOrderState(order,newState);
}
PersitOrderFill(fill);
CreateTransaction(fill);
}

Fixed version (ground truth):
@When("String_Node_Str") public void handleFill(Fill fill){
  Order order=fill.getOrder();
  if (order.getParentOrder() != null) {
switch (order.getParentOrder().getFillType()) {
case GOOD_TIL_CANCELLED:
      break;
case GTC_OR_MARGIN_CAP:
    break;
case CANCEL_REMAINDER:
  break;
case LIMIT:
break;
case STOP_LIMIT:
break;
case TRAILING_STOP_LIMIT:
break;
case STOP_LOSS:
OrderBuilder.CommonOrderBuilder orderBuilder=buildStopLimitOrder(fill);
if (orderBuilder != null) {
Order stopOrder=orderBuilder.getOrder();
placeOrder(stopOrder);
}
break;
}
}
if (log.isInfoEnabled()) log.info("String_Node_Str" + fill);
OrderState state=orderStateMap.get(order);
if (state == null) {
log.warn("String_Node_Str" + order);
state=OrderState.PLACED;
}
if (state == OrderState.NEW) log.warn("String_Node_Str");
if (state.isOpen()) {
OrderState newState=order.isFilled() ? OrderState.FILLED : OrderState.PARTFILLED;
if (newState == OrderState.FILLED) {
log.info("String_Node_Str");
}
updateOrderState(order,newState);
}
PersitOrderFill(fill);
CreateTransaction(fill);
}
Program: 114728
Project: 114728
Buggy source:
@When("String_Node_Str") public void announceFill(Fill f){
  writer.println("String_Node_Str" + f.getOrder().getId() + "String_Node_Str"+ f);
  writer.flush();
}

Fixed version (ground truth):
@When("String_Node_Str") private void announceFill(Fill f){
  out.println("String_Node_Str" + f.getOrder().getId() + "String_Node_Str"+ f);
  out.flush();
}
Program: 114729
Project: 114729
Buggy source:
@When("String_Node_Str") public void announceUpdate(OrderUpdate update){
  writer.println("String_Node_Str" + update.getOrder().getId() + "String_Node_Str"+ update.getState());
  writer.flush();
}

Fixed version (ground truth):
@When("String_Node_Str") private void announceUpdate(OrderUpdate update){
  Order order=update.getOrder();
switch (update.getState()) {
case NEW:
    out.println("String_Node_Str" + order);
case PLACED:
  out.println("String_Node_Str" + order);
case PARTFILLED:
out.println("String_Node_Str" + order);
case FILLED:
out.println("String_Node_Str" + order);
case CANCELLING:
out.println("String_Node_Str" + order);
case CANCELLED:
out.println("String_Node_Str" + order);
case REJECTED:
out.println("String_Node_Str" + order);
case EXPIRED:
out.println("String_Node_Str" + order);
}
out.flush();
}
Program: 114730
Project: 114730
Buggy source:
private void init() throws IOException {
  context=Context.create();
  context.attach(XchangeData.class);
  context.attach(TickWindow.class);
  context.attach(BasicQuoteService.class);
  context.attach(BasicAccountService.class);
  context.attach(MockOrderService.class);
  Terminal terminal=TerminalFactory.get();
  try {
    terminal.init();
  }
 catch (  Exception e) {
    throw new Error("String_Node_Str",e);
  }
  terminal.setEchoEnabled(false);
  console=new ConsoleReader();
  String prompt=config.getString("String_Node_Str","String_Node_Str") + "String_Node_Str";
  console.setPrompt(prompt);
  history=new MemoryHistory();
  history.setMaxSize(config.getInt("String_Node_Str",100));
  console.setHistory(history);
  console.setHistoryEnabled(true);
  console.setKeyMap(KeyMap.EMACS);
  out=new ConsoleWriter(console);
  context.attach(ConsoleWriter.class,out);
  context.attach(PrintWriter.class,out);
  notifications=context.attach(ConsoleNotifications.class);
  console.println("String_Node_Str" + config.getString("String_Node_Str"));
}

Fixed version (ground truth):
private void init() throws IOException {
  context=Context.create();
  context.attach(XchangeData.class);
  context.attach(BasicQuoteService.class);
  context.attach(BasicAccountService.class);
  context.attach(MockOrderService.class);
  Terminal terminal=TerminalFactory.get();
  try {
    terminal.init();
  }
 catch (  Exception e) {
    throw new Error("String_Node_Str",e);
  }
  terminal.setEchoEnabled(false);
  console=new ConsoleReader();
  String prompt=config.getString("String_Node_Str","String_Node_Str") + "String_Node_Str";
  console.setPrompt(prompt);
  history=new MemoryHistory();
  history.setMaxSize(config.getInt("String_Node_Str",100));
  console.setHistory(history);
  console.setHistoryEnabled(true);
  console.setKeyMap(KeyMap.EMACS);
  out=new ConsoleWriter(console);
  context.attach(ConsoleWriter.class,out);
  context.attach(PrintWriter.class,out);
  notifications=context.attach(ConsoleNotifications.class);
  console.println("String_Node_Str" + config.getString("String_Node_Str"));
}
Program: 114731
Project: 114731
Buggy source:
@SuppressWarnings("String_Node_Str") public void write(char[] cbuf,int off,int len) throws IOException {
  String output=new String(cbuf,off,len);
  try {
    console.print(output);
  }
 catch (  IOException e) {
    throw new Error("String_Node_Str",e);
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public void write(char[] cbuf,int off,int len) throws IOException {
  String output=new String(cbuf,off,len);
  try {
    console.print(output);
    if (output.contains("String_Node_Str"))     console.flush();
  }
 catch (  IOException e) {
    throw new Error("String_Node_Str",e);
  }
}
Program: 114732
Project: 114732
Buggy source:
protected void handleSpecificOrder(SpecificOrder specificOrder){
  if (specificOrder.getStopPrice() != null)   reject(specificOrder,"String_Node_Str");
  pendingOrders.add(specificOrder);
}

Fixed version (ground truth):
protected void handleSpecificOrder(SpecificOrder specificOrder){
  if (specificOrder.getStopPrice() != null)   reject(specificOrder,"String_Node_Str");
  pendingOrders.add(specificOrder);
  updateOrderState(specificOrder,OrderState.PLACED);
}
Program: 114733
Project: 114733
Buggy source:
@When("String_Node_Str") public void handleMarketData(MarketData m){
  if (m instanceof Trade) {
    Trade trade=(Trade)m;
    final Trade duplicate=PersistUtil.queryZeroOne(Trade.class,"String_Node_Str",trade.getMarket(),trade.getRemoteKey());
    if (duplicate == null)     PersistUtil.insert(trade);
 else     log.warn("String_Node_Str" + trade);
  }
 else   PersistUtil.insert(m);
}

Fixed version (ground truth):
@When("String_Node_Str") public void handleMarketData(MarketData m){
  if (m instanceof Trade) {
    Trade trade=(Trade)m;
    final Trade duplicate=PersistUtil.queryZeroOne(Trade.class,"String_Node_Str",trade.getMarket(),trade.getRemoteKey());
    if (duplicate == null)     PersistUtil.insert(trade);
 else     log.warn("String_Node_Str" + trade);
  }
 else {
    try {
      PersistUtil.insert(m);
    }
 catch (    Throwable e) {
      throw new Error("String_Node_Str" + m,e);
    }
  }
}
Program: 114735
Project: 114735
Buggy source:
public void configure(Binder binder){
  binder.bind(Context.class).toInstance(Context.this);
  binder.bindListener(Matchers.any(),new ProvisionListener(){
    public <T>void onProvision(    ProvisionInvocation<T> tProvisionInvocation){
      T provision=tProvisionInvocation.provision();
      subscribe(provision);
    }
  }
);
  binder.bindListener(Matchers.any(),new TypeListener(){
    public <I>void hear(    TypeLiteral<I> typeLiteral,    TypeEncounter<I> typeEncounter){
      for (Class<?> c=typeLiteral.getRawType(); c != Object.class; c=c.getSuperclass()) {
        for (        final Field field : c.getDeclaredFields()) {
          if (field.getType().isAssignableFrom(Logger.class)) {
            typeEncounter.register(new MembersInjector<I>(){
              public void injectMembers(              I i){
                try {
                  boolean wasAccessible=field.isAccessible();
                  field.setAccessible(true);
                  if (field.get(i) == null) {
                    field.set(i,LoggerFactory.getLogger(field.getDeclaringClass()));
                  }
                  field.setAccessible(wasAccessible);
                }
 catch (                IllegalAccessException e) {
                  e.printStackTrace();
                }
              }
            }
);
          }
        }
      }
    }
  }
);
}

Fixed version (ground truth):
public void configure(Binder binder){
  binder.bind(Context.class).toInstance(Context.this);
  binder.bind(Configuration.class).toInstance(Context.this.config);
  binder.bindListener(Matchers.any(),new ProvisionListener(){
    public <T>void onProvision(    ProvisionInvocation<T> tProvisionInvocation){
      T provision=tProvisionInvocation.provision();
      subscribe(provision);
    }
  }
);
  binder.bindListener(Matchers.any(),new TypeListener(){
    public <I>void hear(    TypeLiteral<I> typeLiteral,    TypeEncounter<I> typeEncounter){
      for (Class<?> c=typeLiteral.getRawType(); c != Object.class; c=c.getSuperclass()) {
        for (        final Field field : c.getDeclaredFields()) {
          if (field.getType().isAssignableFrom(Logger.class)) {
            typeEncounter.register(new MembersInjector<I>(){
              public void injectMembers(              I i){
                try {
                  boolean wasAccessible=field.isAccessible();
                  field.setAccessible(true);
                  if (field.get(i) == null) {
                    field.set(i,LoggerFactory.getLogger(field.getDeclaringClass()));
                  }
                  field.setAccessible(wasAccessible);
                }
 catch (                IllegalAccessException e) {
                  e.printStackTrace();
                }
              }
            }
);
          }
        }
      }
    }
  }
);
}
Program: 114736
Project: 114736
Buggy source:
@SuppressWarnings("String_Node_Str") @When("String_Node_Str") private void handleBook(Book b){
  List<Fill> fills=new ArrayList<>();
  for (  SpecificOrder order : pendingOrders) {
    if (order.getMarket().equals(b.getMarket())) {
      if (order.isBid()) {
        long remainingVolume=order.getUnfilledVolumeCount();
        for (        Offer ask : b.getAsks()) {
          if (order.getLimitPrice() != null && order.getLimitPrice().getCount() < ask.getPriceCount())           break;
          long fillVolume=Math.min(Math.abs(ask.getVolumeCount()),remainingVolume);
          Fill fill=new Fill(order,ask.getTime(),ask.getMarket(),ask.getPriceCount(),fillVolume);
          fills.add(fill);
          remainingVolume-=fillVolume;
          logFill(order,ask,fill);
          if (remainingVolume == 0)           break;
        }
      }
      if (order.isAsk()) {
        long remainingVolume=order.getVolume().getCount();
        for (        Offer bid : b.getBids()) {
          if (order.getLimitPrice() != null && order.getLimitPrice().getCount() > bid.getPriceCount())           break;
          long fillVolume=-Math.min(bid.getVolumeCount(),Math.abs(remainingVolume));
          Fill fill=new Fill(order,bid.getTime(),bid.getMarket(),bid.getPriceCount(),fillVolume);
          fills.add(fill);
          remainingVolume-=fillVolume;
          logFill(order,bid,fill);
          if (remainingVolume == 0)           break;
        }
      }
    }
  }
  for (  Fill fill : fills)   context.publish(fill);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @When("String_Node_Str") private void handleBook(Book b){
  List<Fill> fills=new ArrayList<>();
  for (  SpecificOrder order : pendingOrders) {
    if (order.getMarket().equals(b.getMarket())) {
      if (order.isBid()) {
        long remainingVolume=order.getUnfilledVolumeCount();
        for (        Offer ask : b.getAsks()) {
          if (order.getLimitPrice() != null && order.getLimitPrice().getCount() < ask.getPriceCount())           break;
          long fillVolume=Math.min(Math.abs(ask.getVolumeCount()),remainingVolume);
          Fill fill=new Fill(order,ask.getTime(),ask.getMarket(),ask.getPriceCount(),fillVolume);
          fills.add(fill);
          remainingVolume-=fillVolume;
          logFill(order,ask,fill);
          if (remainingVolume == 0)           break;
        }
      }
      if (order.isAsk()) {
        long remainingVolume=order.getUnfilledVolumeCount();
        for (        Offer bid : b.getBids()) {
          if (order.getLimitPrice() != null && order.getLimitPrice().getCount() > bid.getPriceCount())           break;
          long fillVolume=-Math.min(bid.getVolumeCount(),Math.abs(remainingVolume));
          Fill fill=new Fill(order,bid.getTime(),bid.getMarket(),bid.getPriceCount(),fillVolume);
          fills.add(fill);
          remainingVolume-=fillVolume;
          logFill(order,bid,fill);
          if (remainingVolume == 0)           break;
        }
      }
    }
  }
  for (  Fill fill : fills) {
    fill.getOrder().addFill(fill);
    context.publish(fill);
  }
}
Program: 114737
Project: 114737
Buggy source:
protected @ManyToOne Book getParent(){
  return parent;
}

Fixed version (ground truth):
protected @ManyToOne(cascade=CascadeType.PERSIST) Book getParent(){
  return parent;
}
Program: 114738
Project: 114738
Buggy source:
@Override public void onScrollStateChanged(final AbsListView view,final int scrollState){
}

Fixed version (ground truth):
@Override public void onScrollStateChanged(AbsListView view,int scrollState){
}
Program: 114739
Project: 114739
Buggy source:
@Override public void onScroll(final AbsListView view,final int firstVisibleItem,final int visibleItemCount,final int totalItemCount){
}

Fixed version (ground truth):
@Override public void onScroll(AbsListView view,int firstVisibleItem,int visibleItemCount,int totalItemCount){
}
Program: 114740
Project: 114740
Buggy source:
@Override public void onItemClick(final AdapterView<?> parent,final View view,final int position,final long id){
  Toast.makeText(this,"String_Node_Str" + position + "String_Node_Str",Toast.LENGTH_SHORT).show();
}

Fixed version (ground truth):
@Override public void onItemClick(final AdapterView<?> parent,View view,int position,long id){
  Toast.makeText(this,"String_Node_Str" + position + "String_Node_Str",Toast.LENGTH_SHORT).show();
}
Program: 114741
Project: 114741
Buggy source:
private void initialize(final int layoutId){
  setContentView(layoutId);
  offset=0;
  final ViewGroup viewGroup=(ViewGroup)findViewById(R.id.listView);
  topTextView=(TextView)findViewById(R.id.quickReturnTopTarget);
  bottomTextView=(TextView)findViewById(R.id.quickReturnBottomTarget);
  adapter=new ArrayAdapter<>(this,R.layout.list_item);
  addMoreItems(100);
  if (viewGroup instanceof AbsListView) {
    int numColumns=(viewGroup instanceof GridView) ? 3 : 1;
    final AbsListView absListView=(AbsListView)viewGroup;
    absListView.setAdapter(new QuickReturnAdapter(adapter,numColumns));
  }
  final QuickReturnAttacher quickReturnAttacher=QuickReturnAttacher.forView(viewGroup);
  quickReturnAttacher.addTargetView(bottomTextView,AbsListViewScrollTarget.POSITION_BOTTOM);
  topTargetView=quickReturnAttacher.addTargetView(topTextView,AbsListViewScrollTarget.POSITION_TOP,dpToPx(this,50));
  if (quickReturnAttacher instanceof AbsListViewQuickReturnAttacher) {
    final AbsListViewQuickReturnAttacher attacher=(AbsListViewQuickReturnAttacher)quickReturnAttacher;
    attacher.addOnScrollListener(this);
    attacher.setOnItemClickListener(this);
  }
}

Fixed version (ground truth):
private void initialize(final int layoutId){
  setContentView(layoutId);
  offset=0;
  final ViewGroup viewGroup=(ViewGroup)findViewById(R.id.listView);
  topTextView=(TextView)findViewById(R.id.quickReturnTopTarget);
  bottomTextView=(TextView)findViewById(R.id.quickReturnBottomTarget);
  adapter=new ArrayAdapter<>(this,R.layout.list_item);
  addMoreItems(100);
  if (viewGroup instanceof AbsListView) {
    int numColumns=(viewGroup instanceof GridView) ? 3 : 1;
    final AbsListView absListView=(AbsListView)viewGroup;
    absListView.setAdapter(new QuickReturnAdapter(adapter,numColumns));
  }
  final QuickReturnAttacher quickReturnAttacher=QuickReturnAttacher.forView(viewGroup);
  quickReturnAttacher.addTargetView(bottomTextView,AbsListViewScrollTarget.POSITION_BOTTOM);
  topTargetView=quickReturnAttacher.addTargetView(topTextView,AbsListViewScrollTarget.POSITION_TOP,dpToPx(this,50));
  if (quickReturnAttacher instanceof AbsListViewQuickReturnAttacher) {
    final AbsListViewQuickReturnAttacher attacher=(AbsListViewQuickReturnAttacher)quickReturnAttacher;
    attacher.addOnScrollListener(this);
    attacher.setOnItemClickListener(this);
    attacher.setOnItemLongClickListener(this);
  }
}
Program: 114742
Project: 114742
Buggy source:
@Override public boolean onNavigationItemSelected(final int itemPos,final long itemId){
  if (itemPos == currentPos)   return false;
  currentPos=itemPos;
switch (itemPos) {
case 0:
    currentPos=R.layout.activity_main;
  break;
case 1:
currentPos=R.layout.activity_main_grid;
break;
case 2:
currentPos=R.layout.activity_main_scrollview;
break;
}
initialize(currentPos);
return true;
}

Fixed version (ground truth):
@Override public boolean onNavigationItemSelected(int itemPos,long itemId){
  if (itemPos == currentPos)   return false;
  currentPos=itemPos;
switch (itemPos) {
case 0:
    currentPos=R.layout.activity_main;
  break;
case 1:
currentPos=R.layout.activity_main_grid;
break;
case 2:
currentPos=R.layout.activity_main_scrollview;
break;
}
initialize(currentPos);
return true;
}
Program: 114743
Project: 114743
Buggy source:
public AbsListViewQuickReturnAttacher(final AbsListView listView){
  this.absListView=listView;
  listView.setOnScrollListener(onScrollListener);
  listView.setOnItemClickListener(this);
}

Fixed version (ground truth):
public AbsListViewQuickReturnAttacher(AbsListView listView){
  this.absListView=listView;
  listView.setOnScrollListener(onScrollListener);
  listView.setOnItemClickListener(this);
  listView.setOnItemLongClickListener(this);
}
Program: 114744
Project: 114744
Buggy source:
public QuickReturnTargetView addTargetView(View view,int position,int viewHeight){
  final AbsListViewScrollTarget targetView=new AbsListViewScrollTarget(absListView,view,position,viewHeight);
  onScrollListener.registerOnScrollListener(targetView);
  return targetView;
}

Fixed version (ground truth):
public QuickReturnTargetView addTargetView(View view,int position,int viewHeight){
  AbsListViewScrollTarget targetView=new AbsListViewScrollTarget(absListView,view,position,viewHeight);
  onScrollListener.registerOnScrollListener(targetView);
  return targetView;
}
Program: 114745
Project: 114745
Buggy source:
public void setOnItemClickListener(final AbsListView.OnItemClickListener listener){
  onItemClickListener=listener;
}

Fixed version (ground truth):
public void setOnItemClickListener(AbsListView.OnItemClickListener listener){
  onItemClickListener=listener;
}
Program: 114746
Project: 114746
Buggy source:
public void addOnScrollListener(final AbsListView.OnScrollListener listener){
  onScrollListener.registerOnScrollListener(listener);
}

Fixed version (ground truth):
public void addOnScrollListener(AbsListView.OnScrollListener listener){
  onScrollListener.registerOnScrollListener(listener);
}
Program: 114747
Project: 114747
Buggy source:
@Override public void onItemClick(final AdapterView<?> parent,View view,int position,long id){
  int positionOffset;
  if (onItemClickListener != null) {
    if (parent instanceof ListView)     positionOffset=1;
 else     if (parent instanceof GridView)     positionOffset=((GridView)parent).getNumColumns();
 else     positionOffset=0;
    onItemClickListener.onItemClick(parent,view,position - positionOffset,id);
  }
}

Fixed version (ground truth):
@Override public void onItemClick(final AdapterView<?> parent,View view,int position,long id){
  if (onItemClickListener != null) {
    onItemClickListener.onItemClick(parent,view,position - getClickPositionOffset(parent),id);
  }
}
Program: 114748
Project: 114748
Buggy source:
public void removeTargetView(final AbsListViewScrollTarget targetView){
  onScrollListener.unregisterOnScrollListener(targetView);
}

Fixed version (ground truth):
public void removeTargetView(AbsListViewScrollTarget targetView){
  onScrollListener.unregisterOnScrollListener(targetView);
}
Program: 114749
Project: 114749
Buggy source:
@Override public View getView(final int position,final View convertView,final ViewGroup parent){
  View v;
  int finalHeight;
  if (position < numColumns) {
    if (convertView == null)     v=new View(parent.getContext());
 else     v=convertView;
    v.setLayoutParams(new AbsListView.LayoutParams(AbsListView.LayoutParams.MATCH_PARENT,targetViewHeight));
    finalHeight=targetViewHeight;
  }
 else {
    v=wrappedAdapter.getView(position - numColumns,convertView,parent);
    v.measure(View.MeasureSpec.makeMeasureSpec(parent.getWidth() / numColumns,View.MeasureSpec.AT_MOST),heightMeasureSpec);
    finalHeight=v.getMeasuredHeight();
  }
  if (position + numColumns < itemsVerticalOffset.length)   itemsVerticalOffset[position + numColumns]=itemsVerticalOffset[position] + finalHeight + verticalSpacing;
  return v;
}

Fixed version (ground truth):
@Override public View getView(final int position,final View convertView,final ViewGroup parent){
  View v;
  int finalHeight;
  if (position < numColumns) {
    if (convertView == null)     v=new View(parent.getContext());
 else     v=convertView;
    v.setLayoutParams(new AbsListView.LayoutParams(AbsListView.LayoutParams.MATCH_PARENT,targetViewHeight));
    finalHeight=targetViewHeight;
  }
 else {
    v=wrappedAdapter.getView(position - numColumns,convertView,parent);
    v.setLayoutParams(new AbsListView.LayoutParams(AbsListView.LayoutParams.MATCH_PARENT,AbsListView.LayoutParams.WRAP_CONTENT));
    v.measure(View.MeasureSpec.makeMeasureSpec(parent.getWidth() / numColumns,View.MeasureSpec.AT_MOST),heightMeasureSpec);
    finalHeight=v.getMeasuredHeight();
  }
  if (position + numColumns < itemsVerticalOffset.length)   itemsVerticalOffset[position + numColumns]=itemsVerticalOffset[position] + finalHeight + verticalSpacing;
  return v;
}