nus-yam/ex-repair huggingface dataset:
Program: 7914
Project: 7914
Buggy source:
private void calcBtnDivideActions(){
  if (uint64Instance == BigInteger.ZERO) {
    Toast toast=Toast.makeText(getApplicationContext(),"String_Node_Str",Toast.LENGTH_SHORT);
    toast.show();
  }
 else {
    uint64Instance=uint64Instance_SaveValue.divide(uint64Instance);
  }
}

Fixed version (ground truth):
private void calcBtnDivideActions(){
  btnClear.setText("String_Node_Str");
  btnPlus.setVisibility(View.VISIBLE);
  btnMinus.setVisibility(View.VISIBLE);
  btnTimes.setVisibility(View.VISIBLE);
  btnDivide.setVisibility(View.VISIBLE);
  btnAND.setVisibility(View.VISIBLE);
  btnOR.setVisibility(View.VISIBLE);
  btnNOT.setVisibility(View.VISIBLE);
  btnXOR.setVisibility(View.VISIBLE);
  btnShiftL.setVisibility(View.VISIBLE);
  btnShiftR.setVisibility(View.VISIBLE);
  btnEquals.setVisibility(View.INVISIBLE);
  btnEquals.setEnabled(false);
  btnDivide.setEnabled(true);
  if (uint64Instance == BigInteger.ZERO) {
    Toast toast=Toast.makeText(getApplicationContext(),"String_Node_Str",Toast.LENGTH_SHORT);
    toast.show();
  }
 else {
    uint64Instance=uint64Instance_SaveValue.divide(uint64Instance);
  }
}
Program: 7915
Project: 7915
Buggy source:
private void calcBtnShiftLActions(){
  uint64Instance=uint64Instance_SaveValue.shiftLeft(1);
}

Fixed version (ground truth):
private void calcBtnShiftLActions(){
  btnClear.setText("String_Node_Str");
  btnPlus.setVisibility(View.VISIBLE);
  btnMinus.setVisibility(View.VISIBLE);
  btnTimes.setVisibility(View.VISIBLE);
  btnDivide.setVisibility(View.VISIBLE);
  btnAND.setVisibility(View.VISIBLE);
  btnOR.setVisibility(View.VISIBLE);
  btnNOT.setVisibility(View.VISIBLE);
  btnXOR.setVisibility(View.VISIBLE);
  btnShiftL.setVisibility(View.VISIBLE);
  btnShiftR.setVisibility(View.VISIBLE);
  btnEquals.setVisibility(View.INVISIBLE);
  btnEquals.setEnabled(false);
  btnShiftL.setEnabled(true);
  uint64Instance=uint64Instance_SaveValue.shiftLeft(1);
}
Program: 7916
Project: 7916
Buggy source:
private void calcBtnORActions(){
  uint64Instance=uint64Instance_SaveValue.or(uint64Instance);
}

Fixed version (ground truth):
private void calcBtnORActions(){
  btnClear.setText("String_Node_Str");
  btnPlus.setVisibility(View.VISIBLE);
  btnMinus.setVisibility(View.VISIBLE);
  btnTimes.setVisibility(View.VISIBLE);
  btnDivide.setVisibility(View.VISIBLE);
  btnAND.setVisibility(View.VISIBLE);
  btnOR.setVisibility(View.VISIBLE);
  btnNOT.setVisibility(View.VISIBLE);
  btnXOR.setVisibility(View.VISIBLE);
  btnShiftL.setVisibility(View.VISIBLE);
  btnShiftR.setVisibility(View.VISIBLE);
  btnEquals.setVisibility(View.INVISIBLE);
  btnEquals.setEnabled(false);
  btnOR.setEnabled(true);
  uint64Instance=uint64Instance_SaveValue.or(uint64Instance);
}
Program: 7917
Project: 7917
Buggy source:
private void performDigitButtonPressAction(View v){
  char c=getButtonValue(v);
  if (currentCalculationOperation != calculationTypeEnum.NO_OP_CALC) {
    clearDisp();
    calculationOperationInProgress=false;
    currentCalculationOperation=calculationTypeEnum.NO_OP_CALC;
  }
switch (currentMode) {
case DECIMAL_MODE:
    decstring=decstring + c;
  uint64Instance=new BigInteger(decstring,10);
break;
case HEX_MODE:
hexstring=hexstring + c;
uint64Instance=new BigInteger(hexstring,16);
break;
case BINARY_MODE:
binstring=binstring + c;
uint64Instance=new BigInteger(binstring,2);
break;
}
}

Fixed version (ground truth):
private void performDigitButtonPressAction(View v){
  char c=getButtonValue(v);
  if (currentCalculationOperation != calculationTypeEnum.NO_OP_CALC) {
    clearDisp();
  }
switch (currentMode) {
case DECIMAL_MODE:
    decstring=decstring + c;
  uint64Instance=new BigInteger(decstring,10);
break;
case HEX_MODE:
hexstring=hexstring + c;
uint64Instance=new BigInteger(hexstring,16);
break;
case BINARY_MODE:
binstring=binstring + c;
uint64Instance=new BigInteger(binstring,2);
break;
}
}
Program: 7918
Project: 7918
Buggy source:
private void calcBtnANDActions(){
  uint64Instance=uint64Instance_SaveValue.and(uint64Instance);
}

Fixed version (ground truth):
private void calcBtnANDActions(){
  btnClear.setText("String_Node_Str");
  btnPlus.setVisibility(View.VISIBLE);
  btnMinus.setVisibility(View.VISIBLE);
  btnTimes.setVisibility(View.VISIBLE);
  btnDivide.setVisibility(View.VISIBLE);
  btnAND.setVisibility(View.VISIBLE);
  btnOR.setVisibility(View.VISIBLE);
  btnNOT.setVisibility(View.VISIBLE);
  btnXOR.setVisibility(View.VISIBLE);
  btnShiftL.setVisibility(View.VISIBLE);
  btnShiftR.setVisibility(View.VISIBLE);
  btnEquals.setVisibility(View.INVISIBLE);
  btnEquals.setEnabled(false);
  btnAND.setEnabled(true);
  uint64Instance=uint64Instance_SaveValue.and(uint64Instance);
}
Program: 7919
Project: 7919
Buggy source:
private void calcBtnPlusActions(){
  uint64Instance=uint64Instance_SaveValue.add(uint64Instance);
}

