nus-yam/ex-repair huggingface dataset:
Program: 194440
Project: 194440
Buggy source:
@Override public void calculateApp(BatterySipper app,BatteryStats.Uid u,long rawUptimeUs,long rawRealtimeUs,int statsType){
  long wakeLockTimeUs=0;
  final ArrayMap<String,? extends BatteryStats.Uid.Wakelock> wakelockStats=u.getWakelockStats();
  final int wakelockStatsCount=wakelockStats.size();
  for (int i=0; i < wakelockStatsCount; i++) {
    final BatteryStats.Uid.Wakelock wakelock=wakelockStats.valueAt(i);
    BatteryStats.Timer timer=wakelock.getWakeTime(BatteryStats.WAKE_TYPE_PARTIAL);
    if (timer != null) {
      wakeLockTimeUs+=timer.getTotalTimeLocked(rawRealtimeUs,statsType);
    }
  }
  app.wakeLockTimeMs=wakeLockTimeUs / 1000;
  mTotalAppWakelockTimeMs+=app.wakeLockTimeMs;
  app.wakeLockPowerMah=(app.wakeLockTimeMs * mPowerWakelock) / (1000 * 60 * 60);
  if (DEBUG && app.wakeLockPowerMah != 0) {
    Log.d(TAG,"String_Node_Str" + u.getUid() + "String_Node_Str"+ app.wakeLockTimeMs+ "String_Node_Str"+ BatteryStatsHelper.makemAh(app.wakeLockPowerMah));
  }
}

Fixed version (ground truth):
@Override public void calculateApp(BatterySipper app,BatteryStats.Uid u,long rawRealtimeUs,long rawUptimeUs,int statsType){
  long wakeLockTimeUs=0;
  final ArrayMap<String,? extends BatteryStats.Uid.Wakelock> wakelockStats=u.getWakelockStats();
  final int wakelockStatsCount=wakelockStats.size();
  for (int i=0; i < wakelockStatsCount; i++) {
    final BatteryStats.Uid.Wakelock wakelock=wakelockStats.valueAt(i);
    BatteryStats.Timer timer=wakelock.getWakeTime(BatteryStats.WAKE_TYPE_PARTIAL);
    if (timer != null) {
      wakeLockTimeUs+=timer.getTotalTimeLocked(rawRealtimeUs,statsType);
    }
  }
  app.wakeLockTimeMs=wakeLockTimeUs / 1000;
  mTotalAppWakelockTimeMs+=app.wakeLockTimeMs;
  app.wakeLockPowerMah=(app.wakeLockTimeMs * mPowerWakelock) / (1000 * 60 * 60);
  if (DEBUG && app.wakeLockPowerMah != 0) {
    Log.d(TAG,"String_Node_Str" + u.getUid() + "String_Node_Str"+ app.wakeLockTimeMs+ "String_Node_Str"+ BatteryStatsHelper.makemAh(app.wakeLockPowerMah));
  }
}
Program: 194443
Project: 194443
Buggy source:
/** 
 * Set indents. Arguments are arrays holding an indent amount, one per line, measured in pixels. For lines past the last element in the array, the last element repeats.
 * @param leftIndents array of indent values for left margin, in pixels
 * @param rightIndents array of indent values for right margin, in pixels
 * @return this builder, useful for chaining
 * @see android.widget.TextView#setIndents
 */
public Builder setIndents(int[] leftIndents,int[] rightIndents){
  int leftLen=leftIndents == null ? 0 : leftIndents.length;
  int rightLen=rightIndents == null ? 0 : rightIndents.length;
  int[] indents=new int[Math.max(leftLen,rightLen)];
  for (int i=0; i < indents.length; i++) {
    int leftMargin=i < leftLen ? leftIndents[i] : 0;
    int rightMargin=i < rightLen ? rightIndents[i] : 0;
    indents[i]=leftMargin + rightMargin;
  }
  nSetIndents(mNativePtr,indents);
  return this;
}

Fixed version (ground truth):
/** 
 * Set indents. Arguments are arrays holding an indent amount, one per line, measured in pixels. For lines past the last element in the array, the last element repeats.
 * @param leftIndents array of indent values for left margin, in pixels
 * @param rightIndents array of indent values for right margin, in pixels
 * @return this builder, useful for chaining
 */
public Builder setIndents(int[] leftIndents,int[] rightIndents){
  mLeftIndents=leftIndents;
  mRightIndents=rightIndents;
  int leftLen=leftIndents == null ? 0 : leftIndents.length;
  int rightLen=rightIndents == null ? 0 : rightIndents.length;
  int[] indents=new int[Math.max(leftLen,rightLen)];
  for (int i=0; i < indents.length; i++) {
    int leftMargin=i < leftLen ? leftIndents[i] : 0;
    int rightMargin=i < rightLen ? rightIndents[i] : 0;
    indents[i]=leftMargin + rightMargin;
  }
  nSetIndents(mNativePtr,indents);
  return this;
}
Program: 194444
Project: 194444
Buggy source:
private static void recycle(Builder b){
  b.mPaint=null;
  b.mText=null;
  MeasuredText.recycle(b.mMeasuredText);
  b.mMeasuredText=null;
  nFinishBuilder(b.mNativePtr);
  sPool.release(b);
}

Fixed version (ground truth):
private static void recycle(Builder b){
  b.mPaint=null;
  b.mText=null;
  MeasuredText.recycle(b.mMeasuredText);
  b.mMeasuredText=null;
  b.mLeftIndents=null;
  b.mRightIndents=null;
  nFinishBuilder(b.mNativePtr);
  sPool.release(b);
}
Program: 194446
Project: 194446
Buggy source:
private StaticLayout(Builder b){
  super((b.mEllipsize == null) ? b.mText : (b.mText instanceof Spanned) ? new SpannedEllipsizer(b.mText) : new Ellipsizer(b.mText),b.mPaint,b.mWidth,b.mAlignment,b.mSpacingMult,b.mSpacingAdd);
  if (b.mEllipsize != null) {
    Ellipsizer e=(Ellipsizer)getText();
    e.mLayout=this;
    e.mWidth=b.mEllipsizedWidth;
    e.mMethod=b.mEllipsize;
    mEllipsizedWidth=b.mEllipsizedWidth;
    mColumns=COLUMNS_ELLIPSIZE;
  }
 else {
    mColumns=COLUMNS_NORMAL;
    mEllipsizedWidth=b.mWidth;
  }
  mLineDirections=ArrayUtils.newUnpaddedArray(Directions.class,2 * mColumns);
  mLines=new int[mLineDirections.length];
  mMaximumVisibleLineCount=b.mMaxLines;
  generate(b,b.mIncludePad,b.mIncludePad);
}

