nus-yam/ex-repair huggingface dataset:
Program: 1619
Project: 1619
Buggy source:
private void updateUiForNewPrinterCapabilities(){
  if (!mMediaSizeSpinnerAdapter.isEmpty()) {
    mIgnoreNextMediaSizeChange=true;
    mMediaSizeSpinnerAdapter.clear();
  }
  if (!mColorModeSpinnerAdapter.isEmpty()) {
    mIgnoreNextColorModeChange=true;
    mColorModeSpinnerAdapter.clear();
  }
  if (!mOrientationSpinnerAdapter.isEmpty()) {
    mIgnoreNextOrientationChange=true;
    mOrientationSpinner.setSelection(0);
  }
  if (mRangeOptionsSpinner.getSelectedItemPosition() != 0) {
    mIgnoreNextRangeOptionChange=true;
    mRangeOptionsSpinner.setSelection(0);
  }
  if (!TextUtils.isEmpty(mCopiesEditText.getText())) {
    mIgnoreNextCopiesChange=true;
    mCopiesEditText.setText(MIN_COPIES_STRING);
  }
  updateUi();
}

Fixed version (ground truth):
private void updateUiForNewPrinterCapabilities(){
  if (!mMediaSizeSpinnerAdapter.isEmpty()) {
    mIgnoreNextMediaSizeChange=true;
    mMediaSizeSpinnerAdapter.clear();
  }
  if (!mColorModeSpinnerAdapter.isEmpty()) {
    mIgnoreNextColorModeChange=true;
    mColorModeSpinnerAdapter.clear();
  }
  if (mOrientationSpinner.getSelectedItemPosition() != 0) {
    mIgnoreNextOrientationChange=true;
    mOrientationSpinner.setSelection(0);
  }
  if (mRangeOptionsSpinner.getSelectedItemPosition() != 0) {
    mIgnoreNextRangeOptionChange=true;
    mRangeOptionsSpinner.setSelection(0);
  }
  if (!TextUtils.isEmpty(mCopiesEditText.getText())) {
    mIgnoreNextCopiesChange=true;
    mCopiesEditText.setText(MIN_COPIES_STRING);
  }
  updateUi();
}
Program: 1620
Project: 1620
Buggy source:
public boolean onTouchEvent(MotionEvent event){
  if (!mEditor.isPrintConfirmed() && !mEditor.isPreviewConfirmed() && mEditor.shouldCloseOnTouch(event)) {
    if (!mController.isWorking()) {
      PrintJobConfigActivity.this.finish();
    }
    mEditor.cancel();
    return true;
  }
  return super.onTouchEvent(event);
}

Fixed version (ground truth):
public boolean onTouchEvent(MotionEvent event){
  if (!mEditor.isPrintConfirmed() && mEditor.shouldCloseOnTouch(event)) {
    if (!mController.isWorking()) {
      PrintJobConfigActivity.this.finish();
    }
    mEditor.cancel();
    return true;
  }
  return super.onTouchEvent(event);
}
Program: 1622
Project: 1622
Buggy source:
public void addCurrentPrinterToHistory(){
  PrinterInfo printer=(PrinterInfo)mDestinationSpinner.getSelectedItem();
  if (printer != null) {
    FusedPrintersProvider printersLoader=(FusedPrintersProvider)(Loader<?>)getLoaderManager().getLoader(LOADER_ID_PRINTERS_LOADER);
    if (printersLoader != null) {
      printersLoader.addHistoricalPrinter(printer);
    }
  }
}

Fixed version (ground truth):
public void addCurrentPrinterToHistory(){
  PrinterInfo printer=(PrinterInfo)mDestinationSpinner.getSelectedItem();
  PrinterId fakePdfPritnerId=mDestinationSpinnerAdapter.mFakePdfPrinter.getId();
  if (printer != null && !printer.getId().equals(fakePdfPritnerId)) {
    FusedPrintersProvider printersLoader=(FusedPrintersProvider)(Loader<?>)getLoaderManager().getLoader(LOADER_ID_PRINTERS_LOADER);
    if (printersLoader != null) {
      printersLoader.addHistoricalPrinter(printer);
    }
  }
}
Program: 1623
Project: 1623
Buggy source:
private void handleOnLayoutFinished(PrintDocumentInfo info,boolean layoutChanged,int sequence){
  if (mRequestCounter.get() != sequence) {
    return;
  }
  if (isCancelled()) {
    mEditor.updateUi();
    if (mEditor.isDone()) {
      PrintJobConfigActivity.this.finish();
    }
    return;
  }
  mControllerState=CONTROLLER_STATE_LAYOUT_COMPLETED;
  final boolean infoChanged=!info.equals(mDocument.info);
  if (infoChanged) {
    mDocument.info=info;
    PrintSpoolerService.peekInstance().setPrintJobPrintDocumentInfoNoPersistence(mPrintJobId,info);
  }
  if (infoChanged || layoutChanged) {
    mDocument.pages=null;
    PrintSpoolerService.peekInstance().setPrintJobPagesNoPersistence(mPrintJobId,null);
  }
  mRequestedPages=mEditor.getRequestedPages();
  if (mRequestedPages == null) {
    mEditor.updateUi();
    if (mEditor.isDone()) {
      PrintJobConfigActivity.this.finish();
    }
    return;
  }
  if (!infoChanged && !layoutChanged && PageRangeUtils.contains(mDocument.pages,mRequestedPages)) {
    if (mEditor.isDone()) {
      PrintJobConfigActivity.this.finish();
    }
    return;
  }
  if (!LIVE_PREVIEW_SUPPORTED && !mEditor.isPreviewConfirmed() && mMetadata.getBoolean(PrintDocumentAdapter.METADATA_KEY_PRINT_PREVIEW)) {
    mEditor.updateUi();
    if (mEditor.isDone()) {
      PrintJobConfigActivity.this.finish();
    }
    return;
  }
  mEditor.updateUi();
  mControllerState=CONTROLLER_STATE_WRITE_STARTED;
  mRemotePrintAdapter.write(mRequestedPages,mWriteResultCallback,mRequestCounter.incrementAndGet());
}

Fixed version (ground truth):
private void handleOnLayoutFinished(PrintDocumentInfo info,boolean layoutChanged,int sequence){
  if (mRequestCounter.get() != sequence) {
    return;
  }
  if (isCancelled()) {
    mEditor.updateUi();
    if (mEditor.isDone()) {
      PrintJobConfigActivity.this.finish();
    }
    return;
  }
  mControllerState=CONTROLLER_STATE_LAYOUT_COMPLETED;
  final boolean infoChanged=!info.equals(mDocument.info);
  if (infoChanged) {
    mDocument.info=info;
    PrintSpoolerService.peekInstance().setPrintJobPrintDocumentInfoNoPersistence(mPrintJobId,info);
  }
  if (infoChanged || layoutChanged) {
    mDocument.pages=null;
    PrintSpoolerService.peekInstance().setPrintJobPagesNoPersistence(mPrintJobId,null);
  }
  mRequestedPages=mEditor.getRequestedPages();
  if (mRequestedPages == null) {
    mEditor.updateUi();
    if (mEditor.isDone()) {
      PrintJobConfigActivity.this.finish();
    }
    return;
  }
  if (!infoChanged && !layoutChanged && PageRangeUtils.contains(mDocument.pages,mRequestedPages)) {
    if (mEditor.isDone()) {
      requestCreatePdfFileOrFinish();
    }
    return;
  }
  mEditor.updateUi();
  mControllerState=CONTROLLER_STATE_WRITE_STARTED;
  mRemotePrintAdapter.write(mRequestedPages,mWriteResultCallback,mRequestCounter.incrementAndGet());
}
Program: 1625
Project: 1625
Buggy source:
public boolean isDone(){
  return isPrintConfirmed() || isPreviewConfirmed() || isCancelled();
}