Fixed version (ground truth):
private void calcBtnPlusActions(){
  btnClear.setText("String_Node_Str");
  btnPlus.setVisibility(View.VISIBLE);
  btnMinus.setVisibility(View.VISIBLE);
  btnTimes.setVisibility(View.VISIBLE);
  btnDivide.setVisibility(View.VISIBLE);
  btnAND.setVisibility(View.VISIBLE);
  btnOR.setVisibility(View.VISIBLE);
  btnNOT.setVisibility(View.VISIBLE);
  btnXOR.setVisibility(View.VISIBLE);
  btnShiftL.setVisibility(View.VISIBLE);
  btnShiftR.setVisibility(View.VISIBLE);
  btnEquals.setVisibility(View.INVISIBLE);
  btnEquals.setEnabled(false);
  btnPlus.setEnabled(true);
  uint64Instance=uint64Instance_SaveValue.add(uint64Instance);
}
Program: 7920
Project: 7920
Buggy source:
private void performBtnEqualActions(){
switch (currentCalculationOperation) {
case PLUS_CALC:
    calcBtnPlusActions();
  break;
case MINUS_CALC:
calcBtnMinusActions();
break;
case MULTIPLY_CALC:
calcBtnTimesActions();
break;
case DIVIDE_CALC:
calcBtnDivideActions();
break;
case OR_CALC:
calcBtnORActions();
break;
case AND_CALC:
calcBtnANDActions();
break;
case SHIFT_L_CALC:
calcBtnShiftLActions();
break;
case SHIFT_R_CALC:
calcBtnShiftRActions();
break;
}
currentCalculationOperation=calculationTypeEnum.NO_OP_CALC;
calculationOperationInProgress=false;
}

Fixed version (ground truth):
private void performBtnEqualActions(){
switch (currentCalculationOperation) {
case PLUS_CALC:
    calcBtnPlusActions();
  break;
case MINUS_CALC:
calcBtnMinusActions();
break;
case MULTIPLY_CALC:
calcBtnTimesActions();
break;
case DIVIDE_CALC:
calcBtnDivideActions();
break;
case OR_CALC:
calcBtnORActions();
break;
case AND_CALC:
calcBtnANDActions();
break;
case SHIFT_L_CALC:
calcBtnShiftLActions();
break;
case SHIFT_R_CALC:
calcBtnShiftRActions();
break;
}
btnEquals.setEnabled(false);
currentCalculationOperation=calculationTypeEnum.NO_OP_CALC;
calculationOperationInProgress=false;
}
Program: 7921
Project: 7921
Buggy source:
private void linkTextFieldsIntoControlObjects(){
  lbldecimal=(TextView)findViewById(R.id.lbldecimal);
  txtdecimal=(TextView)findViewById(R.id.txtdecimal);
  lblhex=(TextView)findViewById(R.id.lblhex);
  txthex=(TextView)findViewById(R.id.txthex);
  lblbinary=(TextView)findViewById(R.id.lblbinary);
  txtbinary=(TextView)findViewById(R.id.txtbinary);
  txtInformational=(TextView)findViewById(R.id.txtrotate);
  txtcomp=(TextView)findViewById(R.id.txtcomp);
  txtprecision=(TextView)findViewById(R.id.txtprecision);
  txtTestParse=(TextView)findViewById(R.id.txtTestParse);
}

Fixed version (ground truth):
private void linkTextFieldsIntoControlObjects(){
  txtdecimal=(TextView)findViewById(R.id.txtdecimal);
  txthex=(TextView)findViewById(R.id.txthex);
  txtbinary=(TextView)findViewById(R.id.txtbinary);
  txtInformational=(TextView)findViewById(R.id.txtrotate);
  txtcomp=(TextView)findViewById(R.id.txtcomp);
  txtprecision=(TextView)findViewById(R.id.txtprecision);
  txtTestParse=(TextView)findViewById(R.id.txtTestParse);
}
Program: 7922
Project: 7922
Buggy source:
private void displayValues(){
  String parsedNumericString;
  int kp, k;
  Display display=((WindowManager)getSystemService(WINDOW_SERVICE)).getDefaultDisplay();
  int orient=display.getOrientation();
  Resources res=getResources();
  String configStatus=String.format("String_Node_Str",testFlag1,testFlag2,testFlag3,testFlag4,testFlag5);
  txtTestParse.setText(configStatus);
  txtTestParse.setVisibility(View.VISIBLE);
  txtInformational.setText(buildPadded64BitHexString());
  txtInformational.setVisibility(View.VISIBLE);
  decstring=uint64Instance.toString(10);
  parsedNumericString=NumberFormat.getInstance().format(uint64Instance);
  txtdecimal.setText(parsedNumericString);
  hexstring=uint64Instance.toString(16);
  txthex.setText(padString(uint64Instance.toString(16).toUpperCase(),8));
  binstring=uint64Instance.toString(2);
  txtbinary.setText(padString(uint64Instance.toString(2).toUpperCase(),8));
  if ((parsedNumericString.length() >= 22) & (orient == 0)) {
    parsedNumericString=parsedNumericString.substring(parsedNumericString.length() - 22);
    txtbinary.setTextSize(10);
  }
 else {
    txtbinary.setTextSize(18);
  }
}

Fixed version (ground truth):
private void displayValues(){
  String parsedNumericString;
  Display display=((WindowManager)getSystemService(WINDOW_SERVICE)).getDefaultDisplay();
  int orient=display.getOrientation();
  String configStatus=String.format("String_Node_Str",testFlag1,testFlag2,testFlag3,testFlag4,testFlag5);
  txtTestParse.setText(configStatus);
  txtTestParse.setVisibility(View.VISIBLE);
  txtInformational.setText(buildPadded64BitHexString());
  txtInformational.setVisibility(View.VISIBLE);
  decstring=uint64Instance.toString(10);
  parsedNumericString=NumberFormat.getInstance().format(uint64Instance);
  txtdecimal.setText(parsedNumericString);
  hexstring=uint64Instance.toString(16);
  txthex.setText(padString(uint64Instance.toString(16).toUpperCase(),8));
  binstring=uint64Instance.toString(2);
  txtbinary.setText(padString(uint64Instance.toString(2).toUpperCase(),8));
  if ((txtbinary.length() >= 22) & (orient == 0)) {
    txtbinary.setTextSize(10);
  }
 else {
    txtbinary.setTextSize(18);
  }
}
Program: 7923
Project: 7923
Buggy source:
private void performDigitButtonPressAction(View v){
  char c=getButtonValue(v);
  if (currentCalculationOperation != calculationTypeEnum.NO_OP_CALC) {
    clearDisp();
    calculationOperationInProgress=false;
    currentCalculationOperation=calculationTypeEnum.NO_OP_CALC;
  }
switch (currentMode) {
case DECIMAL_MODE:
    decstring=decstring + c;
  uint64Instance=new BigInteger(decstring,10);
break;
case HEX_MODE:
hexstring=hexstring + c;
uint64Instance=new BigInteger(hexstring,16);
break;
case BINARY_MODE:
binstring=binstring + c;
uint64Instance=new BigInteger(hexstring,2);
break;
}
}