Fixed version (ground truth):
private StaticLayout(Builder b){
  super((b.mEllipsize == null) ? b.mText : (b.mText instanceof Spanned) ? new SpannedEllipsizer(b.mText) : new Ellipsizer(b.mText),b.mPaint,b.mWidth,b.mAlignment,b.mSpacingMult,b.mSpacingAdd);
  if (b.mEllipsize != null) {
    Ellipsizer e=(Ellipsizer)getText();
    e.mLayout=this;
    e.mWidth=b.mEllipsizedWidth;
    e.mMethod=b.mEllipsize;
    mEllipsizedWidth=b.mEllipsizedWidth;
    mColumns=COLUMNS_ELLIPSIZE;
  }
 else {
    mColumns=COLUMNS_NORMAL;
    mEllipsizedWidth=b.mWidth;
  }
  mLineDirections=ArrayUtils.newUnpaddedArray(Directions.class,2 * mColumns);
  mLines=new int[mLineDirections.length];
  mMaximumVisibleLineCount=b.mMaxLines;
  mLeftIndents=b.mLeftIndents;
  mRightIndents=b.mRightIndents;
  generate(b,b.mIncludePad,b.mIncludePad);
}
Program: 194448
Project: 194448
Buggy source:
@Override public void calculateApp(BatterySipper app,BatteryStats.Uid u,long rawUptimeUs,long rawRealtimeUs,int statsType){
  long wakeLockTimeUs=0;
  final ArrayMap<String,? extends BatteryStats.Uid.Wakelock> wakelockStats=u.getWakelockStats();
  final int wakelockStatsCount=wakelockStats.size();
  for (int i=0; i < wakelockStatsCount; i++) {
    final BatteryStats.Uid.Wakelock wakelock=wakelockStats.valueAt(i);
    BatteryStats.Timer timer=wakelock.getWakeTime(BatteryStats.WAKE_TYPE_PARTIAL);
    if (timer != null) {
      wakeLockTimeUs+=timer.getTotalTimeLocked(rawRealtimeUs,statsType);
    }
  }
  app.wakeLockTimeMs=wakeLockTimeUs / 1000;
  mTotalAppWakelockTimeMs+=app.wakeLockTimeMs;
  app.wakeLockPowerMah=(app.wakeLockTimeMs * mPowerWakelock) / (1000 * 60 * 60);
  if (DEBUG && app.wakeLockPowerMah != 0) {
    Log.d(TAG,"String_Node_Str" + u.getUid() + "String_Node_Str"+ app.wakeLockTimeMs+ "String_Node_Str"+ BatteryStatsHelper.makemAh(app.wakeLockPowerMah));
  }
}

Fixed version (ground truth):
@Override public void calculateApp(BatterySipper app,BatteryStats.Uid u,long rawRealtimeUs,long rawUptimeUs,int statsType){
  long wakeLockTimeUs=0;
  final ArrayMap<String,? extends BatteryStats.Uid.Wakelock> wakelockStats=u.getWakelockStats();
  final int wakelockStatsCount=wakelockStats.size();
  for (int i=0; i < wakelockStatsCount; i++) {
    final BatteryStats.Uid.Wakelock wakelock=wakelockStats.valueAt(i);
    BatteryStats.Timer timer=wakelock.getWakeTime(BatteryStats.WAKE_TYPE_PARTIAL);
    if (timer != null) {
      wakeLockTimeUs+=timer.getTotalTimeLocked(rawRealtimeUs,statsType);
    }
  }
  app.wakeLockTimeMs=wakeLockTimeUs / 1000;
  mTotalAppWakelockTimeMs+=app.wakeLockTimeMs;
  app.wakeLockPowerMah=(app.wakeLockTimeMs * mPowerWakelock) / (1000 * 60 * 60);
  if (DEBUG && app.wakeLockPowerMah != 0) {
    Log.d(TAG,"String_Node_Str" + u.getUid() + "String_Node_Str"+ app.wakeLockTimeMs+ "String_Node_Str"+ BatteryStatsHelper.makemAh(app.wakeLockPowerMah));
  }
}
Program: 194451
Project: 194451
Buggy source:
/** 
 * Set indents. Arguments are arrays holding an indent amount, one per line, measured in pixels. For lines past the last element in the array, the last element repeats.
 * @param leftIndents array of indent values for left margin, in pixels
 * @param rightIndents array of indent values for right margin, in pixels
 * @return this builder, useful for chaining
 * @see android.widget.TextView#setIndents
 */
public Builder setIndents(int[] leftIndents,int[] rightIndents){
  int leftLen=leftIndents == null ? 0 : leftIndents.length;
  int rightLen=rightIndents == null ? 0 : rightIndents.length;
  int[] indents=new int[Math.max(leftLen,rightLen)];
  for (int i=0; i < indents.length; i++) {
    int leftMargin=i < leftLen ? leftIndents[i] : 0;
    int rightMargin=i < rightLen ? rightIndents[i] : 0;
    indents[i]=leftMargin + rightMargin;
  }
  nSetIndents(mNativePtr,indents);
  return this;
}

Fixed version (ground truth):
/** 
 * Set indents. Arguments are arrays holding an indent amount, one per line, measured in pixels. For lines past the last element in the array, the last element repeats.
 * @param leftIndents array of indent values for left margin, in pixels
 * @param rightIndents array of indent values for right margin, in pixels
 * @return this builder, useful for chaining
 */
public Builder setIndents(int[] leftIndents,int[] rightIndents){
  mLeftIndents=leftIndents;
  mRightIndents=rightIndents;
  int leftLen=leftIndents == null ? 0 : leftIndents.length;
  int rightLen=rightIndents == null ? 0 : rightIndents.length;
  int[] indents=new int[Math.max(leftLen,rightLen)];
  for (int i=0; i < indents.length; i++) {
    int leftMargin=i < leftLen ? leftIndents[i] : 0;
    int rightMargin=i < rightLen ? rightIndents[i] : 0;
    indents[i]=leftMargin + rightMargin;
  }
  nSetIndents(mNativePtr,indents);
  return this;
}
Program: 194452
Project: 194452
Buggy source:
private static void recycle(Builder b){
  b.mPaint=null;
  b.mText=null;
  MeasuredText.recycle(b.mMeasuredText);
  b.mMeasuredText=null;
  nFinishBuilder(b.mNativePtr);
  sPool.release(b);
}

Fixed version (ground truth):
private static void recycle(Builder b){
  b.mPaint=null;
  b.mText=null;
  MeasuredText.recycle(b.mMeasuredText);
  b.mMeasuredText=null;
  b.mLeftIndents=null;
  b.mRightIndents=null;
  nFinishBuilder(b.mNativePtr);
  sPool.release(b);
}
Program: 194454
Project: 194454
Buggy source:
private StaticLayout(Builder b){
  super((b.mEllipsize == null) ? b.mText : (b.mText instanceof Spanned) ? new SpannedEllipsizer(b.mText) : new Ellipsizer(b.mText),b.mPaint,b.mWidth,b.mAlignment,b.mSpacingMult,b.mSpacingAdd);
  if (b.mEllipsize != null) {
    Ellipsizer e=(Ellipsizer)getText();
    e.mLayout=this;
    e.mWidth=b.mEllipsizedWidth;
    e.mMethod=b.mEllipsize;
    mEllipsizedWidth=b.mEllipsizedWidth;
    mColumns=COLUMNS_ELLIPSIZE;
  }
 else {
    mColumns=COLUMNS_NORMAL;
    mEllipsizedWidth=b.mWidth;
  }
  mLineDirections=ArrayUtils.newUnpaddedArray(Directions.class,2 * mColumns);
  mLines=new int[mLineDirections.length];
  mMaximumVisibleLineCount=b.mMaxLines;
  generate(b,b.mIncludePad,b.mIncludePad);
}