Fixed version (ground truth):
public boolean isDone(){
  return isPrintConfirmed() || isCancelled();
}
Program: 1626
Project: 1626
Buggy source:
@Override public void onAfterInvocation(Method m,Object[] args,Object result){
  if (m.getReturnType() == Integer.TYPE) {
    int returnValue=(Integer)result;
switch (returnValue) {
case NO_ERROR:
      return;
case PERMISSION_DENIED:
    throw new SecurityException("String_Node_Str");
case ALREADY_EXISTS:
  return;
case BAD_VALUE:
throw new IllegalArgumentException("String_Node_Str");
case DEAD_OBJECT:
UncheckedThrow.throwAnyException(new CameraRuntimeException(CAMERA_DISCONNECTED));
case EACCES:
UncheckedThrow.throwAnyException(new CameraRuntimeException(CAMERA_DISABLED));
case EBUSY:
UncheckedThrow.throwAnyException(new CameraRuntimeException(CAMERA_IN_USE));
case ENODEV:
UncheckedThrow.throwAnyException(new CameraRuntimeException(CAMERA_DISCONNECTED));
case ENOTSUP:
UncheckedThrow.throwAnyException(new CameraRuntimeException(CAMERA_DEPRECATED_HAL));
}
if (returnValue < 0) {
throw new UnsupportedOperationException(String.format("String_Node_Str",returnValue));
}
}
}

Fixed version (ground truth):
@Override public void onAfterInvocation(Method m,Object[] args,Object result){
  if (m.getReturnType() == Integer.TYPE) {
    int returnValue=(Integer)result;
switch (returnValue) {
case NO_ERROR:
      return;
case PERMISSION_DENIED:
    throw new SecurityException("String_Node_Str");
case ALREADY_EXISTS:
  return;
case BAD_VALUE:
throw new IllegalArgumentException("String_Node_Str");
case DEAD_OBJECT:
UncheckedThrow.throwAnyException(new CameraRuntimeException(CAMERA_DISCONNECTED));
case EACCES:
UncheckedThrow.throwAnyException(new CameraRuntimeException(CAMERA_DISABLED));
case EBUSY:
UncheckedThrow.throwAnyException(new CameraRuntimeException(CAMERA_IN_USE));
case ENODEV:
UncheckedThrow.throwAnyException(new CameraRuntimeException(CAMERA_DISCONNECTED));
case EOPNOTSUPP:
UncheckedThrow.throwAnyException(new CameraRuntimeException(CAMERA_DEPRECATED_HAL));
}
if (returnValue < 0) {
throw new UnsupportedOperationException(String.format("String_Node_Str",returnValue));
}
}
}
Program: 1635
Project: 1635
Buggy source:
@Override public void onAfterInvocation(Method m,Object[] args,Object result){
  if (m.getReturnType() == Integer.TYPE) {
    int returnValue=(Integer)result;
switch (returnValue) {
case NO_ERROR:
      return;
case PERMISSION_DENIED:
    throw new SecurityException("String_Node_Str");
case ALREADY_EXISTS:
  return;
case BAD_VALUE:
throw new IllegalArgumentException("String_Node_Str");
case DEAD_OBJECT:
UncheckedThrow.throwAnyException(new CameraRuntimeException(CAMERA_DISCONNECTED));
case EACCES:
UncheckedThrow.throwAnyException(new CameraRuntimeException(CAMERA_DISABLED));
case EBUSY:
UncheckedThrow.throwAnyException(new CameraRuntimeException(CAMERA_IN_USE));
case ENODEV:
UncheckedThrow.throwAnyException(new CameraRuntimeException(CAMERA_DISCONNECTED));
case ENOTSUP:
UncheckedThrow.throwAnyException(new CameraRuntimeException(CAMERA_DEPRECATED_HAL));
}
if (returnValue < 0) {
throw new UnsupportedOperationException(String.format("String_Node_Str",returnValue));
}
}
}

Fixed version (ground truth):
@Override public void onAfterInvocation(Method m,Object[] args,Object result){
  if (m.getReturnType() == Integer.TYPE) {
    int returnValue=(Integer)result;
switch (returnValue) {
case NO_ERROR:
      return;
case PERMISSION_DENIED:
    throw new SecurityException("String_Node_Str");
case ALREADY_EXISTS:
  return;
case BAD_VALUE:
throw new IllegalArgumentException("String_Node_Str");
case DEAD_OBJECT:
UncheckedThrow.throwAnyException(new CameraRuntimeException(CAMERA_DISCONNECTED));
case EACCES:
UncheckedThrow.throwAnyException(new CameraRuntimeException(CAMERA_DISABLED));
case EBUSY:
UncheckedThrow.throwAnyException(new CameraRuntimeException(CAMERA_IN_USE));
case ENODEV:
UncheckedThrow.throwAnyException(new CameraRuntimeException(CAMERA_DISCONNECTED));
case EOPNOTSUPP:
UncheckedThrow.throwAnyException(new CameraRuntimeException(CAMERA_DEPRECATED_HAL));
}
if (returnValue < 0) {
throw new UnsupportedOperationException(String.format("String_Node_Str",returnValue));
}
}
}
Program: 1636
Project: 1636
Buggy source:
@Override public void onAfterInvocation(Method m,Object[] args,Object result){
  if (m.getReturnType() == Integer.TYPE) {
    int returnValue=(Integer)result;
switch (returnValue) {
case NO_ERROR:
      return;
case PERMISSION_DENIED:
    throw new SecurityException("String_Node_Str");
case ALREADY_EXISTS:
  return;
case BAD_VALUE:
throw new IllegalArgumentException("String_Node_Str");
case DEAD_OBJECT:
UncheckedThrow.throwAnyException(new CameraRuntimeException(CAMERA_DISCONNECTED));
case EACCES:
UncheckedThrow.throwAnyException(new CameraRuntimeException(CAMERA_DISABLED));
case EBUSY:
UncheckedThrow.throwAnyException(new CameraRuntimeException(CAMERA_IN_USE));
case ENODEV:
UncheckedThrow.throwAnyException(new CameraRuntimeException(CAMERA_DISCONNECTED));
case ENOTSUP:
UncheckedThrow.throwAnyException(new CameraRuntimeException(CAMERA_DEPRECATED_HAL));
}
if (returnValue < 0) {
throw new UnsupportedOperationException(String.format("String_Node_Str",returnValue));
}
}
}