Fixed version (ground truth):
private void performDigitButtonPressAction(View v){
  char c=getButtonValue(v);
  if (currentCalculationOperation != calculationTypeEnum.NO_OP_CALC) {
    clearDisp();
    calculationOperationInProgress=false;
    currentCalculationOperation=calculationTypeEnum.NO_OP_CALC;
  }
switch (currentMode) {
case DECIMAL_MODE:
    decstring=decstring + c;
  uint64Instance=new BigInteger(decstring,10);
break;
case HEX_MODE:
hexstring=hexstring + c;
uint64Instance=new BigInteger(hexstring,16);
break;
case BINARY_MODE:
binstring=binstring + c;
uint64Instance=new BigInteger(binstring,2);
break;
}
}
Program: 7924
Project: 7924
Buggy source:
private void performBtnBackSpaceActions(){
switch (currentMode) {
case DECIMAL_MODE:
    if (decstring.length() > 0) {
      decstring=decstring.substring(0,decstring.length() - 1);
    }
  uint64Instance=new BigInteger(decstring);
break;
case HEX_MODE:
if (hexstring.length() > 0) {
hexstring=hexstring.substring(0,hexstring.length() - 1);
}
uint64Instance=new BigInteger(hexstring,16);
break;
case BINARY_MODE:
if (binstring.length() > 0) {
binstring=binstring.substring(0,binstring.length() - 1);
}
uint64Instance=new BigInteger(binstring,2);
break;
}
}

Fixed version (ground truth):
private void performBtnBackSpaceActions(){
switch (currentMode) {
case DECIMAL_MODE:
    if (decstring.length() == 1) {
      decstring="String_Node_Str";
    }
 else     if (decstring.length() > 0) {
      decstring=decstring.substring(0,decstring.length() - 1);
    }
  uint64Instance=new BigInteger(decstring);
break;
case HEX_MODE:
if (hexstring.length() == 1) {
hexstring="String_Node_Str";
}
 else if (hexstring.length() > 0) {
hexstring=hexstring.substring(0,hexstring.length() - 1);
}
uint64Instance=new BigInteger(hexstring,16);
break;
case BINARY_MODE:
if (binstring.length() == 1) {
binstring="String_Node_Str";
}
 else if (binstring.length() > 0) {
binstring=binstring.substring(0,binstring.length() - 1);
}
uint64Instance=new BigInteger(binstring,2);
break;
}
}
Program: 7925
Project: 7925
Buggy source:
/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  dm=this.getResources().getDisplayMetrics();
  setContentView(R.layout.map);
  initMapView();
  initMyLocationOverlay();
  initMyItemizedOverlay();
}

Fixed version (ground truth):
/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mtlo=new MapTouchListenerOverlay(this);
  dm=this.getResources().getDisplayMetrics();
  setContentView(R.layout.map);
  initMapView();
  initMyLocationOverlay();
  initMyItemizedOverlay();
}
Program: 7926
Project: 7926
Buggy source:
public void initMapView(){
  map=(MapView)findViewById(R.id.map);
  map.setBuiltInZoomControls(true);
  map.getOverlays().add(restricter);
  MapController mc=map.getController();
  mc.setCenter(mapCenter);
  mc.setZoom(START_ZOOM);
}

Fixed version (ground truth):
public void initMapView(){
  map=(MapView)findViewById(R.id.map);
  map.setBuiltInZoomControls(true);
  map.getOverlays().add(mtlo);
  map.getOverlays().add(restricter);
  MapController mc=map.getController();
  mc.setCenter(mapCenter);
  mc.setZoom(START_ZOOM);
}
Program: 7927
Project: 7927
Buggy source:
@Override public void drawMyLocation(Canvas canvas,MapView mapView,Location lastFix,GeoPoint myLocation,long when){
  if (ctx.getFollow())   mc.setCenter(myLocation);
  mapView.getProjection().toPixels(myLocation,currentLocationPoint);
  drawAt(canvas,arrow,currentLocationPoint.x,currentLocationPoint.y,false);
}

Fixed version (ground truth):
@Override public void drawMyLocation(Canvas canvas,MapView mapView,Location lastFix,GeoPoint myLocation,long when){
  mapView.getProjection().toPixels(myLocation,currentLocationPoint);
  drawAt(canvas,arrow,currentLocationPoint.x,currentLocationPoint.y,false);
  if (ctx.getFollow())   mc.setCenter(myLocation);
}
Program: 7928
Project: 7928
Buggy source:
@Override public void onUnitCreate(ROUnit unit){
  if (!unit.getPlayer().equals(Game.getInstance().self()))   return;
  if (((Unit)unit).getType().isBuilding()) {
    buildLock=false;
  }
}

Fixed version (ground truth):
@Override public void onUnitCreate(ROUnit unit){
  if (!unit.getPlayer().equals(Game.getInstance().self()))   return;
  if (((Unit)unit).getType().isBuilding()) {
    buildLock=false;
  }
  Unit u=(Unit)unit;
  if (u.getType().equals(UnitType.getUnitType(hatchery)))   bases.add(u);
  if (u.getType().equals(UnitType.getUnitType(larva)))   larvae.add(u);
  if (u.getType().equals(UnitType.getUnitType(drone)))   drones.add(u);
  if (u.getType().equals(UnitType.getUnitType(overlord)))   ovies.add(u);
  if (u.getType().equals(UnitType.getUnitType(zergling)))   lings.add(u);
  if (u.getType().equals(UnitType.getUnitType(hydralisk)))   hydras.add(u);
  if (u.getType().equals(UnitType.getUnitType(lurker)))   lurkers.add(u);
}
Program: 7929
Project: 7929
Buggy source:
@Override public void onFrame(){
  List<ROUnit> minersList=UnitUtils.getAllMy(UnitType.getUnitType(drone));
  for (  Unit u : workers) {
    if (u.isIdle()) {
      ROUnit closestPatch=UnitUtils.getClosest(u,Game.getInstance().getMinerals());
      ((Unit)u).rightClick(closestPatch);
    }
  }
  buildNext();
}

Fixed version (ground truth):
@Override public void onFrame(){
  for (  Unit u : drones) {
    if (u.isIdle()) {
      ROUnit closestPatch=UnitUtils.getClosest(u,Game.getInstance().getMinerals());
      ((Unit)u).rightClick(closestPatch);
    }
  }
  buildNext();
}
Program: 7931
Project: 7931
Buggy source:
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  mList.layout(0,0,mList.getMeasuredWidth(),getHeight());
  if (mHeader != null) {
    MarginLayoutParams lp=(MarginLayoutParams)mHeader.getLayoutParams();
    int headerTop=lp.topMargin + stickyHeaderTop();
    mHeader.layout(mPaddingLeft,headerTop,mHeader.getMeasuredWidth() + mPaddingLeft,headerTop + mHeader.getMeasuredHeight());
  }
}

