nus-yam/ex-repair huggingface dataset:
Program: 8493
Project: 8493
Buggy source:
@Override public void bindData(ContactItem memberItem){
  contactItem=memberItem;
  alpha.setVisibility(memberItem.initialVisible ? View.VISIBLE : View.GONE);
  alpha.setText(String.valueOf(Character.toUpperCase(memberItem.sortContent.charAt(0))));
  Picasso.with(getContext()).load(memberItem.user.getAvatarUrl()).placeholder(R.drawable.lcim_default_avatar_icon).into(avatarView);
  nameView.setText(memberItem.user.getUsername());
}

Fixed version (ground truth):
@Override public void bindData(ContactItem memberItem){
  contactItem=memberItem;
  alpha.setVisibility(memberItem.initialVisible ? View.VISIBLE : View.GONE);
  if (!TextUtils.isEmpty(memberItem.sortContent)) {
    alpha.setText(String.valueOf(Character.toUpperCase(memberItem.sortContent.charAt(0))));
  }
 else {
    alpha.setText("String_Node_Str");
  }
  Picasso.with(getContext()).load(memberItem.user.getAvatarUrl()).placeholder(R.drawable.lcim_default_avatar_icon).into(avatarView);
  nameView.setText(memberItem.user.getUsername());
}
Program: 8494
Project: 8494
Buggy source:
@Override public void onCreate(){
  super.onCreate();
  AVOSCloud.initialize(this,"String_Node_Str","String_Node_Str");
  ChatManager.setDebugEnabled(true);
  AVOSCloud.setDebugLogEnabled(true);
  ChatManager.getInstance().init(this);
  initImageLoader(this);
  ThirdPartUserUtils.setThirdPartUserProvider(new CustomUserProvider());
}

Fixed version (ground truth):
@Override public void onCreate(){
  super.onCreate();
  AVOSCloud.initialize(this,"String_Node_Str","String_Node_Str");
  ChatManager.setDebugEnabled(true);
  AVOSCloud.setDebugLogEnabled(true);
  initImageLoader(this);
  ThirdPartUserUtils.setThirdPartUserProvider(new CustomUserProvider());
}
Program: 8495
Project: 8495
Buggy source:
/** 
 * 获取 conversation，为了避免重复的创建，此处先 query 是否已经存在只包含该 member 的 conversation 如果存在，则直接赋值给 ChatFragment，否者创建后再赋值
 */
private void getConversation(final String memberId){
  Map<String,Object> attrs=new HashMap<>();
  attrs.put(ConversationType.TYPE_KEY,ConversationType.Single.getValue());
  ChatManager.getInstance().getImClient().createConversation(Arrays.asList(memberId),"String_Node_Str",attrs,false,true,new AVIMConversationCreatedCallback(){
    @Override public void done(    AVIMConversation avimConversation,    AVIMException e){
      if (filterException(e)) {
        ChatManager.getInstance().getRoomsTable().insertRoom(conversation.getConversationId());
        updateConversation(conversation);
      }
    }
  }
);
}

Fixed version (ground truth):
/** 
 * 获取 conversation，为了避免重复的创建，此处先 query 是否已经存在只包含该 member 的 conversation 如果存在，则直接赋值给 ChatFragment，否者创建后再赋值
 */
private void getConversation(final String memberId){
  Map<String,Object> attrs=new HashMap<>();
  attrs.put(ConversationType.TYPE_KEY,ConversationType.Single.getValue());
  ChatManager.getInstance().getImClient().createConversation(Arrays.asList(memberId),"String_Node_Str",attrs,false,true,new AVIMConversationCreatedCallback(){
    @Override public void done(    AVIMConversation avimConversation,    AVIMException e){
      if (filterException(e)) {
        ChatManager.getInstance().getRoomsTable().insertRoom(avimConversation.getConversationId());
        updateConversation(avimConversation);
      }
    }
  }
);
}
Program: 8496
Project: 8496
Buggy source:
@Override public void done(AVIMConversation avimConversation,AVIMException e){
  if (filterException(e)) {
    ChatManager.getInstance().getRoomsTable().insertRoom(conversation.getConversationId());
    updateConversation(conversation);
  }
}

Fixed version (ground truth):
@Override public void done(AVIMConversation avimConversation,AVIMException e){
  if (filterException(e)) {
    ChatManager.getInstance().getRoomsTable().insertRoom(avimConversation.getConversationId());
    updateConversation(avimConversation);
  }
}
Program: 8497
Project: 8497
Buggy source:
@Nullable @Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View view=inflater.inflate(R.layout.fragment_chat,container,false);
  recyclerView=(RecyclerView)view.findViewById(R.id.fragment_chat_rv_chat);
  refreshLayout=(SwipeRefreshLayout)view.findViewById(R.id.fragment_chat_srl_pullrefresh);
  refreshLayout.setEnabled(false);
  inputBottomBar=(InputBottomBar)view.findViewById(R.id.fragment_chat_inputbottombar);
  layoutManager=new LinearLayoutManager(getActivity());
  recyclerView.setLayoutManager(layoutManager);
  itemAdapter=new MultipleItemAdapter();
  itemAdapter.resetRecycledViewPoolSize(recyclerView);
  recyclerView.setAdapter(itemAdapter);
  EventBus.getDefault().register(this);
  return view;
}

Fixed version (ground truth):
@Nullable @Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View view=inflater.inflate(R.layout.fragment_chat,container,false);
  localCameraPath=PathUtils.getPicturePathByCurrentTime(getContext());
  recyclerView=(RecyclerView)view.findViewById(R.id.fragment_chat_rv_chat);
  refreshLayout=(SwipeRefreshLayout)view.findViewById(R.id.fragment_chat_srl_pullrefresh);
  refreshLayout.setEnabled(false);
  inputBottomBar=(InputBottomBar)view.findViewById(R.id.fragment_chat_inputbottombar);
  layoutManager=new LinearLayoutManager(getActivity());
  recyclerView.setLayoutManager(layoutManager);
  itemAdapter=new MultipleItemAdapter();
  itemAdapter.resetRecycledViewPoolSize(recyclerView);
  recyclerView.setAdapter(itemAdapter);
  EventBus.getDefault().register(this);
  return view;
}
Program: 8498
Project: 8498
Buggy source:
@Override public void onMessage(AVIMTypedMessage message,AVIMConversation conversation,AVIMClient client){
  if (message == null || message.getMessageId() == null) {
    LogUtils.d("String_Node_Str");
    return;
  }
  if (!ConversationHelper.isValidConversation(conversation)) {
    LogUtils.d("String_Node_Str");
  }
  if (ChatManager.getInstance().getSelfId() == null) {
    LogUtils.d("String_Node_Str");
    client.close(null);
  }
 else {
    if (!client.getClientId().equals(ChatManager.getInstance().getSelfId())) {
      client.close(null);
    }
 else {
      ChatManager.getInstance().getRoomsTable().insertRoom(message.getConversationId());
      if (!message.getFrom().equals(client.getClientId())) {
        if (NotificationUtils.isShowNotification(conversation.getConversationId())) {
          sendNotification(message,conversation);
        }
        ChatManager.getInstance().getRoomsTable().increaseUnreadCount(message.getConversationId());
      }
      sendEvent(message,conversation);
    }
  }
}