Fixed version (ground truth):
@Override public void onAfterInvocation(Method m,Object[] args,Object result){
  if (m.getReturnType() == Integer.TYPE) {
    int returnValue=(Integer)result;
switch (returnValue) {
case NO_ERROR:
      return;
case PERMISSION_DENIED:
    throw new SecurityException("String_Node_Str");
case ALREADY_EXISTS:
  return;
case BAD_VALUE:
throw new IllegalArgumentException("String_Node_Str");
case DEAD_OBJECT:
UncheckedThrow.throwAnyException(new CameraRuntimeException(CAMERA_DISCONNECTED));
case EACCES:
UncheckedThrow.throwAnyException(new CameraRuntimeException(CAMERA_DISABLED));
case EBUSY:
UncheckedThrow.throwAnyException(new CameraRuntimeException(CAMERA_IN_USE));
case ENODEV:
UncheckedThrow.throwAnyException(new CameraRuntimeException(CAMERA_DISCONNECTED));
case EOPNOTSUPP:
UncheckedThrow.throwAnyException(new CameraRuntimeException(CAMERA_DEPRECATED_HAL));
}
if (returnValue < 0) {
throw new UnsupportedOperationException(String.format("String_Node_Str",returnValue));
}
}
}
Program: 1637
Project: 1637
Buggy source:
public void setExecuting(boolean executing,int memFactor,long now){
  if (mActive <= 0) {
    throw new IllegalStateException("String_Node_Str" + this + "String_Node_Str"+ mActive);
  }
  int state=executing ? memFactor : STATE_NOTHING;
  if (mExecState != state) {
    if (mExecState != STATE_NOTHING) {
      addStateTime(SERVICE_EXEC + (mExecState * SERVICE_COUNT),now - mExecStartTime);
    }
 else     if (executing) {
      mExecCount++;
    }
    mExecState=state;
    mExecStartTime=now;
  }
}

Fixed version (ground truth):
public void setExecuting(boolean executing,int memFactor,long now){
  if (mActive <= 0) {
    throw new IllegalStateException("String_Node_Str" + this + "String_Node_Str"+ mActive);
  }
  final int state=executing ? memFactor : STATE_NOTHING;
  if (mExecState != state) {
    if (mExecState != STATE_NOTHING) {
      addStateTime(SERVICE_EXEC + (mExecState * SERVICE_COUNT),now - mExecStartTime);
    }
 else     if (executing) {
      mExecCount++;
    }
    mExecState=state;
    mExecStartTime=now;
  }
}
Program: 1639
Project: 1639
Buggy source:
public void setStarted(boolean started,int memFactor,long now){
  if (mActive <= 0) {
    throw new IllegalStateException("String_Node_Str" + this + "String_Node_Str"+ mActive);
  }
  int state=started ? memFactor : STATE_NOTHING;
  if (mStartedState != state) {
    if (mStartedState != STATE_NOTHING) {
      addStateTime(SERVICE_STARTED + (mStartedState * SERVICE_COUNT),now - mStartedStartTime);
    }
 else     if (started) {
      mStartedCount++;
    }
    mStartedState=state;
    mStartedStartTime=now;
    if (mProc != null) {
      mProc=mProc.pullFixedProc(mPackage);
      if (started) {
        mProc.incStartedServices(memFactor,now);
      }
 else {
        mProc.decStartedServices(memFactor,now);
      }
    }
  }
}

Fixed version (ground truth):
public void setStarted(boolean started,int memFactor,long now){
  if (mActive <= 0) {
    throw new IllegalStateException("String_Node_Str" + this + "String_Node_Str"+ mActive);
  }
  final boolean wasStarted=mStartedState != STATE_NOTHING;
  final int state=started ? memFactor : STATE_NOTHING;
  if (mStartedState != state) {
    if (mStartedState != STATE_NOTHING) {
      addStateTime(SERVICE_STARTED + (mStartedState * SERVICE_COUNT),now - mStartedStartTime);
    }
 else     if (started) {
      mStartedCount++;
    }
    mStartedState=state;
    mStartedStartTime=now;
    mProc=mProc.pullFixedProc(mPackage);
    if (wasStarted != started) {
      if (started) {
        mProc.incStartedServices(memFactor,now);
      }
 else {
        mProc.decStartedServices(memFactor,now);
      }
    }
  }
}
Program: 1640
Project: 1640
Buggy source:
public void setBound(boolean bound,int memFactor,long now){
  if (mActive <= 0) {
    throw new IllegalStateException("String_Node_Str" + this + "String_Node_Str"+ mActive);
  }
  int state=bound ? memFactor : STATE_NOTHING;
  if (mBoundState != state) {
    if (mBoundState != STATE_NOTHING) {
      addStateTime(SERVICE_BOUND + (mBoundState * SERVICE_COUNT),now - mBoundStartTime);
    }
 else     if (bound) {
      mBoundCount++;
    }
    mBoundState=state;
    mBoundStartTime=now;
  }
}

Fixed version (ground truth):
public void setBound(boolean bound,int memFactor,long now){
  if (mActive <= 0) {
    throw new IllegalStateException("String_Node_Str" + this + "String_Node_Str"+ mActive);
  }
  final int state=bound ? memFactor : STATE_NOTHING;
  if (mBoundState != state) {
    if (mBoundState != STATE_NOTHING) {
      addStateTime(SERVICE_BOUND + (mBoundState * SERVICE_COUNT),now - mBoundStartTime);
    }
 else     if (bound) {
      mBoundCount++;
    }
    mBoundState=state;
    mBoundStartTime=now;
  }
}
Program: 1642
Project: 1642
Buggy source:
public void setExecuting(boolean executing,int memFactor,long now){
  if (mActive <= 0) {
    throw new IllegalStateException("String_Node_Str" + this + "String_Node_Str"+ mActive);
  }
  int state=executing ? memFactor : STATE_NOTHING;
  if (mExecState != state) {
    if (mExecState != STATE_NOTHING) {
      addStateTime(SERVICE_EXEC + (mExecState * SERVICE_COUNT),now - mExecStartTime);
    }
 else     if (executing) {
      mExecCount++;
    }
    mExecState=state;
    mExecStartTime=now;
  }
}

Fixed version (ground truth):
public void setExecuting(boolean executing,int memFactor,long now){
  if (mActive <= 0) {
    throw new IllegalStateException("String_Node_Str" + this + "String_Node_Str"+ mActive);
  }
  final int state=executing ? memFactor : STATE_NOTHING;
  if (mExecState != state) {
    if (mExecState != STATE_NOTHING) {
      addStateTime(SERVICE_EXEC + (mExecState * SERVICE_COUNT),now - mExecStartTime);
    }
 else     if (executing) {
      mExecCount++;
    }
    mExecState=state;
    mExecStartTime=now;
  }
}
Program: 1644
Project: 1644
Buggy source:
public void setStarted(boolean started,int memFactor,long now){
  if (mActive <= 0) {
    throw new IllegalStateException("String_Node_Str" + this + "String_Node_Str"+ mActive);
  }
  int state=started ? memFactor : STATE_NOTHING;
  if (mStartedState != state) {
    if (mStartedState != STATE_NOTHING) {
      addStateTime(SERVICE_STARTED + (mStartedState * SERVICE_COUNT),now - mStartedStartTime);
    }
 else     if (started) {
      mStartedCount++;
    }
    mStartedState=state;
    mStartedStartTime=now;
    if (mProc != null) {
      mProc=mProc.pullFixedProc(mPackage);
      if (started) {
        mProc.incStartedServices(memFactor,now);
      }
 else {
        mProc.decStartedServices(memFactor,now);
      }
    }
  }
}