Fixed version (ground truth):
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  mList.layout(0,0,mList.getMeasuredWidth(),getHeight());
  if (mHeader != null) {
    MarginLayoutParams lp=(MarginLayoutParams)mHeader.getLayoutParams();
    int headerTop=lp.topMargin;
    mHeader.layout(mPaddingLeft,headerTop,mHeader.getMeasuredWidth() + mPaddingLeft,headerTop + mHeader.getMeasuredHeight());
  }
}
Program: 7932
Project: 7932
Buggy source:
private void updateHeaderVisibilities(){
  int top;
  if (mHeader != null) {
    top=mHeader.getMeasuredHeight() + (mHeaderOffset != null ? mHeaderOffset : 0) + mStickyHeaderTopOffset;
  }
 else {
    top=stickyHeaderTop();
  }
  int childCount=mList.getChildCount();
  for (int i=0; i < childCount; i++) {
    View child=mList.getChildAt(i);
    if (!(child instanceof WrapperView)) {
      continue;
    }
    WrapperView wrapperViewChild=(WrapperView)child;
    if (!wrapperViewChild.hasHeader()) {
      continue;
    }
    View childHeader=wrapperViewChild.mHeader;
    if (wrapperViewChild.getTop() < top) {
      if (childHeader.getVisibility() != View.INVISIBLE) {
        childHeader.setVisibility(View.INVISIBLE);
      }
    }
 else {
      if (childHeader.getVisibility() != View.VISIBLE) {
        childHeader.setVisibility(View.VISIBLE);
      }
    }
  }
}

Fixed version (ground truth):
private void updateHeaderVisibilities(){
  int top=stickyHeaderTop();
  int childCount=mList.getChildCount();
  for (int i=0; i < childCount; i++) {
    View child=mList.getChildAt(i);
    if (!(child instanceof WrapperView)) {
      continue;
    }
    WrapperView wrapperViewChild=(WrapperView)child;
    if (!wrapperViewChild.hasHeader()) {
      continue;
    }
    View childHeader=wrapperViewChild.mHeader;
    if (wrapperViewChild.getTop() < top) {
      if (childHeader.getVisibility() != View.INVISIBLE) {
        childHeader.setVisibility(View.INVISIBLE);
      }
    }
 else {
      if (childHeader.getVisibility() != View.VISIBLE) {
        childHeader.setVisibility(View.VISIBLE);
      }
    }
  }
}
Program: 7933
Project: 7933
Buggy source:
private void updateHeader(int headerPosition){
  if (mHeaderPosition == null || mHeaderPosition != headerPosition) {
    mHeaderPosition=headerPosition;
    final long headerId=mAdapter.getHeaderId(headerPosition);
    if (mHeaderId == null || mHeaderId != headerId) {
      mHeaderId=headerId;
      final View header=mAdapter.getHeaderView(mHeaderPosition,mHeader,this);
      if (mHeader != header) {
        if (header == null) {
          throw new NullPointerException("String_Node_Str");
        }
        swapHeader(header);
      }
      ensureHeaderHasCorrectLayoutParams(mHeader);
      measureHeader(mHeader);
      if (mOnStickyHeaderChangedListener != null) {
        mOnStickyHeaderChangedListener.onStickyHeaderChanged(this,mHeader,headerPosition,mHeaderId);
      }
      mHeaderOffset=null;
    }
  }
  int headerOffset=0;
  int headerBottom=mHeader.getMeasuredHeight() + stickyHeaderTop();
  for (int i=0; i < mList.getChildCount(); i++) {
    final View child=mList.getChildAt(i);
    final boolean doesChildHaveHeader=child instanceof WrapperView && ((WrapperView)child).hasHeader();
    final boolean isChildFooter=mList.containsFooterView(child);
    if (child.getTop() >= stickyHeaderTop() && (doesChildHaveHeader || isChildFooter)) {
      headerOffset=Math.min(child.getTop() - headerBottom,0);
      break;
    }
  }
  setHeaderOffet(headerOffset);
  if (!mIsDrawingListUnderStickyHeader) {
    mList.setTopClippingLength(mHeader.getMeasuredHeight() + mHeaderOffset);
  }
  updateHeaderVisibilities();
}

Fixed version (ground truth):
private void updateHeader(int headerPosition){
  if (mHeaderPosition == null || mHeaderPosition != headerPosition) {
    mHeaderPosition=headerPosition;
    final long headerId=mAdapter.getHeaderId(headerPosition);
    if (mHeaderId == null || mHeaderId != headerId) {
      mHeaderId=headerId;
      final View header=mAdapter.getHeaderView(mHeaderPosition,mHeader,this);
      if (mHeader != header) {
        if (header == null) {
          throw new NullPointerException("String_Node_Str");
        }
        swapHeader(header);
      }
      ensureHeaderHasCorrectLayoutParams(mHeader);
      measureHeader(mHeader);
      if (mOnStickyHeaderChangedListener != null) {
        mOnStickyHeaderChangedListener.onStickyHeaderChanged(this,mHeader,headerPosition,mHeaderId);
      }
      mHeaderOffset=null;
    }
  }
  int headerOffset=stickyHeaderTop();
  for (int i=0; i < mList.getChildCount(); i++) {
    final View child=mList.getChildAt(i);
    final boolean doesChildHaveHeader=child instanceof WrapperView && ((WrapperView)child).hasHeader();
    final boolean isChildFooter=mList.containsFooterView(child);
    if (child.getTop() >= stickyHeaderTop() && (doesChildHaveHeader || isChildFooter)) {
      headerOffset=Math.min(child.getTop() - mHeader.getMeasuredHeight(),headerOffset);
      break;
    }
  }
  setHeaderOffet(headerOffset);
  if (!mIsDrawingListUnderStickyHeader) {
    mList.setTopClippingLength(mHeader.getMeasuredHeight() + mHeaderOffset);
  }
  updateHeaderVisibilities();
}
Program: 7934
Project: 7934
Buggy source:
private int getHeaderOverlap(int position){
  boolean isStartOfSection=isStartOfSection(position);
  if (!isStartOfSection) {
    View header=mAdapter.getView(position,null,mList);
    int widthMeasureSpec=MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED);
    int heightMeasureSpec=MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED);
    header.measure(widthMeasureSpec,heightMeasureSpec);
    return header.getMeasuredHeight();
  }
  return 0;
}

