nus-yam/ex-repair huggingface dataset:
Program: 37434
Project: 37434
Buggy source:
/** 
 * Get the local variables of an stack frame.
 * @param stackFrame the stack frame
 * @return local variable list
 * @throws AbsentInformationException when there is any error in retrieving information
 */
public static List<Variable> listLocalVariables(StackFrame stackFrame) throws AbsentInformationException {
  List<Variable> res=new ArrayList<>();
  try {
    for (    LocalVariable localVariable : stackFrame.visibleVariables()) {
      Variable var=new Variable(localVariable.name(),stackFrame.getValue(localVariable));
      var.local=localVariable;
      res.add(var);
    }
  }
 catch (  AbsentInformationException ex) {
    int argId=0;
    try {
      for (      Value argValue : stackFrame.getArgumentValues()) {
        Variable var=new Variable("String_Node_Str" + argId,argValue);
        var.argumentIndex=argId++;
        res.add(var);
      }
    }
 catch (    InternalException ex2) {
      if (ex2.errorCode() != 32) {
        throw ex;
      }
    }
  }
  return res;
}

Fixed version (ground truth):
/** 
 * Get the local variables of an stack frame.
 * @param stackFrame the stack frame
 * @return local variable list
 * @throws AbsentInformationException when there is any error in retrieving information
 */
public static List<Variable> listLocalVariables(StackFrame stackFrame) throws AbsentInformationException {
  List<Variable> res=new ArrayList<>();
  try {
    for (    LocalVariable localVariable : stackFrame.visibleVariables()) {
      Variable var=new Variable(localVariable.name(),stackFrame.getValue(localVariable));
      var.local=localVariable;
      res.add(var);
    }
  }
 catch (  AbsentInformationException ex) {
    int argId=0;
    try {
      List<Value> arguments=stackFrame.getArgumentValues();
      if (arguments == null) {
        return res;
      }
      for (      Value argValue : arguments) {
        Variable var=new Variable("String_Node_Str" + argId,argValue);
        var.argumentIndex=argId++;
        res.add(var);
      }
    }
 catch (    InternalException ex2) {
      if (ex2.errorCode() != 32) {
        throw ex;
      }
    }
  }
  return res;
}
Program: 37435
Project: 37435
Buggy source:
private void checkThreadRunningAndRecycleIds(ThreadReference thread){
  if (allThreadRunning()) {
    this.variableRequestHandler.recyclableAllObject();
  }
 else {
    this.variableRequestHandler.recyclableThreads(thread);
  }
}

Fixed version (ground truth):
private void checkThreadRunningAndRecycleIds(ThreadReference thread){
  try {
    if (allThreadRunning()) {
      this.variableRequestHandler.recyclableAllObject();
    }
 else {
      this.variableRequestHandler.recyclableThreads(thread);
    }
  }
 catch (  VMDisconnectedException ex) {
    this.variableRequestHandler.recyclableAllObject();
  }
}
Program: 37436
Project: 37436
Buggy source:
/** 
 * Get the local variables of an stack frame.
 * @param stackFrame the stack frame
 * @return local variable list
 * @throws AbsentInformationException when there is any error in retrieving information
 */
public static List<Variable> listLocalVariables(StackFrame stackFrame) throws AbsentInformationException {
  List<Variable> res=new ArrayList<>();
  try {
    for (    LocalVariable localVariable : stackFrame.visibleVariables()) {
      Variable var=new Variable(localVariable.name(),stackFrame.getValue(localVariable));
      var.local=localVariable;
      res.add(var);
    }
  }
 catch (  AbsentInformationException ex) {
    int argId=0;
    try {
      List<Value> arguments=stackFrame.getArgumentValues();
      if (arguments == null) {
        return res;
      }
      for (      Value argValue : arguments) {
        Variable var=new Variable("String_Node_Str" + argId,argValue);
        var.argumentIndex=argId++;
        res.add(var);
      }
    }
 catch (    InternalException ex2) {
      if (ex2.errorCode() != 32) {
        throw ex;
      }
    }
  }
  return res;
}

Fixed version (ground truth):
/** 
 * Get the local variables of an stack frame.
 * @param stackFrame the stack frame
 * @return local variable list
 * @throws AbsentInformationException when there is any error in retrieving information
 */
public static List<Variable> listLocalVariables(StackFrame stackFrame) throws AbsentInformationException {
  List<Variable> res=new ArrayList<>();
  try {
    for (    LocalVariable localVariable : stackFrame.visibleVariables()) {
      Variable var=new Variable(localVariable.name(),stackFrame.getValue(localVariable));
      var.local=localVariable;
      res.add(var);
    }
  }
 catch (  AbsentInformationException ex) {
    if (stackFrame.location().method().isNative()) {
      return res;
    }
    int argId=0;
    try {
      List<Value> arguments=stackFrame.getArgumentValues();
      if (arguments == null) {
        return res;
      }
      for (      Value argValue : arguments) {
        Variable var=new Variable("String_Node_Str" + argId,argValue);
        var.argumentIndex=argId++;
        res.add(var);
      }
    }
 catch (    InternalException ex2) {
      if (ex2.errorCode() != 32) {
        throw ex;
      }
    }
  }
  return res;
}
Program: 37437
Project: 37437
Buggy source:
private void openUserProfile(){
  openPage(ConstantUtil.USER_PROFILE_SELF_FAKE_URL,getString(R.string.profile));
}

Fixed version (ground truth):
private void openUserProfile(){
  openPage(ConstantUtil.USER_PROFILE_SELF_FAKE_URL,getString(R.string.personal_center));
}
Program: 37438
Project: 37438
Buggy source:
private void initViews(){
  initWebView();
  initRecyclerView();
  mCommentEditText.addTextChangedListener(new TextWatcher(){
    @Override public void beforeTextChanged(    CharSequence charSequence,    int i,    int i1,    int i2){
    }
    @Override public void onTextChanged(    CharSequence charSequence,    int i,    int i1,    int i2){
    }
    @Override public void afterTextChanged(    Editable editable){
      mSubmitButton.setEnabled(!TextUtils.isEmpty(editable));
    }
  }
);
}