Fixed version (ground truth):
public void setStarted(boolean started,int memFactor,long now){
  if (mActive <= 0) {
    throw new IllegalStateException("String_Node_Str" + this + "String_Node_Str"+ mActive);
  }
  final boolean wasStarted=mStartedState != STATE_NOTHING;
  final int state=started ? memFactor : STATE_NOTHING;
  if (mStartedState != state) {
    if (mStartedState != STATE_NOTHING) {
      addStateTime(SERVICE_STARTED + (mStartedState * SERVICE_COUNT),now - mStartedStartTime);
    }
 else     if (started) {
      mStartedCount++;
    }
    mStartedState=state;
    mStartedStartTime=now;
    mProc=mProc.pullFixedProc(mPackage);
    if (wasStarted != started) {
      if (started) {
        mProc.incStartedServices(memFactor,now);
      }
 else {
        mProc.decStartedServices(memFactor,now);
      }
    }
  }
}
Program: 1645
Project: 1645
Buggy source:
public void setBound(boolean bound,int memFactor,long now){
  if (mActive <= 0) {
    throw new IllegalStateException("String_Node_Str" + this + "String_Node_Str"+ mActive);
  }
  int state=bound ? memFactor : STATE_NOTHING;
  if (mBoundState != state) {
    if (mBoundState != STATE_NOTHING) {
      addStateTime(SERVICE_BOUND + (mBoundState * SERVICE_COUNT),now - mBoundStartTime);
    }
 else     if (bound) {
      mBoundCount++;
    }
    mBoundState=state;
    mBoundStartTime=now;
  }
}

Fixed version (ground truth):
public void setBound(boolean bound,int memFactor,long now){
  if (mActive <= 0) {
    throw new IllegalStateException("String_Node_Str" + this + "String_Node_Str"+ mActive);
  }
  final int state=bound ? memFactor : STATE_NOTHING;
  if (mBoundState != state) {
    if (mBoundState != STATE_NOTHING) {
      addStateTime(SERVICE_BOUND + (mBoundState * SERVICE_COUNT),now - mBoundStartTime);
    }
 else     if (bound) {
      mBoundCount++;
    }
    mBoundState=state;
    mBoundStartTime=now;
  }
}
Program: 1648
Project: 1648
Buggy source:
public void setExecuting(boolean executing,int memFactor,long now){
  if (mActive <= 0) {
    throw new IllegalStateException("String_Node_Str" + this + "String_Node_Str"+ mActive);
  }
  int state=executing ? memFactor : STATE_NOTHING;
  if (mExecState != state) {
    if (mExecState != STATE_NOTHING) {
      addStateTime(SERVICE_EXEC + (mExecState * SERVICE_COUNT),now - mExecStartTime);
    }
 else     if (executing) {
      mExecCount++;
    }
    mExecState=state;
    mExecStartTime=now;
  }
}

Fixed version (ground truth):
public void setExecuting(boolean executing,int memFactor,long now){
  if (mActive <= 0) {
    throw new IllegalStateException("String_Node_Str" + this + "String_Node_Str"+ mActive);
  }
  final int state=executing ? memFactor : STATE_NOTHING;
  if (mExecState != state) {
    if (mExecState != STATE_NOTHING) {
      addStateTime(SERVICE_EXEC + (mExecState * SERVICE_COUNT),now - mExecStartTime);
    }
 else     if (executing) {
      mExecCount++;
    }
    mExecState=state;
    mExecStartTime=now;
  }
}
Program: 1650
Project: 1650
Buggy source:
public void setStarted(boolean started,int memFactor,long now){
  if (mActive <= 0) {
    throw new IllegalStateException("String_Node_Str" + this + "String_Node_Str"+ mActive);
  }
  int state=started ? memFactor : STATE_NOTHING;
  if (mStartedState != state) {
    if (mStartedState != STATE_NOTHING) {
      addStateTime(SERVICE_STARTED + (mStartedState * SERVICE_COUNT),now - mStartedStartTime);
    }
 else     if (started) {
      mStartedCount++;
    }
    mStartedState=state;
    mStartedStartTime=now;
    if (mProc != null) {
      mProc=mProc.pullFixedProc(mPackage);
      if (started) {
        mProc.incStartedServices(memFactor,now);
      }
 else {
        mProc.decStartedServices(memFactor,now);
      }
    }
  }
}

Fixed version (ground truth):
public void setStarted(boolean started,int memFactor,long now){
  if (mActive <= 0) {
    throw new IllegalStateException("String_Node_Str" + this + "String_Node_Str"+ mActive);
  }
  final boolean wasStarted=mStartedState != STATE_NOTHING;
  final int state=started ? memFactor : STATE_NOTHING;
  if (mStartedState != state) {
    if (mStartedState != STATE_NOTHING) {
      addStateTime(SERVICE_STARTED + (mStartedState * SERVICE_COUNT),now - mStartedStartTime);
    }
 else     if (started) {
      mStartedCount++;
    }
    mStartedState=state;
    mStartedStartTime=now;
    mProc=mProc.pullFixedProc(mPackage);
    if (wasStarted != started) {
      if (started) {
        mProc.incStartedServices(memFactor,now);
      }
 else {
        mProc.decStartedServices(memFactor,now);
      }
    }
  }
}
Program: 1651
Project: 1651
Buggy source:
public void setBound(boolean bound,int memFactor,long now){
  if (mActive <= 0) {
    throw new IllegalStateException("String_Node_Str" + this + "String_Node_Str"+ mActive);
  }
  int state=bound ? memFactor : STATE_NOTHING;
  if (mBoundState != state) {
    if (mBoundState != STATE_NOTHING) {
      addStateTime(SERVICE_BOUND + (mBoundState * SERVICE_COUNT),now - mBoundStartTime);
    }
 else     if (bound) {
      mBoundCount++;
    }
    mBoundState=state;
    mBoundStartTime=now;
  }
}