Fixed version (ground truth):
@Override public void onMessage(AVIMTypedMessage message,AVIMConversation conversation,AVIMClient client){
  if (message == null || message.getMessageId() == null) {
    LogUtils.d("String_Node_Str");
    return;
  }
  if (!ConversationHelper.isValidConversation(conversation)) {
    LogUtils.d("String_Node_Str");
  }
  if (ChatManager.getInstance().getSelfId() == null) {
    LogUtils.d("String_Node_Str");
    client.close(null);
  }
 else {
    if (!client.getClientId().equals(ChatManager.getInstance().getSelfId())) {
      client.close(null);
    }
 else {
      ChatManager.getInstance().getRoomsTable().insertRoom(message.getConversationId());
      if (!message.getFrom().equals(client.getClientId())) {
        if (NotificationUtils.isShowNotification(conversation.getConversationId())) {
          sendNotification(message,conversation);
        }
        ChatManager.getInstance().getRoomsTable().increaseUnreadCount(message.getConversationId());
        sendEvent(message,conversation);
      }
    }
  }
}
Program: 8499
Project: 8499
Buggy source:
public static CharSequence outlineOfMsg(AVIMTypedMessage msg){
  AVIMReservedMessageType type=AVIMReservedMessageType.getAVIMReservedMessageType(msg.getMessageType());
switch (type) {
case TextMessageType:
    return EmotionHelper.replace(ChatManager.getContext(),((AVIMTextMessage)msg).getText());
case ImageMessageType:
  return bracket(ChatManager.getContext().getString(R.string.chat_image));
case LocationMessageType:
AVIMLocationMessage locMsg=(AVIMLocationMessage)msg;
String address=locMsg.getText();
if (address == null) {
address="String_Node_Str";
}
return bracket(ChatManager.getContext().getString(R.string.chat_position)) + address;
case AudioMessageType:
return bracket(ChatManager.getContext().getString(R.string.chat_audio));
}
return null;
}

Fixed version (ground truth):
public static CharSequence outlineOfMsg(AVIMMessage msg){
  if (msg instanceof AVIMTypedMessage) {
    AVIMReservedMessageType type=AVIMReservedMessageType.getAVIMReservedMessageType(((AVIMTypedMessage)msg).getMessageType());
switch (type) {
case TextMessageType:
      return EmotionHelper.replace(ChatManager.getContext(),((AVIMTextMessage)msg).getText());
case ImageMessageType:
    return bracket(ChatManager.getContext().getString(R.string.chat_image));
case LocationMessageType:
  AVIMLocationMessage locMsg=(AVIMLocationMessage)msg;
String address=locMsg.getText();
if (address == null) {
address="String_Node_Str";
}
return bracket(ChatManager.getContext().getString(R.string.chat_position)) + address;
case AudioMessageType:
return bracket(ChatManager.getContext().getString(R.string.chat_audio));
}
return null;
}
 else {
return msg.getContent();
}
}
Program: 8500
Project: 8500
Buggy source:
public void refreshUserData(List<String> userList){
  thirdPartDataProvider.getFriends(userList,new FetchUserCallBack(){
    @Override public void done(    List<ThirdPartUser> userList,    Exception e){
      if (null != e && null != userList) {
        for (        ThirdPartUser user : userList) {
          ThirdPartDataCache.getInstance().cacheUser(user.userId,user);
        }
      }
    }
  }
);
}

Fixed version (ground truth):
public void refreshUserData(List<String> userList){
  thirdPartDataProvider.getFriends(userList,new FetchUserCallBack(){
    @Override public void done(    List<ThirdPartUser> userList,    Exception e){
      if (null == e && null != userList) {
        for (        ThirdPartUser user : userList) {
          ThirdPartDataCache.getInstance().cacheUser(user.userId,user);
        }
      }
    }
  }
);
}
Program: 8501
Project: 8501
Buggy source:
private void refresh(){
  LeanchatUser curUser=(LeanchatUser)AVUser.getCurrentUser();
  userNameView.setText(curUser.getUsername());
  ImageLoader.getInstance().displayImage(curUser.getAvatarUrl(),avatarView,com.avoscloud.leanchatlib.utils.PhotoUtils.avatarImageOptions);
}

Fixed version (ground truth):
private void refresh(){
  LeanchatUser curUser=AVUser.getCurrentUser(LeanchatUser.class);
  userNameView.setText(curUser.getUsername());
  ImageLoader.getInstance().displayImage(curUser.getAvatarUrl(),avatarView,com.avoscloud.leanchatlib.utils.PhotoUtils.avatarImageOptions);
}
Program: 8502
Project: 8502
Buggy source:
private void setListData(){
  AVUser.getCurrentUser(LeanchatUser.class).findFriendsWithCachePolicy(AVQuery.CachePolicy.CACHE_ELSE_NETWORK,new FindCallback<LeanchatUser>(){
    @Override public void done(    List<LeanchatUser> users,    AVException e){
      if (filterException(e)) {
        List<String> userIds=new ArrayList<String>();
        for (        AVUser user : users) {
          userIds.add(user.getObjectId());
        }
        userIds.removeAll(conversation.getMembers());
        adapter.setDatas(userIds);
        adapter.notifyDataSetChanged();
      }
    }
  }
);
}