Fixed version (ground truth):
private StaticLayout(Builder b){
  super((b.mEllipsize == null) ? b.mText : (b.mText instanceof Spanned) ? new SpannedEllipsizer(b.mText) : new Ellipsizer(b.mText),b.mPaint,b.mWidth,b.mAlignment,b.mSpacingMult,b.mSpacingAdd);
  if (b.mEllipsize != null) {
    Ellipsizer e=(Ellipsizer)getText();
    e.mLayout=this;
    e.mWidth=b.mEllipsizedWidth;
    e.mMethod=b.mEllipsize;
    mEllipsizedWidth=b.mEllipsizedWidth;
    mColumns=COLUMNS_ELLIPSIZE;
  }
 else {
    mColumns=COLUMNS_NORMAL;
    mEllipsizedWidth=b.mWidth;
  }
  mLineDirections=ArrayUtils.newUnpaddedArray(Directions.class,2 * mColumns);
  mLines=new int[mLineDirections.length];
  mMaximumVisibleLineCount=b.mMaxLines;
  mLeftIndents=b.mLeftIndents;
  mRightIndents=b.mRightIndents;
  generate(b,b.mIncludePad,b.mIncludePad);
}
Program: 194455
Project: 194455
Buggy source:
@Override public void calculateApp(BatterySipper app,BatteryStats.Uid u,long rawUptimeUs,long rawRealtimeUs,int statsType){
  long wakeLockTimeUs=0;
  final ArrayMap<String,? extends BatteryStats.Uid.Wakelock> wakelockStats=u.getWakelockStats();
  final int wakelockStatsCount=wakelockStats.size();
  for (int i=0; i < wakelockStatsCount; i++) {
    final BatteryStats.Uid.Wakelock wakelock=wakelockStats.valueAt(i);
    BatteryStats.Timer timer=wakelock.getWakeTime(BatteryStats.WAKE_TYPE_PARTIAL);
    if (timer != null) {
      wakeLockTimeUs+=timer.getTotalTimeLocked(rawRealtimeUs,statsType);
    }
  }
  app.wakeLockTimeMs=wakeLockTimeUs / 1000;
  mTotalAppWakelockTimeMs+=app.wakeLockTimeMs;
  app.wakeLockPowerMah=(app.wakeLockTimeMs * mPowerWakelock) / (1000 * 60 * 60);
  if (DEBUG && app.wakeLockPowerMah != 0) {
    Log.d(TAG,"String_Node_Str" + u.getUid() + "String_Node_Str"+ app.wakeLockTimeMs+ "String_Node_Str"+ BatteryStatsHelper.makemAh(app.wakeLockPowerMah));
  }
}

Fixed version (ground truth):
@Override public void calculateApp(BatterySipper app,BatteryStats.Uid u,long rawRealtimeUs,long rawUptimeUs,int statsType){
  long wakeLockTimeUs=0;
  final ArrayMap<String,? extends BatteryStats.Uid.Wakelock> wakelockStats=u.getWakelockStats();
  final int wakelockStatsCount=wakelockStats.size();
  for (int i=0; i < wakelockStatsCount; i++) {
    final BatteryStats.Uid.Wakelock wakelock=wakelockStats.valueAt(i);
    BatteryStats.Timer timer=wakelock.getWakeTime(BatteryStats.WAKE_TYPE_PARTIAL);
    if (timer != null) {
      wakeLockTimeUs+=timer.getTotalTimeLocked(rawRealtimeUs,statsType);
    }
  }
  app.wakeLockTimeMs=wakeLockTimeUs / 1000;
  mTotalAppWakelockTimeMs+=app.wakeLockTimeMs;
  app.wakeLockPowerMah=(app.wakeLockTimeMs * mPowerWakelock) / (1000 * 60 * 60);
  if (DEBUG && app.wakeLockPowerMah != 0) {
    Log.d(TAG,"String_Node_Str" + u.getUid() + "String_Node_Str"+ app.wakeLockTimeMs+ "String_Node_Str"+ BatteryStatsHelper.makemAh(app.wakeLockPowerMah));
  }
}
Program: 194458
Project: 194458
Buggy source:
/** 
 * Set indents. Arguments are arrays holding an indent amount, one per line, measured in pixels. For lines past the last element in the array, the last element repeats.
 * @param leftIndents array of indent values for left margin, in pixels
 * @param rightIndents array of indent values for right margin, in pixels
 * @return this builder, useful for chaining
 * @see android.widget.TextView#setIndents
 */
public Builder setIndents(int[] leftIndents,int[] rightIndents){
  int leftLen=leftIndents == null ? 0 : leftIndents.length;
  int rightLen=rightIndents == null ? 0 : rightIndents.length;
  int[] indents=new int[Math.max(leftLen,rightLen)];
  for (int i=0; i < indents.length; i++) {
    int leftMargin=i < leftLen ? leftIndents[i] : 0;
    int rightMargin=i < rightLen ? rightIndents[i] : 0;
    indents[i]=leftMargin + rightMargin;
  }
  nSetIndents(mNativePtr,indents);
  return this;
}

Fixed version (ground truth):
/** 
 * Set indents. Arguments are arrays holding an indent amount, one per line, measured in pixels. For lines past the last element in the array, the last element repeats.
 * @param leftIndents array of indent values for left margin, in pixels
 * @param rightIndents array of indent values for right margin, in pixels
 * @return this builder, useful for chaining
 */
public Builder setIndents(int[] leftIndents,int[] rightIndents){
  mLeftIndents=leftIndents;
  mRightIndents=rightIndents;
  int leftLen=leftIndents == null ? 0 : leftIndents.length;
  int rightLen=rightIndents == null ? 0 : rightIndents.length;
  int[] indents=new int[Math.max(leftLen,rightLen)];
  for (int i=0; i < indents.length; i++) {
    int leftMargin=i < leftLen ? leftIndents[i] : 0;
    int rightMargin=i < rightLen ? rightIndents[i] : 0;
    indents[i]=leftMargin + rightMargin;
  }
  nSetIndents(mNativePtr,indents);
  return this;
}
Program: 194459
Project: 194459
Buggy source:
private static void recycle(Builder b){
  b.mPaint=null;
  b.mText=null;
  MeasuredText.recycle(b.mMeasuredText);
  b.mMeasuredText=null;
  nFinishBuilder(b.mNativePtr);
  sPool.release(b);
}

Fixed version (ground truth):
private static void recycle(Builder b){
  b.mPaint=null;
  b.mText=null;
  MeasuredText.recycle(b.mMeasuredText);
  b.mMeasuredText=null;
  b.mLeftIndents=null;
  b.mRightIndents=null;
  nFinishBuilder(b.mNativePtr);
  sPool.release(b);
}
Program: 194461
Project: 194461
Buggy source:
private StaticLayout(Builder b){
  super((b.mEllipsize == null) ? b.mText : (b.mText instanceof Spanned) ? new SpannedEllipsizer(b.mText) : new Ellipsizer(b.mText),b.mPaint,b.mWidth,b.mAlignment,b.mSpacingMult,b.mSpacingAdd);
  if (b.mEllipsize != null) {
    Ellipsizer e=(Ellipsizer)getText();
    e.mLayout=this;
    e.mWidth=b.mEllipsizedWidth;
    e.mMethod=b.mEllipsize;
    mEllipsizedWidth=b.mEllipsizedWidth;
    mColumns=COLUMNS_ELLIPSIZE;
  }
 else {
    mColumns=COLUMNS_NORMAL;
    mEllipsizedWidth=b.mWidth;
  }
  mLineDirections=ArrayUtils.newUnpaddedArray(Directions.class,2 * mColumns);
  mLines=new int[mLineDirections.length];
  mMaximumVisibleLineCount=b.mMaxLines;
  generate(b,b.mIncludePad,b.mIncludePad);
}