Fixed version (ground truth):
public void setBound(boolean bound,int memFactor,long now){
  if (mActive <= 0) {
    throw new IllegalStateException("String_Node_Str" + this + "String_Node_Str"+ mActive);
  }
  final int state=bound ? memFactor : STATE_NOTHING;
  if (mBoundState != state) {
    if (mBoundState != STATE_NOTHING) {
      addStateTime(SERVICE_BOUND + (mBoundState * SERVICE_COUNT),now - mBoundStartTime);
    }
 else     if (bound) {
      mBoundCount++;
    }
    mBoundState=state;
    mBoundStartTime=now;
  }
}
Program: 1656
Project: 1656
Buggy source:
@Override public void onAfterInvocation(Method m,Object[] args,Object result){
  if (m.getReturnType() == Integer.TYPE) {
    int returnValue=(Integer)result;
switch (returnValue) {
case NO_ERROR:
      return;
case PERMISSION_DENIED:
    throw new SecurityException("String_Node_Str");
case ALREADY_EXISTS:
  return;
case BAD_VALUE:
throw new IllegalArgumentException("String_Node_Str");
case DEAD_OBJECT:
UncheckedThrow.throwAnyException(new CameraRuntimeException(CAMERA_DISCONNECTED));
case EACCES:
UncheckedThrow.throwAnyException(new CameraRuntimeException(CAMERA_DISABLED));
case EBUSY:
UncheckedThrow.throwAnyException(new CameraRuntimeException(CAMERA_IN_USE));
case ENODEV:
UncheckedThrow.throwAnyException(new CameraRuntimeException(CAMERA_DISCONNECTED));
case ENOTSUP:
UncheckedThrow.throwAnyException(new CameraRuntimeException(CAMERA_DEPRECATED_HAL));
}
if (returnValue < 0) {
throw new UnsupportedOperationException(String.format("String_Node_Str",returnValue));
}
}
}

Fixed version (ground truth):
@Override public void onAfterInvocation(Method m,Object[] args,Object result){
  if (m.getReturnType() == Integer.TYPE) {
    int returnValue=(Integer)result;
switch (returnValue) {
case NO_ERROR:
      return;
case PERMISSION_DENIED:
    throw new SecurityException("String_Node_Str");
case ALREADY_EXISTS:
  return;
case BAD_VALUE:
throw new IllegalArgumentException("String_Node_Str");
case DEAD_OBJECT:
UncheckedThrow.throwAnyException(new CameraRuntimeException(CAMERA_DISCONNECTED));
case EACCES:
UncheckedThrow.throwAnyException(new CameraRuntimeException(CAMERA_DISABLED));
case EBUSY:
UncheckedThrow.throwAnyException(new CameraRuntimeException(CAMERA_IN_USE));
case ENODEV:
UncheckedThrow.throwAnyException(new CameraRuntimeException(CAMERA_DISCONNECTED));
case EOPNOTSUPP:
UncheckedThrow.throwAnyException(new CameraRuntimeException(CAMERA_DEPRECATED_HAL));
}
if (returnValue < 0) {
throw new UnsupportedOperationException(String.format("String_Node_Str",returnValue));
}
}
}
Program: 1657
Project: 1657
Buggy source:
public void setExecuting(boolean executing,int memFactor,long now){
  if (mActive <= 0) {
    throw new IllegalStateException("String_Node_Str" + this + "String_Node_Str"+ mActive);
  }
  int state=executing ? memFactor : STATE_NOTHING;
  if (mExecState != state) {
    if (mExecState != STATE_NOTHING) {
      addStateTime(SERVICE_EXEC + (mExecState * SERVICE_COUNT),now - mExecStartTime);
    }
 else     if (executing) {
      mExecCount++;
    }
    mExecState=state;
    mExecStartTime=now;
  }
}

Fixed version (ground truth):
public void setExecuting(boolean executing,int memFactor,long now){
  if (mActive <= 0) {
    throw new IllegalStateException("String_Node_Str" + this + "String_Node_Str"+ mActive);
  }
  final int state=executing ? memFactor : STATE_NOTHING;
  if (mExecState != state) {
    if (mExecState != STATE_NOTHING) {
      addStateTime(SERVICE_EXEC + (mExecState * SERVICE_COUNT),now - mExecStartTime);
    }
 else     if (executing) {
      mExecCount++;
    }
    mExecState=state;
    mExecStartTime=now;
  }
}
Program: 1659
Project: 1659
Buggy source:
public void setStarted(boolean started,int memFactor,long now){
  if (mActive <= 0) {
    throw new IllegalStateException("String_Node_Str" + this + "String_Node_Str"+ mActive);
  }
  int state=started ? memFactor : STATE_NOTHING;
  if (mStartedState != state) {
    if (mStartedState != STATE_NOTHING) {
      addStateTime(SERVICE_STARTED + (mStartedState * SERVICE_COUNT),now - mStartedStartTime);
    }
 else     if (started) {
      mStartedCount++;
    }
    mStartedState=state;
    mStartedStartTime=now;
    if (mProc != null) {
      mProc=mProc.pullFixedProc(mPackage);
      if (started) {
        mProc.incStartedServices(memFactor,now);
      }
 else {
        mProc.decStartedServices(memFactor,now);
      }
    }
  }
}

Fixed version (ground truth):
public void setStarted(boolean started,int memFactor,long now){
  if (mActive <= 0) {
    throw new IllegalStateException("String_Node_Str" + this + "String_Node_Str"+ mActive);
  }
  final boolean wasStarted=mStartedState != STATE_NOTHING;
  final int state=started ? memFactor : STATE_NOTHING;
  if (mStartedState != state) {
    if (mStartedState != STATE_NOTHING) {
      addStateTime(SERVICE_STARTED + (mStartedState * SERVICE_COUNT),now - mStartedStartTime);
    }
 else     if (started) {
      mStartedCount++;
    }
    mStartedState=state;
    mStartedStartTime=now;
    mProc=mProc.pullFixedProc(mPackage);
    if (wasStarted != started) {
      if (started) {
        mProc.incStartedServices(memFactor,now);
      }
 else {
        mProc.decStartedServices(memFactor,now);
      }
    }
  }
}
Program: 1660
Project: 1660
Buggy source:
public void setBound(boolean bound,int memFactor,long now){
  if (mActive <= 0) {
    throw new IllegalStateException("String_Node_Str" + this + "String_Node_Str"+ mActive);
  }
  int state=bound ? memFactor : STATE_NOTHING;
  if (mBoundState != state) {
    if (mBoundState != STATE_NOTHING) {
      addStateTime(SERVICE_BOUND + (mBoundState * SERVICE_COUNT),now - mBoundStartTime);
    }
 else     if (bound) {
      mBoundCount++;
    }
    mBoundState=state;
    mBoundStartTime=now;
  }
}

Fixed version (ground truth):
public void setBound(boolean bound,int memFactor,long now){
  if (mActive <= 0) {
    throw new IllegalStateException("String_Node_Str" + this + "String_Node_Str"+ mActive);
  }
  final int state=bound ? memFactor : STATE_NOTHING;
  if (mBoundState != state) {
    if (mBoundState != STATE_NOTHING) {
      addStateTime(SERVICE_BOUND + (mBoundState * SERVICE_COUNT),now - mBoundStartTime);
    }
 else     if (bound) {
      mBoundCount++;
    }
    mBoundState=state;
    mBoundStartTime=now;
  }
}
Program: 1662
Project: 1662
Buggy source:
private void addWidgetsFromSettings(){
  if (mSafeModeEnabled || widgetsDisabled()) {
    return;
  }
  int insertionIndex=getInsertPageIndex();
  final int[] widgets=mLockPatternUtils.getAppWidgets();
  if (widgets == null) {
    Log.d(TAG,"String_Node_Str");
  }
 else {
    for (int i=widgets.length - 1; i >= 0; i--) {
      if (widgets[i] == LockPatternUtils.ID_DEFAULT_STATUS_WIDGET) {
        addDefaultStatusWidget(insertionIndex);
      }
 else {
        addWidget(widgets[i],insertionIndex,true);
      }
    }
  }
}