Fixed version (ground truth):
private int getHeaderOverlap(int position){
  boolean isStartOfSection=isStartOfSection(position);
  if (!isStartOfSection) {
    View header=mAdapter.getView(position,null,mList);
    final int width=getWidth();
    final int parentWidthMeasureSpec=MeasureSpec.makeMeasureSpec(width,MeasureSpec.EXACTLY);
    final int parentHeightMeasureSpec=MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED);
    measureChild(header,parentWidthMeasureSpec,parentHeightMeasureSpec);
    return header.getMeasuredHeight();
  }
  return 0;
}
Program: 7936
Project: 7936
Buggy source:
private void updateOrClearHeader(int firstVisiblePosition){
  int adapterCount=mAdapter == null ? 0 : mAdapter.getCount();
  if (adapterCount == 0 || !mAreHeadersSticky) {
    return;
  }
  final int headerViewCount=mList.getHeaderViewsCount();
  final int realFirstVisibleItem=firstVisiblePosition - headerViewCount;
  if (mList.getChildCount() == 0 || realFirstVisibleItem < 0 || realFirstVisibleItem > adapterCount - 1) {
    clearHeader();
    return;
  }
  updateHeader(realFirstVisibleItem);
}

Fixed version (ground truth):
private void updateOrClearHeader(int firstVisiblePosition){
  final int adapterCount=mAdapter == null ? 0 : mAdapter.getCount();
  if (adapterCount == 0 || !mAreHeadersSticky) {
    return;
  }
  final int headerViewCount=mList.getHeaderViewsCount();
  final int realFirstVisibleItem=firstVisiblePosition - headerViewCount;
  final boolean isFirstViewBelowTop=mList.getChildAt(0).getTop() > 0;
  final boolean isFirstVisibleItemOutsideAdapterRange=realFirstVisibleItem > adapterCount - 1 || realFirstVisibleItem < 0;
  final boolean doesListHaveChildren=mList.getChildCount() != 0;
  if (!doesListHaveChildren || isFirstVisibleItemOutsideAdapterRange || isFirstViewBelowTop) {
    clearHeader();
    return;
  }
  updateHeader(realFirstVisibleItem);
}
Program: 7937
Project: 7937
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View v=inflater.inflate(R.layout.fragment_test,container,false);
  mStickyList=(StickyListHeadersListView)v.findViewById(R.id.list);
  mStickyList.setOnItemClickListener(this);
  mStickyList.setOnHeaderClickListener(this);
  mStickyList.addHeaderView(inflater.inflate(R.layout.list_header,null));
  mStickyList.addFooterView(inflater.inflate(R.layout.list_footer,null));
  mStickyList.setEmptyView(v.findViewById(R.id.empty));
  mStickyList.setDrawingListUnderStickyHeader(true);
  mStickyList.setAreHeadersSticky(true);
  mAdapter=new TestBaseAdapter(getActivity());
  mStickyList.setAdapter(mAdapter);
  return v;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View v=inflater.inflate(R.layout.fragment_test,container,false);
  mStickyList=(StickyListHeadersListView)v.findViewById(R.id.list);
  mStickyList.setOnItemClickListener(this);
  mStickyList.setOnHeaderClickListener(this);
  mStickyList.setEmptyView(v.findViewById(R.id.empty));
  mStickyList.setDrawingListUnderStickyHeader(true);
  mStickyList.setAreHeadersSticky(true);
  mAdapter=new TestBaseAdapter(getActivity());
  mStickyList.setAdapter(mAdapter);
  return v;
}
Program: 7938
Project: 7938
Buggy source:
private void measureHeader(){
  int widthMeasureSpec=MeasureSpec.makeMeasureSpec(getWidth() - getPaddingLeft() - getPaddingRight()- (isScrollBarOverlay() ? 0 : getVerticalScrollbarWidth()),MeasureSpec.EXACTLY);
  int heightMeasureSpec=0;
  ViewGroup.LayoutParams params=mHeader.getLayoutParams();
  if (params == null) {
    mHeader.setLayoutParams(new ViewGroup.MarginLayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT));
  }
  if (params != null && params.height > 0) {
    heightMeasureSpec=MeasureSpec.makeMeasureSpec(params.height,MeasureSpec.EXACTLY);
  }
 else {
    heightMeasureSpec=MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED);
  }
  mHeader.measure(widthMeasureSpec,heightMeasureSpec);
  if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR1) {
    mHeader.setLayoutDirection(this.getLayoutDirection());
  }
  mHeader.layout(getPaddingLeft(),0,getWidth() - getPaddingRight(),mHeader.getMeasuredHeight());
}

Fixed version (ground truth):
private void measureHeader(){
  int widthMeasureSpec=MeasureSpec.makeMeasureSpec(getWidth() - getPaddingLeft() - getPaddingRight()- (isScrollBarOverlay() ? 0 : getVerticalScrollbarWidth()),MeasureSpec.EXACTLY);
  int heightMeasureSpec=0;
  ViewGroup.LayoutParams params=mHeader.getLayoutParams();
  if (params == null) {
    mHeader.setLayoutParams(new ViewGroup.MarginLayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT));
  }
  if (params != null && params.height > 0) {
    heightMeasureSpec=MeasureSpec.makeMeasureSpec(params.height,MeasureSpec.EXACTLY);
  }
 else {
    heightMeasureSpec=MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED);
  }
  mHeader.measure(widthMeasureSpec,heightMeasureSpec);
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
    mHeader.setLayoutDirection(this.getLayoutDirection());
  }
  mHeader.layout(getPaddingLeft(),0,getWidth() - getPaddingRight(),mHeader.getMeasuredHeight());
}
Program: 7939
Project: 7939
Buggy source:
private boolean hasStickyHeaderAtPosition(int position){
  return mAreHeadersSticky && position > 0 && position < mAdapter.getCount() && mAdapter.getHeaderId(position) == mAdapter.getHeaderId(position - 1);
}

Fixed version (ground truth):
private boolean hasStickyHeaderAtPosition(int position){
  position-=getHeaderViewsCount();
  return mAreHeadersSticky && position > 0 && position < mAdapter.getCount() && mAdapter.getHeaderId(position) == mAdapter.getHeaderId(position - 1);
}
Program: 7940
Project: 7940
Buggy source:
@SuppressLint("String_Node_Str") @Override public void onHeaderClick(StickyListHeadersListView l,View header,int itemPosition,long headerId,boolean currentlySticky){
  Toast.makeText(getActivity(),"String_Node_Str" + headerId,Toast.LENGTH_SHORT).show();
  mStickyList.smoothScrollToPositionFromTop(mAdapter.getSectionStart(itemPosition) + mStickyList.getHeaderViewsCount(),-mStickyList.getPaddingTop());
}