Fixed version (ground truth):
private void setListData(){
  AVUser.getCurrentUser(LeanchatUser.class).findFriendsWithCachePolicy(AVQuery.CachePolicy.CACHE_ELSE_NETWORK,new FindCallback<LeanchatUser>(){
    @Override public void done(    List<LeanchatUser> users,    AVException e){
      if (filterException(e)) {
        final List<String> userIds=new ArrayList<String>();
        for (        AVUser user : users) {
          userIds.add(user.getObjectId());
        }
        userIds.removeAll(conversation.getMembers());
        CacheService.cacheUsers(userIds,new AVUserCacheUtils.CacheUserCallback(){
          @Override public void done(          Exception e){
            adapter.setDatas(userIds);
            adapter.notifyDataSetChanged();
          }
        }
);
      }
    }
  }
);
}
Program: 8503
Project: 8503
Buggy source:
@Override public View getView(final int position,View conView,ViewGroup parent){
  if (conView == null) {
    conView=View.inflate(ctx,R.layout.conversation_add_members_item,null);
  }
  String userId=datas.get(position);
  AVUser user=CacheService.lookupUser(userId);
  ImageView avatarView=ViewHolder.findViewById(conView,R.id.avatar);
  TextView nameView=ViewHolder.findViewById(conView,R.id.username);
  ImageLoader.getInstance().displayImage(((LeanchatUser)user).getAvatarUrl(),avatarView,PhotoUtils.avatarImageOptions);
  nameView.setText(user.getUsername());
  CheckBox checkBox=ViewHolder.findViewById(conView,R.id.checkbox);
  setCheckBox(checkBox,position);
  checkBox.setOnCheckedChangeListener(new CheckListener(position));
  return conView;
}

Fixed version (ground truth):
@Override public View getView(final int position,View conView,ViewGroup parent){
  if (conView == null) {
    conView=View.inflate(ctx,R.layout.conversation_add_members_item,null);
  }
  String userId=datas.get(position);
  LeanchatUser user=CacheService.lookupUser(userId);
  ImageView avatarView=ViewHolder.findViewById(conView,R.id.avatar);
  TextView nameView=ViewHolder.findViewById(conView,R.id.username);
  if (null != user) {
    ImageLoader.getInstance().displayImage(user.getAvatarUrl(),avatarView,PhotoUtils.avatarImageOptions);
    nameView.setText(user.getUsername());
  }
 else {
    nameView.setText("String_Node_Str");
  }
  CheckBox checkBox=ViewHolder.findViewById(conView,R.id.checkbox);
  setCheckBox(checkBox,position);
  checkBox.setOnCheckedChangeListener(new CheckListener(position));
  return conView;
}
Program: 8504
Project: 8504
Buggy source:
public static void cacheUsers(List<String> ids) throws AVException {
  Set<String> uncachedIds=new HashSet<String>();
  for (  String id : ids) {
    if (lookupUser(id) == null) {
      uncachedIds.add(id);
    }
  }
  List<LeanchatUser> foundUsers=findUsers(new ArrayList<String>(uncachedIds));
  registerUsers(foundUsers);
}

Fixed version (ground truth):
public static void cacheUsers(List<String> userIds,final AVUserCacheUtils.CacheUserCallback callback){
  if (userIds.size() <= 0) {
    callback.done(null);
    return;
  }
  AVQuery<LeanchatUser> q=AVUser.getQuery(LeanchatUser.class);
  q.whereContainedIn(Constants.OBJECT_ID,userIds);
  q.setLimit(1000);
  q.setCachePolicy(AVQuery.CachePolicy.NETWORK_ELSE_CACHE);
  q.findInBackground(new FindCallback<LeanchatUser>(){
    @Override public void done(    List<LeanchatUser> list,    AVException e){
      registerUsers(list);
      callback.done(e);
    }
  }
);
}
Program: 8505
Project: 8505
Buggy source:
public static void registerUsers(List<LeanchatUser> users){
  for (  LeanchatUser user : users) {
    registerUser(user);
  }
}

Fixed version (ground truth):
public static void registerUsers(List<LeanchatUser> users){
  if (null != users) {
    for (    LeanchatUser user : users) {
      registerUser(user);
    }
  }
}
Program: 8506
Project: 8506
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main_activity);
  findView();
  init();
  conversationBtn.performClick();
  initBaiduLocClient();
  CacheService.registerUser((LeanchatUser)AVUser.getCurrentUser());
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main_activity);
  findView();
  init();
  conversationBtn.performClick();
  initBaiduLocClient();
  CacheService.registerUser(AVUser.getCurrentUser(LeanchatUser.class));
}
Program: 8507
Project: 8507
Buggy source:
@Override public void onRefresh(){
  AVIMMessage message=itemAdapter.getFirstMessage();
  imConversation.queryMessages(message.getMessageId(),message.getTimestamp(),20,new AVIMMessagesQueryCallback(){
    @Override public void done(    List<AVIMMessage> list,    AVIMException e){
      refreshLayout.setRefreshing(false);
      if (filterException(e)) {
        if (null != list && list.size() > 0) {
          itemAdapter.addMessageList(list);
          itemAdapter.notifyDataSetChanged();
          layoutManager.scrollToPositionWithOffset(list.size() - 1,0);
        }
      }
    }
  }
);
}

Fixed version (ground truth):
@Override public void onRefresh(){
  AVIMMessage message=itemAdapter.getFirstMessage();
  if (null == message) {
    refreshLayout.setRefreshing(false);
  }
 else {
    imConversation.queryMessages(message.getMessageId(),message.getTimestamp(),20,new AVIMMessagesQueryCallback(){
      @Override public void done(      List<AVIMMessage> list,      AVIMException e){
        refreshLayout.setRefreshing(false);
        if (filterException(e)) {
          if (null != list && list.size() > 0) {
            itemAdapter.addMessageList(list);
            itemAdapter.notifyDataSetChanged();
            layoutManager.scrollToPositionWithOffset(list.size() - 1,0);
          }
        }
      }
    }
);
  }
}
Program: 8508
Project: 8508
Buggy source:
@Override public void onViewCreated(View view,Bundle savedInstanceState){
  refreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener(){
    @Override public void onRefresh(){
      AVIMMessage message=itemAdapter.getFirstMessage();
      imConversation.queryMessages(message.getMessageId(),message.getTimestamp(),20,new AVIMMessagesQueryCallback(){
        @Override public void done(        List<AVIMMessage> list,        AVIMException e){
          refreshLayout.setRefreshing(false);
          if (filterException(e)) {
            if (null != list && list.size() > 0) {
              itemAdapter.addMessageList(list);
              itemAdapter.notifyDataSetChanged();
              layoutManager.scrollToPositionWithOffset(list.size() - 1,0);
            }
          }
        }
      }
);
    }
  }
);
}