Fixed version (ground truth):
private void addWidgetsFromSettings(){
  if (mSafeModeEnabled || widgetsDisabled()) {
    addDefaultStatusWidget(0);
    return;
  }
  int insertionIndex=getInsertPageIndex();
  final int[] widgets=mLockPatternUtils.getAppWidgets();
  if (widgets == null) {
    Log.d(TAG,"String_Node_Str");
  }
 else {
    for (int i=widgets.length - 1; i >= 0; i--) {
      if (widgets[i] == LockPatternUtils.ID_DEFAULT_STATUS_WIDGET) {
        addDefaultStatusWidget(insertionIndex);
      }
 else {
        addWidget(widgets[i],insertionIndex,true);
      }
    }
  }
}
Program: 1663
Project: 1663
Buggy source:
private void addWidgetsFromSettings(){
  if (mSafeModeEnabled || widgetsDisabled()) {
    return;
  }
  int insertionIndex=getInsertPageIndex();
  final int[] widgets=mLockPatternUtils.getAppWidgets();
  if (widgets == null) {
    Log.d(TAG,"String_Node_Str");
  }
 else {
    for (int i=widgets.length - 1; i >= 0; i--) {
      if (widgets[i] == LockPatternUtils.ID_DEFAULT_STATUS_WIDGET) {
        addDefaultStatusWidget(insertionIndex);
      }
 else {
        addWidget(widgets[i],insertionIndex,true);
      }
    }
  }
}

Fixed version (ground truth):
private void addWidgetsFromSettings(){
  if (mSafeModeEnabled || widgetsDisabled()) {
    addDefaultStatusWidget(0);
    return;
  }
  int insertionIndex=getInsertPageIndex();
  final int[] widgets=mLockPatternUtils.getAppWidgets();
  if (widgets == null) {
    Log.d(TAG,"String_Node_Str");
  }
 else {
    for (int i=widgets.length - 1; i >= 0; i--) {
      if (widgets[i] == LockPatternUtils.ID_DEFAULT_STATUS_WIDGET) {
        addDefaultStatusWidget(insertionIndex);
      }
 else {
        addWidget(widgets[i],insertionIndex,true);
      }
    }
  }
}
Program: 1664
Project: 1664
Buggy source:
private void addWidgetsFromSettings(){
  if (mSafeModeEnabled || widgetsDisabled()) {
    return;
  }
  int insertionIndex=getInsertPageIndex();
  final int[] widgets=mLockPatternUtils.getAppWidgets();
  if (widgets == null) {
    Log.d(TAG,"String_Node_Str");
  }
 else {
    for (int i=widgets.length - 1; i >= 0; i--) {
      if (widgets[i] == LockPatternUtils.ID_DEFAULT_STATUS_WIDGET) {
        addDefaultStatusWidget(insertionIndex);
      }
 else {
        addWidget(widgets[i],insertionIndex,true);
      }
    }
  }
}

Fixed version (ground truth):
private void addWidgetsFromSettings(){
  if (mSafeModeEnabled || widgetsDisabled()) {
    addDefaultStatusWidget(0);
    return;
  }
  int insertionIndex=getInsertPageIndex();
  final int[] widgets=mLockPatternUtils.getAppWidgets();
  if (widgets == null) {
    Log.d(TAG,"String_Node_Str");
  }
 else {
    for (int i=widgets.length - 1; i >= 0; i--) {
      if (widgets[i] == LockPatternUtils.ID_DEFAULT_STATUS_WIDGET) {
        addDefaultStatusWidget(insertionIndex);
      }
 else {
        addWidget(widgets[i],insertionIndex,true);
      }
    }
  }
}
Program: 1665
Project: 1665
Buggy source:
private void addWidgetsFromSettings(){
  if (mSafeModeEnabled || widgetsDisabled()) {
    return;
  }
  int insertionIndex=getInsertPageIndex();
  final int[] widgets=mLockPatternUtils.getAppWidgets();
  if (widgets == null) {
    Log.d(TAG,"String_Node_Str");
  }
 else {
    for (int i=widgets.length - 1; i >= 0; i--) {
      if (widgets[i] == LockPatternUtils.ID_DEFAULT_STATUS_WIDGET) {
        addDefaultStatusWidget(insertionIndex);
      }
 else {
        addWidget(widgets[i],insertionIndex,true);
      }
    }
  }
}

Fixed version (ground truth):
private void addWidgetsFromSettings(){
  if (mSafeModeEnabled || widgetsDisabled()) {
    addDefaultStatusWidget(0);
    return;
  }
  int insertionIndex=getInsertPageIndex();
  final int[] widgets=mLockPatternUtils.getAppWidgets();
  if (widgets == null) {
    Log.d(TAG,"String_Node_Str");
  }
 else {
    for (int i=widgets.length - 1; i >= 0; i--) {
      if (widgets[i] == LockPatternUtils.ID_DEFAULT_STATUS_WIDGET) {
        addDefaultStatusWidget(insertionIndex);
      }
 else {
        addWidget(widgets[i],insertionIndex,true);
      }
    }
  }
}
Program: 1666
Project: 1666
Buggy source:
/** 
 * Sets up the strings to be used by the header.
 */
private void setUpHeader(){
  mDayLabels=new String[mDaysPerWeek];
  for (int i=mFirstDayOfWeek, count=mFirstDayOfWeek + mDaysPerWeek; i < count; i++) {
    int calendarDay=(i > Calendar.SATURDAY) ? i - Calendar.SATURDAY : i;
    mDayLabels[i - mFirstDayOfWeek]=DateUtils.getDayOfWeekString(calendarDay,DateUtils.LENGTH_SHORTEST);
  }
  TextView label=(TextView)mDayNamesHeader.getChildAt(0);
  if (mShowWeekNumber) {
    label.setVisibility(View.VISIBLE);
  }
 else {
    label.setVisibility(View.GONE);
  }
  for (int i=1, count=mDayNamesHeader.getChildCount(); i < count; i++) {
    label=(TextView)mDayNamesHeader.getChildAt(i);
    if (mWeekDayTextAppearanceResId > -1) {
      label.setTextAppearance(mContext,mWeekDayTextAppearanceResId);
    }
    if (i < mDaysPerWeek + 1) {
      label.setText(mDayLabels[i - 1]);
      label.setVisibility(View.VISIBLE);
    }
 else {
      label.setVisibility(View.GONE);
    }
  }
  mDayNamesHeader.invalidate();
}

Fixed version (ground truth):
/** 
 * Sets up the strings to be used by the header.
 */