Fixed version (ground truth):
@SuppressLint("String_Node_Str") @Override public void onHeaderClick(StickyListHeadersListView l,View header,int itemPosition,long headerId,boolean currentlySticky){
  Toast.makeText(getActivity(),"String_Node_Str" + headerId,Toast.LENGTH_SHORT).show();
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
    mStickyList.smoothScrollToPositionFromTop(mAdapter.getSectionStart(itemPosition) + mStickyList.getHeaderViewsCount(),-mStickyList.getPaddingTop());
  }
}
Program: 7941
Project: 7941
Buggy source:
private void measureHeader(){
  int widthMeasureSpec=MeasureSpec.makeMeasureSpec(getWidth(),MeasureSpec.EXACTLY);
  int heightMeasureSpec=0;
  ViewGroup.LayoutParams params=mHeader.getLayoutParams();
  if (params != null && params.height > 0) {
    heightMeasureSpec=MeasureSpec.makeMeasureSpec(params.height,MeasureSpec.EXACTLY);
  }
 else {
    heightMeasureSpec=MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED);
  }
  mHeader.measure(widthMeasureSpec,heightMeasureSpec);
  mHeader.layout(getLeft() + getPaddingLeft(),0,getRight() - getPaddingRight(),mHeader.getMeasuredHeight());
}

Fixed version (ground truth):
private void measureHeader(){
  int widthMeasureSpec=MeasureSpec.makeMeasureSpec(getWidth() - getPaddingLeft() - getPaddingRight()- (isScrollBarOverlay() ? 0 : getVerticalScrollbarWidth()),MeasureSpec.EXACTLY);
  int heightMeasureSpec=0;
  ViewGroup.LayoutParams params=mHeader.getLayoutParams();
  if (params != null && params.height > 0) {
    heightMeasureSpec=MeasureSpec.makeMeasureSpec(params.height,MeasureSpec.EXACTLY);
  }
 else {
    heightMeasureSpec=MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED);
  }
  mHeader.measure(widthMeasureSpec,heightMeasureSpec);
  mHeader.layout(getPaddingLeft(),0,getWidth() - getPaddingRight(),mHeader.getMeasuredHeight());
}
Program: 7942
Project: 7942
Buggy source:
@Override public void onHeaderClick(StickyListHeadersListView l,View header,int itemPosition,long headerId,boolean currentlySticky){
  Toast.makeText(getActivity(),"String_Node_Str" + headerId,Toast.LENGTH_SHORT).show();
  mStickyList.smoothScrollToPosition(mAdapter.getSectionStart(itemPosition) + mStickyList.getHeaderViewsCount());
}

Fixed version (ground truth):
@SuppressLint("String_Node_Str") @Override public void onHeaderClick(StickyListHeadersListView l,View header,int itemPosition,long headerId,boolean currentlySticky){
  Toast.makeText(getActivity(),"String_Node_Str" + headerId,Toast.LENGTH_SHORT).show();
  mStickyList.smoothScrollToPositionFromTop(mAdapter.getSectionStart(itemPosition) + mStickyList.getHeaderViewsCount(),-mStickyList.getPaddingTop());
}
Program: 7944
Project: 7944
Buggy source:
private void reset(){
  mHeader=null;
  mCurrentHeaderId=null;
  mHeaderBottomPosition=-1;
}

Fixed version (ground truth):
private void reset(){
  mHeader=null;
  mCurrentHeaderId=null;
  mHeaderPosition=null;
  mHeaderBottomPosition=-1;
}
Program: 7945
Project: 7945
Buggy source:
@Override public long getHeaderId(int position){
  return countries[position].subSequence(0,1).charAt(0);
}

Fixed version (ground truth):
@Override public long getHeaderId(int position){
  Log.d("String_Node_Str","String_Node_Str");
  return countries[position].subSequence(0,1).charAt(0);
}
Program: 7946
Project: 7946
Buggy source:
@Override protected void onLayout(boolean changed,int l,int t,int r,int b){
  super.onLayout(changed,l,t,r,b);
  if (changed) {
    reset();
  }
}

Fixed version (ground truth):
@Override protected void onLayout(boolean changed,int l,int t,int r,int b){
  super.onLayout(changed,l,t,r,b);
  if (changed) {
    reset();
    scrollChanged(getFirstVisiblePosition());
  }
}
Program: 7947
Project: 7947
Buggy source:
public StickyListHeadersListView(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  TypedArray a=context.obtainStyledAttributes(attrs,ATTRS);
  divider=a.getDrawable(ATTRS_listDivider);
  dividerHeight=a.getDimensionPixelSize(ATTRS_dividerHeight,-1);
  a.recycle();
  super.setOnScrollListener(this);
  super.setDivider(null);
  super.setDividerHeight(0);
  setVerticalFadingEdgeEnabled(false);
  viewConfig=ViewConfiguration.get(context);
}

Fixed version (ground truth):
public StickyListHeadersListView(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  super.setOnScrollListener(this);
  super.setDivider(null);
  super.setDividerHeight(0);
  setVerticalFadingEdgeEnabled(false);
  viewConfig=ViewConfiguration.get(context);
}
Program: 7948
Project: 7948
Buggy source:
private void measureHeader(){
  int widthMeasureSpec=MeasureSpec.makeMeasureSpec(getWidth(),MeasureSpec.EXACTLY);
  int heightMeasureSpec=MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED);
  header.measure(widthMeasureSpec,heightMeasureSpec);
  header.layout(getLeft() + getPaddingLeft(),0,getRight() - getPaddingRight(),header.getMeasuredHeight());
}

Fixed version (ground truth):
private void measureHeader(){
  int widthMeasureSpec=MeasureSpec.makeMeasureSpec(getWidth(),MeasureSpec.EXACTLY);
  int heightMeasureSpec=0;
  ViewGroup.LayoutParams params=header.getLayoutParams();
  if (params != null && params.height > 0) {
    heightMeasureSpec=MeasureSpec.makeMeasureSpec(params.height,MeasureSpec.EXACTLY);
  }
 else {
    heightMeasureSpec=MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED);
  }
  header.measure(widthMeasureSpec,heightMeasureSpec);
  header.layout(getLeft() + getPaddingLeft(),0,getRight() - getPaddingRight(),header.getMeasuredHeight());
}
Program: 7949
Project: 7949
Buggy source:
@Override protected void onMeasure(int widthMeasureSpec,int heightMeasureSpec){
  int measuredWidth=MeasureSpec.getSize(widthMeasureSpec);
  int measuredHeight=0;
  if (header != null) {
    header.measure(MeasureSpec.makeMeasureSpec(measuredWidth,MeasureSpec.EXACTLY),MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED));
    measuredHeight+=header.getMeasuredHeight();
  }
 else   if (divider != null) {
    measuredHeight+=dividerHeight;
  }
  item.measure(MeasureSpec.makeMeasureSpec(measuredWidth,MeasureSpec.EXACTLY),MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED));
  measuredHeight+=item.getMeasuredHeight();
  setMeasuredDimension(measuredWidth,measuredHeight);
}

