nus-yam/ex-repair huggingface dataset:
Program: 22754
Project: 22754
Buggy source:
/** 
 * Helper function: Remove a focus listener from the focus stack.
 * @param focusListenerToRemove the focus listener
 * @param signal if true and the listener was at the top of the focus stack, i.e. it was holdingfocus, notify the next item in the stack it gained focus.
 */
private void removeFocusStackEntry(String clientToRemove,boolean signal){
  if (!mFocusStack.empty() && mFocusStack.peek().mClientId.equals(clientToRemove)) {
    mFocusStack.pop();
    if (signal) {
      if (!mFocusStack.empty() && (mFocusStack.peek().mFocusDispatcher != null) && canReassignAudioFocus()) {
        try {
          mFocusStack.peek().mFocusDispatcher.dispatchAudioFocusChange(AudioManager.AUDIOFOCUS_GAIN,mFocusStack.peek().mClientId);
        }
 catch (        RemoteException e) {
          Log.e(TAG,"String_Node_Str" + e);
          e.printStackTrace();
        }
      }
    }
  }
 else {
    Iterator<FocusStackEntry> stackIterator=mFocusStack.iterator();
    while (stackIterator.hasNext()) {
      FocusStackEntry fse=(FocusStackEntry)stackIterator.next();
      if (fse.mClientId.equals(clientToRemove)) {
        Log.i(TAG,"String_Node_Str" + fse.mClientId);
        mFocusStack.remove(fse);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Helper function: Remove a focus listener from the focus stack.
 * @param focusListenerToRemove the focus listener
 * @param signal if true and the listener was at the top of the focus stack, i.e. it was holdingfocus, notify the next item in the stack it gained focus.
 */
private void removeFocusStackEntry(String clientToRemove,boolean signal){
  if (!mFocusStack.empty() && mFocusStack.peek().mClientId.equals(clientToRemove)) {
    mFocusStack.pop();
    if (signal) {
      notifyTopOfAudioFocusStack();
    }
  }
 else {
    Iterator<FocusStackEntry> stackIterator=mFocusStack.iterator();
    while (stackIterator.hasNext()) {
      FocusStackEntry fse=(FocusStackEntry)stackIterator.next();
      if (fse.mClientId.equals(clientToRemove)) {
        Log.i(TAG,"String_Node_Str" + fse.mClientId);
        mFocusStack.remove(fse);
      }
    }
  }
}
Program: 22755
Project: 22755
Buggy source:
/** 
 * @see AudioManager#requestAudioFocus(IAudioFocusDispatcher,int,int) 
 */
public int requestAudioFocus(int mainStreamType,int focusChangeHint,IBinder cb,IAudioFocusDispatcher fd,String clientId){
  Log.i(TAG,"String_Node_Str" + clientId);
  if ((cb == null) || !cb.pingBinder()) {
    Log.i(TAG,"String_Node_Str");
    return AudioManager.AUDIOFOCUS_REQUEST_FAILED;
  }
  if (!canReassignAudioFocus()) {
    return AudioManager.AUDIOFOCUS_REQUEST_FAILED;
  }
synchronized (mFocusStack) {
    if (!mFocusStack.empty() && mFocusStack.peek().mClientId.equals(clientId)) {
      mFocusStack.peek().mFocusChangeType=focusChangeHint;
      return AudioManager.AUDIOFOCUS_REQUEST_GRANTED;
    }
    if (!mFocusStack.empty() && (mFocusStack.peek().mFocusDispatcher != null)) {
      try {
        mFocusStack.peek().mFocusDispatcher.dispatchAudioFocusChange(-1 * focusChangeHint,mFocusStack.peek().mClientId);
      }
 catch (      RemoteException e) {
        Log.e(TAG,"String_Node_Str" + e);
        e.printStackTrace();
      }
    }
    mFocusStack.push(new FocusStackEntry(mainStreamType,focusChangeHint,false,fd,cb,clientId));
  }
  AudioFocusDeathHandler afdh=new AudioFocusDeathHandler(cb);
  try {
    cb.linkToDeath(afdh,0);
  }
 catch (  RemoteException e) {
    Log.w(TAG,"String_Node_Str" + cb + "String_Node_Str");
  }
  return AudioManager.AUDIOFOCUS_REQUEST_GRANTED;
}

Fixed version (ground truth):
/** 
 * @see AudioManager#requestAudioFocus(IAudioFocusDispatcher,int,int) 
 */
public int requestAudioFocus(int mainStreamType,int focusChangeHint,IBinder cb,IAudioFocusDispatcher fd,String clientId){
  Log.i(TAG,"String_Node_Str" + clientId);
  if ((cb == null) || !cb.pingBinder()) {
    Log.i(TAG,"String_Node_Str");
    return AudioManager.AUDIOFOCUS_REQUEST_FAILED;
  }
  if (!canReassignAudioFocus()) {
    return AudioManager.AUDIOFOCUS_REQUEST_FAILED;
  }
synchronized (mFocusStack) {
    if (!mFocusStack.empty() && mFocusStack.peek().mClientId.equals(clientId)) {
      if (mFocusStack.peek().mFocusChangeType == focusChangeHint) {
        return AudioManager.AUDIOFOCUS_REQUEST_GRANTED;
      }
      mFocusStack.pop();
    }
    if (!mFocusStack.empty() && (mFocusStack.peek().mFocusDispatcher != null)) {
      try {
        mFocusStack.peek().mFocusDispatcher.dispatchAudioFocusChange(-1 * focusChangeHint,mFocusStack.peek().mClientId);
      }
 catch (      RemoteException e) {
        Log.e(TAG,"String_Node_Str" + e);
        e.printStackTrace();
      }
    }
    mFocusStack.push(new FocusStackEntry(mainStreamType,focusChangeHint,false,fd,cb,clientId));
  }
  AudioFocusDeathHandler afdh=new AudioFocusDeathHandler(cb);
  try {
    cb.linkToDeath(afdh,0);
  }
 catch (  RemoteException e) {
    Log.w(TAG,"String_Node_Str" + cb + "String_Node_Str");
  }
  return AudioManager.AUDIOFOCUS_REQUEST_GRANTED;
}
Program: 22756
Project: 22756
Buggy source:
public PointerLocationView(Context c){
  super(c);
  mVC=ViewConfiguration.get(c);
  mTextPaint=new Paint();
  mTextPaint.setAntiAlias(true);
  mTextPaint.setTextSize(10 * getResources().getDisplayMetrics().density);
  mTextPaint.setARGB(255,0,0,0);
  mTextBackgroundPaint=new Paint();
  mTextBackgroundPaint.setAntiAlias(false);
  mTextBackgroundPaint.setARGB(128,255,255,255);
  mTextLevelPaint=new Paint();
  mTextLevelPaint.setAntiAlias(false);
  mTextLevelPaint.setARGB(192,255,0,0);
  mPaint=new Paint();
  mPaint.setAntiAlias(true);
  mPaint.setARGB(255,255,255,255);
  mPaint.setStyle(Paint.Style.STROKE);
  mPaint.setStrokeWidth(2);
  mTargetPaint=new Paint();
  mTargetPaint.setAntiAlias(false);
  mTargetPaint.setARGB(255,0,0,192);
  mPathPaint=new Paint();
  mPathPaint.setAntiAlias(false);
  mPathPaint.setARGB(255,0,96,255);
  mPaint.setStyle(Paint.Style.STROKE);
  mPaint.setStrokeWidth(1);
  PointerState ps=new PointerState();
  ps.mVelocity=VelocityTracker.obtain();
  mPointers.add(ps);
}

Fixed version (ground truth):
public PointerLocationView(Context c){
  super(c);
  setFocusable(true);
  mVC=ViewConfiguration.get(c);
  mTextPaint=new Paint();
  mTextPaint.setAntiAlias(true);
  mTextPaint.setTextSize(10 * getResources().getDisplayMetrics().density);
  mTextPaint.setARGB(255,0,0,0);
  mTextBackgroundPaint=new Paint();
  mTextBackgroundPaint.setAntiAlias(false);
  mTextBackgroundPaint.setARGB(128,255,255,255);
  mTextLevelPaint=new Paint();
  mTextLevelPaint.setAntiAlias(false);
  mTextLevelPaint.setARGB(192,255,0,0);
  mPaint=new Paint();
  mPaint.setAntiAlias(true);
  mPaint.setARGB(255,255,255,255);
  mPaint.setStyle(Paint.Style.STROKE);
  mPaint.setStrokeWidth(2);
  mTargetPaint=new Paint();
  mTargetPaint.setAntiAlias(false);
  mTargetPaint.setARGB(255,0,0,192);
  mPathPaint=new Paint();
  mPathPaint.setAntiAlias(false);
  mPathPaint.setARGB(255,0,96,255);
  mPaint.setStyle(Paint.Style.STROKE);
  mPaint.setStrokeWidth(1);
  PointerState ps=new PointerState();
  ps.mVelocity=VelocityTracker.obtain();
  mPointers.add(ps);
}
Program: 22761
Project: 22761
Buggy source:
public PointerLocationView(Context c){
  super(c);
  mVC=ViewConfiguration.get(c);
  mTextPaint=new Paint();
  mTextPaint.setAntiAlias(true);
  mTextPaint.setTextSize(10 * getResources().getDisplayMetrics().density);
  mTextPaint.setARGB(255,0,0,0);
  mTextBackgroundPaint=new Paint();
  mTextBackgroundPaint.setAntiAlias(false);
  mTextBackgroundPaint.setARGB(128,255,255,255);
  mTextLevelPaint=new Paint();
  mTextLevelPaint.setAntiAlias(false);
  mTextLevelPaint.setARGB(192,255,0,0);
  mPaint=new Paint();
  mPaint.setAntiAlias(true);
  mPaint.setARGB(255,255,255,255);
  mPaint.setStyle(Paint.Style.STROKE);
  mPaint.setStrokeWidth(2);
  mTargetPaint=new Paint();
  mTargetPaint.setAntiAlias(false);
  mTargetPaint.setARGB(255,0,0,192);
  mPathPaint=new Paint();
  mPathPaint.setAntiAlias(false);
  mPathPaint.setARGB(255,0,96,255);
  mPaint.setStyle(Paint.Style.STROKE);
  mPaint.setStrokeWidth(1);
  PointerState ps=new PointerState();
  ps.mVelocity=VelocityTracker.obtain();
  mPointers.add(ps);
}

Fixed version (ground truth):
public PointerLocationView(Context c){
  super(c);
  setFocusable(true);
  mVC=ViewConfiguration.get(c);
  mTextPaint=new Paint();
  mTextPaint.setAntiAlias(true);
  mTextPaint.setTextSize(10 * getResources().getDisplayMetrics().density);
  mTextPaint.setARGB(255,0,0,0);
  mTextBackgroundPaint=new Paint();
  mTextBackgroundPaint.setAntiAlias(false);
  mTextBackgroundPaint.setARGB(128,255,255,255);
  mTextLevelPaint=new Paint();
  mTextLevelPaint.setAntiAlias(false);
  mTextLevelPaint.setARGB(192,255,0,0);
  mPaint=new Paint();
  mPaint.setAntiAlias(true);
  mPaint.setARGB(255,255,255,255);
  mPaint.setStyle(Paint.Style.STROKE);
  mPaint.setStrokeWidth(2);
  mTargetPaint=new Paint();
  mTargetPaint.setAntiAlias(false);
  mTargetPaint.setARGB(255,0,0,192);
  mPathPaint=new Paint();
  mPathPaint.setAntiAlias(false);
  mPathPaint.setARGB(255,0,96,255);
  mPaint.setStyle(Paint.Style.STROKE);
  mPaint.setStrokeWidth(1);
  PointerState ps=new PointerState();
  ps.mVelocity=VelocityTracker.obtain();
  mPointers.add(ps);
}
Program: 22763
Project: 22763
Buggy source:
private boolean writeFileLocked(){
  if (mFile.exists()) {
    if (!mFile.renameTo(mBackupFile)) {
      Log.e(TAG,"String_Node_Str" + mFile + "String_Node_Str"+ mBackupFile);
      return false;
    }
  }
  try {
    FileOutputStream str=createFileOutputStream(mFile);
    if (str == null) {
      return false;
    }
    XmlUtils.writeMapXml(mMap,str);
    str.close();
    setFilePermissionsFromMode(mFile.getPath(),mMode,0);
    if (FileUtils.getFileStatus(mFile.getPath(),mFileStatus)) {
      mTimestamp=mFileStatus.mtime;
    }
    mBackupFile.delete();
    return true;
  }
 catch (  XmlPullParserException e) {
    Log.w(TAG,"String_Node_Str",e);
  }
catch (  IOException e) {
    Log.w(TAG,"String_Node_Str",e);
  }
  if (mFile.exists()) {
    if (!mFile.delete()) {
      Log.e(TAG,"String_Node_Str" + mFile);
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean writeFileLocked(){
  if (mFile.exists()) {
    if (!mBackupFile.exists()) {
      if (!mFile.renameTo(mBackupFile)) {
        Log.e(TAG,"String_Node_Str" + mFile + "String_Node_Str"+ mBackupFile);
        return false;
      }
    }
 else {
      mFile.delete();
    }
  }
  try {
    FileOutputStream str=createFileOutputStream(mFile);
    if (str == null) {
      return false;
    }
    XmlUtils.writeMapXml(mMap,str);
    str.close();
    setFilePermissionsFromMode(mFile.getPath(),mMode,0);
    if (FileUtils.getFileStatus(mFile.getPath(),mFileStatus)) {
      mTimestamp=mFileStatus.mtime;
    }
    mBackupFile.delete();
    return true;
  }
 catch (  XmlPullParserException e) {
    Log.w(TAG,"String_Node_Str",e);
  }
catch (  IOException e) {
    Log.w(TAG,"String_Node_Str",e);
  }
  if (mFile.exists()) {
    if (!mFile.delete()) {
      Log.e(TAG,"String_Node_Str" + mFile);
    }
  }
  return false;
}
Program: 22764
Project: 22764
Buggy source:
/** 
 * Copy data from a source stream to destFile. Return true if succeed, return false if failed.
 */
public static boolean copyToFile(InputStream inputStream,File destFile){
  try {
    OutputStream out=new FileOutputStream(destFile);
    try {
      byte[] buffer=new byte[4096];
      int bytesRead;
      while ((bytesRead=inputStream.read(buffer)) >= 0) {
        out.write(buffer,0,bytesRead);
      }
    }
  finally {
      out.close();
    }
    return true;
  }
 catch (  IOException e) {
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Copy data from a source stream to destFile. Return true if succeed, return false if failed.
 */
public static boolean copyToFile(InputStream inputStream,File destFile){
  try {
    if (destFile.exists()) {
      destFile.delete();
    }
    OutputStream out=new FileOutputStream(destFile);
    try {
      byte[] buffer=new byte[4096];
      int bytesRead;
      while ((bytesRead=inputStream.read(buffer)) >= 0) {
        out.write(buffer,0,bytesRead);
      }
    }
  finally {
      out.close();
    }
    return true;
  }
 catch (  IOException e) {
    return false;
  }
}
Program: 22767
Project: 22767
Buggy source:
public FileOutputStream startWrite() throws IOException {
  if (mBaseName.exists()) {
    if (!mBaseName.renameTo(mBackupName)) {
      mBackupName.delete();
      if (!mBaseName.renameTo(mBackupName)) {
        Log.w("String_Node_Str","String_Node_Str" + mBaseName + "String_Node_Str"+ mBackupName);
      }
    }
  }
  FileOutputStream str=null;
  try {
    str=new FileOutputStream(mBaseName);
  }
 catch (  FileNotFoundException e) {
    File parent=mBaseName.getParentFile();
    if (!parent.mkdir()) {
      throw new IOException("String_Node_Str" + mBaseName);
    }
    FileUtils.setPermissions(parent.getPath(),FileUtils.S_IRWXU | FileUtils.S_IRWXG | FileUtils.S_IXOTH,-1,-1);
    try {
      str=new FileOutputStream(mBaseName);
    }
 catch (    FileNotFoundException e2) {
      throw new IOException("String_Node_Str" + mBaseName);
    }
  }
  return str;
}

Fixed version (ground truth):
public FileOutputStream startWrite() throws IOException {
  if (mBaseName.exists()) {
    if (!mBackupName.exists()) {
      if (!mBaseName.renameTo(mBackupName)) {
        Log.w("String_Node_Str","String_Node_Str" + mBaseName + "String_Node_Str"+ mBackupName);
      }
    }
 else {
      mBaseName.delete();
    }
  }
  FileOutputStream str=null;
  try {
    str=new FileOutputStream(mBaseName);
  }
 catch (  FileNotFoundException e) {
    File parent=mBaseName.getParentFile();
    if (!parent.mkdir()) {
      throw new IOException("String_Node_Str" + mBaseName);
    }
    FileUtils.setPermissions(parent.getPath(),FileUtils.S_IRWXU | FileUtils.S_IRWXG | FileUtils.S_IXOTH,-1,-1);
    try {
      str=new FileOutputStream(mBaseName);
    }
 catch (    FileNotFoundException e2) {
      throw new IOException("String_Node_Str" + mBaseName);
    }
  }
  return str;
}
Program: 22768
Project: 22768
Buggy source:
public void writeLocked(){
  if ((mFile == null) || (mBackupFile == null)) {
    Log.w("String_Node_Str","String_Node_Str");
    return;
  }
  if (mFile.exists()) {
    if (mBackupFile.exists()) {
      mBackupFile.delete();
    }
    if (!mFile.renameTo(mBackupFile)) {
      Log.w("String_Node_Str","String_Node_Str");
      return;
    }
  }
  try {
    FileOutputStream stream=new FileOutputStream(mFile);
    Parcel out=Parcel.obtain();
    writeSummaryToParcel(out);
    stream.write(out.marshall());
    out.recycle();
    stream.flush();
    stream.close();
    mBackupFile.delete();
    mLastWriteTime=SystemClock.elapsedRealtime();
    return;
  }
 catch (  IOException e) {
    Log.w("String_Node_Str","String_Node_Str",e);
  }
  if (mFile.exists()) {
    if (!mFile.delete()) {
      Log.w(TAG,"String_Node_Str" + mFile);
    }
  }
}

Fixed version (ground truth):
public void writeLocked(){
  if (mFile == null) {
    Slog.w("String_Node_Str","String_Node_Str");
    return;
  }
  try {
    FileOutputStream stream=new FileOutputStream(mFile.chooseForWrite());
    Parcel out=Parcel.obtain();
    writeSummaryToParcel(out);
    stream.write(out.marshall());
    out.recycle();
    stream.flush();
    stream.close();
    mFile.commit();
    mLastWriteTime=SystemClock.elapsedRealtime();
    return;
  }
 catch (  IOException e) {
    Slog.w("String_Node_Str","String_Node_Str",e);
  }
  mFile.rollback();
}
Program: 22769
Project: 22769
Buggy source:
public void updateKernelWakelocksLocked(){
  Map<String,KernelWakelockStats> m=readKernelWakelockStats();
  if (m == null) {
    Log.w(TAG,"String_Node_Str");
    return;
  }
  for (  Map.Entry<String,KernelWakelockStats> ent : m.entrySet()) {
    String name=ent.getKey();
    KernelWakelockStats kws=ent.getValue();
    SamplingTimer kwlt=mKernelWakelockStats.get(name);
    if (kwlt == null) {
      kwlt=new SamplingTimer(mUnpluggables,mOnBatteryInternal,true);
      mKernelWakelockStats.put(name,kwlt);
    }
    kwlt.updateCurrentReportedCount(kws.mCount);
    kwlt.updateCurrentReportedTotalTime(kws.mTotalTime);
    kwlt.setUpdateVersion(sKernelWakelockUpdateVersion);
  }
  if (m.size() != mKernelWakelockStats.size()) {
    for (    Map.Entry<String,SamplingTimer> ent : mKernelWakelockStats.entrySet()) {
      SamplingTimer st=ent.getValue();
      if (st.getUpdateVersion() != sKernelWakelockUpdateVersion) {
        st.setStale();
      }
    }
  }
}

Fixed version (ground truth):
public void updateKernelWakelocksLocked(){
  Map<String,KernelWakelockStats> m=readKernelWakelockStats();
  if (m == null) {
    Slog.w(TAG,"String_Node_Str");
    return;
  }
  for (  Map.Entry<String,KernelWakelockStats> ent : m.entrySet()) {
    String name=ent.getKey();
    KernelWakelockStats kws=ent.getValue();
    SamplingTimer kwlt=mKernelWakelockStats.get(name);
    if (kwlt == null) {
      kwlt=new SamplingTimer(mUnpluggables,mOnBatteryInternal,true);
      mKernelWakelockStats.put(name,kwlt);
    }
    kwlt.updateCurrentReportedCount(kws.mCount);
    kwlt.updateCurrentReportedTotalTime(kws.mTotalTime);
    kwlt.setUpdateVersion(sKernelWakelockUpdateVersion);
  }
  if (m.size() != mKernelWakelockStats.size()) {
    for (    Map.Entry<String,SamplingTimer> ent : mKernelWakelockStats.entrySet()) {
      SamplingTimer st=ent.getValue();
      if (st.getUpdateVersion() != sKernelWakelockUpdateVersion) {
        st.setStale();
      }
    }
  }
}
Program: 22771
Project: 22771
Buggy source:
public void readLocked(){
  if ((mFile == null) || (mBackupFile == null)) {
    Log.w("String_Node_Str","String_Node_Str");
    return;
  }
  mUidStats.clear();
  FileInputStream stream=null;
  if (mBackupFile.exists()) {
    try {
      stream=new FileInputStream(mBackupFile);
    }
 catch (    java.io.IOException e) {
    }
  }
  try {
    if (stream == null) {
      if (!mFile.exists()) {
        return;
      }
      stream=new FileInputStream(mFile);
    }
    byte[] raw=readFully(stream);
    Parcel in=Parcel.obtain();
    in.unmarshall(raw,0,raw.length);
    in.setDataPosition(0);
    stream.close();
    readSummaryFromParcel(in);
  }
 catch (  java.io.IOException e) {
    Log.e("String_Node_Str","String_Node_Str",e);
  }
}

Fixed version (ground truth):
public void readLocked(){
  if (mFile == null) {
    Slog.w("String_Node_Str","String_Node_Str");
    return;
  }
  mUidStats.clear();
  try {
    File file=mFile.chooseForRead();
    if (!file.exists()) {
      return;
    }
    FileInputStream stream=new FileInputStream(file);
    byte[] raw=readFully(stream);
    Parcel in=Parcel.obtain();
    in.unmarshall(raw,0,raw.length);
    in.setDataPosition(0);
    stream.close();
    readSummaryFromParcel(in);
  }
 catch (  java.io.IOException e) {
    Slog.e("String_Node_Str","String_Node_Str",e);
  }
}
Program: 22772
Project: 22772
Buggy source:
public BatteryStatsImpl(Parcel p){
  mFile=mBackupFile=null;
  readFromParcel(p);
}

Fixed version (ground truth):
public BatteryStatsImpl(Parcel p){
  mFile=null;
  readFromParcel(p);
}
Program: 22775
Project: 22775
Buggy source:
private void writeStatsToFile(boolean force){
synchronized (mFileLock) {
    mCal.setTimeInMillis(System.currentTimeMillis());
    final int curDay=mCal.get(Calendar.DAY_OF_YEAR);
    final boolean dayChanged=curDay != mLastWriteDay;
    long currElapsedTime=SystemClock.elapsedRealtime();
    if (!force) {
      if (((currElapsedTime - mLastWriteElapsedTime) < FILE_WRITE_INTERVAL) && (!dayChanged)) {
        return;
      }
    }
    mFileLeaf=getCurrentDateStr(FILE_PREFIX);
    File backupFile=null;
    if (mFile != null && mFile.exists()) {
      backupFile=new File(mFile.getPath() + "String_Node_Str");
      if (!mFile.renameTo(backupFile)) {
        Slog.w(TAG,"String_Node_Str");
        return;
      }
    }
    try {
      writeStatsFLOCK();
      mLastWriteElapsedTime=currElapsedTime;
      if (dayChanged) {
        mLastWriteDay=curDay;
synchronized (mStats) {
          mStats.clear();
        }
        mFile=new File(mDir,mFileLeaf);
        checkFileLimitFLOCK();
      }
      if (backupFile != null) {
        backupFile.delete();
      }
    }
 catch (    IOException e) {
      Slog.w(TAG,"String_Node_Str" + mFile);
      if (backupFile != null) {
        mFile.delete();
        backupFile.renameTo(mFile);
      }
    }
  }
}

Fixed version (ground truth):
private void writeStatsToFile(boolean force){
synchronized (mFileLock) {
    mCal.setTimeInMillis(System.currentTimeMillis());
    final int curDay=mCal.get(Calendar.DAY_OF_YEAR);
    final boolean dayChanged=curDay != mLastWriteDay;
    long currElapsedTime=SystemClock.elapsedRealtime();
    if (!force) {
      if (((currElapsedTime - mLastWriteElapsedTime) < FILE_WRITE_INTERVAL) && (!dayChanged)) {
        return;
      }
    }
    mFileLeaf=getCurrentDateStr(FILE_PREFIX);
    File backupFile=null;
    if (mFile != null && mFile.exists()) {
      backupFile=new File(mFile.getPath() + "String_Node_Str");
      if (!backupFile.exists()) {
        if (!mFile.renameTo(backupFile)) {
          Slog.w(TAG,"String_Node_Str");
          return;
        }
      }
 else {
        mFile.delete();
      }
    }
    try {
      writeStatsFLOCK();
      mLastWriteElapsedTime=currElapsedTime;
      if (dayChanged) {
        mLastWriteDay=curDay;
synchronized (mStats) {
          mStats.clear();
        }
        mFile=new File(mDir,mFileLeaf);
        checkFileLimitFLOCK();
      }
      if (backupFile != null) {
        backupFile.delete();
      }
    }
 catch (    IOException e) {
      Slog.w(TAG,"String_Node_Str" + mFile);
      if (backupFile != null) {
        mFile.delete();
        backupFile.renameTo(mFile);
      }
    }
  }
}
Program: 22782
Project: 22782
Buggy source:
@Override protected void onRestoreInstanceState(Bundle state){
  super.onRestoreInstanceState(state);
  Bundle container=state.getBundle(PREFERENCES_TAG);
  if (container != null) {
    final PreferenceScreen preferenceScreen=getPreferenceScreen();
    if (preferenceScreen != null) {
      preferenceScreen.restoreHierarchyState(container);
    }
  }
}

Fixed version (ground truth):
@Override protected void onRestoreInstanceState(Bundle state){
  Bundle container=state.getBundle(PREFERENCES_TAG);
  if (container != null) {
    final PreferenceScreen preferenceScreen=getPreferenceScreen();
    if (preferenceScreen != null) {
      preferenceScreen.restoreHierarchyState(container);
      mSavedInstanceState=state;
      return;
    }
  }
  super.onRestoreInstanceState(state);
}
Program: 22783
Project: 22783
Buggy source:
private void bindPreferences(){
  final PreferenceScreen preferenceScreen=getPreferenceScreen();
  if (preferenceScreen != null) {
    preferenceScreen.bind(getListView());
  }
}

Fixed version (ground truth):
private void bindPreferences(){
  final PreferenceScreen preferenceScreen=getPreferenceScreen();
  if (preferenceScreen != null) {
    preferenceScreen.bind(getListView());
    if (mSavedInstanceState != null) {
      super.onRestoreInstanceState(mSavedInstanceState);
      mSavedInstanceState=null;
    }
  }
}
Program: 22784
Project: 22784
Buggy source:
@Override protected void onRestoreInstanceState(Bundle state){
  super.onRestoreInstanceState(state);
  Bundle container=state.getBundle(PREFERENCES_TAG);
  if (container != null) {
    final PreferenceScreen preferenceScreen=getPreferenceScreen();
    if (preferenceScreen != null) {
      preferenceScreen.restoreHierarchyState(container);
    }
  }
}

Fixed version (ground truth):
@Override protected void onRestoreInstanceState(Bundle state){
  Bundle container=state.getBundle(PREFERENCES_TAG);
  if (container != null) {
    final PreferenceScreen preferenceScreen=getPreferenceScreen();
    if (preferenceScreen != null) {
      preferenceScreen.restoreHierarchyState(container);
      mSavedInstanceState=state;
      return;
    }
  }
  super.onRestoreInstanceState(state);
}
Program: 22785
Project: 22785
Buggy source:
private void bindPreferences(){
  final PreferenceScreen preferenceScreen=getPreferenceScreen();
  if (preferenceScreen != null) {
    preferenceScreen.bind(getListView());
  }
}

Fixed version (ground truth):
private void bindPreferences(){
  final PreferenceScreen preferenceScreen=getPreferenceScreen();
  if (preferenceScreen != null) {
    preferenceScreen.bind(getListView());
    if (mSavedInstanceState != null) {
      super.onRestoreInstanceState(mSavedInstanceState);
      mSavedInstanceState=null;
    }
  }
}
Program: 22786
Project: 22786
Buggy source:
/** 
 * Updates the engine configuration.
 */
public int setConfig(String engineConfig){
  return native_setConfig(engineConfig);
}

Fixed version (ground truth):
/** 
 * Updates the engine configuration.
 */
public int setConfig(String engineConfig){
  return native_setConfig(mJniData,engineConfig);
}
Program: 22787
Project: 22787
Buggy source:
private native final int native_setConfig(String engineConfig);

Fixed version (ground truth):
private native final int native_setConfig(int jniData,String engineConfig);
Program: 22788
Project: 22788
Buggy source:
private final void attach(boolean system){
  sThreadLocal.set(this);
  mSystemThread=system;
  if (!system) {
    ViewRoot.addFirstDrawHandler(new Runnable(){
      public void run(){
        ensureJitEnabled();
      }
    }
);
    android.ddm.DdmHandleAppName.setAppName("String_Node_Str");
    RuntimeInit.setApplicationObject(mAppThread.asBinder());
    IActivityManager mgr=ActivityManagerNative.getDefault();
    try {
      mgr.attachApplication(mAppThread);
    }
 catch (    RemoteException ex) {
    }
  }
 else {
    android.ddm.DdmHandleAppName.setAppName("String_Node_Str");
    try {
      mInstrumentation=new Instrumentation();
      ContextImpl context=new ContextImpl();
      context.init(getSystemContext().mPackageInfo,null,this);
      Application app=Instrumentation.newApplication(Application.class,context);
      mAllApplications.add(app);
      mInitialApplication=app;
      app.onCreate();
    }
 catch (    Exception e) {
      throw new RuntimeException("String_Node_Str" + e.toString(),e);
    }
  }
  ViewRoot.addConfigCallback(new ComponentCallbacks(){
    public void onConfigurationChanged(    Configuration newConfig){
synchronized (mPackages) {
        if (mPendingConfiguration == null || mPendingConfiguration.isOtherSeqNewer(newConfig)) {
          mPendingConfiguration=newConfig;
          applyConfigurationToResourcesLocked(newConfig);
        }
      }
      queueOrSendMessage(H.CONFIGURATION_CHANGED,newConfig);
    }
    public void onLowMemory(){
    }
  }
);
}

Fixed version (ground truth):
private final void attach(boolean system){
  sThreadLocal.set(this);
  mSystemThread=system;
  if (!system) {
    ViewRoot.addFirstDrawHandler(new Runnable(){
      public void run(){
        ensureJitEnabled();
      }
    }
);
    android.ddm.DdmHandleAppName.setAppName("String_Node_Str");
    RuntimeInit.setApplicationObject(mAppThread.asBinder());
    IActivityManager mgr=ActivityManagerNative.getDefault();
    try {
      mgr.attachApplication(mAppThread);
    }
 catch (    RemoteException ex) {
    }
  }
 else {
    android.ddm.DdmHandleAppName.setAppName("String_Node_Str");
    try {
      mInstrumentation=new Instrumentation();
      ContextImpl context=new ContextImpl();
      context.init(getSystemContext().mPackageInfo,null,this);
      Application app=Instrumentation.newApplication(Application.class,context);
      mAllApplications.add(app);
      mInitialApplication=app;
      app.onCreate();
    }
 catch (    Exception e) {
      throw new RuntimeException("String_Node_Str" + e.toString(),e);
    }
  }
  ViewRoot.addConfigCallback(new ComponentCallbacks(){
    public void onConfigurationChanged(    Configuration newConfig){
synchronized (mPackages) {
        if (applyConfigurationToResourcesLocked(newConfig)) {
          if (mPendingConfiguration == null || mPendingConfiguration.isOtherSeqNewer(newConfig)) {
            mPendingConfiguration=newConfig;
            queueOrSendMessage(H.CONFIGURATION_CHANGED,newConfig);
          }
        }
      }
    }
    public void onLowMemory(){
    }
  }
);
}
Program: 22789
Project: 22789
Buggy source:
public void onConfigurationChanged(Configuration newConfig){
synchronized (mPackages) {
    if (mPendingConfiguration == null || mPendingConfiguration.isOtherSeqNewer(newConfig)) {
      mPendingConfiguration=newConfig;
      applyConfigurationToResourcesLocked(newConfig);
    }
  }
  queueOrSendMessage(H.CONFIGURATION_CHANGED,newConfig);
}

Fixed version (ground truth):
public void onConfigurationChanged(Configuration newConfig){
synchronized (mPackages) {
    if (applyConfigurationToResourcesLocked(newConfig)) {
      if (mPendingConfiguration == null || mPendingConfiguration.isOtherSeqNewer(newConfig)) {
        mPendingConfiguration=newConfig;
        queueOrSendMessage(H.CONFIGURATION_CHANGED,newConfig);
      }
    }
  }
}
Program: 22790
Project: 22790
Buggy source:
final void applyConfigurationToResourcesLocked(Configuration config){
  if (mResConfiguration == null) {
    mResConfiguration=new Configuration();
  }
  if (!mResConfiguration.isOtherSeqNewer(config)) {
    if (DEBUG_CONFIGURATION)     Log.v(TAG,"String_Node_Str" + mResConfiguration.seq + "String_Node_Str"+ config.seq);
    return;
  }
  mResConfiguration.updateFrom(config);
  DisplayMetrics dm=getDisplayMetricsLocked(true);
  if (config.locale != null) {
    Locale.setDefault(config.locale);
  }
  Resources.updateSystemConfiguration(config,dm);
  ContextImpl.ApplicationPackageManager.configurationChanged();
  Iterator<WeakReference<Resources>> it=mActiveResources.values().iterator();
  while (it.hasNext()) {
    WeakReference<Resources> v=it.next();
    Resources r=v.get();
    if (r != null) {
      if (DEBUG_CONFIGURATION)       Log.v(TAG,"String_Node_Str" + r + "String_Node_Str"+ config);
      r.updateConfiguration(config,dm);
    }
 else {
      it.remove();
    }
  }
}

Fixed version (ground truth):
final boolean applyConfigurationToResourcesLocked(Configuration config){
  if (mResConfiguration == null) {
    mResConfiguration=new Configuration();
  }
  if (!mResConfiguration.isOtherSeqNewer(config)) {
    if (DEBUG_CONFIGURATION)     Log.v(TAG,"String_Node_Str" + mResConfiguration.seq + "String_Node_Str"+ config.seq);
    return false;
  }
  int changes=mResConfiguration.updateFrom(config);
  DisplayMetrics dm=getDisplayMetricsLocked(true);
  if (config.locale != null) {
    Locale.setDefault(config.locale);
  }
  Resources.updateSystemConfiguration(config,dm);
  ContextImpl.ApplicationPackageManager.configurationChanged();
  Iterator<WeakReference<Resources>> it=mActiveResources.values().iterator();
  while (it.hasNext()) {
    WeakReference<Resources> v=it.next();
    Resources r=v.get();
    if (r != null) {
      if (DEBUG_CONFIGURATION)       Log.v(TAG,"String_Node_Str" + r + "String_Node_Str"+ config);
      r.updateConfiguration(config,dm);
    }
 else {
      it.remove();
    }
  }
  return changes != 0;
}
Program: 22791
Project: 22791
Buggy source:
private final void attach(boolean system){
  sThreadLocal.set(this);
  mSystemThread=system;
  if (!system) {
    ViewRoot.addFirstDrawHandler(new Runnable(){
      public void run(){
        ensureJitEnabled();
      }
    }
);
    android.ddm.DdmHandleAppName.setAppName("String_Node_Str");
    RuntimeInit.setApplicationObject(mAppThread.asBinder());
    IActivityManager mgr=ActivityManagerNative.getDefault();
    try {
      mgr.attachApplication(mAppThread);
    }
 catch (    RemoteException ex) {
    }
  }
 else {
    android.ddm.DdmHandleAppName.setAppName("String_Node_Str");
    try {
      mInstrumentation=new Instrumentation();
      ContextImpl context=new ContextImpl();
      context.init(getSystemContext().mPackageInfo,null,this);
      Application app=Instrumentation.newApplication(Application.class,context);
      mAllApplications.add(app);
      mInitialApplication=app;
      app.onCreate();
    }
 catch (    Exception e) {
      throw new RuntimeException("String_Node_Str" + e.toString(),e);
    }
  }
  ViewRoot.addConfigCallback(new ComponentCallbacks(){
    public void onConfigurationChanged(    Configuration newConfig){
synchronized (mPackages) {
        if (mPendingConfiguration == null || mPendingConfiguration.isOtherSeqNewer(newConfig)) {
          mPendingConfiguration=newConfig;
          applyConfigurationToResourcesLocked(newConfig);
        }
      }
      queueOrSendMessage(H.CONFIGURATION_CHANGED,newConfig);
    }
    public void onLowMemory(){
    }
  }
);
}

Fixed version (ground truth):
private final void attach(boolean system){
  sThreadLocal.set(this);
  mSystemThread=system;
  if (!system) {
    ViewRoot.addFirstDrawHandler(new Runnable(){
      public void run(){
        ensureJitEnabled();
      }
    }
);
    android.ddm.DdmHandleAppName.setAppName("String_Node_Str");
    RuntimeInit.setApplicationObject(mAppThread.asBinder());
    IActivityManager mgr=ActivityManagerNative.getDefault();
    try {
      mgr.attachApplication(mAppThread);
    }
 catch (    RemoteException ex) {
    }
  }
 else {
    android.ddm.DdmHandleAppName.setAppName("String_Node_Str");
    try {
      mInstrumentation=new Instrumentation();
      ContextImpl context=new ContextImpl();
      context.init(getSystemContext().mPackageInfo,null,this);
      Application app=Instrumentation.newApplication(Application.class,context);
      mAllApplications.add(app);
      mInitialApplication=app;
      app.onCreate();
    }
 catch (    Exception e) {
      throw new RuntimeException("String_Node_Str" + e.toString(),e);
    }
  }
  ViewRoot.addConfigCallback(new ComponentCallbacks(){
    public void onConfigurationChanged(    Configuration newConfig){
synchronized (mPackages) {
        if (applyConfigurationToResourcesLocked(newConfig)) {
          if (mPendingConfiguration == null || mPendingConfiguration.isOtherSeqNewer(newConfig)) {
            mPendingConfiguration=newConfig;
            queueOrSendMessage(H.CONFIGURATION_CHANGED,newConfig);
          }
        }
      }
    }
    public void onLowMemory(){
    }
  }
);
}
Program: 22792
Project: 22792
Buggy source:
public void onConfigurationChanged(Configuration newConfig){
synchronized (mPackages) {
    if (mPendingConfiguration == null || mPendingConfiguration.isOtherSeqNewer(newConfig)) {
      mPendingConfiguration=newConfig;
      applyConfigurationToResourcesLocked(newConfig);
    }
  }
  queueOrSendMessage(H.CONFIGURATION_CHANGED,newConfig);
}

Fixed version (ground truth):
public void onConfigurationChanged(Configuration newConfig){
synchronized (mPackages) {
    if (applyConfigurationToResourcesLocked(newConfig)) {
      if (mPendingConfiguration == null || mPendingConfiguration.isOtherSeqNewer(newConfig)) {
        mPendingConfiguration=newConfig;
        queueOrSendMessage(H.CONFIGURATION_CHANGED,newConfig);
      }
    }
  }
}
Program: 22793
Project: 22793
Buggy source:
final void applyConfigurationToResourcesLocked(Configuration config){
  if (mResConfiguration == null) {
    mResConfiguration=new Configuration();
  }
  if (!mResConfiguration.isOtherSeqNewer(config)) {
    if (DEBUG_CONFIGURATION)     Log.v(TAG,"String_Node_Str" + mResConfiguration.seq + "String_Node_Str"+ config.seq);
    return;
  }
  mResConfiguration.updateFrom(config);
  DisplayMetrics dm=getDisplayMetricsLocked(true);
  if (config.locale != null) {
    Locale.setDefault(config.locale);
  }
  Resources.updateSystemConfiguration(config,dm);
  ContextImpl.ApplicationPackageManager.configurationChanged();
  Iterator<WeakReference<Resources>> it=mActiveResources.values().iterator();
  while (it.hasNext()) {
    WeakReference<Resources> v=it.next();
    Resources r=v.get();
    if (r != null) {
      if (DEBUG_CONFIGURATION)       Log.v(TAG,"String_Node_Str" + r + "String_Node_Str"+ config);
      r.updateConfiguration(config,dm);
    }
 else {
      it.remove();
    }
  }
}

Fixed version (ground truth):
final boolean applyConfigurationToResourcesLocked(Configuration config){
  if (mResConfiguration == null) {
    mResConfiguration=new Configuration();
  }
  if (!mResConfiguration.isOtherSeqNewer(config)) {
    if (DEBUG_CONFIGURATION)     Log.v(TAG,"String_Node_Str" + mResConfiguration.seq + "String_Node_Str"+ config.seq);
    return false;
  }
  int changes=mResConfiguration.updateFrom(config);
  DisplayMetrics dm=getDisplayMetricsLocked(true);
  if (config.locale != null) {
    Locale.setDefault(config.locale);
  }
  Resources.updateSystemConfiguration(config,dm);
  ContextImpl.ApplicationPackageManager.configurationChanged();
  Iterator<WeakReference<Resources>> it=mActiveResources.values().iterator();
  while (it.hasNext()) {
    WeakReference<Resources> v=it.next();
    Resources r=v.get();
    if (r != null) {
      if (DEBUG_CONFIGURATION)       Log.v(TAG,"String_Node_Str" + r + "String_Node_Str"+ config);
      r.updateConfiguration(config,dm);
    }
 else {
      it.remove();
    }
  }
  return changes != 0;
}
Program: 22794
Project: 22794
Buggy source:
private final void attach(boolean system){
  sThreadLocal.set(this);
  mSystemThread=system;
  if (!system) {
    ViewRoot.addFirstDrawHandler(new Runnable(){
      public void run(){
        ensureJitEnabled();
      }
    }
);
    android.ddm.DdmHandleAppName.setAppName("String_Node_Str");
    RuntimeInit.setApplicationObject(mAppThread.asBinder());
    IActivityManager mgr=ActivityManagerNative.getDefault();
    try {
      mgr.attachApplication(mAppThread);
    }
 catch (    RemoteException ex) {
    }
  }
 else {
    android.ddm.DdmHandleAppName.setAppName("String_Node_Str");
    try {
      mInstrumentation=new Instrumentation();
      ContextImpl context=new ContextImpl();
      context.init(getSystemContext().mPackageInfo,null,this);
      Application app=Instrumentation.newApplication(Application.class,context);
      mAllApplications.add(app);
      mInitialApplication=app;
      app.onCreate();
    }
 catch (    Exception e) {
      throw new RuntimeException("String_Node_Str" + e.toString(),e);
    }
  }
  ViewRoot.addConfigCallback(new ComponentCallbacks(){
    public void onConfigurationChanged(    Configuration newConfig){
synchronized (mPackages) {
        if (mPendingConfiguration == null || mPendingConfiguration.isOtherSeqNewer(newConfig)) {
          mPendingConfiguration=newConfig;
          applyConfigurationToResourcesLocked(newConfig);
        }
      }
      queueOrSendMessage(H.CONFIGURATION_CHANGED,newConfig);
    }
    public void onLowMemory(){
    }
  }
);
}

Fixed version (ground truth):
private final void attach(boolean system){
  sThreadLocal.set(this);
  mSystemThread=system;
  if (!system) {
    ViewRoot.addFirstDrawHandler(new Runnable(){
      public void run(){
        ensureJitEnabled();
      }
    }
);
    android.ddm.DdmHandleAppName.setAppName("String_Node_Str");
    RuntimeInit.setApplicationObject(mAppThread.asBinder());
    IActivityManager mgr=ActivityManagerNative.getDefault();
    try {
      mgr.attachApplication(mAppThread);
    }
 catch (    RemoteException ex) {
    }
  }
 else {
    android.ddm.DdmHandleAppName.setAppName("String_Node_Str");
    try {
      mInstrumentation=new Instrumentation();
      ContextImpl context=new ContextImpl();
      context.init(getSystemContext().mPackageInfo,null,this);
      Application app=Instrumentation.newApplication(Application.class,context);
      mAllApplications.add(app);
      mInitialApplication=app;
      app.onCreate();
    }
 catch (    Exception e) {
      throw new RuntimeException("String_Node_Str" + e.toString(),e);
    }
  }
  ViewRoot.addConfigCallback(new ComponentCallbacks(){
    public void onConfigurationChanged(    Configuration newConfig){
synchronized (mPackages) {
        if (applyConfigurationToResourcesLocked(newConfig)) {
          if (mPendingConfiguration == null || mPendingConfiguration.isOtherSeqNewer(newConfig)) {
            mPendingConfiguration=newConfig;
            queueOrSendMessage(H.CONFIGURATION_CHANGED,newConfig);
          }
        }
      }
    }
    public void onLowMemory(){
    }
  }
);
}
Program: 22795
Project: 22795
Buggy source:
public void onConfigurationChanged(Configuration newConfig){
synchronized (mPackages) {
    if (mPendingConfiguration == null || mPendingConfiguration.isOtherSeqNewer(newConfig)) {
      mPendingConfiguration=newConfig;
      applyConfigurationToResourcesLocked(newConfig);
    }
  }
  queueOrSendMessage(H.CONFIGURATION_CHANGED,newConfig);
}

Fixed version (ground truth):
public void onConfigurationChanged(Configuration newConfig){
synchronized (mPackages) {
    if (applyConfigurationToResourcesLocked(newConfig)) {
      if (mPendingConfiguration == null || mPendingConfiguration.isOtherSeqNewer(newConfig)) {
        mPendingConfiguration=newConfig;
        queueOrSendMessage(H.CONFIGURATION_CHANGED,newConfig);
      }
    }
  }
}
Program: 22796
Project: 22796
Buggy source:
final void applyConfigurationToResourcesLocked(Configuration config){
  if (mResConfiguration == null) {
    mResConfiguration=new Configuration();
  }
  if (!mResConfiguration.isOtherSeqNewer(config)) {
    if (DEBUG_CONFIGURATION)     Log.v(TAG,"String_Node_Str" + mResConfiguration.seq + "String_Node_Str"+ config.seq);
    return;
  }
  mResConfiguration.updateFrom(config);
  DisplayMetrics dm=getDisplayMetricsLocked(true);
  if (config.locale != null) {
    Locale.setDefault(config.locale);
  }
  Resources.updateSystemConfiguration(config,dm);
  ContextImpl.ApplicationPackageManager.configurationChanged();
  Iterator<WeakReference<Resources>> it=mActiveResources.values().iterator();
  while (it.hasNext()) {
    WeakReference<Resources> v=it.next();
    Resources r=v.get();
    if (r != null) {
      if (DEBUG_CONFIGURATION)       Log.v(TAG,"String_Node_Str" + r + "String_Node_Str"+ config);
      r.updateConfiguration(config,dm);
    }
 else {
      it.remove();
    }
  }
}

Fixed version (ground truth):
final boolean applyConfigurationToResourcesLocked(Configuration config){
  if (mResConfiguration == null) {
    mResConfiguration=new Configuration();
  }
  if (!mResConfiguration.isOtherSeqNewer(config)) {
    if (DEBUG_CONFIGURATION)     Log.v(TAG,"String_Node_Str" + mResConfiguration.seq + "String_Node_Str"+ config.seq);
    return false;
  }
  int changes=mResConfiguration.updateFrom(config);
  DisplayMetrics dm=getDisplayMetricsLocked(true);
  if (config.locale != null) {
    Locale.setDefault(config.locale);
  }
  Resources.updateSystemConfiguration(config,dm);
  ContextImpl.ApplicationPackageManager.configurationChanged();
  Iterator<WeakReference<Resources>> it=mActiveResources.values().iterator();
  while (it.hasNext()) {
    WeakReference<Resources> v=it.next();
    Resources r=v.get();
    if (r != null) {
      if (DEBUG_CONFIGURATION)       Log.v(TAG,"String_Node_Str" + r + "String_Node_Str"+ config);
      r.updateConfiguration(config,dm);
    }
 else {
      it.remove();
    }
  }
  return changes != 0;
}
Program: 22797
Project: 22797
Buggy source:
/** 
 * Updates the engine configuration.
 */
public int setConfig(String engineConfig){
  return native_setConfig(engineConfig);
}

Fixed version (ground truth):
/** 
 * Updates the engine configuration.
 */
public int setConfig(String engineConfig){
  return native_setConfig(mJniData,engineConfig);
}
Program: 22798
Project: 22798
Buggy source:
private native final int native_setConfig(String engineConfig);

Fixed version (ground truth):
private native final int native_setConfig(int jniData,String engineConfig);
Program: 22799
Project: 22799
Buggy source:
/** 
 * Re-enable mobile data connectivity after a   {@link #teardown()}.
 */
public boolean reconnect(){
  setTeardownRequested(false);
switch (setEnableApn(mApnType,true)) {
case Phone.APN_ALREADY_ACTIVE:
    mEnabled=true;
  mMobileDataState=Phone.DataState.CONNECTING;
setDetailedState(DetailedState.CONNECTING,Phone.REASON_APN_CHANGED,null);
Intent intent=new Intent(TelephonyIntents.ACTION_ANY_DATA_CONNECTION_STATE_CHANGED);
intent.putExtra(Phone.STATE_KEY,Phone.DataState.CONNECTED.toString());
intent.putExtra(Phone.STATE_CHANGE_REASON_KEY,Phone.REASON_APN_CHANGED);
intent.putExtra(Phone.DATA_APN_TYPES_KEY,mApnTypeToWatchFor);
intent.putExtra(Phone.DATA_APN_KEY,mApnName);
intent.putExtra(Phone.DATA_IFACE_NAME_KEY,mInterfaceName);
intent.putExtra(Phone.NETWORK_UNAVAILABLE_KEY,false);
if (mStateReceiver != null) mStateReceiver.onReceive(mContext,intent);
break;
case Phone.APN_REQUEST_STARTED:
mEnabled=true;
break;
case Phone.APN_REQUEST_FAILED:
if (mPhoneService == null && mApnType == Phone.APN_TYPE_DEFAULT) {
mEnabled=true;
return false;
}
case Phone.APN_TYPE_NOT_AVAILABLE:
mEnabled=false;
break;
default :
Log.e(TAG,"String_Node_Str");
mEnabled=false;
break;
}
return mEnabled;
}

Fixed version (ground truth):
/** 
 * Re-enable mobile data connectivity after a   {@link #teardown()}.
 */
public boolean reconnect(){
  setTeardownRequested(false);
switch (setEnableApn(mApnType,true)) {
case Phone.APN_ALREADY_ACTIVE:
    mEnabled=true;
  mMobileDataState=Phone.DataState.CONNECTING;
setDetailedState(DetailedState.CONNECTING,Phone.REASON_APN_CHANGED,null);
Intent intent=new Intent(TelephonyIntents.ACTION_ANY_DATA_CONNECTION_STATE_CHANGED);
intent.putExtra(Phone.STATE_KEY,Phone.DataState.CONNECTED.toString());
intent.putExtra(Phone.STATE_CHANGE_REASON_KEY,Phone.REASON_APN_CHANGED);
intent.putExtra(Phone.DATA_APN_TYPES_KEY,mApnTypeToWatchFor);
intent.putExtra(Phone.DATA_APN_KEY,mApnName);
intent.putExtra(Phone.DATA_IFACE_NAME_KEY,mInterfaceName);
intent.putExtra(Phone.NETWORK_UNAVAILABLE_KEY,false);
if (mStateReceiver != null) mStateReceiver.onReceive(mContext,intent);
break;
case Phone.APN_REQUEST_STARTED:
mEnabled=true;
break;
case Phone.APN_REQUEST_FAILED:
if (mPhoneService == null && mApnType == Phone.APN_TYPE_DEFAULT) {
mEnabled=true;
return false;
}
case Phone.APN_TYPE_NOT_AVAILABLE:
if (mApnType != Phone.APN_TYPE_DEFAULT) {
mEnabled=false;
}
break;
default :
Log.e(TAG,"String_Node_Str");
mEnabled=false;
break;
}
return mEnabled;
}
Program: 22801
Project: 22801
Buggy source:
/** 
 * Constructor - fires it up and makes it look like the search UI.
 * @param context Application Context we can use for system acess
 */
public SearchDialog(Context context,SearchManager searchManager){
  super(context,com.android.internal.R.style.Theme_SearchBar);
  mVoiceWebSearchIntent=new Intent(RecognizerIntent.ACTION_WEB_SEARCH);
  mVoiceWebSearchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  mVoiceWebSearchIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
  mVoiceAppSearchIntent=new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
  mVoiceAppSearchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  mSearchManager=searchManager;
  IntentFilter filter=new IntentFilter();
  filter.addAction(Intent.ACTION_CONFIGURATION_CHANGED);
  context.registerReceiver(new BroadcastReceiver(){
    @Override public void onReceive(    Context context,    Intent intent){
      if (intent.getAction().equals(Intent.ACTION_CONFIGURATION_CHANGED)) {
        onConfigurationChanged();
      }
    }
  }
,filter);
}

Fixed version (ground truth):
/** 
 * Constructor - fires it up and makes it look like the search UI.
 * @param context Application Context we can use for system acess
 */
public SearchDialog(Context context,SearchManager searchManager){
  super(context,com.android.internal.R.style.Theme_SearchBar);
  mVoiceWebSearchIntent=new Intent(RecognizerIntent.ACTION_WEB_SEARCH);
  mVoiceWebSearchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  mVoiceWebSearchIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
  mVoiceAppSearchIntent=new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
  mVoiceAppSearchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  mSearchManager=searchManager;
}