Fixed version (ground truth):
private StaticLayout(Builder b){
  super((b.mEllipsize == null) ? b.mText : (b.mText instanceof Spanned) ? new SpannedEllipsizer(b.mText) : new Ellipsizer(b.mText),b.mPaint,b.mWidth,b.mAlignment,b.mSpacingMult,b.mSpacingAdd);
  if (b.mEllipsize != null) {
    Ellipsizer e=(Ellipsizer)getText();
    e.mLayout=this;
    e.mWidth=b.mEllipsizedWidth;
    e.mMethod=b.mEllipsize;
    mEllipsizedWidth=b.mEllipsizedWidth;
    mColumns=COLUMNS_ELLIPSIZE;
  }
 else {
    mColumns=COLUMNS_NORMAL;
    mEllipsizedWidth=b.mWidth;
  }
  mLineDirections=ArrayUtils.newUnpaddedArray(Directions.class,2 * mColumns);
  mLines=new int[mLineDirections.length];
  mMaximumVisibleLineCount=b.mMaxLines;
  mLeftIndents=b.mLeftIndents;
  mRightIndents=b.mRightIndents;
  generate(b,b.mIncludePad,b.mIncludePad);
}
Program: 194463
Project: 194463
Buggy source:
@Override public void calculateApp(BatterySipper app,BatteryStats.Uid u,long rawUptimeUs,long rawRealtimeUs,int statsType){
  long wakeLockTimeUs=0;
  final ArrayMap<String,? extends BatteryStats.Uid.Wakelock> wakelockStats=u.getWakelockStats();
  final int wakelockStatsCount=wakelockStats.size();
  for (int i=0; i < wakelockStatsCount; i++) {
    final BatteryStats.Uid.Wakelock wakelock=wakelockStats.valueAt(i);
    BatteryStats.Timer timer=wakelock.getWakeTime(BatteryStats.WAKE_TYPE_PARTIAL);
    if (timer != null) {
      wakeLockTimeUs+=timer.getTotalTimeLocked(rawRealtimeUs,statsType);
    }
  }
  app.wakeLockTimeMs=wakeLockTimeUs / 1000;
  mTotalAppWakelockTimeMs+=app.wakeLockTimeMs;
  app.wakeLockPowerMah=(app.wakeLockTimeMs * mPowerWakelock) / (1000 * 60 * 60);
  if (DEBUG && app.wakeLockPowerMah != 0) {
    Log.d(TAG,"String_Node_Str" + u.getUid() + "String_Node_Str"+ app.wakeLockTimeMs+ "String_Node_Str"+ BatteryStatsHelper.makemAh(app.wakeLockPowerMah));
  }
}

Fixed version (ground truth):
@Override public void calculateApp(BatterySipper app,BatteryStats.Uid u,long rawRealtimeUs,long rawUptimeUs,int statsType){
  long wakeLockTimeUs=0;
  final ArrayMap<String,? extends BatteryStats.Uid.Wakelock> wakelockStats=u.getWakelockStats();
  final int wakelockStatsCount=wakelockStats.size();
  for (int i=0; i < wakelockStatsCount; i++) {
    final BatteryStats.Uid.Wakelock wakelock=wakelockStats.valueAt(i);
    BatteryStats.Timer timer=wakelock.getWakeTime(BatteryStats.WAKE_TYPE_PARTIAL);
    if (timer != null) {
      wakeLockTimeUs+=timer.getTotalTimeLocked(rawRealtimeUs,statsType);
    }
  }
  app.wakeLockTimeMs=wakeLockTimeUs / 1000;
  mTotalAppWakelockTimeMs+=app.wakeLockTimeMs;
  app.wakeLockPowerMah=(app.wakeLockTimeMs * mPowerWakelock) / (1000 * 60 * 60);
  if (DEBUG && app.wakeLockPowerMah != 0) {
    Log.d(TAG,"String_Node_Str" + u.getUid() + "String_Node_Str"+ app.wakeLockTimeMs+ "String_Node_Str"+ BatteryStatsHelper.makemAh(app.wakeLockPowerMah));
  }
}
Program: 194464
Project: 194464
Buggy source:
@Override public void calculateApp(BatterySipper app,BatteryStats.Uid u,long rawUptimeUs,long rawRealtimeUs,int statsType){
  long wakeLockTimeUs=0;
  final ArrayMap<String,? extends BatteryStats.Uid.Wakelock> wakelockStats=u.getWakelockStats();
  final int wakelockStatsCount=wakelockStats.size();
  for (int i=0; i < wakelockStatsCount; i++) {
    final BatteryStats.Uid.Wakelock wakelock=wakelockStats.valueAt(i);
    BatteryStats.Timer timer=wakelock.getWakeTime(BatteryStats.WAKE_TYPE_PARTIAL);
    if (timer != null) {
      wakeLockTimeUs+=timer.getTotalTimeLocked(rawRealtimeUs,statsType);
    }
  }
  app.wakeLockTimeMs=wakeLockTimeUs / 1000;
  mTotalAppWakelockTimeMs+=app.wakeLockTimeMs;
  app.wakeLockPowerMah=(app.wakeLockTimeMs * mPowerWakelock) / (1000 * 60 * 60);
  if (DEBUG && app.wakeLockPowerMah != 0) {
    Log.d(TAG,"String_Node_Str" + u.getUid() + "String_Node_Str"+ app.wakeLockTimeMs+ "String_Node_Str"+ BatteryStatsHelper.makemAh(app.wakeLockPowerMah));
  }
}

Fixed version (ground truth):
@Override public void calculateApp(BatterySipper app,BatteryStats.Uid u,long rawRealtimeUs,long rawUptimeUs,int statsType){
  long wakeLockTimeUs=0;
  final ArrayMap<String,? extends BatteryStats.Uid.Wakelock> wakelockStats=u.getWakelockStats();
  final int wakelockStatsCount=wakelockStats.size();
  for (int i=0; i < wakelockStatsCount; i++) {
    final BatteryStats.Uid.Wakelock wakelock=wakelockStats.valueAt(i);
    BatteryStats.Timer timer=wakelock.getWakeTime(BatteryStats.WAKE_TYPE_PARTIAL);
    if (timer != null) {
      wakeLockTimeUs+=timer.getTotalTimeLocked(rawRealtimeUs,statsType);
    }
  }
  app.wakeLockTimeMs=wakeLockTimeUs / 1000;
  mTotalAppWakelockTimeMs+=app.wakeLockTimeMs;
  app.wakeLockPowerMah=(app.wakeLockTimeMs * mPowerWakelock) / (1000 * 60 * 60);
  if (DEBUG && app.wakeLockPowerMah != 0) {
    Log.d(TAG,"String_Node_Str" + u.getUid() + "String_Node_Str"+ app.wakeLockTimeMs+ "String_Node_Str"+ BatteryStatsHelper.makemAh(app.wakeLockPowerMah));
  }
}
Program: 194468
Project: 194468
Buggy source:
/** 
 * Set indents. Arguments are arrays holding an indent amount, one per line, measured in pixels. For lines past the last element in the array, the last element repeats.
 * @param leftIndents array of indent values for left margin, in pixels
 * @param rightIndents array of indent values for right margin, in pixels
 * @return this builder, useful for chaining
 * @see android.widget.TextView#setIndents
 */
public Builder setIndents(int[] leftIndents,int[] rightIndents){
  int leftLen=leftIndents == null ? 0 : leftIndents.length;
  int rightLen=rightIndents == null ? 0 : rightIndents.length;
  int[] indents=new int[Math.max(leftLen,rightLen)];
  for (int i=0; i < indents.length; i++) {
    int leftMargin=i < leftLen ? leftIndents[i] : 0;
    int rightMargin=i < rightLen ? rightIndents[i] : 0;
    indents[i]=leftMargin + rightMargin;
  }
  nSetIndents(mNativePtr,indents);
  return this;
}

Fixed version (ground truth):
/** 
 * Set indents. Arguments are arrays holding an indent amount, one per line, measured in pixels. For lines past the last element in the array, the last element repeats.
 * @param leftIndents array of indent values for left margin, in pixels
 * @param rightIndents array of indent values for right margin, in pixels
 * @return this builder, useful for chaining
 */
public Builder setIndents(int[] leftIndents,int[] rightIndents){
  mLeftIndents=leftIndents;
  mRightIndents=rightIndents;
  int leftLen=leftIndents == null ? 0 : leftIndents.length;
  int rightLen=rightIndents == null ? 0 : rightIndents.length;
  int[] indents=new int[Math.max(leftLen,rightLen)];
  for (int i=0; i < indents.length; i++) {
    int leftMargin=i < leftLen ? leftIndents[i] : 0;
    int rightMargin=i < rightLen ? rightIndents[i] : 0;
    indents[i]=leftMargin + rightMargin;
  }
  nSetIndents(mNativePtr,indents);
  return this;
}
Program: 194469
Project: 194469
Buggy source:
private static void recycle(Builder b){
  b.mPaint=null;
  b.mText=null;
  MeasuredText.recycle(b.mMeasuredText);
  b.mMeasuredText=null;
  nFinishBuilder(b.mNativePtr);
  sPool.release(b);
}