Fixed version (ground truth):
private void initViews(){
  initWebView();
  initRecyclerView();
  mCommentEditText.addTextChangedListener(new TextWatcher(){
    @Override public void beforeTextChanged(    CharSequence charSequence,    int i,    int i1,    int i2){
    }
    @Override public void onTextChanged(    CharSequence charSequence,    int i,    int i1,    int i2){
    }
    @Override public void afterTextChanged(    Editable editable){
      mSubmitButton.setEnabled(!TextUtils.isEmpty(editable));
    }
  }
);
  mCommentEditText.setOnFocusChangeListener(new View.OnFocusChangeListener(){
    @Override public void onFocusChange(    View v,    boolean hasFocus){
      if (hasFocus) {
        InputMethodManager imm=(InputMethodManager)getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,0);
      }
 else {
        InputMethodManager imm=(InputMethodManager)getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.hideSoftInputFromWindow(v.getWindowToken(),0);
      }
    }
  }
);
  mCommentEditText.setParentView(mCommentsView);
}
Program: 37439
Project: 37439
Buggy source:
@Override public void onGetTopicListFailed(String msg){
  finishRefresh();
  if (getContext() == null) {
    return;
  }
  Toast.makeText(getActivity(),msg,Toast.LENGTH_SHORT).show();
  handleEmptyList();
}

Fixed version (ground truth):
@Override public void onGetTopicListFailed(String msg){
  finishRefresh();
  if (getContext() == null) {
    return;
  }
  mNoContentTextView.setText(R.string.no_content);
  Toast.makeText(getActivity(),msg,Toast.LENGTH_SHORT).show();
  handleEmptyList();
}
Program: 37440
Project: 37440
Buggy source:
@Override public void onRefresh(){
  if (!mFirstFetchFinished) {
    return;
  }
  mPresenter.getTopicList();
}

Fixed version (ground truth):
@Override public void onRefresh(){
  if (!mFirstFetchFinished) {
    return;
  }
  mNoContentTextView.setText("String_Node_Str");
  mPresenter.getTopicList();
}
Program: 37441
Project: 37441
Buggy source:
private void initSwipeLayout(SwipeRefreshLayout swipeRefreshLayout){
  swipeRefreshLayout.setOnRefreshListener(this);
  swipeRefreshLayout.setColorSchemeResources(R.color.metaColor,R.color.colorAccent,android.R.color.white);
}

Fixed version (ground truth):
private void initSwipeLayout(SwipeRefreshLayout swipeRefreshLayout){
  swipeRefreshLayout.setOnRefreshListener(this);
  swipeRefreshLayout.setColorSchemeResources(R.color.main);
}
Program: 37442
Project: 37442
Buggy source:
@Override public void onGetTopicListSucceed(TopicList topicList){
  finishRefresh();
  if (getContext() == null) {
    return;
  }
  mLoadable=topicList.isHasMore();
  mAdapter.setData(topicList.getTopics());
  handleEmptyList();
}

Fixed version (ground truth):
@Override public void onGetTopicListSucceed(TopicList topicList){
  finishRefresh();
  if (getContext() == null) {
    return;
  }
  if (topicList.getTopics().isEmpty()) {
    mNoContentTextView.setText(R.string.no_content);
  }
  mLoadable=topicList.isHasMore();
  mAdapter.setData(topicList.getTopics());
  handleEmptyList();
}
Program: 37443
Project: 37443
Buggy source:
@OnClick({R.id.user_favors,R.id.user_topics,R.id.user_replies,R.id.logout}) public void onClick(View v){
  if (mListener == null || mUserProfile == null) {
    return;
  }
switch (v.getId()) {
case R.id.user_favors:
    mListener.openPage(String.format(ConstantUtil.USER_FAVORS_BASE_URL,mUserProfile.getUsername()),mFavoriteTextView.getText().toString());
  break;
case R.id.user_topics:
mListener.openPage(String.format(ConstantUtil.USER_TOPICS_BASE_URL,mUserProfile.getUsername()),mTopicTextView.getText().toString());
break;
case R.id.user_replies:
mListener.openPage(String.format(ConstantUtil.USER_REPLIES_BASE_URL,mUserProfile.getUsername()),mReplyTextView.getText().toString());
break;
case R.id.logout:
mListener.onLoginStatusChanged(false);
getActivity().onBackPressed();
break;
default :
break;
}
}

Fixed version (ground truth):
@Override public void onClick(DialogInterface dialog,int which){
  mListener.onLoginStatusChanged(false);
  getActivity().onBackPressed();
}
Program: 37444
Project: 37444
Buggy source:
public GetTopicListTask(String url,OnResponseListener<List<Topic>> listener){
  super(listener);
  mUrl=url;
}