private void setUpHeader(){
  final String[] tinyWeekdayNames=LocaleData.get(Locale.getDefault()).tinyWeekdayNames;
  mDayLabels=new String[mDaysPerWeek];
  for (int i=0; i < mDaysPerWeek; i++) {
    final int j=i + mFirstDayOfWeek;
    final int calendarDay=(j > Calendar.SATURDAY) ? j - Calendar.SATURDAY : j;
    mDayLabels[i]=tinyWeekdayNames[calendarDay];
  }
  TextView label=(TextView)mDayNamesHeader.getChildAt(0);
  if (mShowWeekNumber) {
    label.setVisibility(View.VISIBLE);
  }
 else {
    label.setVisibility(View.GONE);
  }
  final int count=mDayNamesHeader.getChildCount();
  for (int i=0; i < count - 1; i++) {
    label=(TextView)mDayNamesHeader.getChildAt(i + 1);
    if (mWeekDayTextAppearanceResId > -1) {
      label.setTextAppearance(mContext,mWeekDayTextAppearanceResId);
    }
    if (i < mDaysPerWeek) {
      label.setText(mDayLabels[i]);
      label.setVisibility(View.VISIBLE);
    }
 else {
      label.setVisibility(View.GONE);
    }
  }
  mDayNamesHeader.invalidate();
}
Program: 1667
Project: 1667
Buggy source:
/** 
 * Sets up the strings to be used by the header.
 */
private void setUpHeader(){
  mDayLabels=new String[mDaysPerWeek];
  for (int i=mFirstDayOfWeek, count=mFirstDayOfWeek + mDaysPerWeek; i < count; i++) {
    int calendarDay=(i > Calendar.SATURDAY) ? i - Calendar.SATURDAY : i;
    mDayLabels[i - mFirstDayOfWeek]=DateUtils.getDayOfWeekString(calendarDay,DateUtils.LENGTH_SHORTEST);
  }
  TextView label=(TextView)mDayNamesHeader.getChildAt(0);
  if (mShowWeekNumber) {
    label.setVisibility(View.VISIBLE);
  }
 else {
    label.setVisibility(View.GONE);
  }
  for (int i=1, count=mDayNamesHeader.getChildCount(); i < count; i++) {
    label=(TextView)mDayNamesHeader.getChildAt(i);
    if (mWeekDayTextAppearanceResId > -1) {
      label.setTextAppearance(mContext,mWeekDayTextAppearanceResId);
    }
    if (i < mDaysPerWeek + 1) {
      label.setText(mDayLabels[i - 1]);
      label.setVisibility(View.VISIBLE);
    }
 else {
      label.setVisibility(View.GONE);
    }
  }
  mDayNamesHeader.invalidate();
}

Fixed version (ground truth):
/** 
 * Sets up the strings to be used by the header.
 */
private void setUpHeader(){
  final String[] tinyWeekdayNames=LocaleData.get(Locale.getDefault()).tinyWeekdayNames;
  mDayLabels=new String[mDaysPerWeek];
  for (int i=0; i < mDaysPerWeek; i++) {
    final int j=i + mFirstDayOfWeek;
    final int calendarDay=(j > Calendar.SATURDAY) ? j - Calendar.SATURDAY : j;
    mDayLabels[i]=tinyWeekdayNames[calendarDay];
  }
  TextView label=(TextView)mDayNamesHeader.getChildAt(0);
  if (mShowWeekNumber) {
    label.setVisibility(View.VISIBLE);
  }
 else {
    label.setVisibility(View.GONE);
  }
  final int count=mDayNamesHeader.getChildCount();
  for (int i=0; i < count - 1; i++) {
    label=(TextView)mDayNamesHeader.getChildAt(i + 1);
    if (mWeekDayTextAppearanceResId > -1) {
      label.setTextAppearance(mContext,mWeekDayTextAppearanceResId);
    }
    if (i < mDaysPerWeek) {
      label.setText(mDayLabels[i]);
      label.setVisibility(View.VISIBLE);
    }
 else {
      label.setVisibility(View.GONE);
    }
  }
  mDayNamesHeader.invalidate();
}
Program: 1668
Project: 1668
Buggy source:
/** 
 * Sets up the strings to be used by the header.
 */
private void setUpHeader(){
  mDayLabels=new String[mDaysPerWeek];
  for (int i=mFirstDayOfWeek, count=mFirstDayOfWeek + mDaysPerWeek; i < count; i++) {
    int calendarDay=(i > Calendar.SATURDAY) ? i - Calendar.SATURDAY : i;
    mDayLabels[i - mFirstDayOfWeek]=DateUtils.getDayOfWeekString(calendarDay,DateUtils.LENGTH_SHORTEST);
  }
  TextView label=(TextView)mDayNamesHeader.getChildAt(0);
  if (mShowWeekNumber) {
    label.setVisibility(View.VISIBLE);
  }
 else {
    label.setVisibility(View.GONE);
  }
  for (int i=1, count=mDayNamesHeader.getChildCount(); i < count; i++) {
    label=(TextView)mDayNamesHeader.getChildAt(i);
    if (mWeekDayTextAppearanceResId > -1) {
      label.setTextAppearance(mContext,mWeekDayTextAppearanceResId);
    }
    if (i < mDaysPerWeek + 1) {
      label.setText(mDayLabels[i - 1]);
      label.setVisibility(View.VISIBLE);
    }
 else {
      label.setVisibility(View.GONE);
    }
  }
  mDayNamesHeader.invalidate();
}

Fixed version (ground truth):
/** 
 * Sets up the strings to be used by the header.
 */
private void setUpHeader(){
  final String[] tinyWeekdayNames=LocaleData.get(Locale.getDefault()).tinyWeekdayNames;
  mDayLabels=new String[mDaysPerWeek];
  for (int i=0; i < mDaysPerWeek; i++) {
    final int j=i + mFirstDayOfWeek;
    final int calendarDay=(j > Calendar.SATURDAY) ? j - Calendar.SATURDAY : j;
    mDayLabels[i]=tinyWeekdayNames[calendarDay];
  }
  TextView label=(TextView)mDayNamesHeader.getChildAt(0);
  if (mShowWeekNumber) {
    label.setVisibility(View.VISIBLE);
  }
 else {
    label.setVisibility(View.GONE);
  }
  final int count=mDayNamesHeader.getChildCount();
  for (int i=0; i < count - 1; i++) {
    label=(TextView)mDayNamesHeader.getChildAt(i + 1);
    if (mWeekDayTextAppearanceResId > -1) {
      label.setTextAppearance(mContext,mWeekDayTextAppearanceResId);
    }
    if (i < mDaysPerWeek) {
      label.setText(mDayLabels[i]);
      label.setVisibility(View.VISIBLE);
    }
 else {
      label.setVisibility(View.GONE);
    }
  }
  mDayNamesHeader.invalidate();
}
Program: 1669
Project: 1669
Buggy source:
/** 
 * Sets up the strings to be used by the header.
 */
private void setUpHeader(){
  mDayLabels=new String[mDaysPerWeek];
  for (int i=mFirstDayOfWeek, count=mFirstDayOfWeek + mDaysPerWeek; i < count; i++) {
    int calendarDay=(i > Calendar.SATURDAY) ? i - Calendar.SATURDAY : i;
    mDayLabels[i - mFirstDayOfWeek]=DateUtils.getDayOfWeekString(calendarDay,DateUtils.LENGTH_SHORTEST);
  }
  TextView label=(TextView)mDayNamesHeader.getChildAt(0);
  if (mShowWeekNumber) {
    label.setVisibility(View.VISIBLE);
  }
 else {
    label.setVisibility(View.GONE);
  }
  for (int i=1, count=mDayNamesHeader.getChildCount(); i < count; i++) {
    label=(TextView)mDayNamesHeader.getChildAt(i);
    if (mWeekDayTextAppearanceResId > -1) {
      label.setTextAppearance(mContext,mWeekDayTextAppearanceResId);
    }
    if (i < mDaysPerWeek + 1) {
      label.setText(mDayLabels[i - 1]);
      label.setVisibility(View.VISIBLE);
    }
 else {
      label.setVisibility(View.GONE);
    }
  }
  mDayNamesHeader.invalidate();
}