Fixed version (ground truth):
private static void recycle(Builder b){
  b.mPaint=null;
  b.mText=null;
  MeasuredText.recycle(b.mMeasuredText);
  b.mMeasuredText=null;
  b.mLeftIndents=null;
  b.mRightIndents=null;
  nFinishBuilder(b.mNativePtr);
  sPool.release(b);
}
Program: 194471
Project: 194471
Buggy source:
private StaticLayout(Builder b){
  super((b.mEllipsize == null) ? b.mText : (b.mText instanceof Spanned) ? new SpannedEllipsizer(b.mText) : new Ellipsizer(b.mText),b.mPaint,b.mWidth,b.mAlignment,b.mSpacingMult,b.mSpacingAdd);
  if (b.mEllipsize != null) {
    Ellipsizer e=(Ellipsizer)getText();
    e.mLayout=this;
    e.mWidth=b.mEllipsizedWidth;
    e.mMethod=b.mEllipsize;
    mEllipsizedWidth=b.mEllipsizedWidth;
    mColumns=COLUMNS_ELLIPSIZE;
  }
 else {
    mColumns=COLUMNS_NORMAL;
    mEllipsizedWidth=b.mWidth;
  }
  mLineDirections=ArrayUtils.newUnpaddedArray(Directions.class,2 * mColumns);
  mLines=new int[mLineDirections.length];
  mMaximumVisibleLineCount=b.mMaxLines;
  generate(b,b.mIncludePad,b.mIncludePad);
}

Fixed version (ground truth):
private StaticLayout(Builder b){
  super((b.mEllipsize == null) ? b.mText : (b.mText instanceof Spanned) ? new SpannedEllipsizer(b.mText) : new Ellipsizer(b.mText),b.mPaint,b.mWidth,b.mAlignment,b.mSpacingMult,b.mSpacingAdd);
  if (b.mEllipsize != null) {
    Ellipsizer e=(Ellipsizer)getText();
    e.mLayout=this;
    e.mWidth=b.mEllipsizedWidth;
    e.mMethod=b.mEllipsize;
    mEllipsizedWidth=b.mEllipsizedWidth;
    mColumns=COLUMNS_ELLIPSIZE;
  }
 else {
    mColumns=COLUMNS_NORMAL;
    mEllipsizedWidth=b.mWidth;
  }
  mLineDirections=ArrayUtils.newUnpaddedArray(Directions.class,2 * mColumns);
  mLines=new int[mLineDirections.length];
  mMaximumVisibleLineCount=b.mMaxLines;
  mLeftIndents=b.mLeftIndents;
  mRightIndents=b.mRightIndents;
  generate(b,b.mIncludePad,b.mIncludePad);
}
Program: 194474
Project: 194474
Buggy source:
@Override public void calculateApp(BatterySipper app,BatteryStats.Uid u,long rawUptimeUs,long rawRealtimeUs,int statsType){
  long wakeLockTimeUs=0;
  final ArrayMap<String,? extends BatteryStats.Uid.Wakelock> wakelockStats=u.getWakelockStats();
  final int wakelockStatsCount=wakelockStats.size();
  for (int i=0; i < wakelockStatsCount; i++) {
    final BatteryStats.Uid.Wakelock wakelock=wakelockStats.valueAt(i);
    BatteryStats.Timer timer=wakelock.getWakeTime(BatteryStats.WAKE_TYPE_PARTIAL);
    if (timer != null) {
      wakeLockTimeUs+=timer.getTotalTimeLocked(rawRealtimeUs,statsType);
    }
  }
  app.wakeLockTimeMs=wakeLockTimeUs / 1000;
  mTotalAppWakelockTimeMs+=app.wakeLockTimeMs;
  app.wakeLockPowerMah=(app.wakeLockTimeMs * mPowerWakelock) / (1000 * 60 * 60);
  if (DEBUG && app.wakeLockPowerMah != 0) {
    Log.d(TAG,"String_Node_Str" + u.getUid() + "String_Node_Str"+ app.wakeLockTimeMs+ "String_Node_Str"+ BatteryStatsHelper.makemAh(app.wakeLockPowerMah));
  }
}

Fixed version (ground truth):
@Override public void calculateApp(BatterySipper app,BatteryStats.Uid u,long rawRealtimeUs,long rawUptimeUs,int statsType){
  long wakeLockTimeUs=0;
  final ArrayMap<String,? extends BatteryStats.Uid.Wakelock> wakelockStats=u.getWakelockStats();
  final int wakelockStatsCount=wakelockStats.size();
  for (int i=0; i < wakelockStatsCount; i++) {
    final BatteryStats.Uid.Wakelock wakelock=wakelockStats.valueAt(i);
    BatteryStats.Timer timer=wakelock.getWakeTime(BatteryStats.WAKE_TYPE_PARTIAL);
    if (timer != null) {
      wakeLockTimeUs+=timer.getTotalTimeLocked(rawRealtimeUs,statsType);
    }
  }
  app.wakeLockTimeMs=wakeLockTimeUs / 1000;
  mTotalAppWakelockTimeMs+=app.wakeLockTimeMs;
  app.wakeLockPowerMah=(app.wakeLockTimeMs * mPowerWakelock) / (1000 * 60 * 60);
  if (DEBUG && app.wakeLockPowerMah != 0) {
    Log.d(TAG,"String_Node_Str" + u.getUid() + "String_Node_Str"+ app.wakeLockTimeMs+ "String_Node_Str"+ BatteryStatsHelper.makemAh(app.wakeLockPowerMah));
  }
}
Program: 194476
Project: 194476
Buggy source:
/** 
 * Construct a DhcpResults object from a DHCP reply packet.
 */
public DhcpResults toDhcpResults(){
  Inet4Address ipAddress=mYourIp;
  if (ipAddress.equals(Inet4Address.ANY)) {
    ipAddress=mClientIp;
    if (ipAddress.equals(Inet4Address.ANY)) {
      return null;
    }
  }
  int prefixLength;
  if (mSubnetMask != null) {
    try {
      prefixLength=NetworkUtils.netmaskToPrefixLength(mSubnetMask);
    }
 catch (    IllegalArgumentException e) {
      return null;
    }
  }
 else {
    prefixLength=NetworkUtils.getImplicitNetmask(ipAddress);
  }
  DhcpResults results=new DhcpResults();
  try {
    results.ipAddress=new LinkAddress(ipAddress,prefixLength);
  }
 catch (  IllegalArgumentException e) {
    return null;
  }
  results.gateway=mGateway;
  results.dnsServers.addAll(mDnsServers);
  results.domains=mDomainName;
  results.serverAddress=mServerIdentifier;
  results.vendorInfo=mVendorId;
  results.leaseDuration=(mLeaseTime != null) ? mLeaseTime : INFINITE_LEASE;
  return results;
}

Fixed version (ground truth):
/** 
 * Construct a DhcpResults object from a DHCP reply packet.
 */