Fixed version (ground truth):
@Override public void onViewCreated(View view,Bundle savedInstanceState){
  refreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener(){
    @Override public void onRefresh(){
      AVIMMessage message=itemAdapter.getFirstMessage();
      if (null == message) {
        refreshLayout.setRefreshing(false);
      }
 else {
        imConversation.queryMessages(message.getMessageId(),message.getTimestamp(),20,new AVIMMessagesQueryCallback(){
          @Override public void done(          List<AVIMMessage> list,          AVIMException e){
            refreshLayout.setRefreshing(false);
            if (filterException(e)) {
              if (null != list && list.size() > 0) {
                itemAdapter.addMessageList(list);
                itemAdapter.notifyDataSetChanged();
                layoutManager.scrollToPositionWithOffset(list.size() - 1,0);
              }
            }
          }
        }
);
      }
    }
  }
);
}
Program: 8509
Project: 8509
Buggy source:
protected void updateConversation(AVIMConversation conversation){
  if (null != conversation) {
    this.conversation=conversation;
    chatFragment.setConversation(conversation);
    initActionBar(ConversationHelper.titleOfConversation(conversation));
  }
}

Fixed version (ground truth):
protected void updateConversation(AVIMConversation conversation){
  if (null != conversation) {
    this.conversation=conversation;
    chatFragment.setConversation(conversation);
    chatFragment.showUserName(ConversationHelper.typeOfConversation(conversation) != ConversationType.Single);
    initActionBar(ConversationHelper.titleOfConversation(conversation));
  }
}
Program: 8510
Project: 8510
Buggy source:
@Override public void onMessage(AVIMTypedMessage message,AVIMConversation conversation,AVIMClient client){
  if (message == null || message.getMessageId() == null) {
    LogUtils.d("String_Node_Str");
    return;
  }
  if (!ConversationHelper.isValidConversation(conversation)) {
    LogUtils.d("String_Node_Str");
  }
  ChatManager.getInstance().getRoomsTable().insertRoom(message.getConversationId());
  ChatManager.getInstance().getRoomsTable().increaseUnreadCount(message.getConversationId());
  if (ChatManager.getInstance().getSelfId() == null) {
    LogUtils.d("String_Node_Str");
  }
 else {
    if (client.getClientId().equals(ChatManager.getInstance().getSelfId())) {
      if (!message.getFrom().equals(client.getClientId())) {
        sendEvent(message,conversation);
        if (NotificationUtils.isShowNotification(conversation.getConversationId())) {
          sendNotification(message,conversation);
        }
        return;
      }
    }
  }
  client.close(null);
}

Fixed version (ground truth):
@Override public void onMessage(AVIMTypedMessage message,AVIMConversation conversation,AVIMClient client){
  if (message == null || message.getMessageId() == null) {
    LogUtils.d("String_Node_Str");
    return;
  }
  if (!ConversationHelper.isValidConversation(conversation)) {
    LogUtils.d("String_Node_Str");
  }
  if (ChatManager.getInstance().getSelfId() == null) {
    LogUtils.d("String_Node_Str");
    client.close(null);
  }
 else {
    if (!client.getClientId().equals(ChatManager.getInstance().getSelfId())) {
      client.close(null);
    }
 else {
      ChatManager.getInstance().getRoomsTable().insertRoom(message.getConversationId());
      if (!message.getFrom().equals(client.getClientId())) {
        if (NotificationUtils.isShowNotification(conversation.getConversationId())) {
          sendNotification(message,conversation);
        }
        ChatManager.getInstance().getRoomsTable().increaseUnreadCount(message.getConversationId());
      }
      sendEvent(message,conversation);
    }
  }
}
Program: 8511
Project: 8511
Buggy source:
@Override public boolean onMenuItemSelected(int featureId,MenuItem item){
  int menuId=item.getItemId();
  if (menuId == ADD_MEMBERS) {
    Intent intent=new Intent(this,ConversationAddMembersActivity.class);
    startActivityForResult(intent,ADD_MEMBERS);
  }
  return super.onMenuItemSelected(featureId,item);
}

Fixed version (ground truth):
@Override public boolean onMenuItemSelected(int featureId,MenuItem item){
  int menuId=item.getItemId();
  if (menuId == ADD_MEMBERS) {
    Intent intent=new Intent(this,ConversationAddMembersActivity.class);
    intent.putExtra(Constants.CONVERSATION_ID,conversation.getConversationId());
    startActivityForResult(intent,ADD_MEMBERS);
  }
  return super.onMenuItemSelected(featureId,item);
}
Program: 8512
Project: 8512
Buggy source:
private void init(){
  volumeHandler=new ShowVolumeHandler();
  setBackgroundResource(BACK_IDLE);
  initRecordDialog();
}

Fixed version (ground truth):
private void init(){
  volumeHandler=new ShowVolumeHandler();
  setBackgroundResource(BACK_IDLE);
}
Program: 8513
Project: 8513
Buggy source:
private void startRecord(){
  startTime=System.currentTimeMillis();
  setBackgroundResource(BACK_RECORDING);
  startRecording();
  recordIndicator.show();
}

Fixed version (ground truth):
private void startRecord(){
  initRecordDialog();
  startTime=System.currentTimeMillis();
  setBackgroundResource(BACK_RECORDING);
  startRecording();
  recordIndicator.show();
}
Program: 8514
Project: 8514
Buggy source:
private void initRecordDialog(){
  recordIndicator=new Dialog(getContext(),R.style.chat_record_button_toast_dialog_style);
  view=inflate(getContext(),R.layout.chat_record_layout,null);
  imageView=(ImageView)view.findViewById(R.id.imageView);
  textView=(TextView)view.findViewById(R.id.textView);
  recordIndicator.setContentView(view,new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,ViewGroup.LayoutParams.WRAP_CONTENT));
  recordIndicator.setOnDismissListener(onDismiss);
  LayoutParams lp=recordIndicator.getWindow().getAttributes();
  lp.gravity=Gravity.CENTER;
}

Fixed version (ground truth):
private void initRecordDialog(){
  if (null == recordIndicator) {
    recordIndicator=new Dialog(getContext(),R.style.chat_record_button_toast_dialog_style);
    view=inflate(getContext(),R.layout.chat_record_layout,null);
    imageView=(ImageView)view.findViewById(R.id.imageView);
    textView=(TextView)view.findViewById(R.id.textView);
    recordIndicator.setContentView(view,new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,ViewGroup.LayoutParams.WRAP_CONTENT));
    recordIndicator.setOnDismissListener(onDismiss);
    LayoutParams lp=recordIndicator.getWindow().getAttributes();
    lp.gravity=Gravity.CENTER;
  }
}
Program: 8515
Project: 8515
Buggy source:
private void cancelRecord(){
  stopRecording();
  setBackgroundResource(BACK_IDLE);
  recordIndicator.dismiss();
  Toast.makeText(getContext(),getContext().getString(R.string.chat_cancelRecord),Toast.LENGTH_SHORT).show();
  File file=new File(outputPath);
  if (file.exists()) {
    file.delete();
  }
}