Fixed version (ground truth):
public GetTopicListTask(String url,OnResponseListener<TopicList> listener){
  super(listener);
  mUrl=url;
}
Program: 37445
Project: 37445
Buggy source:
@Override public void run(){
  List<Topic> topics=new ArrayList<>();
  boolean succeed=false;
  try {
    Document doc=getConnection(mUrl).get();
    Elements elements=doc.select("String_Node_Str");
    for (    Element element : elements) {
      Topic topic=createTopicFromElement(element);
      topics.add(topic);
    }
    succeed=true;
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  if (succeed) {
    if (topics.size() > 0) {
      successOnUI(topics);
    }
 else {
      failedOnUI("String_Node_Str");
    }
  }
 else {
    failedOnUI("String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void run(){
  List<Topic> topics=new ArrayList<>();
  boolean succeed=false;
  boolean hasMore=false;
  try {
    Document doc=getConnection(mUrl).get();
    Elements elements=doc.select("String_Node_Str");
    for (    Element element : elements) {
      Topic topic=createTopicFromElement(element);
      topics.add(topic);
    }
    succeed=true;
    Elements paginationElements=doc.select("String_Node_Str");
    if (!paginationElements.isEmpty()) {
      Elements disabledElements=paginationElements.select("String_Node_Str");
      if (disabledElements.isEmpty()) {
        hasMore=true;
      }
 else       if (disabledElements.last() != null) {
        Elements disableLinkElements=disabledElements.last().select("String_Node_Str");
        if (!"String_Node_Str".equals(disableLinkElements.text())) {
          hasMore=true;
        }
      }
    }
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  if (succeed) {
    if (topics.size() > 0) {
      TopicList topicList=new TopicList();
      topicList.setTopics(topics);
      topicList.setHasMore(hasMore);
      successOnUI(topicList);
    }
 else {
      failedOnUI("String_Node_Str");
    }
  }
 else {
    failedOnUI("String_Node_Str");
  }
}
Program: 37446
Project: 37446
Buggy source:
void onGetTopicListSucceed(List<Topic> topicList);

Fixed version (ground truth):
void onGetTopicListSucceed(TopicList topicList);
Program: 37447
Project: 37447
Buggy source:
void onGetMoreTopicSucceed(List<Topic> topicList);

Fixed version (ground truth):
void onGetMoreTopicSucceed(TopicList topicList);
Program: 37448
Project: 37448
Buggy source:
@Override public void onGetTopicListSucceed(List<Topic> topicList){
  if (getContext() == null) {
    return;
  }
  mAdapter.setData(topicList);
}

Fixed version (ground truth):
@Override public void onGetTopicListSucceed(TopicList topicList){
  if (getContext() == null) {
    return;
  }
  mLoadable=topicList.isHasMore();
  mAdapter.setData(topicList.getTopics());
}
Program: 37450
Project: 37450
Buggy source:
@Override public void onScrolled(RecyclerView recyclerView,int dx,int dy){
  if (dy > 0) {
    visibleItemCount=layoutManager.getChildCount();
    totalItemCount=layoutManager.getItemCount();
    pastVisibleItems=layoutManager.findFirstVisibleItemPosition();
    if (mLoadable) {
      if ((visibleItemCount + pastVisibleItems) >= totalItemCount) {
        mLoadable=false;
        if (totalItemCount > ConstantUtil.TOPICS_PER_PAGE && totalItemCount <= 1024) {
          mPresenter.getMoreTopic(totalItemCount / ConstantUtil.TOPICS_PER_PAGE + 1);
        }
 else {
          Toast.makeText(getActivity(),"String_Node_Str",Toast.LENGTH_SHORT).show();
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override public void onScrolled(RecyclerView recyclerView,int dx,int dy){
  if (dy > 0) {
    visibleItemCount=layoutManager.getChildCount();
    totalItemCount=layoutManager.getItemCount();
    pastVisibleItems=layoutManager.findFirstVisibleItemPosition();
    if (mLoadable) {
      if ((visibleItemCount + pastVisibleItems) >= totalItemCount) {
        mLoadable=false;
        if (totalItemCount >= ConstantUtil.TOPICS_PER_PAGE && totalItemCount <= 1024) {
          mPresenter.getMoreTopic(totalItemCount / ConstantUtil.TOPICS_PER_PAGE + 1);
        }
 else {
          Toast.makeText(getActivity(),"String_Node_Str",Toast.LENGTH_SHORT).show();
        }
      }
    }
  }
}
Program: 37451
Project: 37451
Buggy source:
@Override public void onGetMoreTopicSucceed(List<Topic> topicList){
  if (getContext() == null) {
    return;
  }
  mAdapter.addData(topicList);
  mLoadable=true;
}

Fixed version (ground truth):
@Override public void onGetMoreTopicSucceed(TopicList topicList){
  if (getContext() == null) {
    return;
  }
  mLoadable=topicList.isHasMore();
  mAdapter.addData(topicList.getTopics());
}
Program: 37452
Project: 37452
Buggy source:
@Override public void getMoreTopic(int page){
  NetworkTaskScheduler.getInstance().execute(new GetTopicListTask(UrlUtil.appendPage(mView.getUrl(),page),new OnResponseListener<List<Topic>>(){
    @Override public void onSucceed(    List<Topic> data){
      mView.onGetMoreTopicSucceed(data);
    }
    @Override public void onFailed(    String msg){
      mView.onGetMoreTopicFailed(msg);
    }
  }
));
}

Fixed version (ground truth):
@Override public void getMoreTopic(int page){
  NetworkTaskScheduler.getInstance().execute(new GetTopicListTask(UrlUtil.appendPage(mView.getUrl(),page),new OnResponseListener<TopicList>(){
    @Override public void onSucceed(    TopicList data){
      mView.onGetMoreTopicSucceed(data);
    }
    @Override public void onFailed(    String msg){
      mView.onGetMoreTopicFailed(msg);
    }
  }
));
}
Program: 37453
Project: 37453
Buggy source:
@Override public void getTopicList(){
  NetworkTaskScheduler.getInstance().execute(new GetTopicListTask(mView.getUrl(),new OnResponseListener<List<Topic>>(){
    @Override public void onSucceed(    List<Topic> data){
      mView.onGetTopicListSucceed(data);
    }
    @Override public void onFailed(    String msg){
      mView.onGetTopicListFailed(msg);
    }
  }
));
}

Fixed version (ground truth):
@Override public void getTopicList(){
  NetworkTaskScheduler.getInstance().execute(new GetTopicListTask(mView.getUrl(),new OnResponseListener<TopicList>(){
    @Override public void onSucceed(    TopicList data){
      mView.onGetTopicListSucceed(data);
    }
    @Override public void onFailed(    String msg){
      mView.onGetTopicListFailed(msg);
    }
  }
));
}
Program: 37454
Project: 37454
Buggy source:
@Override public void onSucceed(List<Topic> data){
  mView.onGetMoreTopicSucceed(data);
}

Fixed version (ground truth):
@Override public void onSucceed(TopicList data){
  mView.onGetMoreTopicSucceed(data);
}
Program: 37455
Project: 37455
Buggy source:
@Override public void updateState(String state,String logMessage,int localizedResId,ConnectionStatus level){
  Logger.logError("String_Node_Str",state + "String_Node_Str" + logMessage+ "String_Node_Str"+ getString(localizedResId),null);
  runOnUiThread(() -> {
    if (state.equals("String_Node_Str") || (state.equals("String_Node_Str"))) {
      if (AppPreferences.getInstance().getLong(AppConstants.PREFS_CONNECTION_START_TIME) == 0L && state.equals("String_Node_Str"))       AppPreferences.getInstance().saveLong(AppConstants.PREFS_CONNECTION_START_TIME,System.currentTimeMillis());
      SentinelLiteApp.isVpnConnected=true;
    }
    if (!VpnStatus.isVPNActive()) {
      if (SentinelLiteApp.isVpnConnected && !mHasActivityResult) {
        SentinelLiteApp.isVpnInitiated=false;
        SentinelLiteApp.isVpnConnected=false;
        AppPreferences.getInstance().saveLong(AppConstants.PREFS_CONNECTION_START_TIME,0L);
        loadVpnFragment(state.equals("String_Node_Str") ? null : getString(localizedResId));
      }
    }
    if (state.equals("String_Node_Str")) {
      SentinelLiteApp.isVpnInitiated=false;
      SentinelLiteApp.isVpnConnected=false;
      AppPreferences.getInstance().saveLong(AppConstants.PREFS_CONNECTION_START_TIME,0L);
      loadVpnFragment(getString(localizedResId));
    }
    if (mHasActivityResult) {
      onVpnConnectionInitiated(AppPreferences.getInstance().getString(AppConstants.PREFS_CONFIG_PATH));
      mHasActivityResult=false;
    }
  }
);
}

Fixed version (ground truth):
@Override public void updateState(String state,String logMessage,int localizedResId,ConnectionStatus level){
  Logger.logError("String_Node_Str",state + "String_Node_Str" + logMessage+ "String_Node_Str"+ getString(localizedResId),null);
  runOnUiThread(() -> {
    if (state.equals("String_Node_Str") || (state.equals("String_Node_Str"))) {
      if (AppPreferences.getInstance().getLong(AppConstants.PREFS_CONNECTION_START_TIME) == 0L && state.equals("String_Node_Str"))       AppPreferences.getInstance().saveLong(AppConstants.PREFS_CONNECTION_START_TIME,System.currentTimeMillis());
      SentinelLiteApp.isVpnConnected=true;
    }
    if (!VpnStatus.isVPNActive()) {
      if (SentinelLiteApp.isVpnConnected && !mHasActivityResult) {
        SentinelLiteApp.isVpnInitiated=false;
        SentinelLiteApp.isVpnConnected=false;
        AppPreferences.getInstance().saveLong(AppConstants.PREFS_CONNECTION_START_TIME,0L);
        loadVpnFragment(null);
      }
    }
    if (state.equals("String_Node_Str")) {
      SentinelLiteApp.isVpnInitiated=false;
      SentinelLiteApp.isVpnConnected=false;
      AppPreferences.getInstance().saveLong(AppConstants.PREFS_CONNECTION_START_TIME,0L);
      loadVpnFragment(getString(localizedResId));
    }
    if (mHasActivityResult) {
      onVpnConnectionInitiated(AppPreferences.getInstance().getString(AppConstants.PREFS_CONFIG_PATH));
      mHasActivityResult=false;
    }
  }
);
}
Program: 37456
Project: 37456
Buggy source:
private void initView(){
  mPrgDialog=ProgressDialogFragment.newInstance(true);
  mTetReferral=findViewById(R.id.tet_referral);
  findViewById(R.id.btn_next).setOnClickListener(this);
  mTetReferral.addTextChangedListener(this);
}

Fixed version (ground truth):
private void initView(){
  mPrgDialog=ProgressDialogFragment.newInstance(true);
  mTetReferral=findViewById(R.id.tet_referral);
  mTetReferral.setFilters(new InputFilter[]{new InputFilter.AllCaps()});
  findViewById(R.id.btn_next).setOnClickListener(this);
  mTetReferral.addTextChangedListener(this);
}
Program: 37457
Project: 37457
Buggy source:
private void initView(){
  mVpInfoPager=findViewById(R.id.vp_info_pager);
  mVpiInfoDots=findViewById(R.id.vpi_info_dots);
  mTvNext=findViewById(R.id.btn_next);
  mAdapter=new InfoPagerAdapter(getSupportFragmentManager(),this);
  mVpInfoPager.setAdapter(mAdapter);
  mVpInfoPager.setPageTransformer(true,new ZoomOutPageTransformer());
  mVpInfoPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener(){
    @Override public void onPageScrolled(    int position,    float positionOffset,    int positionOffsetPixels){
    }
    @Override public void onPageSelected(    int position){
      mTvNext.setVisibility(position == 1 ? View.VISIBLE : View.GONE);
    }
    @Override public void onPageScrollStateChanged(    int state){
    }
  }
);
  mVpiInfoDots.setDotsClickable(true);
  mVpiInfoDots.setViewPager(mVpInfoPager);
  mTvNext.setOnClickListener(v -> openLauncherActivity());
}

Fixed version (ground truth):
private void initView(){
  mVpInfoPager=findViewById(R.id.vp_info_pager);
  mVpiInfoDots=findViewById(R.id.vpi_info_dots);
  mTvNext=findViewById(R.id.btn_next);
  mAdapter=new InfoPagerAdapter(getSupportFragmentManager(),this);
  mVpInfoPager.setAdapter(mAdapter);
  mVpInfoPager.setPageTransformer(true,new ZoomOutPageTransformer());
  mVpiInfoDots.setDotsClickable(true);
  mVpiInfoDots.setViewPager(mVpInfoPager);
  mTvNext.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      int aCurrentItem=mVpInfoPager.getCurrentItem();
      if (aCurrentItem == 0) {
        mVpInfoPager.setCurrentItem(mVpInfoPager.getCurrentItem() + 1);
      }
 else {
        openLauncherActivity();
      }
    }
  }
);
}
Program: 37458
Project: 37458
Buggy source:
private void setBalanceValue(Chains iData){
  boolean aIsChecked=AppPreferences.getInstance().getBoolean(AppConstants.PREFS_IS_TEST_NET_ACTIVE);
  mTvTotalEther.setText(mViewModel.getFormattedEthBalance(aIsChecked ? iData.getRinkeby().eths : iData.getMain().eths));
  mTvTotalSent.setText(mViewModel.getFormattedSentBalance(aIsChecked ? iData.getRinkeby().sents : iData.getMain().sents));
  setTextDesc(aIsChecked);
}

Fixed version (ground truth):
private void setBalanceValue(Chains iData){
  if (iData != null) {
    boolean aIsChecked=AppPreferences.getInstance().getBoolean(AppConstants.PREFS_IS_TEST_NET_ACTIVE);
    mTvTotalEther.setText(mViewModel.getFormattedEthBalance(aIsChecked ? iData.getRinkeby().eths : iData.getMain().eths));
    mTvTotalSent.setText(mViewModel.getFormattedSentBalance(aIsChecked ? iData.getRinkeby().sents : iData.getMain().sents));
    setTextDesc(aIsChecked);
  }
}
Program: 37459
Project: 37459
Buggy source:
public void updateBalance(boolean isChecked){
  setBalanceValue(mViewModel.updateBalance(isChecked));
}

Fixed version (ground truth):
public void updateBalance(){
  setBalanceValue(mViewModel.updateBalance());
}
Program: 37460
Project: 37460
Buggy source:
public Chains updateBalance(boolean isChecked){
  return mBalanceLiveData.getValue();
}

Fixed version (ground truth):
public Chains updateBalance(){
  return mBalanceLiveData.getValue();
}
Program: 37461
Project: 37461
Buggy source:
@Override public void onCreate(){
  super.onCreate();
  PRNGFixes.apply();
  Bugsnag.init(this);
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
    createNotificationChannels();
  }
  StatusListener mStatus=new StatusListener();
  mStatus.init(getApplicationContext());
  sInstance=this;
  MultiDex.install(this);
  if (AppPreferences.getInstance().getString(AppConstants.PREFS_FILE_PATH).isEmpty()) {
    String aFilePath=new File(getFilesDir(),AppConstants.FILE_NAME).getAbsolutePath();
    AppPreferences.getInstance().saveString(AppConstants.PREFS_FILE_PATH,aFilePath);
  }
  if (AppPreferences.getInstance().getString(AppConstants.PREFS_CONFIG_PATH).isEmpty()) {
    String aConfigPath=new File(getFilesDir(),AppConstants.CONFIG_NAME).getAbsolutePath();
    AppPreferences.getInstance().saveString(AppConstants.PREFS_CONFIG_PATH,aConfigPath);
  }
}

Fixed version (ground truth):
@Override public void onCreate(){
  super.onCreate();
  PRNGFixes.apply();
  Bugsnag.init(this);
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
    createNotificationChannels();
  }
  if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
    upgradeSecurityProvider();
  }
  StatusListener mStatus=new StatusListener();
  mStatus.init(getApplicationContext());
  sInstance=this;
  MultiDex.install(this);
  if (AppPreferences.getInstance().getString(AppConstants.PREFS_FILE_PATH).isEmpty()) {
    String aFilePath=new File(getFilesDir(),AppConstants.FILE_NAME).getAbsolutePath();
    AppPreferences.getInstance().saveString(AppConstants.PREFS_FILE_PATH,aFilePath);
  }
  if (AppPreferences.getInstance().getString(AppConstants.PREFS_CONFIG_PATH).isEmpty()) {
    String aConfigPath=new File(getFilesDir(),AppConstants.CONFIG_NAME).getAbsolutePath();
    AppPreferences.getInstance().saveString(AppConstants.PREFS_CONFIG_PATH,aConfigPath);
  }
}
Program: 37462
Project: 37462
Buggy source:
private static void setupRestClient(){
  HttpLoggingInterceptor aLoggingInterceptor=new HttpLoggingInterceptor();
  aLoggingInterceptor.setLevel(BuildConfig.DEBUG ? HttpLoggingInterceptor.Level.BODY : HttpLoggingInterceptor.Level.NONE);
  ContentTypeInterceptor aContentTypeInterceptor=new ContentTypeInterceptor();
  OkHttpClient aClient=new OkHttpClient.Builder().connectTimeout(30,TimeUnit.SECONDS).readTimeout(30,TimeUnit.SECONDS).writeTimeout(30,TimeUnit.SECONDS).retryOnConnectionFailure(false).addInterceptor(aLoggingInterceptor).addInterceptor(aContentTypeInterceptor).build();
  Retrofit aRetrofit=new Retrofit.Builder().baseUrl(BASE_URL).client(aClient).addConverterFactory(GsonConverterFactory.create()).build();
  sWebService=aRetrofit.create(WebService.class);
}

Fixed version (ground truth):
private static void setupRestClient(){
  HttpLoggingInterceptor aLoggingInterceptor=new HttpLoggingInterceptor();
  aLoggingInterceptor.setLevel(BuildConfig.DEBUG ? HttpLoggingInterceptor.Level.BODY : HttpLoggingInterceptor.Level.NONE);
  ContentTypeInterceptor aContentTypeInterceptor=new ContentTypeInterceptor();
  OkHttpClient.Builder aClientBuilder=new OkHttpClient.Builder().connectTimeout(30,TimeUnit.SECONDS).readTimeout(30,TimeUnit.SECONDS).writeTimeout(30,TimeUnit.SECONDS).retryOnConnectionFailure(false).addInterceptor(aLoggingInterceptor).addInterceptor(aContentTypeInterceptor);
  OkHttpClient aClient=enableTls12OnPreLollipop(aClientBuilder).build();
  Retrofit aRetrofit=new Retrofit.Builder().baseUrl(BASE_URL).client(aClient).addConverterFactory(GsonConverterFactory.create()).build();
  sWebService=aRetrofit.create(WebService.class);
}
Program: 37463
Project: 37463
Buggy source:
private void getUnoccupiedVpnList(){
  mVpnListMutableLiveData.postValue(Resource.loading(null));
  mWebService.getUnoccupiedVpnList().enqueue(new Callback<Vpn>(){
    @Override public void onResponse(    Call<Vpn> call,    Response<Vpn> response){
      reportSuccessResponse(response);
    }
    @Override public void onFailure(    Call<Vpn> call,    Throwable t){
      reportErrorResponse(t.getLocalizedMessage());
    }
    private void reportSuccessResponse(    Response<Vpn> response){
      if (response != null && response.body() != null) {
        if (response.body().success)         mVpnListMutableLiveData.postValue(Resource.success(response.body()));
 else         reportErrorResponse(Resources.getSystem().getString(R.string.empty_vpn_list));
      }
    }
    private void reportErrorResponse(    String iThrowableLocalMessage){
      if (iThrowableLocalMessage != null)       mVpnListMutableLiveData.postValue(Resource.error(iThrowableLocalMessage,null));
 else       mVpnListMutableLiveData.postValue(Resource.error(AppConstants.GENERIC_ERROR,null));
    }
  }
);
}

Fixed version (ground truth):
private void getUnoccupiedVpnList(){
  mWebService.getUnoccupiedVpnList().enqueue(new Callback<Vpn>(){
    @Override public void onResponse(    Call<Vpn> call,    Response<Vpn> response){
      reportSuccessResponse(response);
    }
    @Override public void onFailure(    Call<Vpn> call,    Throwable t){
      reportErrorResponse(t.getLocalizedMessage());
    }
    private void reportSuccessResponse(    Response<Vpn> response){
      if (response != null && response.body() != null) {
        if (response.body().success)         mVpnListMutableLiveData.postValue(Resource.success(response.body()));
 else         reportErrorResponse(Resources.getSystem().getString(R.string.empty_vpn_list));
      }
    }
    private void reportErrorResponse(    String iThrowableLocalMessage){
      if (iThrowableLocalMessage != null)       mVpnListMutableLiveData.postValue(Resource.error(iThrowableLocalMessage,null));
 else       mVpnListMutableLiveData.postValue(Resource.error(AppConstants.GENERIC_ERROR,null));
    }
  }
);
}
Program: 37464
Project: 37464
Buggy source:
public void getVpnUsageForUser(GenericRequestBody iRequestBody){
  mVpnGetServerCredentialsLiveEvent.postValue(Resource.loading(null));
  mWebService.getVpnUsageForUser(iRequestBody).enqueue(new Callback<VpnUsage>(){
    @Override public void onResponse(    Call<VpnUsage> call,    Response<VpnUsage> response){
      reportSuccessResponse(response);
    }
    @Override public void onFailure(    Call<VpnUsage> call,    Throwable t){
      reportErrorResponse(t.getLocalizedMessage());
    }
    private void reportSuccessResponse(    Response<VpnUsage> response){
      if (response != null && response.body() != null) {
        if (response.body().success)         mVpnUsageLiveEvent.postValue(Resource.success(response.body()));
      }
 else {
        reportErrorResponse(null);
      }
    }
    private void reportErrorResponse(    String iThrowableLocalMessage){
      if (iThrowableLocalMessage != null)       mVpnGetServerCredentialsLiveEvent.postValue(Resource.error(iThrowableLocalMessage,null));
 else       mVpnGetServerCredentialsLiveEvent.postValue(Resource.error(AppConstants.GENERIC_ERROR,null));
    }
  }
);
}

Fixed version (ground truth):
public void getVpnUsageForUser(GenericRequestBody iRequestBody){
  mWebService.getVpnUsageForUser(iRequestBody).enqueue(new Callback<VpnUsage>(){
    @Override public void onResponse(    Call<VpnUsage> call,    Response<VpnUsage> response){
      reportSuccessResponse(response);
    }
    @Override public void onFailure(    Call<VpnUsage> call,    Throwable t){
      reportErrorResponse(t.getLocalizedMessage());
    }
    private void reportSuccessResponse(    Response<VpnUsage> response){
      if (response != null && response.body() != null) {
        if (response.body().success)         mVpnUsageLiveEvent.postValue(Resource.success(response.body()));
      }
 else {
        reportErrorResponse(null);
      }
    }
    private void reportErrorResponse(    String iThrowableLocalMessage){
      if (iThrowableLocalMessage != null)       mVpnUsageLiveEvent.postValue(Resource.error(iThrowableLocalMessage,null));
 else       mVpnUsageLiveEvent.postValue(Resource.error(AppConstants.GENERIC_ERROR,null));
    }
  }
);
}
Program: 37465
Project: 37465
Buggy source:
private void reportErrorResponse(String iThrowableLocalMessage){
  if (iThrowableLocalMessage != null)   mVpnGetServerCredentialsLiveEvent.postValue(Resource.error(iThrowableLocalMessage,null));
 else   mVpnGetServerCredentialsLiveEvent.postValue(Resource.error(AppConstants.GENERIC_ERROR,null));
}

Fixed version (ground truth):
private void reportErrorResponse(String iThrowableLocalMessage){
  if (iThrowableLocalMessage != null)   mVpnUsageLiveEvent.postValue(Resource.error(iThrowableLocalMessage,null));
 else   mVpnUsageLiveEvent.postValue(Resource.error(AppConstants.GENERIC_ERROR,null));
}
Program: 37467
Project: 37467
Buggy source:
public SmsStatusPullCallbackResult jsonToSmsStatusPullCallbackrResult(JSONObject json){
  SmsStatusPullCallbackResult result=new SmsStatusPullCallbackResult();
  result.result=json.getInt("String_Node_Str");
  result.errmsg=json.getString("String_Node_Str");
  if (true == json.isNull("String_Node_Str")) {
    return result;
  }
  result.callbacks=new ArrayList<Callback>();
  JSONArray datas=json.getJSONArray("String_Node_Str");
  for (int index=0; index < datas.length(); index++) {
    JSONObject cb=datas.getJSONObject(index);
    SmsStatusPullCallbackResult.Callback callback=result.new Callback();
    callback.user_receive_time=cb.getString("String_Node_Str");
    callback.nationcode=cb.getString("String_Node_Str");
    callback.mobile=cb.getString("String_Node_Str");
    callback.report_status=cb.getString("String_Node_Str");
    callback.errmsg=cb.getString("String_Node_Str");
    callback.description=cb.getString("String_Node_Str");
    callback.sid=cb.getString("String_Node_Str");
    result.callbacks.add(callback);
  }
  return result;
}

Fixed version (ground truth):
public SmsStatusPullCallbackResult jsonToSmsStatusPullCallbackrResult(JSONObject json){
  SmsStatusPullCallbackResult result=new SmsStatusPullCallbackResult();
  result.result=json.getInt("String_Node_Str");
  result.errmsg=json.getString("String_Node_Str");
  result.count=json.getInt("String_Node_Str");
  if (true == json.isNull("String_Node_Str")) {
    return result;
  }
  result.callbacks=new ArrayList<Callback>();
  JSONArray datas=json.getJSONArray("String_Node_Str");
  for (int index=0; index < datas.length(); index++) {
    JSONObject cb=datas.getJSONObject(index);
    SmsStatusPullCallbackResult.Callback callback=result.new Callback();
    callback.user_receive_time=cb.getString("String_Node_Str");
    callback.nationcode=cb.getString("String_Node_Str");
    callback.mobile=cb.getString("String_Node_Str");
    callback.report_status=cb.getString("String_Node_Str");
    callback.errmsg=cb.getString("String_Node_Str");
    callback.description=cb.getString("String_Node_Str");
    callback.sid=cb.getString("String_Node_Str");
    result.callbacks.add(callback);
  }
  return result;
}
Program: 37469
Project: 37469
Buggy source:
public void setPassword(String newPassword){
  AtomicInteger num1=CONN_NUM.get(newPassword);
  if (num1 != null) {
    int maxConn=this.userCfg.getMaxCon();
    if (num1.get() > maxConn) {
      StringBuffer reasonSb=new StringBuffer(90);
      reasonSb.append("String_Node_Str");
      reasonSb.append("String_Node_Str").append(maxConn).append("String_Node_Str");
      reasonSb.append("String_Node_Str");
      reasonSb.append("String_Node_Str");
      this.write(reasonSb.toString().getBytes());
      this.close("String_Node_Str");
      return;
    }
    num1.incrementAndGet();
  }
 else {
    CONN_NUM.put(newPassword,new AtomicInteger(1));
  }
  if (isAuthenticated) {
    AtomicInteger num2=CONN_NUM.get(password);
    if (num2 != null && !this.password.equals(newPassword)) {
      num2.decrementAndGet();
    }
  }
  this.password=newPassword;
  this.isAuthenticated=true;
}

Fixed version (ground truth):
public void setPassword(String newPassword){
  AtomicInteger num1=conNums.get(newPassword);
  if (num1 != null) {
    int maxConn=this.userCfg.getMaxCon();
    if (num1.get() > maxConn) {
      StringBuffer reasonSb=new StringBuffer(90);
      reasonSb.append("String_Node_Str");
      reasonSb.append("String_Node_Str").append(maxConn).append("String_Node_Str");
      reasonSb.append("String_Node_Str");
      reasonSb.append("String_Node_Str");
      this.write(reasonSb.toString().getBytes());
      this.close("String_Node_Str");
      return;
    }
    num1.incrementAndGet();
  }
 else {
    conNums.put(newPassword,new AtomicInteger(1));
  }
  if (isAuthenticated) {
    AtomicInteger num2=conNums.get(password);
    if (num2 != null && !this.password.equals(newPassword)) {
      num2.decrementAndGet();
    }
  }
  this.password=newPassword;
  this.isAuthenticated=true;
}
Program: 37470
Project: 37470
Buggy source:
@Override public void close(String reason){
  super.close(reason);
  this.releaseLock();
  if (isAuthenticated) {
    AtomicInteger num=CONN_NUM.get(password);
    if (num != null) {
      int v=num.decrementAndGet();
      if (v < 0) {
        LOGGER.warn("String_Node_Str",password,v);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void close(String reason){
  super.close(reason);
  this.releaseLock();
synchronized (this) {
    if (isAuthenticated) {
      isAuthenticated=false;
      AtomicInteger num=conNums.get(password);
      if (num != null) {
        int v=num.decrementAndGet();
        if (v < 0) {
          LOGGER.warn("String_Node_Str",password,v);
        }
      }
    }
  }
}
Program: 37471
Project: 37471
Buggy source:
/** 
 * 获取所有topic和配置信息
 * @return
 */
public Map<String,TopicDescription> getTopicAndDescriptions(){
  ListTopicsOptions lto=new ListTopicsOptions();
  lto.timeoutMs(10 * 1000);
  ListTopicsResult ltr=adminClient.listTopics(lto);
  try {
    DescribeTopicsOptions dto=new DescribeTopicsOptions();
    dto.timeoutMs(15 * 1000);
    DescribeTopicsResult dtr=adminClient.describeTopics(ltr.names().get(),dto);
    return dtr.all().get();
  }
 catch (  Exception e) {
    LOGGER.error("String_Node_Str",e);
  }
  return null;
}

Fixed version (ground truth):
public Map<String,TopicDescription> getTopicAndDescriptions() throws Exception {
  try {
    ListTopicsOptions lto=new ListTopicsOptions();
    lto.timeoutMs(10 * 1000);
    ListTopicsResult ltr=adminClient.listTopics(lto);
    DescribeTopicsOptions dto=new DescribeTopicsOptions();
    dto.timeoutMs(15 * 1000);
    DescribeTopicsResult dtr=adminClient.describeTopics(ltr.names().get(),dto);
    return dtr.all().get();
  }
 catch (  Exception e) {
    throw e;
  }
}
Program: 37472
Project: 37472
Buggy source:
/** 
 * 给topic增加分区
 * @param topic
 * @param partitions
 * @return
 */
public CreatePartitionsResult addPartitionsForTopic(String topic,int partitions){
  Map<String,NewPartitions> map=new HashMap<>();
  NewPartitions np=NewPartitions.increaseTo(partitions);
  map.put(topic,np);
  CreatePartitionsOptions cpo=new CreatePartitionsOptions();
  cpo.timeoutMs(5 * 1000);
  return adminClient.createPartitions(map,cpo);
}

Fixed version (ground truth):
/** 
 * 给topic增加分区
 */
public CreatePartitionsResult addPartitionsForTopic(String topic,int partitions){
  Map<String,NewPartitions> map=new HashMap<>();
  NewPartitions np=NewPartitions.increaseTo(partitions);
  map.put(topic,np);
  CreatePartitionsOptions cpo=new CreatePartitionsOptions();
  cpo.timeoutMs(5 * 1000);
  return adminClient.createPartitions(map,cpo);
}
Program: 37476
Project: 37476
Buggy source:
public byte[] encode(HttpResponse response){
  if (response == null)   return null;
  StringBuffer buf=new StringBuffer();
  buf.append(response.getHttpVersion()).append(SP);
  buf.append(String.valueOf(response.getStatusCode())).append(SP);
  buf.append(response.getReasonPhrase()).append(CRLF);
  for (  Map.Entry<String,String> h : response.headers().entrySet()) {
    buf.append(h.getKey()).append(COLON).append(SP);
    buf.append(h.getValue()).append(CRLF);
  }
  buf.append(CRLF);
  byte[] src1=buf.toString().getBytes();
  byte[] src2=response.getContent();
  byte[] dest=new byte[src1.length + src2.length];
  System.arraycopy(src1,0,dest,0,src1.length);
  System.arraycopy(src2,0,dest,dest.length,src2.length);
  return dest;
}

Fixed version (ground truth):
public byte[] encode(HttpResponse response){
  if (response == null)   return null;
  StringBuffer buf=new StringBuffer();
  buf.append(response.getHttpVersion()).append(SP);
  buf.append(String.valueOf(response.getStatusCode())).append(SP);
  buf.append(response.getReasonPhrase()).append(CRLF);
  for (  Map.Entry<String,String> h : response.headers().entrySet()) {
    buf.append(h.getKey()).append(COLON).append(SP);
    buf.append(h.getValue()).append(CRLF);
  }
  buf.append(CRLF);
  byte[] head=buf.toString().getBytes();
  byte[] body=response.getContent();
  if (body != null) {
    byte[] dest=new byte[head.length + body.length];
    System.arraycopy(head,0,dest,0,head.length);
    System.arraycopy(body,0,dest,dest.length,body.length);
    return dest;
  }
 else {
    return head;
  }
}
Program: 37478
Project: 37478
Buggy source:
public List<BigKey> getTop100(){
  try {
    while (!locking.compareAndSet(false,true)) {
    }
    int len=bkList.size() > 100 ? 100 : bkList.size();
    List<BigKey> newList=new ArrayList<BigKey>(len);
    for (int i=0; i < len; i++) {
      newList.add(bkList.get(i));
    }
    return newList;
  }
  finally {
    locking.set(false);
  }
}

Fixed version (ground truth):
public List<BigKey> getTop100(){
  try {
    while (!locking.compareAndSet(false,true)) {
    }
    int len=bkList.size() > 100 ? 100 : bkList.size();
    Collections.sort(bkList,new BigKey());
    List<BigKey> newList=new ArrayList<BigKey>(len);
    for (int i=0; i < len; i++) {
      newList.add(bkList.get(i));
    }
    return newList;
  }
  finally {
    locking.set(false);
  }
}
Program: 37479
Project: 37479
Buggy source:
/** 
 * 解析返回 数量、内容
 */
@Override public RedisPipelineResponse decode(byte[] buffer){
  int result=0;
  append(buffer);
  try {
    for (; ; ) {
      if (compositeArray.remaining(readOffset) < 4) {
        return new RedisPipelineResponse(RedisPipelineResponse.ERR,0,null);
      }
      startByteArray=readByteArray=compositeArray.findByteArray(readOffset);
      byte type=readByteArray.get(readOffset++);
switch (type) {
case '*':
case '+':
case '-':
case ':':
case '$':
        parseResponse(type);
      result++;
    index.add(readOffset);
}
if (compositeArray.getByteCount() < readOffset) {
  throw new IndexOutOfBoundsException("String_Node_Str");
}
 else if (compositeArray.getByteCount() == readOffset) {
  readOffset=0;
  return new RedisPipelineResponse(RedisPipelineResponse.OK,result,getResponses());
}
}
}
 catch (IndexOutOfBoundsException e1) {
readOffset=0;
index.clear();
return new RedisPipelineResponse(RedisPipelineResponse.ERR,0,null);
}
}

Fixed version (ground truth):
/** 
 * 解析返回 数量、内容
 */
@Override public RedisPipelineResponse decode(byte[] buffer){
  int result=0;
  append(buffer);
  try {
    startByteArray=readByteArray=compositeArray.findByteArray(readOffset);
    for (; ; ) {
      if (compositeArray.remaining(readOffset) < 4) {
        return new RedisPipelineResponse(RedisPipelineResponse.ERR,0,null);
      }
      byte type=readByteArray.get(readOffset++);
      updateReadOffsetAndReadByteChunk(readOffset);
switch (type) {
case '*':
case '+':
case '-':
case ':':
case '$':
        parseResponse(type);
      result++;
    index.add(readOffset);
}
if (compositeArray.getByteCount() < readOffset) {
  throw new IndexOutOfBoundsException("String_Node_Str");
}
 else if (compositeArray.getByteCount() == readOffset) {
  readOffset=0;
  return new RedisPipelineResponse(RedisPipelineResponse.OK,result,getResponses());
}
}
}
 catch (IndexOutOfBoundsException e1) {
readOffset=0;
index.clear();
return new RedisPipelineResponse(RedisPipelineResponse.ERR,0,null);
}
}
Program: 37480
Project: 37480
Buggy source:
/** 
 * 接受新连接
 */
private void accept(){
  SocketChannel channel=null;
  try {
    channel=serverChannel.accept();
    channel.socket().setTcpNoDelay(true);
    channel.configureBlocking(false);
    if (NETWORK_QOS_FLAG != null) {
      try {
        if ("String_Node_Str".equals(NETWORK_QOS_FLAG)) {
          channel.socket().setTrafficClass(144);
        }
 else         if ("String_Node_Str".equals(NETWORK_QOS_FLAG)) {
          channel.socket().setTrafficClass(24);
        }
      }
 catch (      Exception ex) {
        ex.printStackTrace();
      }
    }
    ClosableConnection c=factory.make(channel);
    c.setDirection(ClosableConnection.Direction.in);
    InetSocketAddress remoteAddr=(InetSocketAddress)channel.getRemoteAddress();
    c.setHost(remoteAddr.getHostString());
    c.setPort(remoteAddr.getPort());
    NIOReactor reactor=reactorPool.getNextReactor();
    reactor.postRegister(c);
  }
 catch (  Exception e) {
    LOGGER.warn(getName(),e);
    closeChannel(channel);
  }
}

Fixed version (ground truth):
/** 
 * 接受新连接
 */
private void accept(){
  SocketChannel channel=null;
  try {
    channel=serverChannel.accept();
    channel.socket().setTcpNoDelay(true);
    channel.configureBlocking(false);
    channel.socket().setTrafficClass(0x04 | 0x08);
    ClosableConnection c=factory.make(channel);
    c.setDirection(ClosableConnection.Direction.in);
    InetSocketAddress remoteAddr=(InetSocketAddress)channel.getRemoteAddress();
    c.setHost(remoteAddr.getHostString());
    c.setPort(remoteAddr.getPort());
    NIOReactor reactor=reactorPool.getNextReactor();
    reactor.postRegister(c);
  }
 catch (  Exception e) {
    LOGGER.warn(getName(),e);
    closeChannel(channel);
  }
}
Program: 37482
Project: 37482
Buggy source:
public byte[] subArray(int beginIndex,int length){
  checkIndex(beginIndex,length);
  byte[] resultArr=new byte[length];
  Component c=findComponent(beginIndex);
  int srcBeginIndex=beginIndex - c.beginIndex;
  int availableByteCount=c.length - srcBeginIndex;
  if (availableByteCount >= length) {
    System.arraycopy(c.bytes,srcBeginIndex,resultArr,0,length);
  }
 else {
    System.arraycopy(c.bytes,srcBeginIndex,resultArr,0,availableByteCount);
    int destPos=availableByteCount;
    int remaining=length - availableByteCount;
    int index=components.indexOf(c);
    while (remaining > 0) {
      c=components.get(index++);
      if (remaining <= c.length) {
        System.arraycopy(c.bytes,0,resultArr,destPos,remaining);
        break;
      }
 else {
        System.arraycopy(c.bytes,0,resultArr,destPos,c.length);
      }
      destPos+=c.length;
      remaining-=c.length;
    }
  }
  return resultArr;
}

Fixed version (ground truth):
public byte[] subArray(int beginIndex,int length){
  checkIndex(beginIndex,length);
  byte[] resultArr=new byte[length];
  Component c=findComponent(beginIndex);
  int srcBeginIndex=beginIndex - c.beginIndex;
  int availableByteCount=c.length - srcBeginIndex;
  if (availableByteCount >= length) {
    System.arraycopy(c.bytes,srcBeginIndex,resultArr,0,length);
  }
 else {
    System.arraycopy(c.bytes,srcBeginIndex,resultArr,0,availableByteCount);
    int destPos=availableByteCount;
    int remaining=length - availableByteCount;
    int index=components.indexOf(c);
    while (remaining > 0) {
      c=components.get(++index);
      if (remaining <= c.length) {
        System.arraycopy(c.bytes,0,resultArr,destPos,remaining);
        break;
      }
 else {
        System.arraycopy(c.bytes,0,resultArr,destPos,c.length);
      }
      destPos+=c.length;
      remaining-=c.length;
    }
  }
  return resultArr;
}
Program: 37483
Project: 37483
Buggy source:
private JedisPool initialize(String host,int port){
  GenericObjectPoolConfig jedisPoolConfig=new GenericObjectPoolConfig();
  jedisPoolConfig.setMaxIdle(maxIdle);
  jedisPoolConfig.setMinIdle(minIdle);
  jedisPoolConfig.setTestOnBorrow(testOnBorrow);
  jedisPoolConfig.setTestOnReturn(testOnReturn);
  jedisPoolConfig.setTestWhileIdle(testWhileIdle);
  jedisPoolConfig.setNumTestsPerEvictionRun(numTestsPerEvictionRun);
  jedisPoolConfig.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);
  jedisPoolConfig.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
  return new JedisPool(jedisPoolConfig,host,port,timeBetweenEvictionRunsMillis,null);
}

Fixed version (ground truth):
private JedisPool initialize(String host,int port){
  GenericObjectPoolConfig jedisPoolConfig=new GenericObjectPoolConfig();
  jedisPoolConfig.setMaxIdle(maxIdle);
  jedisPoolConfig.setMinIdle(minIdle);
  jedisPoolConfig.setTestOnBorrow(testOnBorrow);
  jedisPoolConfig.setTestOnReturn(testOnReturn);
  jedisPoolConfig.setTestWhileIdle(testWhileIdle);
  jedisPoolConfig.setNumTestsPerEvictionRun(numTestsPerEvictionRun);
  jedisPoolConfig.setMinEvictableIdleTimeMillis(-1);
  jedisPoolConfig.setSoftMinEvictableIdleTimeMillis(softMinEvictableIdleTimeMillis);
  jedisPoolConfig.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
  return new JedisPool(jedisPoolConfig,host,port,timeBetweenEvictionRunsMillis,null);
}