public DhcpResults toDhcpResults(){
  Inet4Address ipAddress=mYourIp;
  if (ipAddress.equals(Inet4Address.ANY)) {
    ipAddress=mClientIp;
    if (ipAddress.equals(Inet4Address.ANY)) {
      return null;
    }
  }
  int prefixLength;
  if (mSubnetMask != null) {
    try {
      prefixLength=NetworkUtils.netmaskToPrefixLength(mSubnetMask);
    }
 catch (    IllegalArgumentException e) {
      return null;
    }
  }
 else {
    prefixLength=NetworkUtils.getImplicitNetmask(ipAddress);
  }
  DhcpResults results=new DhcpResults();
  try {
    results.ipAddress=new LinkAddress(ipAddress,prefixLength);
  }
 catch (  IllegalArgumentException e) {
    return null;
  }
  results.gateway=mGateway;
  results.dnsServers.addAll(mDnsServers);
  results.domains=mDomainName;
  results.serverAddress=mServerIdentifier;
  results.vendorInfo=mVendorInfo;
  results.leaseDuration=(mLeaseTime != null) ? mLeaseTime : INFINITE_LEASE;
  return results;
}
Program: 194477
Project: 194477
Buggy source:
@SmallTest public void testIpAddress() throws Exception {
  byte[] slash11Netmask=new byte[]{(byte)0xff,(byte)0xe0,0x00,0x00};
  byte[] slash24Netmask=new byte[]{(byte)0xff,(byte)0xff,(byte)0xff,0x00};
  byte[] invalidNetmask=new byte[]{(byte)0xff,(byte)0xfb,(byte)0xff,0x00};
  Inet4Address example1=(Inet4Address)NetworkUtils.numericToInetAddress("String_Node_Str");
  Inet4Address example2=(Inet4Address)NetworkUtils.numericToInetAddress("String_Node_Str");
  checkIpAddress(null,ANY,ANY,slash24Netmask);
  checkIpAddress("String_Node_Str",example2,example1,slash24Netmask);
  checkIpAddress("String_Node_Str",example2,ANY,slash11Netmask);
  checkIpAddress("String_Node_Str",ANY,example2,slash11Netmask);
  checkIpAddress(null,example2,ANY,invalidNetmask);
  checkIpAddress("String_Node_Str",ANY,example2,null);
}

Fixed version (ground truth):
@SmallTest public void testIpAddress() throws Exception {
  byte[] slash11Netmask=new byte[]{(byte)0xff,(byte)0xe0,0x00,0x00};
  byte[] slash24Netmask=new byte[]{(byte)0xff,(byte)0xff,(byte)0xff,0x00};
  byte[] invalidNetmask=new byte[]{(byte)0xff,(byte)0xfb,(byte)0xff,0x00};
  Inet4Address example1=v4Address("String_Node_Str");
  Inet4Address example2=v4Address("String_Node_Str");
  checkIpAddress(null,ANY,ANY,slash24Netmask);
  checkIpAddress("String_Node_Str",example2,example1,slash24Netmask);
  checkIpAddress("String_Node_Str",example2,ANY,slash11Netmask);
  checkIpAddress("String_Node_Str",ANY,example2,slash11Netmask);
  checkIpAddress(null,example2,ANY,invalidNetmask);
  checkIpAddress("String_Node_Str",ANY,example2,null);
}
Program: 194478
Project: 194478
Buggy source:
private void assertDomainAndVendorInfoParses(String expectedDomain,byte[] domainBytes,String expectedVendorInfo,byte[] vendorInfoBytes){
  ByteBuffer packet=new TestDhcpPacket(DHCP_MESSAGE_TYPE_OFFER).setDomainBytes(domainBytes).setVendorInfoBytes(vendorInfoBytes).build();
  DhcpPacket offerPacket=DhcpPacket.decodeFullPacket(packet,ENCAP_BOOTP);
  assertEquals(expectedDomain,offerPacket.mDomainName);
  assertEquals(expectedVendorInfo,offerPacket.mVendorId);
}

Fixed version (ground truth):
private void assertDomainAndVendorInfoParses(String expectedDomain,byte[] domainBytes,String expectedVendorInfo,byte[] vendorInfoBytes){
  ByteBuffer packet=new TestDhcpPacket(DHCP_MESSAGE_TYPE_OFFER).setDomainBytes(domainBytes).setVendorInfoBytes(vendorInfoBytes).build();
  DhcpPacket offerPacket=DhcpPacket.decodeFullPacket(packet,ENCAP_BOOTP);
  assertEquals(expectedDomain,offerPacket.mDomainName);
  assertEquals(expectedVendorInfo,offerPacket.mVendorInfo);
}
Program: 194479
Project: 194479
Buggy source:
public void finishPacket(ByteBuffer buffer){
  addTlv(buffer,DHCP_MESSAGE_TYPE,mType);
  if (mDomainBytes != null) {
    addTlv(buffer,DHCP_DOMAIN_NAME,mDomainBytes);
  }
  if (mVendorInfoBytes != null) {
    addTlv(buffer,DHCP_VENDOR_CLASS_ID,mVendorInfoBytes);
  }
  if (mLeaseTimeBytes != null) {
    addTlv(buffer,DHCP_LEASE_TIME,mLeaseTimeBytes);
  }
  if (mNetmaskBytes != null) {
    addTlv(buffer,DHCP_SUBNET_MASK,mNetmaskBytes);
  }
  addTlvEnd(buffer);
}

Fixed version (ground truth):
public void finishPacket(ByteBuffer buffer){
  addTlv(buffer,DHCP_MESSAGE_TYPE,mType);
  if (mDomainBytes != null) {
    addTlv(buffer,DHCP_DOMAIN_NAME,mDomainBytes);
  }
  if (mVendorInfoBytes != null) {
    addTlv(buffer,DHCP_VENDOR_INFO,mVendorInfoBytes);
  }
  if (mLeaseTimeBytes != null) {
    addTlv(buffer,DHCP_LEASE_TIME,mLeaseTimeBytes);
  }
  if (mNetmaskBytes != null) {
    addTlv(buffer,DHCP_SUBNET_MASK,mNetmaskBytes);
  }
  addTlvEnd(buffer);
}
Program: 194480
Project: 194480
Buggy source:
/** 
 * Construct a DhcpResults object from a DHCP reply packet.
 */
public DhcpResults toDhcpResults(){
  Inet4Address ipAddress=mYourIp;
  if (ipAddress.equals(Inet4Address.ANY)) {
    ipAddress=mClientIp;
    if (ipAddress.equals(Inet4Address.ANY)) {
      return null;
    }
  }
  int prefixLength;
  if (mSubnetMask != null) {
    try {
      prefixLength=NetworkUtils.netmaskToPrefixLength(mSubnetMask);
    }
 catch (    IllegalArgumentException e) {
      return null;
    }
  }
 else {
    prefixLength=NetworkUtils.getImplicitNetmask(ipAddress);
  }
  DhcpResults results=new DhcpResults();
  try {
    results.ipAddress=new LinkAddress(ipAddress,prefixLength);
  }
 catch (  IllegalArgumentException e) {
    return null;
  }
  results.gateway=mGateway;
  results.dnsServers.addAll(mDnsServers);
  results.domains=mDomainName;
  results.serverAddress=mServerIdentifier;
  results.vendorInfo=mVendorId;
  results.leaseDuration=(mLeaseTime != null) ? mLeaseTime : INFINITE_LEASE;
  return results;
}

Fixed version (ground truth):
/** 
 * Construct a DhcpResults object from a DHCP reply packet.
 */