Fixed version (ground truth):
private void cancelRecord(){
  stopRecording();
  setBackgroundResource(BACK_IDLE);
  recordIndicator.dismiss();
  Toast.makeText(getContext(),getContext().getString(R.string.chat_cancelRecord),Toast.LENGTH_SHORT).show();
  removeFile();
}
Program: 8516
Project: 8516
Buggy source:
private void finishRecord(){
  stopRecording();
  recordIndicator.dismiss();
  setBackgroundResource(BACK_IDLE);
  long intervalTime=System.currentTimeMillis() - startTime;
  if (intervalTime < MIN_INTERVAL_TIME) {
    Toast.makeText(getContext(),getContext().getString(R.string.chat_record_button_pleaseSayMore),Toast.LENGTH_SHORT).show();
    File file=new File(outputPath);
    file.delete();
    return;
  }
  int sec=Math.round(intervalTime * 1.0f / 1000);
  if (recordEventListener != null) {
    recordEventListener.onFinishedRecord(outputPath,sec);
  }
}

Fixed version (ground truth):
private void finishRecord(){
  stopRecording();
  recordIndicator.dismiss();
  setBackgroundResource(BACK_IDLE);
  long intervalTime=System.currentTimeMillis() - startTime;
  if (intervalTime < MIN_INTERVAL_TIME) {
    Toast.makeText(getContext(),getContext().getString(R.string.chat_record_button_pleaseSayMore),Toast.LENGTH_SHORT).show();
    removeFile();
    return;
  }
  int sec=Math.round(intervalTime * 1.0f / 1000);
  if (recordEventListener != null) {
    recordEventListener.onFinishedRecord(outputPath,sec);
  }
}
Program: 8517
Project: 8517
Buggy source:
private void startRecording(){
  if (recorder == null) {
    recorder=new MediaRecorder();
    recorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT);
    recorder.setOutputFormat(MediaRecorder.OutputFormat.DEFAULT);
    recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
    recorder.setOutputFile(outputPath);
    try {
      recorder.prepare();
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
  }
 else {
    recorder.reset();
    recorder.setOutputFile(outputPath);
  }
  recorder.start();
  thread=new ObtainDecibelThread();
  thread.start();
  recordEventListener.onStartRecord();
}

Fixed version (ground truth):
private void startRecording(){
  try {
    if (recorder == null) {
      recorder=new MediaRecorder();
      recorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT);
      recorder.setOutputFormat(MediaRecorder.OutputFormat.DEFAULT);
      recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
      recorder.setOutputFile(outputPath);
      recorder.prepare();
    }
 else {
      recorder.reset();
      recorder.setOutputFile(outputPath);
    }
    recorder.start();
    thread=new ObtainDecibelThread();
    thread.start();
    recordEventListener.onStartRecord();
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}
Program: 8518
Project: 8518
Buggy source:
private void stopRecording(){
  if (thread != null) {
    thread.exit();
    thread=null;
  }
  if (recorder != null) {
    recorder.stop();
    recorder.release();
    recorder=null;
  }
}

Fixed version (ground truth):
private void stopRecording(){
  if (thread != null) {
    thread.exit();
    thread=null;
  }
  if (recorder != null) {
    try {
      recorder.stop();
    }
 catch (    Exception e) {
    }
 finally {
      recorder.release();
      recorder=null;
    }
  }
}
Program: 8519
Project: 8519
Buggy source:
public void findConversationsByConversationIds(List<String> ids,AVIMConversationQueryCallback callback){
  if (ids.size() > 0) {
    AVIMConversationQuery q=ChatManager.getInstance().getQuery();
    q.whereContainsIn(Constant.OBJECT_ID,ids);
    q.setLimit(1000);
    q.findInBackground(callback);
  }
 else {
    callback.done(new ArrayList<AVIMConversation>(),null);
  }
}

Fixed version (ground truth):
public void findConversationsByConversationIds(List<String> ids,AVIMConversationQueryCallback callback){
  AVIMConversationQuery conversationQuery=ChatManager.getInstance().getQuery();
  if (ids.size() > 0 && null != conversationQuery) {
    conversationQuery.whereContainsIn(Constant.OBJECT_ID,ids);
    conversationQuery.setLimit(1000);
    conversationQuery.findInBackground(callback);
  }
 else   if (null != callback) {
    callback.done(new ArrayList<AVIMConversation>(),null);
  }
}
Program: 8520
Project: 8520
Buggy source:
public void findGroupConversationsIncludeMe(AVIMConversationQueryCallback callback){
  AVIMConversationQuery q=ChatManager.getInstance().getQuery();
  q.containsMembers(Arrays.asList(ChatManager.getInstance().getSelfId()));
  q.whereEqualTo(ConversationType.ATTR_TYPE_KEY,ConversationType.Group.getValue());
  q.orderByDescending(Constant.UPDATED_AT);
  q.findInBackground(callback);
}

Fixed version (ground truth):
public void findGroupConversationsIncludeMe(AVIMConversationQueryCallback callback){
  AVIMConversationQuery conversationQuery=ChatManager.getInstance().getQuery();
  if (null != conversationQuery) {
    conversationQuery.containsMembers(Arrays.asList(ChatManager.getInstance().getSelfId()));
    conversationQuery.whereEqualTo(ConversationType.ATTR_TYPE_KEY,ConversationType.Group.getValue());
    conversationQuery.orderByDescending(Constant.UPDATED_AT);
    conversationQuery.findInBackground(callback);
  }
 else   if (null != callback) {
    callback.done(new ArrayList<AVIMConversation>(),null);
  }
}
Program: 8521
Project: 8521
Buggy source:
public AVIMConversationQuery getQuery(){
  return imClient.getQuery();
}