Fixed version (ground truth):
@Override protected void onMeasure(int widthMeasureSpec,int heightMeasureSpec){
  int measuredWidth=MeasureSpec.getSize(widthMeasureSpec);
  int childWidthMeasureSpec=MeasureSpec.makeMeasureSpec(measuredWidth,MeasureSpec.EXACTLY);
  int measuredHeight=0;
  if (header != null) {
    ViewGroup.LayoutParams params=header.getLayoutParams();
    if (params != null && params.height > 0) {
      header.measure(childWidthMeasureSpec,MeasureSpec.makeMeasureSpec(params.height,MeasureSpec.EXACTLY));
    }
 else {
      header.measure(childWidthMeasureSpec,MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED));
    }
    measuredHeight+=header.getMeasuredHeight();
  }
 else   if (divider != null) {
    measuredHeight+=dividerHeight;
  }
  ViewGroup.LayoutParams params=item.getLayoutParams();
  if (params != null && params.height > 0) {
    item.measure(childWidthMeasureSpec,MeasureSpec.makeMeasureSpec(params.height,MeasureSpec.EXACTLY));
  }
 else {
    item.measure(childWidthMeasureSpec,MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED));
  }
  measuredHeight+=item.getMeasuredHeight();
  setMeasuredDimension(measuredWidth,measuredHeight);
}
Program: 7950
Project: 7950
Buggy source:
StickyListHeadersAdapterWrapper(Context context,StickyListHeadersAdapter delegate){
  this.context=context;
  this.delegate=delegate;
  delegate.registerDataSetObserver(this);
}

Fixed version (ground truth):
StickyListHeadersAdapterWrapper(Context context,StickyListHeadersAdapter delegate){
  this.context=context;
  this.delegate=delegate;
  delegate.registerDataSetObserver(dataSetObserver);
}
Program: 7953
Project: 7953
Buggy source:
@Override public boolean performItemClick(View view,int position,long id){
  view=((WrapperView)view).item;
  return super.performItemClick(view,position,id);
}

Fixed version (ground truth):
@Override public boolean performItemClick(View view,int position,long id){
  if (view instanceof WrapperView) {
    view=((WrapperView)view).item;
  }
  return super.performItemClick(view,position,id);
}
Program: 7955
Project: 7955
Buggy source:
@Override protected void dispatchDraw(Canvas canvas){
  super.dispatchDraw(canvas);
  if (header != null && areHeadersSticky) {
    if (headerHasChanged) {
      int widthMeasureSpec=MeasureSpec.makeMeasureSpec(getWidth(),MeasureSpec.EXACTLY);
      int heightMeasureSpec=MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED);
      header.measure(widthMeasureSpec,heightMeasureSpec);
      header.layout(getLeft() + getPaddingLeft(),0,getRight() - getPaddingRight(),headerHeight);
      headerHasChanged=false;
    }
    int top=headerBottomPosition - headerHeight;
    clippingRect.left=getPaddingLeft();
    clippingRect.right=getWidth() - getPaddingRight();
    clippingRect.bottom=top + headerHeight;
    if (clippingToPadding) {
      clippingRect.top=getPaddingTop();
    }
 else {
      clippingRect.top=0;
    }
    canvas.save();
    canvas.clipRect(clippingRect);
    canvas.translate(getPaddingLeft(),top);
    header.draw(canvas);
    canvas.restore();
  }
}

Fixed version (ground truth):
@Override protected void dispatchDraw(Canvas canvas){
  if (Build.VERSION.SDK_INT < Build.VERSION_CODES.FROYO) {
    scrollChanged(getFirstVisiblePosition());
  }
  super.dispatchDraw(canvas);
  if (header != null && areHeadersSticky) {
    if (headerHasChanged) {
      int widthMeasureSpec=MeasureSpec.makeMeasureSpec(getWidth(),MeasureSpec.EXACTLY);
      int heightMeasureSpec=MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED);
      header.measure(widthMeasureSpec,heightMeasureSpec);
      header.layout(getLeft() + getPaddingLeft(),0,getRight() - getPaddingRight(),headerHeight);
      headerHasChanged=false;
    }
    int top=headerBottomPosition - headerHeight;
    clippingRect.left=getPaddingLeft();
    clippingRect.right=getWidth() - getPaddingRight();
    clippingRect.bottom=top + headerHeight;
    if (clippingToPadding) {
      clippingRect.top=getPaddingTop();
    }
 else {
      clippingRect.top=0;
    }
    canvas.save();
    canvas.clipRect(clippingRect);
    canvas.translate(getPaddingLeft(),top);
    header.draw(canvas);
    canvas.restore();
  }
}
Program: 7957
Project: 7957
Buggy source:
/** 
 * @param position the list position
 * @return an identifier for this header, a header for a position must always have a constant positive ID
 */
public abstract long getHeaderId(int position);

Fixed version (ground truth):
/** 
 * @param position the list position
 * @return an identifier for this header, a header for a position must always have a constant ID
 */
public abstract long getHeaderId(int position);
Program: 7959
Project: 7959
Buggy source:
private void reset(){
  headerBottomPosition=0;
  headerHeight=-1;
  header=null;
  oldHeaderId=-1;
  headerHasChanged=true;
}

Fixed version (ground truth):
private void reset(){
  headerBottomPosition=0;
  headerHeight=-1;
  header=null;
  oldHeaderId=null;
  headerHasChanged=true;
}
Program: 7961
Project: 7961
Buggy source:
@Override public void onRestoreInstanceState(Parcelable state){
  headerHeight=((Bundle)state).getInt(HEADER_HEIGHT);
  super.onRestoreInstanceState(((Bundle)state).getParcelable(SUPER_INSTANCE_STATE));
}

Fixed version (ground truth):
@Override public void onRestoreInstanceState(Parcelable state){
  headerHeight=((Bundle)state).getInt(HEADER_HEIGHT);
  headerHasChanged=true;
  super.onRestoreInstanceState(((Bundle)state).getParcelable(SUPER_INSTANCE_STATE));
}
Program: 7962
Project: 7962
Buggy source:
@Override protected void dispatchDraw(Canvas canvas){
  super.dispatchDraw(canvas);
  if (header != null && areHeadersSticky) {
    if (headerHasChanged) {
      int widthMeasureSpec=MeasureSpec.makeMeasureSpec(getWidth(),MeasureSpec.AT_MOST);
      int heightMeasureSpec=MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED);
      header.measure(widthMeasureSpec,heightMeasureSpec);
      header.layout(getLeft() + getPaddingLeft(),0,getRight() - getPaddingRight(),headerHeight);
      headerHasChanged=false;
    }
    int top=headerBottomPosition - headerHeight;
    clippingRect.left=getPaddingLeft();
    clippingRect.right=getWidth() - getPaddingRight();
    clippingRect.bottom=top + headerHeight;
    if (clippingToPadding) {
      clippingRect.top=getPaddingTop();
    }
 else {
      clippingRect.top=0;
    }
    canvas.save();
    canvas.clipRect(clippingRect);
    canvas.translate(getPaddingLeft(),top);
    header.draw(canvas);
    canvas.restore();
  }
}