public DhcpResults toDhcpResults(){
  Inet4Address ipAddress=mYourIp;
  if (ipAddress.equals(Inet4Address.ANY)) {
    ipAddress=mClientIp;
    if (ipAddress.equals(Inet4Address.ANY)) {
      return null;
    }
  }
  int prefixLength;
  if (mSubnetMask != null) {
    try {
      prefixLength=NetworkUtils.netmaskToPrefixLength(mSubnetMask);
    }
 catch (    IllegalArgumentException e) {
      return null;
    }
  }
 else {
    prefixLength=NetworkUtils.getImplicitNetmask(ipAddress);
  }
  DhcpResults results=new DhcpResults();
  try {
    results.ipAddress=new LinkAddress(ipAddress,prefixLength);
  }
 catch (  IllegalArgumentException e) {
    return null;
  }
  results.gateway=mGateway;
  results.dnsServers.addAll(mDnsServers);
  results.domains=mDomainName;
  results.serverAddress=mServerIdentifier;
  results.vendorInfo=mVendorInfo;
  results.leaseDuration=(mLeaseTime != null) ? mLeaseTime : INFINITE_LEASE;
  return results;
}
Program: 194481
Project: 194481
Buggy source:
@SmallTest public void testIpAddress() throws Exception {
  byte[] slash11Netmask=new byte[]{(byte)0xff,(byte)0xe0,0x00,0x00};
  byte[] slash24Netmask=new byte[]{(byte)0xff,(byte)0xff,(byte)0xff,0x00};
  byte[] invalidNetmask=new byte[]{(byte)0xff,(byte)0xfb,(byte)0xff,0x00};
  Inet4Address example1=(Inet4Address)NetworkUtils.numericToInetAddress("String_Node_Str");
  Inet4Address example2=(Inet4Address)NetworkUtils.numericToInetAddress("String_Node_Str");
  checkIpAddress(null,ANY,ANY,slash24Netmask);
  checkIpAddress("String_Node_Str",example2,example1,slash24Netmask);
  checkIpAddress("String_Node_Str",example2,ANY,slash11Netmask);
  checkIpAddress("String_Node_Str",ANY,example2,slash11Netmask);
  checkIpAddress(null,example2,ANY,invalidNetmask);
  checkIpAddress("String_Node_Str",ANY,example2,null);
}

Fixed version (ground truth):
@SmallTest public void testIpAddress() throws Exception {
  byte[] slash11Netmask=new byte[]{(byte)0xff,(byte)0xe0,0x00,0x00};
  byte[] slash24Netmask=new byte[]{(byte)0xff,(byte)0xff,(byte)0xff,0x00};
  byte[] invalidNetmask=new byte[]{(byte)0xff,(byte)0xfb,(byte)0xff,0x00};
  Inet4Address example1=v4Address("String_Node_Str");
  Inet4Address example2=v4Address("String_Node_Str");
  checkIpAddress(null,ANY,ANY,slash24Netmask);
  checkIpAddress("String_Node_Str",example2,example1,slash24Netmask);
  checkIpAddress("String_Node_Str",example2,ANY,slash11Netmask);
  checkIpAddress("String_Node_Str",ANY,example2,slash11Netmask);
  checkIpAddress(null,example2,ANY,invalidNetmask);
  checkIpAddress("String_Node_Str",ANY,example2,null);
}
Program: 194482
Project: 194482
Buggy source:
private void assertDomainAndVendorInfoParses(String expectedDomain,byte[] domainBytes,String expectedVendorInfo,byte[] vendorInfoBytes){
  ByteBuffer packet=new TestDhcpPacket(DHCP_MESSAGE_TYPE_OFFER).setDomainBytes(domainBytes).setVendorInfoBytes(vendorInfoBytes).build();
  DhcpPacket offerPacket=DhcpPacket.decodeFullPacket(packet,ENCAP_BOOTP);
  assertEquals(expectedDomain,offerPacket.mDomainName);
  assertEquals(expectedVendorInfo,offerPacket.mVendorId);
}

Fixed version (ground truth):
private void assertDomainAndVendorInfoParses(String expectedDomain,byte[] domainBytes,String expectedVendorInfo,byte[] vendorInfoBytes){
  ByteBuffer packet=new TestDhcpPacket(DHCP_MESSAGE_TYPE_OFFER).setDomainBytes(domainBytes).setVendorInfoBytes(vendorInfoBytes).build();
  DhcpPacket offerPacket=DhcpPacket.decodeFullPacket(packet,ENCAP_BOOTP);
  assertEquals(expectedDomain,offerPacket.mDomainName);
  assertEquals(expectedVendorInfo,offerPacket.mVendorInfo);
}
Program: 194483
Project: 194483
Buggy source:
public void finishPacket(ByteBuffer buffer){
  addTlv(buffer,DHCP_MESSAGE_TYPE,mType);
  if (mDomainBytes != null) {
    addTlv(buffer,DHCP_DOMAIN_NAME,mDomainBytes);
  }
  if (mVendorInfoBytes != null) {
    addTlv(buffer,DHCP_VENDOR_CLASS_ID,mVendorInfoBytes);
  }
  if (mLeaseTimeBytes != null) {
    addTlv(buffer,DHCP_LEASE_TIME,mLeaseTimeBytes);
  }
  if (mNetmaskBytes != null) {
    addTlv(buffer,DHCP_SUBNET_MASK,mNetmaskBytes);
  }
  addTlvEnd(buffer);
}

Fixed version (ground truth):
public void finishPacket(ByteBuffer buffer){
  addTlv(buffer,DHCP_MESSAGE_TYPE,mType);
  if (mDomainBytes != null) {
    addTlv(buffer,DHCP_DOMAIN_NAME,mDomainBytes);
  }
  if (mVendorInfoBytes != null) {
    addTlv(buffer,DHCP_VENDOR_INFO,mVendorInfoBytes);
  }
  if (mLeaseTimeBytes != null) {
    addTlv(buffer,DHCP_LEASE_TIME,mLeaseTimeBytes);
  }
  if (mNetmaskBytes != null) {
    addTlv(buffer,DHCP_SUBNET_MASK,mNetmaskBytes);
  }
  addTlvEnd(buffer);
}
Program: 194484
Project: 194484
Buggy source:
/** 
 * Construct a DhcpResults object from a DHCP reply packet.
 */
public DhcpResults toDhcpResults(){
  Inet4Address ipAddress=mYourIp;
  if (ipAddress.equals(Inet4Address.ANY)) {
    ipAddress=mClientIp;
    if (ipAddress.equals(Inet4Address.ANY)) {
      return null;
    }
  }
  int prefixLength;
  if (mSubnetMask != null) {
    try {
      prefixLength=NetworkUtils.netmaskToPrefixLength(mSubnetMask);
    }
 catch (    IllegalArgumentException e) {
      return null;
    }
  }
 else {
    prefixLength=NetworkUtils.getImplicitNetmask(ipAddress);
  }
  DhcpResults results=new DhcpResults();
  try {
    results.ipAddress=new LinkAddress(ipAddress,prefixLength);
  }
 catch (  IllegalArgumentException e) {
    return null;
  }
  results.gateway=mGateway;
  results.dnsServers.addAll(mDnsServers);
  results.domains=mDomainName;
  results.serverAddress=mServerIdentifier;
  results.vendorInfo=mVendorId;
  results.leaseDuration=(mLeaseTime != null) ? mLeaseTime : INFINITE_LEASE;
  return results;
}

Fixed version (ground truth):
/** 
 * Construct a DhcpResults object from a DHCP reply packet.
 */