Fixed version (ground truth):
public AVIMConversationQuery getQuery(){
  if (null != imClient) {
    return imClient.getQuery();
  }
  return null;
}
Program: 8522
Project: 8522
Buggy source:
@Override public int compare(Room lhs,Room rhs){
  if (lhs.getLastMessage() != null && rhs.getLastMessage() != null) {
    long value=lhs.getLastMessage().getTimestamp() - rhs.getLastMessage().getTimestamp();
    if (value > 0) {
      return -1;
    }
 else     if (value < 0) {
      return 1;
    }
  }
  return 0;
}

Fixed version (ground truth):
@Override public int compare(Room lhs,Room rhs){
  long leftTs=getCompareTimestamp(lhs.getLastMessage());
  long rightTs=getCompareTimestamp(rhs.getLastMessage());
  long value=leftTs - rightTs;
  if (value > 0) {
    return -1;
  }
 else   if (value < 0) {
    return 1;
  }
 else {
    return 0;
  }
}
Program: 8524
Project: 8524
Buggy source:
private void initChatManager(){
  final ChatManager chatManager=ChatManager.getInstance();
  chatManager.init(this);
  if (AVUser.getCurrentUser() != null) {
    chatManager.setupDatabaseWithSelfId(AVUser.getCurrentUser().getObjectId());
  }
  chatManager.setConversationEventHandler(ConversationManager.getEventHandler());
  ChatManagerAdapterImpl chatManagerAdapter=new ChatManagerAdapterImpl(App.ctx);
  chatManager.setChatManagerAdapter(chatManagerAdapter);
  ChatManager.setDebugEnabled(App.debug);
}

Fixed version (ground truth):
private void initChatManager(){
  final ChatManager chatManager=ChatManager.getInstance();
  chatManager.init(this);
  if (AVUser.getCurrentUser() != null) {
    chatManager.setupManagerWithUserId(AVUser.getCurrentUser().getObjectId());
  }
  chatManager.setConversationEventHandler(ConversationManager.getEventHandler());
  ChatManagerAdapterImpl chatManagerAdapter=new ChatManagerAdapterImpl(App.ctx);
  chatManager.setChatManagerAdapter(chatManagerAdapter);
  ChatManager.setDebugEnabled(App.debug);
}
Program: 8525
Project: 8525
Buggy source:
public void findConversationsByConversationIds(List<String> ids,AVIMConversationQueryCallback callback){
  if (ids.size() > 0) {
    AVIMConversationQuery q=ChatManager.getInstance().getQuery();
    q.whereContainsIn(Constant.OBJECT_ID,ids);
    q.setLimit(1000);
    q.findInBackground(callback);
  }
 else {
    callback.done(new ArrayList<AVIMConversation>(),null);
  }
}

Fixed version (ground truth):
public void findConversationsByConversationIds(List<String> ids,AVIMConversationQueryCallback callback){
  if (ids.size() > 0) {
    AVIMConversationQuery q=ChatManager.getInstance().getConversationQuery();
    q.whereContainsIn(Constant.OBJECT_ID,ids);
    q.setLimit(1000);
    q.findInBackground(callback);
  }
 else {
    callback.done(new ArrayList<AVIMConversation>(),null);
  }
}
Program: 8526
Project: 8526
Buggy source:
public void createGroupConversation(List<String> members,final AVIMConversationCreatedCallback callback){
  Map<String,Object> map=new HashMap<String,Object>();
  map.put(ConversationType.TYPE_KEY,ConversationType.Group.getValue());
  final String name=MessageHelper.nameByUserIds(members);
  map.put(ConversationType.NAME_KEY,name);
  ChatManager.getInstance().getImClient().createConversation(members,map,callback);
}

Fixed version (ground truth):
public void createGroupConversation(List<String> members,final AVIMConversationCreatedCallback callback){
  Map<String,Object> map=new HashMap<String,Object>();
  map.put(ConversationType.TYPE_KEY,ConversationType.Group.getValue());
  final String name=MessageHelper.nameByUserIds(members);
  map.put("String_Node_Str",name);
  ChatManager.getInstance().createConversation(members,map,callback);
}
Program: 8527
Project: 8527
Buggy source:
public void findGroupConversationsIncludeMe(AVIMConversationQueryCallback callback){
  AVIMConversationQuery q=ChatManager.getInstance().getQuery();
  q.containsMembers(Arrays.asList(ChatManager.getInstance().getSelfId()));
  q.whereEqualTo(ConversationType.ATTR_TYPE_KEY,ConversationType.Group.getValue());
  q.orderByDescending(Constant.UPDATED_AT);
  q.findInBackground(callback);
}

Fixed version (ground truth):
public void findGroupConversationsIncludeMe(AVIMConversationQueryCallback callback){
  AVIMConversationQuery q=ChatManager.getInstance().getConversationQuery();
  q.containsMembers(Arrays.asList(ChatManager.getInstance().getSelfId()));
  q.whereEqualTo(ConversationType.ATTR_TYPE_KEY,ConversationType.Group.getValue());
  q.orderByDescending(Constant.UPDATED_AT);
  q.findInBackground(callback);
}
Program: 8528
Project: 8528
Buggy source:
public static void goMainActivityFromActivity(Activity fromActivity){
  EventBus eventBus=EventBus.getDefault();
  eventBus.post(new LoginFinishEvent());
  ChatManager chatManager=ChatManager.getInstance();
  chatManager.setupDatabaseWithSelfId(AVUser.getCurrentUser().getObjectId());
  chatManager.openClientWithSelfId(AVUser.getCurrentUser().getObjectId(),null);
  Intent intent=new Intent(fromActivity,MainActivity.class);
  fromActivity.startActivity(intent);
}

Fixed version (ground truth):
public static void goMainActivityFromActivity(Activity fromActivity){
  EventBus eventBus=EventBus.getDefault();
  eventBus.post(new LoginFinishEvent());
  ChatManager chatManager=ChatManager.getInstance();
  chatManager.setupManagerWithUserId(AVUser.getCurrentUser().getObjectId());
  chatManager.openClientWithUserId(null);
  Intent intent=new Intent(fromActivity,MainActivity.class);
  fromActivity.startActivity(intent);
}
Program: 8529
Project: 8529
Buggy source:
@OnClick(R.id.quit_layout) void quit(){
  final String convid=conv().getConversationId();
  conv().quit(new AVIMConversationCallback(){
    @Override public void done(    AVException e){
      if (filterException(e)) {
        RoomsTable roomsTable=RoomsTable.getCurrentUserInstance();
        roomsTable.deleteRoom(convid);
        Utils.toast(R.string.conversation_alreadyQuitConv);
        ConversationDetailActivity.this.finish();
        if (ChatActivity.getChatInstance() != null) {
          ChatActivity.getChatInstance().finish();
        }
      }
    }
  }
);
}