Fixed version (ground truth):
/** 
 * Sets up the strings to be used by the header.
 */
private void setUpHeader(){
  final String[] tinyWeekdayNames=LocaleData.get(Locale.getDefault()).tinyWeekdayNames;
  mDayLabels=new String[mDaysPerWeek];
  for (int i=0; i < mDaysPerWeek; i++) {
    final int j=i + mFirstDayOfWeek;
    final int calendarDay=(j > Calendar.SATURDAY) ? j - Calendar.SATURDAY : j;
    mDayLabels[i]=tinyWeekdayNames[calendarDay];
  }
  TextView label=(TextView)mDayNamesHeader.getChildAt(0);
  if (mShowWeekNumber) {
    label.setVisibility(View.VISIBLE);
  }
 else {
    label.setVisibility(View.GONE);
  }
  final int count=mDayNamesHeader.getChildCount();
  for (int i=0; i < count - 1; i++) {
    label=(TextView)mDayNamesHeader.getChildAt(i + 1);
    if (mWeekDayTextAppearanceResId > -1) {
      label.setTextAppearance(mContext,mWeekDayTextAppearanceResId);
    }
    if (i < mDaysPerWeek) {
      label.setText(mDayLabels[i]);
      label.setVisibility(View.VISIBLE);
    }
 else {
      label.setVisibility(View.GONE);
    }
  }
  mDayNamesHeader.invalidate();
}
Program: 1670
Project: 1670
Buggy source:
/** 
 * Set whether in 24 hour or AM/PM mode.
 * @param is24HourView True = 24 hour mode. False = AM/PM.
 */
public void setIs24HourView(Boolean is24HourView){
  if (mIs24HourView == is24HourView) {
    return;
  }
  int currentHour=getCurrentHour();
  mIs24HourView=is24HourView;
  getHourFormatData();
  updateHourControl();
  setCurrentHour(currentHour);
  updateMinuteControl();
  updateAmPmControl();
}

Fixed version (ground truth):
/** 
 * Set whether in 24 hour or AM/PM mode.
 * @param is24HourView True = 24 hour mode. False = AM/PM.
 */
public void setIs24HourView(Boolean is24HourView){
  if (mIs24HourView == is24HourView) {
    return;
  }
  int currentHour=getCurrentHour();
  mIs24HourView=is24HourView;
  getHourFormatData();
  updateHourControl();
  setCurrentHour(currentHour,false);
  updateMinuteControl();
  updateAmPmControl();
}
Program: 1671
Project: 1671
Buggy source:
/** 
 * Set the current hour.
 */
public void setCurrentHour(Integer currentHour){
  if (currentHour == null || currentHour == getCurrentHour()) {
    return;
  }
  if (!is24HourView()) {
    if (currentHour >= HOURS_IN_HALF_DAY) {
      mIsAm=false;
      if (currentHour > HOURS_IN_HALF_DAY) {
        currentHour=currentHour - HOURS_IN_HALF_DAY;
      }
    }
 else {
      mIsAm=true;
      if (currentHour == 0) {
        currentHour=HOURS_IN_HALF_DAY;
      }
    }
    updateAmPmControl();
  }
  mHourSpinner.setValue(currentHour);
  onTimeChanged();
}

Fixed version (ground truth):
private void setCurrentHour(Integer currentHour,boolean notifyTimeChanged){
  if (currentHour == null || currentHour == getCurrentHour()) {
    return;
  }
  if (!is24HourView()) {
    if (currentHour >= HOURS_IN_HALF_DAY) {
      mIsAm=false;
      if (currentHour > HOURS_IN_HALF_DAY) {
        currentHour=currentHour - HOURS_IN_HALF_DAY;
      }
    }
 else {
      mIsAm=true;
      if (currentHour == 0) {
        currentHour=HOURS_IN_HALF_DAY;
      }
    }
    updateAmPmControl();
  }
  mHourSpinner.setValue(currentHour);
  if (notifyTimeChanged) {
    onTimeChanged();
  }
}
Program: 1672
Project: 1672
Buggy source:
/** 
 * Set whether in 24 hour or AM/PM mode.
 * @param is24HourView True = 24 hour mode. False = AM/PM.
 */
public void setIs24HourView(Boolean is24HourView){
  if (mIs24HourView == is24HourView) {
    return;
  }
  int currentHour=getCurrentHour();
  mIs24HourView=is24HourView;
  getHourFormatData();
  updateHourControl();
  setCurrentHour(currentHour);
  updateMinuteControl();
  updateAmPmControl();
}

Fixed version (ground truth):
/** 
 * Set whether in 24 hour or AM/PM mode.
 * @param is24HourView True = 24 hour mode. False = AM/PM.
 */
public void setIs24HourView(Boolean is24HourView){
  if (mIs24HourView == is24HourView) {
    return;
  }
  int currentHour=getCurrentHour();
  mIs24HourView=is24HourView;
  getHourFormatData();
  updateHourControl();
  setCurrentHour(currentHour,false);
  updateMinuteControl();
  updateAmPmControl();
}
Program: 1673
Project: 1673
Buggy source:
/** 
 * Set the current hour.
 */
public void setCurrentHour(Integer currentHour){
  if (currentHour == null || currentHour == getCurrentHour()) {
    return;
  }
  if (!is24HourView()) {
    if (currentHour >= HOURS_IN_HALF_DAY) {
      mIsAm=false;
      if (currentHour > HOURS_IN_HALF_DAY) {
        currentHour=currentHour - HOURS_IN_HALF_DAY;
      }
    }
 else {
      mIsAm=true;
      if (currentHour == 0) {
        currentHour=HOURS_IN_HALF_DAY;
      }
    }
    updateAmPmControl();
  }
  mHourSpinner.setValue(currentHour);
  onTimeChanged();
}

Fixed version (ground truth):
private void setCurrentHour(Integer currentHour,boolean notifyTimeChanged){
  if (currentHour == null || currentHour == getCurrentHour()) {
    return;
  }
  if (!is24HourView()) {
    if (currentHour >= HOURS_IN_HALF_DAY) {
      mIsAm=false;
      if (currentHour > HOURS_IN_HALF_DAY) {
        currentHour=currentHour - HOURS_IN_HALF_DAY;
      }
    }
 else {
      mIsAm=true;
      if (currentHour == 0) {
        currentHour=HOURS_IN_HALF_DAY;
      }
    }
    updateAmPmControl();
  }
  mHourSpinner.setValue(currentHour);
  if (notifyTimeChanged) {
    onTimeChanged();
  }
}