public DhcpResults toDhcpResults(){
  Inet4Address ipAddress=mYourIp;
  if (ipAddress.equals(Inet4Address.ANY)) {
    ipAddress=mClientIp;
    if (ipAddress.equals(Inet4Address.ANY)) {
      return null;
    }
  }
  int prefixLength;
  if (mSubnetMask != null) {
    try {
      prefixLength=NetworkUtils.netmaskToPrefixLength(mSubnetMask);
    }
 catch (    IllegalArgumentException e) {
      return null;
    }
  }
 else {
    prefixLength=NetworkUtils.getImplicitNetmask(ipAddress);
  }
  DhcpResults results=new DhcpResults();
  try {
    results.ipAddress=new LinkAddress(ipAddress,prefixLength);
  }
 catch (  IllegalArgumentException e) {
    return null;
  }
  results.gateway=mGateway;
  results.dnsServers.addAll(mDnsServers);
  results.domains=mDomainName;
  results.serverAddress=mServerIdentifier;
  results.vendorInfo=mVendorInfo;
  results.leaseDuration=(mLeaseTime != null) ? mLeaseTime : INFINITE_LEASE;
  return results;
}
Program: 194485
Project: 194485
Buggy source:
@SmallTest public void testIpAddress() throws Exception {
  byte[] slash11Netmask=new byte[]{(byte)0xff,(byte)0xe0,0x00,0x00};
  byte[] slash24Netmask=new byte[]{(byte)0xff,(byte)0xff,(byte)0xff,0x00};
  byte[] invalidNetmask=new byte[]{(byte)0xff,(byte)0xfb,(byte)0xff,0x00};
  Inet4Address example1=(Inet4Address)NetworkUtils.numericToInetAddress("String_Node_Str");
  Inet4Address example2=(Inet4Address)NetworkUtils.numericToInetAddress("String_Node_Str");
  checkIpAddress(null,ANY,ANY,slash24Netmask);
  checkIpAddress("String_Node_Str",example2,example1,slash24Netmask);
  checkIpAddress("String_Node_Str",example2,ANY,slash11Netmask);
  checkIpAddress("String_Node_Str",ANY,example2,slash11Netmask);
  checkIpAddress(null,example2,ANY,invalidNetmask);
  checkIpAddress("String_Node_Str",ANY,example2,null);
}

Fixed version (ground truth):
@SmallTest public void testIpAddress() throws Exception {
  byte[] slash11Netmask=new byte[]{(byte)0xff,(byte)0xe0,0x00,0x00};
  byte[] slash24Netmask=new byte[]{(byte)0xff,(byte)0xff,(byte)0xff,0x00};
  byte[] invalidNetmask=new byte[]{(byte)0xff,(byte)0xfb,(byte)0xff,0x00};
  Inet4Address example1=v4Address("String_Node_Str");
  Inet4Address example2=v4Address("String_Node_Str");
  checkIpAddress(null,ANY,ANY,slash24Netmask);
  checkIpAddress("String_Node_Str",example2,example1,slash24Netmask);
  checkIpAddress("String_Node_Str",example2,ANY,slash11Netmask);
  checkIpAddress("String_Node_Str",ANY,example2,slash11Netmask);
  checkIpAddress(null,example2,ANY,invalidNetmask);
  checkIpAddress("String_Node_Str",ANY,example2,null);
}
Program: 194486
Project: 194486
Buggy source:
private void assertDomainAndVendorInfoParses(String expectedDomain,byte[] domainBytes,String expectedVendorInfo,byte[] vendorInfoBytes){
  ByteBuffer packet=new TestDhcpPacket(DHCP_MESSAGE_TYPE_OFFER).setDomainBytes(domainBytes).setVendorInfoBytes(vendorInfoBytes).build();
  DhcpPacket offerPacket=DhcpPacket.decodeFullPacket(packet,ENCAP_BOOTP);
  assertEquals(expectedDomain,offerPacket.mDomainName);
  assertEquals(expectedVendorInfo,offerPacket.mVendorId);
}

Fixed version (ground truth):
private void assertDomainAndVendorInfoParses(String expectedDomain,byte[] domainBytes,String expectedVendorInfo,byte[] vendorInfoBytes){
  ByteBuffer packet=new TestDhcpPacket(DHCP_MESSAGE_TYPE_OFFER).setDomainBytes(domainBytes).setVendorInfoBytes(vendorInfoBytes).build();
  DhcpPacket offerPacket=DhcpPacket.decodeFullPacket(packet,ENCAP_BOOTP);
  assertEquals(expectedDomain,offerPacket.mDomainName);
  assertEquals(expectedVendorInfo,offerPacket.mVendorInfo);
}
Program: 194487
Project: 194487
Buggy source:
public void finishPacket(ByteBuffer buffer){
  addTlv(buffer,DHCP_MESSAGE_TYPE,mType);
  if (mDomainBytes != null) {
    addTlv(buffer,DHCP_DOMAIN_NAME,mDomainBytes);
  }
  if (mVendorInfoBytes != null) {
    addTlv(buffer,DHCP_VENDOR_CLASS_ID,mVendorInfoBytes);
  }
  if (mLeaseTimeBytes != null) {
    addTlv(buffer,DHCP_LEASE_TIME,mLeaseTimeBytes);
  }
  if (mNetmaskBytes != null) {
    addTlv(buffer,DHCP_SUBNET_MASK,mNetmaskBytes);
  }
  addTlvEnd(buffer);
}

Fixed version (ground truth):
public void finishPacket(ByteBuffer buffer){
  addTlv(buffer,DHCP_MESSAGE_TYPE,mType);
  if (mDomainBytes != null) {
    addTlv(buffer,DHCP_DOMAIN_NAME,mDomainBytes);
  }
  if (mVendorInfoBytes != null) {
    addTlv(buffer,DHCP_VENDOR_INFO,mVendorInfoBytes);
  }
  if (mLeaseTimeBytes != null) {
    addTlv(buffer,DHCP_LEASE_TIME,mLeaseTimeBytes);
  }
  if (mNetmaskBytes != null) {
    addTlv(buffer,DHCP_SUBNET_MASK,mNetmaskBytes);
  }
  addTlvEnd(buffer);
}
Program: 194488
Project: 194488
Buggy source:
/** 
 * Construct a DhcpResults object from a DHCP reply packet.
 */
public DhcpResults toDhcpResults(){
  Inet4Address ipAddress=mYourIp;
  if (ipAddress.equals(Inet4Address.ANY)) {
    ipAddress=mClientIp;
    if (ipAddress.equals(Inet4Address.ANY)) {
      return null;
    }
  }
  int prefixLength;
  if (mSubnetMask != null) {
    try {
      prefixLength=NetworkUtils.netmaskToPrefixLength(mSubnetMask);
    }
 catch (    IllegalArgumentException e) {
      return null;
    }
  }
 else {
    prefixLength=NetworkUtils.getImplicitNetmask(ipAddress);
  }
  DhcpResults results=new DhcpResults();
  try {
    results.ipAddress=new LinkAddress(ipAddress,prefixLength);
  }
 catch (  IllegalArgumentException e) {
    return null;
  }
  results.gateway=mGateway;
  results.dnsServers.addAll(mDnsServers);
  results.domains=mDomainName;
  results.serverAddress=mServerIdentifier;
  results.vendorInfo=mVendorId;
  results.leaseDuration=(mLeaseTime != null) ? mLeaseTime : INFINITE_LEASE;
  return results;
}

Fixed version (ground truth):
/** 
 * Construct a DhcpResults object from a DHCP reply packet.
 */
public DhcpResults toDhcpResults(){
  Inet4Address ipAddress=mYourIp;
  if (ipAddress.equals(Inet4Address.ANY)) {
    ipAddress=mClientIp;
    if (ipAddress.equals(Inet4Address.ANY)) {
      return null;
    }
  }
  int prefixLength;
  if (mSubnetMask != null) {
    try {
      prefixLength=NetworkUtils.netmaskToPrefixLength(mSubnetMask);
    }
 catch (    IllegalArgumentException e) {
      return null;
    }
  }
 else {
    prefixLength=NetworkUtils.getImplicitNetmask(ipAddress);
  }
  DhcpResults results=new DhcpResults();
  try {
    results.ipAddress=new LinkAddress(ipAddress,prefixLength);
  }
 catch (  IllegalArgumentException e) {
    return null;
  }
  results.gateway=mGateway;
  results.dnsServers.addAll(mDnsServers);
  results.domains=mDomainName;
  results.serverAddress=mServerIdentifier;
  results.vendorInfo=mVendorInfo;
  results.leaseDuration=(mLeaseTime != null) ? mLeaseTime : INFINITE_LEASE;
  return results;
}