Fixed version (ground truth):
@OnClick(R.id.quit_layout) void quit(){
  final String convid=conv().getConversationId();
  conv().quit(new AVIMConversationCallback(){
    @Override public void done(    AVException e){
      if (filterException(e)) {
        ChatManager.getInstance().getRoomsTable().deleteRoom(convid);
        Utils.toast(R.string.conversation_alreadyQuitConv);
        ConversationDetailActivity.this.finish();
        if (ChatActivity.getChatInstance() != null) {
          ChatActivity.getChatInstance().finish();
        }
      }
    }
  }
);
}
Program: 8530
Project: 8530
Buggy source:
@Override public void onClick(View v){
  int id=v.getId();
  if (id == R.id.avatarLayout) {
    Intent intent=new Intent(Intent.ACTION_PICK,null);
    intent.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,"String_Node_Str");
    startActivityForResult(intent,IMAGE_PICK_REQUEST);
  }
 else   if (id == R.id.logoutLayout) {
    RoomsTable.DBHelper.getCurrentUserInstance().closeHelper();
    chatManager.closeWithCallback(new AVIMClientCallback(){
      @Override public void done(      AVIMClient avimClient,      AVException e){
      }
    }
);
    AVUser.logOut();
    getActivity().finish();
    Utils.goActivity(ctx,EntryLoginActivity.class);
  }
 else   if (id == R.id.notifyLayout) {
    Utils.goActivity(ctx,ProfileNotifySettingActivity.class);
  }
 else   if (id == R.id.updateLayout) {
    UpdateService updateService=UpdateService.getInstance(getActivity());
    updateService.showSureUpdateDialog();
  }
}

Fixed version (ground truth):
@Override public void onClick(View v){
  int id=v.getId();
  if (id == R.id.avatarLayout) {
    Intent intent=new Intent(Intent.ACTION_PICK,null);
    intent.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,"String_Node_Str");
    startActivityForResult(intent,IMAGE_PICK_REQUEST);
  }
 else   if (id == R.id.logoutLayout) {
    chatManager.closeWithCallback(new AVIMClientCallback(){
      @Override public void done(      AVIMClient avimClient,      AVException e){
      }
    }
);
    AVUser.logOut();
    getActivity().finish();
    Utils.goActivity(ctx,EntryLoginActivity.class);
  }
 else   if (id == R.id.notifyLayout) {
    Utils.goActivity(ctx,ProfileNotifySettingActivity.class);
  }
 else   if (id == R.id.updateLayout) {
    UpdateService updateService=UpdateService.getInstance(getActivity());
    updateService.showSureUpdateDialog();
  }
}
Program: 8531
Project: 8531
Buggy source:
@Override public void onCreate(){
  super.onCreate();
  AVOSCloud.initialize(this,"String_Node_Str","String_Node_Str");
  ChatManager.setDebugEnabled(true);
  AVOSCloud.setDebugLogEnabled(true);
  final ChatManager chatManager=ChatManager.getInstance();
  chatManager.init(this);
  chatManager.setChatManagerAdapter(new ChatManagerAdapter(){
    @Override public UserInfo getUserInfoById(    String userId){
      UserInfo userInfo=new UserInfo();
      userInfo.setUsername(userId);
      userInfo.setAvatarUrl("String_Node_Str");
      return userInfo;
    }
    @Override public void cacheUserInfoByIdsInBackground(    List<String> userIds) throws Exception {
    }
    @Override public void shouldShowNotification(    Context context,    String selfId,    AVIMConversation conversation,    AVIMTypedMessage message){
      Toast.makeText(context,"String_Node_Str",Toast.LENGTH_LONG).show();
    }
  }
);
  initImageLoader(this);
}

Fixed version (ground truth):
@Override public void onCreate(){
  super.onCreate();
  AVOSCloud.initialize(this,"String_Node_Str","String_Node_Str");
  ChatManager.setDebugEnabled(true);
  AVOSCloud.setDebugLogEnabled(true);
  ChatManager.getInstance().init(this);
  ChatManager.getInstance().setChatManagerAdapter(new ChatManagerAdapter(){
    @Override public UserInfo getUserInfoById(    String userId){
      UserInfo userInfo=new UserInfo();
      userInfo.setUsername(userId);
      userInfo.setAvatarUrl("String_Node_Str");
      return userInfo;
    }
    @Override public void cacheUserInfoByIdsInBackground(    List<String> userIds) throws Exception {
    }
    @Override public void shouldShowNotification(    Context context,    String selfId,    AVIMConversation conversation,    AVIMTypedMessage message){
      Toast.makeText(context,"String_Node_Str",Toast.LENGTH_LONG).show();
    }
  }
);
  initImageLoader(this);
}
Program: 8532
Project: 8532
Buggy source:
@Override public void onClick(View view){
  String selfId=selfIdEditText.getText().toString();
  if (!TextUtils.isEmpty(selfId)) {
    ChatManager chatManager=ChatManager.getInstance();
    chatManager.setupDatabaseWithSelfId(selfId);
    chatManager.openClientWithSelfId(selfId,new AVIMClientCallback(){
      @Override public void done(      AVIMClient avimClient,      AVException e){
        if (e != null) {
          e.printStackTrace();
        }
        Intent intent=new Intent(LoginActivity.this,MainActivity.class);
        startActivity(intent);
        finish();
      }
    }
);
  }
}

Fixed version (ground truth):
@Override public void onClick(View view){
  String selfId=selfIdEditText.getText().toString();
  if (!TextUtils.isEmpty(selfId)) {
    ChatManager chatManager=ChatManager.getInstance();
    chatManager.setupManagerWithUserId(selfId);
    chatManager.openClientWithUserId(new AVIMClientCallback(){
      @Override public void done(      AVIMClient avimClient,      AVException e){
        if (e != null) {
          e.printStackTrace();
        }
        Intent intent=new Intent(LoginActivity.this,MainActivity.class);
        startActivity(intent);
        finish();
      }
    }
);
  }
}
Program: 8533
Project: 8533
Buggy source:
public static String getCurrentChattingConvid(){
  return currentChattingConvid;
}

Fixed version (ground truth):
public static String getCurrentChattingConvid(){
  return ChatManager.currentChattingConvid;
}
Program: 8534
Project: 8534
Buggy source:
void commonInit(){
  chatInstance=this;
  roomsTable=RoomsTable.getCurrentUserInstance();
  eventBus=EventBus.getDefault();
  eventBus.register(this);
  getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
}