Fixed version (ground truth):
@Override protected void dispatchDraw(Canvas canvas){
  super.dispatchDraw(canvas);
  if (header != null && areHeadersSticky) {
    if (headerHasChanged) {
      int widthMeasureSpec=MeasureSpec.makeMeasureSpec(getWidth(),MeasureSpec.EXACTLY);
      int heightMeasureSpec=MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED);
      header.measure(widthMeasureSpec,heightMeasureSpec);
      header.layout(getLeft() + getPaddingLeft(),0,getRight() - getPaddingRight(),headerHeight);
      headerHasChanged=false;
    }
    int top=headerBottomPosition - headerHeight;
    clippingRect.left=getPaddingLeft();
    clippingRect.right=getWidth() - getPaddingRight();
    clippingRect.bottom=top + headerHeight;
    if (clippingToPadding) {
      clippingRect.top=getPaddingTop();
    }
 else {
      clippingRect.top=0;
    }
    canvas.save();
    canvas.clipRect(clippingRect);
    canvas.translate(getPaddingLeft(),top);
    header.draw(canvas);
    canvas.restore();
  }
}
Program: 7964
Project: 7964
Buggy source:
@Override public void setAdapter(ListAdapter adapter){
  if (!clipToPaddingHasBeenSet) {
    clippingToPadding=true;
  }
  if (!(adapter instanceof StickyListHeadersAdapter))   throw new IllegalArgumentException("String_Node_Str");
  ((StickyListHeadersAdapter)adapter).setDivider(divider);
  ((StickyListHeadersAdapter)adapter).setDividerHeight(dividerHeight);
  super.setAdapter(adapter);
}

Fixed version (ground truth):
@Override public void setAdapter(ListAdapter adapter){
  if (!clipToPaddingHasBeenSet) {
    clippingToPadding=true;
  }
  if (!(adapter instanceof StickyListHeadersAdapter))   throw new IllegalArgumentException("String_Node_Str");
  ((StickyListHeadersAdapter)adapter).setDivider(divider);
  ((StickyListHeadersAdapter)adapter).setDividerHeight(dividerHeight);
  reset();
  super.setAdapter(adapter);
}
Program: 7966
Project: 7966
Buggy source:
LoadThread(Context ctxt){
  super();
  this.ctxt=ctxt.getApplicationContext();
  android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_BACKGROUND);
}

Fixed version (ground truth):
LoadThread(Context ctxt){
  super();
  this.ctxt=ctxt.getApplicationContext();
}
Program: 7967
Project: 7967
Buggy source:
@Override public void run(){
  PresoRoster.getInstance().load(ctxt);
  EventBus.getDefault().postSticky(new RosterLoadedEvent());
}

Fixed version (ground truth):
@Override public void run(){
  android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_BACKGROUND);
  PresoRoster.getInstance().load(ctxt);
  EventBus.getDefault().postSticky(new RosterLoadedEvent());
}
Program: 7968
Project: 7968
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setRetainInstance(true);
  adapter=new ArrayAdapter<>(getActivity(),android.R.layout.simple_list_item_1,model);
  Observable.create(source()).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).takeUntil(s -> (isCancelled.get())).doOnComplete(() -> {
    if (!isCancelled.get()) {
      Toast.makeText(getActivity(),R.string.done,Toast.LENGTH_SHORT).show();
    }
  }
).subscribe(s -> adapter.add(s));
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setRetainInstance(true);
  adapter=new ArrayAdapter<>(getActivity(),android.R.layout.simple_list_item_1,model);
  Observable<String> observable=Observable.create(source()).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).doOnComplete(() -> {
    Toast.makeText(getActivity(),R.string.done,Toast.LENGTH_SHORT).show();
  }
);
  sub=observable.subscribe(s -> {
    adapter.add(s);
  }
);
}
Program: 7969
Project: 7969
Buggy source:
@Override public void onDestroy(){
  isCancelled.set(true);
  super.onDestroy();
}

Fixed version (ground truth):
@Override public void onDestroy(){
  if (sub != null && !sub.isDisposed()) {
    sub.dispose();
  }
  super.onDestroy();
}
Program: 7970
Project: 7970
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setRetainInstance(true);
  adapter=new ArrayAdapter<>(getActivity(),android.R.layout.simple_list_item_1,model);
  Observable.create(new WordSource(getActivity())).subscribeOn(Schedulers.io()).map(s -> (s.toUpperCase())).observeOn(AndroidSchedulers.mainThread()).takeUntil(s -> (isCancelled.get())).doOnComplete(() -> {
    if (!isCancelled.get()) {
      Toast.makeText(getActivity(),R.string.done,Toast.LENGTH_SHORT).show();
    }
  }
).subscribe(s -> adapter.add(s),error -> Toast.makeText(getActivity(),error.getMessage(),Toast.LENGTH_LONG).show());
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  adapter=new ArrayAdapter<>(getActivity(),android.R.layout.simple_list_item_1,model);
  Observable<String> observable=Observable.create(new WordSource(getActivity())).subscribeOn(Schedulers.io()).map(s -> (s.toUpperCase())).observeOn(AndroidSchedulers.mainThread()).doOnComplete(() -> {
    Toast.makeText(getActivity(),R.string.done,Toast.LENGTH_SHORT).show();
  }
);
  sub=observable.subscribe(s -> adapter.add(s),error -> Toast.makeText(getActivity(),error.getMessage(),Toast.LENGTH_LONG).show());
}
Program: 7971
Project: 7971
Buggy source:
@Override public void onDestroy(){
  isCancelled.set(true);
  super.onDestroy();
}

Fixed version (ground truth):
@Override public void onDestroy(){
  if (sub != null && !sub.isDisposed()) {
    sub.dispose();
  }
  super.onDestroy();
}
Program: 7972
Project: 7972
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  ViewPager pager=(ViewPager)findViewById(R.id.pager);
  adapter=new SampleAdapter(this,getSupportFragmentManager());
  pager.setAdapter(adapter);
  tabs=(TabLayout)findViewById(R.id.tabs);
  tabs.setupWithViewPager(pager);
  tabs.setTabMode(TabLayout.MODE_FIXED);
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  pager=(ViewPager)findViewById(R.id.pager);
  adapter=new SampleAdapter(this,getSupportFragmentManager());
  pager.setAdapter(adapter);
  tabs=(TabLayout)findViewById(R.id.tabs);
  tabs.setupWithViewPager(pager);
  tabs.setTabMode(TabLayout.MODE_FIXED);
}