Fixed version (ground truth):
void commonInit(){
  chatInstance=this;
  roomsTable=ChatManager.getInstance().getRoomsTable();
  eventBus=EventBus.getDefault();
  eventBus.register(this);
  getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
}
Program: 8535
Project: 8535
Buggy source:
protected void onLocationMessageViewClicked(AVIMLocationMessage locationMessage){
}

Fixed version (ground truth):
/** 
 * 当地图消息view被点击时
 * @param locationMessage
 */
protected void onLocationMessageViewClicked(AVIMLocationMessage locationMessage){
}
Program: 8536
Project: 8536
Buggy source:
@Override public void onFailButtonClick(AVIMTypedMessage msg){
  messageAgent.resendMessage(msg,new MessageAgent.SendCallback(){
    @Override public void onError(    AVIMTypedMessage message,    Exception e){
      Utils.log();
      loadMessagesWhenInit(adapter.getCount());
    }
    @Override public void onSuccess(    AVIMTypedMessage message){
      Utils.log();
      loadMessagesWhenInit(adapter.getCount());
    }
  }
);
}

Fixed version (ground truth):
@Override public void onFailButtonClick(AVIMTypedMessage msg){
  messageAgent.resendMessage(msg,new MessageAgent.SendCallback(){
    @Override public void onError(    AVIMTypedMessage message,    Exception e){
      LogUtils.i();
      loadMessagesWhenInit(adapter.getCount());
    }
    @Override public void onSuccess(    AVIMTypedMessage message){
      LogUtils.i();
      loadMessagesWhenInit(adapter.getCount());
    }
  }
);
}
Program: 8537
Project: 8537
Buggy source:
public void loadOldMessages(){
  if (adapter.getDatas().size() == 0) {
    refreshableView.finishRefreshing();
    return;
  }
 else {
    AVIMTypedMessage firstMsg=adapter.getDatas().get(0);
    String msgId=adapter.getDatas().get(0).getMessageId();
    long time=firstMsg.getTimestamp();
    ChatManager.getInstance().queryMessages(conversation,msgId,time,PAGE_SIZE,new AVIMTypedMessagesArrayCallback(){
      @Override public void done(      List<AVIMTypedMessage> typedMessages,      AVException e){
        refreshableView.finishRefreshing();
        if (filterException(e)) {
          new CacheMessagesTask(ChatActivity.this,typedMessages){
            @Override void onSucceed(            List<AVIMTypedMessage> typedMessages){
              List<AVIMTypedMessage> newMessages=new ArrayList<>();
              newMessages.addAll(typedMessages);
              newMessages.addAll(adapter.getDatas());
              adapter.setDatas(newMessages);
              adapter.notifyDataSetChanged();
              if (typedMessages.size() > 0) {
                messageListView.setSelection(typedMessages.size() - 1);
              }
 else {
                toast(R.string.chat_activity_loadMessagesFinish);
              }
            }
          }
.execute();
        }
      }
    }
);
  }
}

Fixed version (ground truth):
public void loadOldMessages(){
  if (adapter.getDatas().size() == 0) {
    refreshableView.finishRefreshing();
    return;
  }
 else {
    AVIMTypedMessage firstMsg=adapter.getDatas().get(0);
    String msgId=firstMsg.getMessageId();
    long time=firstMsg.getTimestamp();
    ChatManager.getInstance().queryMessages(conversation,msgId,time,PAGE_SIZE,new AVIMTypedMessagesArrayCallback(){
      @Override public void done(      List<AVIMTypedMessage> typedMessages,      AVException e){
        refreshableView.finishRefreshing();
        if (filterException(e)) {
          new CacheMessagesTask(ChatActivity.this,typedMessages){
            @Override void onSucceed(            List<AVIMTypedMessage> typedMessages){
              List<AVIMTypedMessage> newMessages=new ArrayList<>(PAGE_SIZE);
              newMessages.addAll(typedMessages);
              newMessages.addAll(adapter.getDatas());
              adapter.setDatas(newMessages);
              adapter.notifyDataSetChanged();
              if (typedMessages.size() > 0) {
                messageListView.setSelection(typedMessages.size() - 1);
              }
 else {
                toast(R.string.chat_activity_loadMessagesFinish);
              }
            }
          }
.execute();
        }
      }
    }
);
  }
}
Program: 8538
Project: 8538
Buggy source:
@Override protected Void doInBackground(Void... voids){
  try {
    Set<String> userIds=new HashSet<String>();
    for (    AVIMTypedMessage msg : messages) {
      AVIMReservedMessageType type=AVIMReservedMessageType.getAVIMReservedMessageType(msg.getMessageType());
      if (type == AVIMReservedMessageType.AudioMessageType) {
        File file=new File(MessageHelper.getFilePath(msg));
        if (!file.exists()) {
          AVIMAudioMessage audioMsg=(AVIMAudioMessage)msg;
          String url=audioMsg.getFileUrl();
          Utils.downloadFileIfNotExists(url,file);
        }
      }
      userIds.add(msg.getFrom());
    }
    if (chatManager.getChatManagerAdapter() == null) {
      throw new NullPointerException("String_Node_Str");
    }
    chatManager.getChatManagerAdapter().cacheUserInfoByIdsInBackground(new ArrayList<String>(userIds));
  }
 catch (  Exception e) {
    this.e=e;
  }
  return null;
}

Fixed version (ground truth):
@Override protected Void doInBackground(Void... voids){
  try {
    Set<String> userIds=new HashSet<String>();
    for (    AVIMTypedMessage msg : messages) {
      AVIMReservedMessageType type=AVIMReservedMessageType.getAVIMReservedMessageType(msg.getMessageType());
      if (type == AVIMReservedMessageType.AudioMessageType) {
        File file=new File(MessageHelper.getFilePath(msg));
        if (!file.exists()) {
          AVIMAudioMessage audioMsg=(AVIMAudioMessage)msg;
          String url=audioMsg.getFileUrl();
          Utils.downloadFileIfNotExists(url,file);
        }
      }
      userIds.add(msg.getFrom());
    }
    if (chatManager.getChatManagerAdapter() == null) {
      throw new IllegalStateException("String_Node_Str");
    }
    chatManager.getChatManagerAdapter().cacheUserInfoByIdsInBackground(new ArrayList<String>(userIds));
  }
 catch (  Exception e) {
    this.e=e;
  }
  return null;
}