nus-yam/ex-repair huggingface dataset:
Program: 183533
Project: 183533
Buggy source:
public void profilerControl(boolean start,String path) throws RemoteException {
  Parcel data=Parcel.obtain();
  data.writeInterfaceToken(IApplicationThread.descriptor);
  data.writeInt(start ? 1 : 0);
  data.writeString(path);
  mRemote.transact(PROFILER_CONTROL_TRANSACTION,data,null,IBinder.FLAG_ONEWAY);
  data.recycle();
}

Fixed version (ground truth):
public void profilerControl(boolean start,String path,ParcelFileDescriptor fd) throws RemoteException {
  Parcel data=Parcel.obtain();
  data.writeInterfaceToken(IApplicationThread.descriptor);
  data.writeInt(start ? 1 : 0);
  data.writeString(path);
  if (fd != null) {
    data.writeInt(1);
    fd.writeToParcel(data,Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
  }
 else {
    data.writeInt(0);
  }
  mRemote.transact(PROFILER_CONTROL_TRANSACTION,data,null,IBinder.FLAG_ONEWAY);
  data.recycle();
}
Program: 183534
Project: 183534
Buggy source:
public boolean profileControl(String process,boolean start,String path) throws RemoteException ;

Fixed version (ground truth):
public boolean profileControl(String process,boolean start,String path,ParcelFileDescriptor fd) throws RemoteException ;
Program: 183535
Project: 183535
Buggy source:
void profilerControl(boolean start,String path) throws RemoteException ;

Fixed version (ground truth):
void profilerControl(boolean start,String path,ParcelFileDescriptor fd) throws RemoteException ;
Program: 183536
Project: 183536
Buggy source:
/** 
 * Start method tracing, specifying the trace log file name and the buffer size. The trace files will be put under "/sdcard" unless an absolute path is given. See <a href="  {@docRoot}guide/developing/tools/traceview.html">Traceview: A Graphical Log Viewer</a> for information about reading trace files. <p> When method tracing is enabled, the VM will run more slowly than usual, so the timings from the trace files should only be considered in relative terms (e.g. was run #1 faster than run #2).  The times for native methods will not change, so don't try to use this to compare the performance of interpreted and native implementations of the same method.  As an alternative, consider using "native" tracing in the emulator via   {@link #startNativeTracing()}. </p>
 * @param traceName    Name for the trace log file to create.If no name argument is given, this value defaults to "/sdcard/dmtrace.trace". If the files already exist, they will be truncated. If the trace file given does not end in ".trace", it will be appended for you.
 * @param bufferSize    The maximum amount of trace data we gather. If not given, it defaults to 8MB.
 */
public static void startMethodTracing(String traceName,int bufferSize,int flags){
  String pathName=traceName;
  if (pathName.charAt(0) != '/')   pathName=DEFAULT_TRACE_PATH_PREFIX + pathName;
  if (!pathName.endsWith(DEFAULT_TRACE_EXTENSION))   pathName=pathName + DEFAULT_TRACE_EXTENSION;
  VMDebug.startMethodTracing(pathName,bufferSize,flags);
}

Fixed version (ground truth):
/** 
 * Like startMethodTracing(String, int, int), but taking an already-opened FileDescriptor in which the trace is written.  The file name is also supplied simply for logging.  Makes a dup of the file descriptor. Not exposed in the SDK unless we are really comfortable with supporting this and find it would be useful.
 * @hide
 */
public static void startMethodTracing(String traceName,FileDescriptor fd,int bufferSize,int flags){
  VMDebug.startMethodTracing(traceName,fd,bufferSize,flags);
}
Program: 183537
Project: 183537
Buggy source:
public boolean profileControl(String process,boolean start,String path) throws RemoteException {
synchronized (this) {
    if (checkCallingPermission(android.Manifest.permission.SET_ACTIVITY_WATCHER) != PackageManager.PERMISSION_GRANTED) {
      throw new SecurityException("String_Node_Str" + android.Manifest.permission.SET_ACTIVITY_WATCHER);
    }
    ProcessRecord proc=null;
    try {
      int pid=Integer.parseInt(process);
synchronized (mPidsSelfLocked) {
        proc=mPidsSelfLocked.get(pid);
      }
    }
 catch (    NumberFormatException e) {
    }
    if (proc == null) {
      HashMap<String,SparseArray<ProcessRecord>> all=mProcessNames.getMap();
      SparseArray<ProcessRecord> procs=all.get(process);
      if (procs != null && procs.size() > 0) {
        proc=procs.valueAt(0);
      }
    }
    if (proc == null || proc.thread == null) {
      throw new IllegalArgumentException("String_Node_Str" + process);
    }
    boolean isSecure="String_Node_Str".equals(SystemProperties.get(SYSTEM_SECURE,"String_Node_Str"));
    if (isSecure) {
      if ((proc.info.flags & ApplicationInfo.FLAG_DEBUGGABLE) == 0) {
        throw new SecurityException("String_Node_Str" + proc);
      }
    }
    try {
      proc.thread.profilerControl(start,path);
      return true;
    }
 catch (    RemoteException e) {
      throw new IllegalStateException("String_Node_Str");
    }
  }
}

Fixed version (ground truth):
public boolean profileControl(String process,boolean start,String path,ParcelFileDescriptor fd) throws RemoteException {
  try {
synchronized (this) {
      if (checkCallingPermission(android.Manifest.permission.SET_ACTIVITY_WATCHER) != PackageManager.PERMISSION_GRANTED) {
        throw new SecurityException("String_Node_Str" + android.Manifest.permission.SET_ACTIVITY_WATCHER);
      }
      if (start && fd == null) {
        throw new IllegalArgumentException("String_Node_Str");
      }
      ProcessRecord proc=null;
      try {
        int pid=Integer.parseInt(process);
synchronized (mPidsSelfLocked) {
          proc=mPidsSelfLocked.get(pid);
        }
      }
 catch (      NumberFormatException e) {
      }
      if (proc == null) {
        HashMap<String,SparseArray<ProcessRecord>> all=mProcessNames.getMap();
        SparseArray<ProcessRecord> procs=all.get(process);
        if (procs != null && procs.size() > 0) {
          proc=procs.valueAt(0);
        }
      }
      if (proc == null || proc.thread == null) {
        throw new IllegalArgumentException("String_Node_Str" + process);
      }
      boolean isSecure="String_Node_Str".equals(SystemProperties.get(SYSTEM_SECURE,"String_Node_Str"));
      if (isSecure) {
        if ((proc.info.flags & ApplicationInfo.FLAG_DEBUGGABLE) == 0) {
          throw new SecurityException("String_Node_Str" + proc);
        }
      }
      proc.thread.profilerControl(start,path,fd);
      fd=null;
      return true;
    }
  }
 catch (  RemoteException e) {
    throw new IllegalStateException("String_Node_Str");
  }
 finally {
    if (fd != null) {
      try {
        fd.close();
      }
 catch (      IOException e) {
      }
    }
  }
}
Program: 183538
Project: 183538
Buggy source:
public void noteAudioOffLocked(int uid){
  if (mAudioOn) {
    mAudioOn=false;
    mAudioOnTimer.stopRunningLocked(this);
  }
  Uid u=mUidStats.get(uid);
  if (u != null) {
    u.noteAudioTurnedOffLocked();
  }
}

Fixed version (ground truth):
public void noteAudioOffLocked(int uid){
  if (mAudioOn) {
    mAudioOn=false;
    mAudioOnTimer.stopRunningLocked(this);
  }
  getUidStatsLocked(uid).noteAudioTurnedOffLocked();
}
Program: 183539
Project: 183539
Buggy source:
public void noteWifiOffLocked(int uid){
  if (mWifiOn) {
    mWifiOn=false;
    mWifiOnTimer.stopRunningLocked(this);
  }
  if (mWifiOnUid >= 0) {
    Uid u=mUidStats.get(mWifiOnUid);
    if (u != null) {
      u.noteWifiTurnedOffLocked();
    }
    mWifiOnUid=-1;
  }
}

Fixed version (ground truth):
public void noteWifiOffLocked(int uid){
  if (mWifiOn) {
    mWifiOn=false;
    mWifiOnTimer.stopRunningLocked(this);
  }
  if (mWifiOnUid >= 0) {
    getUidStatsLocked(mWifiOnUid).noteWifiTurnedOffLocked();
    mWifiOnUid=-1;
  }
}
Program: 183540
Project: 183540
Buggy source:
public void noteAudioOnLocked(int uid){
  if (!mAudioOn) {
    mAudioOn=true;
    mAudioOnTimer.startRunningLocked(this);
  }
  Uid u=mUidStats.get(uid);
  if (u != null) {
    u.noteAudioTurnedOnLocked();
  }
}

Fixed version (ground truth):
public void noteAudioOnLocked(int uid){
  if (!mAudioOn) {
    mAudioOn=true;
    mAudioOnTimer.startRunningLocked(this);
  }
  getUidStatsLocked(uid).noteAudioTurnedOnLocked();
}
Program: 183541
Project: 183541
Buggy source:
public void noteVideoOffLocked(int uid){
  if (mVideoOn) {
    mVideoOn=false;
    mVideoOnTimer.stopRunningLocked(this);
  }
  Uid u=mUidStats.get(uid);
  if (u != null) {
    u.noteVideoTurnedOffLocked();
  }
}

Fixed version (ground truth):
public void noteVideoOffLocked(int uid){
  if (mVideoOn) {
    mVideoOn=false;
    mVideoOnTimer.stopRunningLocked(this);
  }
  getUidStatsLocked(uid).noteVideoTurnedOffLocked();
}
Program: 183542
Project: 183542
Buggy source:
public void noteWifiOnLocked(int uid){
  if (!mWifiOn) {
    mWifiOn=true;
    mWifiOnTimer.startRunningLocked(this);
  }
  if (mWifiOnUid != uid) {
    if (mWifiOnUid >= 0) {
      Uid u=mUidStats.get(mWifiOnUid);
      if (u != null) {
        u.noteWifiTurnedOffLocked();
      }
    }
    mWifiOnUid=uid;
    Uid u=mUidStats.get(uid);
    if (u != null) {
      u.noteWifiTurnedOnLocked();
    }
  }
}

Fixed version (ground truth):
public void noteWifiOnLocked(int uid){
  if (!mWifiOn) {
    mWifiOn=true;
    mWifiOnTimer.startRunningLocked(this);
  }
  if (mWifiOnUid != uid) {
    if (mWifiOnUid >= 0) {
      getUidStatsLocked(mWifiOnUid).noteWifiTurnedOffLocked();
    }
    mWifiOnUid=uid;
    getUidStatsLocked(uid).noteWifiTurnedOnLocked();
  }
}
Program: 183543
Project: 183543
Buggy source:
public void noteVideoOnLocked(int uid){
  if (!mVideoOn) {
    mVideoOn=true;
    mVideoOnTimer.startRunningLocked(this);
  }
  Uid u=mUidStats.get(uid);
  if (u != null) {
    u.noteVideoTurnedOnLocked();
  }
}

Fixed version (ground truth):
public void noteVideoOnLocked(int uid){
  if (!mVideoOn) {
    mVideoOn=true;
    mVideoOnTimer.startRunningLocked(this);
  }
  getUidStatsLocked(uid).noteVideoTurnedOnLocked();
}
Program: 183544
Project: 183544
Buggy source:
/** 
 * called from native code to update our status
 */
private void reportStatus(int status){
  if (VERBOSE)   Log.v(TAG,"String_Node_Str" + status);
  boolean wasNavigating=mNavigating;
  mNavigating=(status == GPS_STATUS_SESSION_BEGIN);
  if (wasNavigating != mNavigating) {
    if (mNavigating) {
      if (DEBUG)       Log.d(TAG,"String_Node_Str");
      mWakeLock.acquire();
    }
synchronized (mListeners) {
      int size=mListeners.size();
      for (int i=0; i < size; i++) {
        Listener listener=mListeners.get(i);
        try {
          if (mNavigating) {
            listener.mListener.onGpsStarted();
          }
 else {
            listener.mListener.onGpsStopped();
          }
        }
 catch (        RemoteException e) {
          Log.w(TAG,"String_Node_Str");
          mListeners.remove(listener);
          size--;
        }
      }
    }
    try {
      for (int i=mClientUids.size() - 1; i >= 0; i--) {
        int uid=mClientUids.keyAt(i);
        if (mNavigating) {
          mBatteryStats.noteStartGps(uid);
        }
 else {
          mBatteryStats.noteStopGps(uid);
        }
      }
    }
 catch (    RemoteException e) {
      Log.w(TAG,"String_Node_Str");
    }
    Intent intent=new Intent(GPS_ENABLED_CHANGE_ACTION);
    intent.putExtra(EXTRA_ENABLED,mNavigating);
    mContext.sendBroadcast(intent);
    if (!mNavigating) {
      if (DEBUG)       Log.d(TAG,"String_Node_Str");
      mWakeLock.release();
    }
  }
}

Fixed version (ground truth):
/** 
 * called from native code to update our status
 */
private void reportStatus(int status){
  if (VERBOSE)   Log.v(TAG,"String_Node_Str" + status);
synchronized (mListeners) {
    boolean wasNavigating=mNavigating;
    mNavigating=(status == GPS_STATUS_SESSION_BEGIN);
    if (wasNavigating == mNavigating) {
      return;
    }
    if (mNavigating) {
      if (DEBUG)       Log.d(TAG,"String_Node_Str");
      mWakeLock.acquire();
    }
    int size=mListeners.size();
    for (int i=0; i < size; i++) {
      Listener listener=mListeners.get(i);
      try {
        if (mNavigating) {
          listener.mListener.onGpsStarted();
        }
 else {
          listener.mListener.onGpsStopped();
        }
      }
 catch (      RemoteException e) {
        Log.w(TAG,"String_Node_Str");
        mListeners.remove(listener);
        size--;
      }
    }
    try {
      for (int i=mClientUids.size() - 1; i >= 0; i--) {
        int uid=mClientUids.keyAt(i);
        if (mNavigating) {
          mBatteryStats.noteStartGps(uid);
        }
 else {
          mBatteryStats.noteStopGps(uid);
        }
      }
    }
 catch (    RemoteException e) {
      Log.w(TAG,"String_Node_Str");
    }
    Intent intent=new Intent(GPS_ENABLED_CHANGE_ACTION);
    intent.putExtra(EXTRA_ENABLED,mNavigating);
    mContext.sendBroadcast(intent);
    if (!mNavigating) {
      if (DEBUG)       Log.d(TAG,"String_Node_Str");
      mWakeLock.release();
    }
  }
}
Program: 183545
Project: 183545
Buggy source:
public void addListener(int uid){
  mClientUids.put(uid,0);
  if (mNavigating) {
    try {
      mBatteryStats.noteStartGps(uid);
    }
 catch (    RemoteException e) {
      Log.w(TAG,"String_Node_Str");
    }
  }
}

Fixed version (ground truth):
public void addListener(int uid){
synchronized (mListeners) {
    if (mClientUids.indexOfKey(uid) >= 0) {
      Log.w(TAG,"String_Node_Str" + uid);
      return;
    }
    mClientUids.put(uid,0);
    if (mNavigating) {
      try {
        mBatteryStats.noteStartGps(uid);
      }
 catch (      RemoteException e) {
        Log.w(TAG,"String_Node_Str");
      }
    }
  }
}
Program: 183546
Project: 183546
Buggy source:
public void removeListener(int uid){
  mClientUids.delete(uid);
  if (mNavigating) {
    try {
      mBatteryStats.noteStopGps(uid);
    }
 catch (    RemoteException e) {
      Log.w(TAG,"String_Node_Str");
    }
  }
}

Fixed version (ground truth):
public void removeListener(int uid){
synchronized (mListeners) {
    if (mClientUids.indexOfKey(uid) < 0) {
      Log.w(TAG,"String_Node_Str" + uid);
      return;
    }
    mClientUids.delete(uid);
    if (mNavigating) {
      try {
        mBatteryStats.noteStopGps(uid);
      }
 catch (      RemoteException e) {
        Log.w(TAG,"String_Node_Str");
      }
    }
  }
}
Program: 183547
Project: 183547
Buggy source:
public void noteAudioOffLocked(int uid){
  if (mAudioOn) {
    mAudioOn=false;
    mAudioOnTimer.stopRunningLocked(this);
  }
  Uid u=mUidStats.get(uid);
  if (u != null) {
    u.noteAudioTurnedOffLocked();
  }
}

Fixed version (ground truth):
public void noteAudioOffLocked(int uid){
  if (mAudioOn) {
    mAudioOn=false;
    mAudioOnTimer.stopRunningLocked(this);
  }
  getUidStatsLocked(uid).noteAudioTurnedOffLocked();
}
Program: 183548
Project: 183548
Buggy source:
public void noteWifiOffLocked(int uid){
  if (mWifiOn) {
    mWifiOn=false;
    mWifiOnTimer.stopRunningLocked(this);
  }
  if (mWifiOnUid >= 0) {
    Uid u=mUidStats.get(mWifiOnUid);
    if (u != null) {
      u.noteWifiTurnedOffLocked();
    }
    mWifiOnUid=-1;
  }
}

Fixed version (ground truth):
public void noteWifiOffLocked(int uid){
  if (mWifiOn) {
    mWifiOn=false;
    mWifiOnTimer.stopRunningLocked(this);
  }
  if (mWifiOnUid >= 0) {
    getUidStatsLocked(mWifiOnUid).noteWifiTurnedOffLocked();
    mWifiOnUid=-1;
  }
}
Program: 183549
Project: 183549
Buggy source:
public void noteAudioOnLocked(int uid){
  if (!mAudioOn) {
    mAudioOn=true;
    mAudioOnTimer.startRunningLocked(this);
  }
  Uid u=mUidStats.get(uid);
  if (u != null) {
    u.noteAudioTurnedOnLocked();
  }
}

Fixed version (ground truth):
public void noteAudioOnLocked(int uid){
  if (!mAudioOn) {
    mAudioOn=true;
    mAudioOnTimer.startRunningLocked(this);
  }
  getUidStatsLocked(uid).noteAudioTurnedOnLocked();
}
Program: 183550
Project: 183550
Buggy source:
public void noteVideoOffLocked(int uid){
  if (mVideoOn) {
    mVideoOn=false;
    mVideoOnTimer.stopRunningLocked(this);
  }
  Uid u=mUidStats.get(uid);
  if (u != null) {
    u.noteVideoTurnedOffLocked();
  }
}

Fixed version (ground truth):
public void noteVideoOffLocked(int uid){
  if (mVideoOn) {
    mVideoOn=false;
    mVideoOnTimer.stopRunningLocked(this);
  }
  getUidStatsLocked(uid).noteVideoTurnedOffLocked();
}
Program: 183551
Project: 183551
Buggy source:
public void noteWifiOnLocked(int uid){
  if (!mWifiOn) {
    mWifiOn=true;
    mWifiOnTimer.startRunningLocked(this);
  }
  if (mWifiOnUid != uid) {
    if (mWifiOnUid >= 0) {
      Uid u=mUidStats.get(mWifiOnUid);
      if (u != null) {
        u.noteWifiTurnedOffLocked();
      }
    }
    mWifiOnUid=uid;
    Uid u=mUidStats.get(uid);
    if (u != null) {
      u.noteWifiTurnedOnLocked();
    }
  }
}

Fixed version (ground truth):
public void noteWifiOnLocked(int uid){
  if (!mWifiOn) {
    mWifiOn=true;
    mWifiOnTimer.startRunningLocked(this);
  }
  if (mWifiOnUid != uid) {
    if (mWifiOnUid >= 0) {
      getUidStatsLocked(mWifiOnUid).noteWifiTurnedOffLocked();
    }
    mWifiOnUid=uid;
    getUidStatsLocked(uid).noteWifiTurnedOnLocked();
  }
}
Program: 183552
Project: 183552
Buggy source:
public void noteVideoOnLocked(int uid){
  if (!mVideoOn) {
    mVideoOn=true;
    mVideoOnTimer.startRunningLocked(this);
  }
  Uid u=mUidStats.get(uid);
  if (u != null) {
    u.noteVideoTurnedOnLocked();
  }
}

Fixed version (ground truth):
public void noteVideoOnLocked(int uid){
  if (!mVideoOn) {
    mVideoOn=true;
    mVideoOnTimer.startRunningLocked(this);
  }
  getUidStatsLocked(uid).noteVideoTurnedOnLocked();
}
Program: 183553
Project: 183553
Buggy source:
/** 
 * called from native code to update our status
 */
private void reportStatus(int status){
  if (VERBOSE)   Log.v(TAG,"String_Node_Str" + status);
  boolean wasNavigating=mNavigating;
  mNavigating=(status == GPS_STATUS_SESSION_BEGIN);
  if (wasNavigating != mNavigating) {
    if (mNavigating) {
      if (DEBUG)       Log.d(TAG,"String_Node_Str");
      mWakeLock.acquire();
    }
synchronized (mListeners) {
      int size=mListeners.size();
      for (int i=0; i < size; i++) {
        Listener listener=mListeners.get(i);
        try {
          if (mNavigating) {
            listener.mListener.onGpsStarted();
          }
 else {
            listener.mListener.onGpsStopped();
          }
        }
 catch (        RemoteException e) {
          Log.w(TAG,"String_Node_Str");
          mListeners.remove(listener);
          size--;
        }
      }
    }
    try {
      for (int i=mClientUids.size() - 1; i >= 0; i--) {
        int uid=mClientUids.keyAt(i);
        if (mNavigating) {
          mBatteryStats.noteStartGps(uid);
        }
 else {
          mBatteryStats.noteStopGps(uid);
        }
      }
    }
 catch (    RemoteException e) {
      Log.w(TAG,"String_Node_Str");
    }
    Intent intent=new Intent(GPS_ENABLED_CHANGE_ACTION);
    intent.putExtra(EXTRA_ENABLED,mNavigating);
    mContext.sendBroadcast(intent);
    if (!mNavigating) {
      if (DEBUG)       Log.d(TAG,"String_Node_Str");
      mWakeLock.release();
    }
  }
}

Fixed version (ground truth):
/** 
 * called from native code to update our status
 */
private void reportStatus(int status){
  if (VERBOSE)   Log.v(TAG,"String_Node_Str" + status);
synchronized (mListeners) {
    boolean wasNavigating=mNavigating;
    mNavigating=(status == GPS_STATUS_SESSION_BEGIN);
    if (wasNavigating == mNavigating) {
      return;
    }
    if (mNavigating) {
      if (DEBUG)       Log.d(TAG,"String_Node_Str");
      mWakeLock.acquire();
    }
    int size=mListeners.size();
    for (int i=0; i < size; i++) {
      Listener listener=mListeners.get(i);
      try {
        if (mNavigating) {
          listener.mListener.onGpsStarted();
        }
 else {
          listener.mListener.onGpsStopped();
        }
      }
 catch (      RemoteException e) {
        Log.w(TAG,"String_Node_Str");
        mListeners.remove(listener);
        size--;
      }
    }
    try {
      for (int i=mClientUids.size() - 1; i >= 0; i--) {
        int uid=mClientUids.keyAt(i);
        if (mNavigating) {
          mBatteryStats.noteStartGps(uid);
        }
 else {
          mBatteryStats.noteStopGps(uid);
        }
      }
    }
 catch (    RemoteException e) {
      Log.w(TAG,"String_Node_Str");
    }
    Intent intent=new Intent(GPS_ENABLED_CHANGE_ACTION);
    intent.putExtra(EXTRA_ENABLED,mNavigating);
    mContext.sendBroadcast(intent);
    if (!mNavigating) {
      if (DEBUG)       Log.d(TAG,"String_Node_Str");
      mWakeLock.release();
    }
  }
}
Program: 183554
Project: 183554
Buggy source:
public void addListener(int uid){
  mClientUids.put(uid,0);
  if (mNavigating) {
    try {
      mBatteryStats.noteStartGps(uid);
    }
 catch (    RemoteException e) {
      Log.w(TAG,"String_Node_Str");
    }
  }
}

Fixed version (ground truth):
public void addListener(int uid){
synchronized (mListeners) {
    if (mClientUids.indexOfKey(uid) >= 0) {
      Log.w(TAG,"String_Node_Str" + uid);
      return;
    }
    mClientUids.put(uid,0);
    if (mNavigating) {
      try {
        mBatteryStats.noteStartGps(uid);
      }
 catch (      RemoteException e) {
        Log.w(TAG,"String_Node_Str");
      }
    }
  }
}
Program: 183555
Project: 183555
Buggy source:
public void removeListener(int uid){
  mClientUids.delete(uid);
  if (mNavigating) {
    try {
      mBatteryStats.noteStopGps(uid);
    }
 catch (    RemoteException e) {
      Log.w(TAG,"String_Node_Str");
    }
  }
}

Fixed version (ground truth):
public void removeListener(int uid){
synchronized (mListeners) {
    if (mClientUids.indexOfKey(uid) < 0) {
      Log.w(TAG,"String_Node_Str" + uid);
      return;
    }
    mClientUids.delete(uid);
    if (mNavigating) {
      try {
        mBatteryStats.noteStopGps(uid);
      }
 catch (      RemoteException e) {
        Log.w(TAG,"String_Node_Str");
      }
    }
  }
}
Program: 183556
Project: 183556
Buggy source:
@Override public final void setBackgroundDrawable(Drawable drawable){
  if (drawable != mBackgroundDrawable) {
    mBackgroundResource=0;
    mBackgroundDrawable=drawable;
    if (mDecor != null) {
      mDecor.setWindowBackground(drawable);
    }
  }
}

Fixed version (ground truth):
@Override public final void setBackgroundDrawable(Drawable drawable){
  if (drawable != mBackgroundDrawable || mBackgroundResource != 0) {
    mBackgroundResource=0;
    mBackgroundDrawable=drawable;
    if (mDecor != null) {
      mDecor.setWindowBackground(drawable);
    }
  }
}
Program: 183558
Project: 183558
Buggy source:
@Override public final void setBackgroundDrawable(Drawable drawable){
  if (drawable != mBackgroundDrawable) {
    mBackgroundResource=0;
    mBackgroundDrawable=drawable;
    if (mDecor != null) {
      mDecor.setWindowBackground(drawable);
    }
  }
}

Fixed version (ground truth):
@Override public final void setBackgroundDrawable(Drawable drawable){
  if (drawable != mBackgroundDrawable || mBackgroundResource != 0) {
    mBackgroundResource=0;
    mBackgroundDrawable=drawable;
    if (mDecor != null) {
      mDecor.setWindowBackground(drawable);
    }
  }
}
Program: 183559
Project: 183559
Buggy source:
/** 
 * The default implementation returns the given amount of text from the current cursor position in the buffer.
 */
public CharSequence getTextBeforeCursor(int length,int flags){
  final Editable content=getEditable();
  if (content == null)   return null;
  int a=Selection.getSelectionStart(content);
  int b=Selection.getSelectionEnd(content);
  if (a > b) {
    int tmp=a;
    a=b;
    b=tmp;
  }
  if (length > a) {
    length=a;
  }
  if ((flags & GET_TEXT_WITH_STYLES) != 0) {
    return content.subSequence(a - length,a);
  }
  return TextUtils.substring(content,a - length,a);
}

Fixed version (ground truth):
/** 
 * The default implementation returns the given amount of text from the current cursor position in the buffer.
 */
public CharSequence getTextBeforeCursor(int length,int flags){
  final Editable content=getEditable();
  if (content == null)   return null;
  int a=Selection.getSelectionStart(content);
  int b=Selection.getSelectionEnd(content);
  if (a > b) {
    int tmp=a;
    a=b;
    b=tmp;
  }
  if (a <= 0) {
    return "String_Node_Str";
  }
  if (length > a) {
    length=a;
  }
  if ((flags & GET_TEXT_WITH_STYLES) != 0) {
    return content.subSequence(a - length,a);
  }
  return TextUtils.substring(content,a - length,a);
}
Program: 183561
Project: 183561
Buggy source:
protected void onReceiveResult(int resultCode,Bundle resultData){
  if (resultCode != InputMethodManager.RESULT_SHOWN) {
    Selection.setSelection((Spannable)mText,mNewStart,mNewEnd);
  }
}

Fixed version (ground truth):
protected void onReceiveResult(int resultCode,Bundle resultData){
  if (resultCode != InputMethodManager.RESULT_SHOWN) {
    final int len=mText.length();
    if (mNewStart > len) {
      mNewStart=len;
    }
    if (mNewEnd > len) {
      mNewEnd=len;
    }
    Selection.setSelection((Spannable)mText,mNewStart,mNewEnd);
  }
}
Program: 183562
Project: 183562
Buggy source:
private Rect sendOurVisibleRect(){
  Rect rect=new Rect();
  calcOurContentVisibleRect(rect);
  if (mFindIsUp) {
    rect.bottom-=viewToContent(FIND_HEIGHT);
  }
  if (!rect.equals(mLastVisibleRectSent)) {
    Point pos=new Point(rect.left,rect.top);
    mWebViewCore.sendMessage(EventHub.SET_SCROLL_OFFSET,nativeMoveGeneration(),0,pos);
    mLastVisibleRectSent=rect;
  }
  Rect globalRect=new Rect();
  if (getGlobalVisibleRect(globalRect) && !globalRect.equals(mLastGlobalRect)) {
    mWebViewCore.sendMessage(EventHub.SET_GLOBAL_BOUNDS,globalRect);
    mLastGlobalRect=globalRect;
  }
  return rect;
}

Fixed version (ground truth):
private Rect sendOurVisibleRect(){
  Rect rect=new Rect();
  calcOurContentVisibleRect(rect);
  if (!rect.equals(mLastVisibleRectSent)) {
    Point pos=new Point(rect.left,rect.top);
    mWebViewCore.sendMessage(EventHub.SET_SCROLL_OFFSET,nativeMoveGeneration(),0,pos);
    mLastVisibleRectSent=rect;
  }
  Rect globalRect=new Rect();
  if (getGlobalVisibleRect(globalRect) && !globalRect.equals(mLastGlobalRect)) {
    if (DebugFlags.WEB_VIEW) {
      Log.v(LOGTAG,"String_Node_Str" + globalRect.left + "String_Node_Str"+ globalRect.top+ "String_Node_Str"+ globalRect.right+ "String_Node_Str"+ globalRect.bottom);
    }
    mWebViewCore.sendMessage(EventHub.SET_GLOBAL_BOUNDS,globalRect);
    mLastGlobalRect=globalRect;
  }
  return rect;
}
Program: 183564
Project: 183564
Buggy source:
private void calcOurVisibleRect(Rect r){
  Point p=new Point();
  getGlobalVisibleRect(r,p);
  r.offset(-p.x,-p.y);
}

Fixed version (ground truth):
private void calcOurVisibleRect(Rect r){
  Point p=new Point();
  getGlobalVisibleRect(r,p);
  r.offset(-p.x,-p.y);
  if (mFindIsUp) {
    r.bottom-=FIND_HEIGHT;
  }
}
Program: 183565
Project: 183565
Buggy source:
private void updateSharedUserPerms(PackageSetting deletedPs){
  if ((deletedPs == null) || (deletedPs.pkg == null)) {
    Log.i(TAG,"String_Node_Str");
    return;
  }
  if (deletedPs.sharedUser == null) {
    return;
  }
  SharedUserSetting sus=deletedPs.sharedUser;
  for (  String eachPerm : deletedPs.pkg.requestedPermissions) {
    boolean used=false;
    if (!sus.grantedPermissions.contains(eachPerm)) {
      continue;
    }
    for (    PackageSetting pkg : sus.packages) {
      if (pkg.grantedPermissions.contains(eachPerm)) {
        used=true;
        break;
      }
    }
    if (!used) {
      sus.grantedPermissions.remove(eachPerm);
      sus.loadedPermissions.remove(eachPerm);
    }
  }
  int newGids[]=null;
  for (  PackageSetting pkg : sus.packages) {
    newGids=appendInts(newGids,pkg.gids);
  }
  sus.gids=newGids;
}

Fixed version (ground truth):
private void updateSharedUserPerms(PackageSetting deletedPs){
  if ((deletedPs == null) || (deletedPs.pkg == null)) {
    Log.i(TAG,"String_Node_Str");
    return;
  }
  if (deletedPs.sharedUser == null) {
    return;
  }
  SharedUserSetting sus=deletedPs.sharedUser;
  for (  String eachPerm : deletedPs.pkg.requestedPermissions) {
    boolean used=false;
    if (!sus.grantedPermissions.contains(eachPerm)) {
      continue;
    }
    for (    PackageSetting pkg : sus.packages) {
      if (pkg.pkg.requestedPermissions.contains(eachPerm)) {
        used=true;
        break;
      }
    }
    if (!used) {
      sus.grantedPermissions.remove(eachPerm);
      sus.loadedPermissions.remove(eachPerm);
    }
  }
  int newGids[]=null;
  for (  PackageSetting pkg : sus.packages) {
    newGids=appendInts(newGids,pkg.gids);
  }
  sus.gids=newGids;
}
Program: 183567
Project: 183567
Buggy source:
/** 
 * Sends a series of key events through instrumentation and waits for idle. For instance: sendKeys(KEYCODE_DPAD_LEFT, KEYCODE_DPAD_CENTER).
 * @param keys The series of key codes to send through instrumentation.
 */
public void sendKeys(int... keys){
  final int count=keys.length;
  final Instrumentation instrumentation=getInstrumentation();
  for (int i=0; i < count; i++) {
    instrumentation.sendKeyDownUpSync(keys[i]);
  }
  instrumentation.waitForIdleSync();
}

Fixed version (ground truth):
/** 
 * Sends a series of key events through instrumentation and waits for idle. For instance: sendKeys(KEYCODE_DPAD_LEFT, KEYCODE_DPAD_CENTER).
 * @param keys The series of key codes to send through instrumentation.
 */
public void sendKeys(int... keys){
  final int count=keys.length;
  final Instrumentation instrumentation=getInstrumentation();
  for (int i=0; i < count; i++) {
    try {
      instrumentation.sendKeyDownUpSync(keys[i]);
    }
 catch (    SecurityException e) {
    }
  }
  instrumentation.waitForIdleSync();
}
Program: 183568
Project: 183568
Buggy source:
/** 
 * Sends a series of key events through instrumentation and waits for idle. Each key code must be preceded by the number of times the key code must be sent. For instance: sendRepeatedKeys(1, KEYCODE_DPAD_CENTER, 2, KEYCODE_DPAD_LEFT).
 * @param keys The series of key repeats and codes to send through instrumentation.
 */
public void sendRepeatedKeys(int... keys){
  final int count=keys.length;
  if ((count & 0x1) == 0x1) {
    throw new IllegalArgumentException("String_Node_Str" + "String_Node_Str");
  }
  final Instrumentation instrumentation=getInstrumentation();
  for (int i=0; i < count; i+=2) {
    final int keyCount=keys[i];
    final int keyCode=keys[i + 1];
    for (int j=0; j < keyCount; j++) {
      instrumentation.sendKeyDownUpSync(keyCode);
    }
  }
  instrumentation.waitForIdleSync();
}

Fixed version (ground truth):
/** 
 * Sends a series of key events through instrumentation and waits for idle. Each key code must be preceded by the number of times the key code must be sent. For instance: sendRepeatedKeys(1, KEYCODE_DPAD_CENTER, 2, KEYCODE_DPAD_LEFT).
 * @param keys The series of key repeats and codes to send through instrumentation.
 */
public void sendRepeatedKeys(int... keys){
  final int count=keys.length;
  if ((count & 0x1) == 0x1) {
    throw new IllegalArgumentException("String_Node_Str" + "String_Node_Str");
  }
  final Instrumentation instrumentation=getInstrumentation();
  for (int i=0; i < count; i+=2) {
    final int keyCount=keys[i];
    final int keyCode=keys[i + 1];
    for (int j=0; j < keyCount; j++) {
      try {
        instrumentation.sendKeyDownUpSync(keyCode);
      }
 catch (      SecurityException e) {
      }
    }
  }
  instrumentation.waitForIdleSync();
}
Program: 183569
Project: 183569
Buggy source:
TimeStats(Parcel in){
  final int[] localTimes=times;
  for (int i=0; i < NUM_LAUNCH_TIME_BINS; i++) {
    localTimes[i]=in.readInt();
  }
}

Fixed version (ground truth):
TimeStats(Parcel in){
  count=in.readInt();
  final int[] localTimes=times;
  for (int i=0; i < NUM_LAUNCH_TIME_BINS; i++) {
    localTimes[i]=in.readInt();
  }
}
Program: 183570
Project: 183570
Buggy source:
public void noteResumeComponent(ComponentName componentName){
  enforceCallingPermission();
  String pkgName;
  if ((componentName == null) || ((pkgName=componentName.getPackageName()) == null)) {
    return;
  }
  if ((mResumedPkg != null) && (mResumedPkg.equalsIgnoreCase(pkgName))) {
    return;
  }
  if (localLOGV)   Log.i(TAG,"String_Node_Str" + pkgName);
synchronized (mStatsLock) {
    PkgUsageStatsExtended pus=mStats.get(pkgName);
    if (pus == null) {
      pus=new PkgUsageStatsExtended();
      mStats.put(pkgName,pus);
    }
    pus.updateResume();
  }
  mResumedPkg=pkgName;
}

Fixed version (ground truth):
public void noteResumeComponent(ComponentName componentName){
  enforceCallingPermission();
  String pkgName;
synchronized (mStatsLock) {
    if ((componentName == null) || ((pkgName=componentName.getPackageName()) == null)) {
      return;
    }
    final boolean samePackage=pkgName.equals(mLastResumedPkg);
    if (mIsResumed) {
      if (samePackage) {
        Log.w(TAG,"String_Node_Str" + pkgName + "String_Node_Str");
        return;
      }
      if (mLastResumedPkg != null) {
        Log.w(TAG,"String_Node_Str" + pkgName + "String_Node_Str"+ mLastResumedPkg);
        PkgUsageStatsExtended pus=mStats.get(mLastResumedPkg);
        if (pus != null) {
          pus.updatePause();
        }
      }
    }
    final boolean sameComp=samePackage && componentName.getClassName().equals(mLastResumedComp);
    mIsResumed=true;
    mLastResumedPkg=pkgName;
    mLastResumedComp=componentName.getClassName();
    if (localLOGV)     Log.i(TAG,"String_Node_Str" + pkgName);
    PkgUsageStatsExtended pus=mStats.get(pkgName);
    if (pus == null) {
      pus=new PkgUsageStatsExtended();
      mStats.put(pkgName,pus);
    }
    pus.updateResume(!samePackage);
    if (!sameComp) {
      pus.addLaunchCount(mLastResumedComp);
    }
  }
}
Program: 183572
Project: 183572
Buggy source:
public void notePauseComponent(ComponentName componentName){
  enforceCallingPermission();
  String pkgName;
  if ((componentName == null) || ((pkgName=componentName.getPackageName()) == null)) {
    return;
  }
  if ((mResumedPkg == null) || (!pkgName.equalsIgnoreCase(mResumedPkg))) {
    Log.w(TAG,"String_Node_Str" + pkgName + "String_Node_Str");
    return;
  }
  if (localLOGV)   Log.i(TAG,"String_Node_Str" + pkgName);
  writeStatsToFile(false);
synchronized (mStatsLock) {
    PkgUsageStatsExtended pus=mStats.get(pkgName);
    if (pus == null) {
      Log.w(TAG,"String_Node_Str" + pkgName);
      return;
    }
    pus.updatePause();
  }
}

Fixed version (ground truth):
public void notePauseComponent(ComponentName componentName){
  enforceCallingPermission();
synchronized (mStatsLock) {
    String pkgName;
    if ((componentName == null) || ((pkgName=componentName.getPackageName()) == null)) {
      return;
    }
    if (!mIsResumed) {
      Log.w(TAG,"String_Node_Str" + pkgName + "String_Node_Str");
      return;
    }
    mIsResumed=false;
    if (localLOGV)     Log.i(TAG,"String_Node_Str" + pkgName);
    PkgUsageStatsExtended pus=mStats.get(pkgName);
    if (pus == null) {
      Log.w(TAG,"String_Node_Str" + pkgName);
      return;
    }
    pus.updatePause();
  }
  writeStatsToFile(false);
}
Program: 183573
Project: 183573
Buggy source:
void updateResume(){
  mLaunchCount++;
  mResumedTime=SystemClock.elapsedRealtime();
}

Fixed version (ground truth):
void updateResume(boolean launched){
  if (launched) {
    mLaunchCount++;
  }
  mResumedTime=SystemClock.elapsedRealtime();
}
Program: 183575
Project: 183575
Buggy source:
/** 
 * If tearDown is true, this only tears down a CONNECTED session. Presently, there is no mechanism for abandoning an INITING/CONNECTING session, but would likely involve cancelling pending async requests or setting a flag or new state to ignore them when they came in
 * @param tearDown true if the underlying DataConnection should bedisconnected.
 * @param reason reason for the clean up.
 */
private void cleanUpConnection(boolean tearDown,String reason){
  if (DBG)   log("String_Node_Str" + reason);
  if (mReconnectIntent != null) {
    AlarmManager am=(AlarmManager)phone.getContext().getSystemService(Context.ALARM_SERVICE);
    am.cancel(mReconnectIntent);
    mReconnectIntent=null;
  }
  for (  DataConnection connBase : dataConnectionList) {
    CdmaDataConnection conn=(CdmaDataConnection)connBase;
    if (conn != null) {
      if (tearDown) {
        Message msg=obtainMessage(EVENT_DISCONNECT_DONE,reason);
        conn.disconnect(msg);
      }
 else {
        conn.clearSettings();
      }
    }
  }
  stopNetStatPoll();
  if (!tearDown) {
    setState(State.IDLE);
    phone.notifyDataConnection(reason);
  }
 else   if (state != State.IDLE) {
    setState(State.DISCONNECTING);
  }
}

Fixed version (ground truth):
/** 
 * If tearDown is true, this only tears down a CONNECTED session. Presently, there is no mechanism for abandoning an INITING/CONNECTING session, but would likely involve cancelling pending async requests or setting a flag or new state to ignore them when they came in
 * @param tearDown true if the underlying DataConnection should bedisconnected.
 * @param reason reason for the clean up.
 */
private void cleanUpConnection(boolean tearDown,String reason){
  if (DBG)   log("String_Node_Str" + reason);
  if (mReconnectIntent != null) {
    AlarmManager am=(AlarmManager)phone.getContext().getSystemService(Context.ALARM_SERVICE);
    am.cancel(mReconnectIntent);
    mReconnectIntent=null;
  }
  setState(State.DISCONNECTING);
  for (  DataConnection connBase : dataConnectionList) {
    CdmaDataConnection conn=(CdmaDataConnection)connBase;
    if (conn != null) {
      if (tearDown) {
        Message msg=obtainMessage(EVENT_DISCONNECT_DONE,reason);
        conn.disconnect(msg);
      }
 else {
        conn.clearSettings();
      }
    }
  }
  stopNetStatPoll();
  if (!tearDown) {
    setState(State.IDLE);
    phone.notifyDataConnection(reason);
  }
}
Program: 183576
Project: 183576
Buggy source:
/** 
 * @override com.android.internal.telephony.DataConnectionTracker
 */
protected void onVoiceCallEnded(){
  if (state == State.CONNECTED) {
    if (!mCdmaPhone.mSST.isConcurrentVoiceAndData()) {
      startNetStatPoll();
      phone.notifyDataConnection(Phone.REASON_VOICE_CALL_ENDED);
    }
 else {
      resetPollStats();
    }
  }
 else {
    trySetupData(Phone.REASON_VOICE_CALL_ENDED);
  }
}

Fixed version (ground truth):
/** 
 * @override com.android.internal.telephony.DataConnectionTracker
 */
protected void onVoiceCallEnded(){
  if (state == State.CONNECTED) {
    if (!mCdmaPhone.mSST.isConcurrentVoiceAndData()) {
      startNetStatPoll();
      phone.notifyDataConnection(Phone.REASON_VOICE_CALL_ENDED);
    }
 else {
      resetPollStats();
    }
  }
 else {
    nextReconnectDelay=RECONNECT_DELAY_INITIAL_MILLIS;
    trySetupData(Phone.REASON_VOICE_CALL_ENDED);
  }
}
Program: 183577
Project: 183577
Buggy source:
/** 
 * If tearDown is true, this only tears down a CONNECTED session. Presently, there is no mechanism for abandoning an INITING/CONNECTING session, but would likely involve cancelling pending async requests or setting a flag or new state to ignore them when they came in
 * @param tearDown true if the underlying PdpConnection should bedisconnected.
 * @param reason reason for the clean up.
 */
private void cleanUpConnection(boolean tearDown,String reason){
  if (DBG)   log("String_Node_Str" + reason);
  if (mReconnectIntent != null) {
    AlarmManager am=(AlarmManager)phone.getContext().getSystemService(Context.ALARM_SERVICE);
    am.cancel(mReconnectIntent);
    mReconnectIntent=null;
  }
  for (  DataConnection conn : pdpList) {
    PdpConnection pdp=(PdpConnection)conn;
    if (tearDown) {
      Message msg=obtainMessage(EVENT_DISCONNECT_DONE,reason);
      pdp.disconnect(msg);
    }
 else {
      pdp.clearSettings();
    }
  }
  stopNetStatPoll();
  if (!tearDown) {
    setState(State.IDLE);
    phone.notifyDataConnection(reason);
    mActiveApn=null;
  }
 else   if (state != State.IDLE) {
    setState(State.DISCONNECTING);
  }
}

Fixed version (ground truth):
/** 
 * If tearDown is true, this only tears down a CONNECTED session. Presently, there is no mechanism for abandoning an INITING/CONNECTING session, but would likely involve cancelling pending async requests or setting a flag or new state to ignore them when they came in
 * @param tearDown true if the underlying PdpConnection should bedisconnected.
 * @param reason reason for the clean up.
 */
private void cleanUpConnection(boolean tearDown,String reason){
  if (DBG)   log("String_Node_Str" + reason);
  if (mReconnectIntent != null) {
    AlarmManager am=(AlarmManager)phone.getContext().getSystemService(Context.ALARM_SERVICE);
    am.cancel(mReconnectIntent);
    mReconnectIntent=null;
  }
  setState(State.DISCONNECTING);
  for (  DataConnection conn : pdpList) {
    PdpConnection pdp=(PdpConnection)conn;
    if (tearDown) {
      Message msg=obtainMessage(EVENT_DISCONNECT_DONE,reason);
      pdp.disconnect(msg);
    }
 else {
      pdp.clearSettings();
    }
  }
  stopNetStatPoll();
  if (!tearDown) {
    setState(State.IDLE);
    phone.notifyDataConnection(reason);
    mActiveApn=null;
  }
}
Program: 183578
Project: 183578
Buggy source:
/** 
 * Handles changes to the APN database.
 */
private void onApnChanged(){
  boolean isConnected;
  isConnected=(state != State.IDLE && state != State.FAILED);
  ((GSMPhone)phone).updateCurrentCarrierInProvider();
  createAllApnList();
  if (state != State.DISCONNECTING) {
    cleanUpConnection(isConnected,Phone.REASON_APN_CHANGED);
    if (!isConnected) {
      trySetupData(Phone.REASON_APN_CHANGED);
    }
  }
}

Fixed version (ground truth):
/** 
 * Handles changes to the APN database.
 */
private void onApnChanged(){
  boolean isConnected;
  isConnected=(state != State.IDLE && state != State.FAILED);
  ((GSMPhone)phone).updateCurrentCarrierInProvider();
  createAllApnList();
  if (state != State.DISCONNECTING) {
    cleanUpConnection(isConnected,Phone.REASON_APN_CHANGED);
    if (!isConnected) {
      nextReconnectDelay=RECONNECT_DELAY_INITIAL_MILLIS;
      trySetupData(Phone.REASON_APN_CHANGED);
    }
  }
}
Program: 183579
Project: 183579
Buggy source:
protected void onVoiceCallEnded(){
  if (state == State.CONNECTED) {
    if (!((GSMPhone)phone).mSST.isConcurrentVoiceAndData()) {
      startNetStatPoll();
      phone.notifyDataConnection(Phone.REASON_VOICE_CALL_ENDED);
    }
 else {
      resetPollStats();
    }
  }
 else {
    trySetupData(Phone.REASON_VOICE_CALL_ENDED);
  }
}

Fixed version (ground truth):
protected void onVoiceCallEnded(){
  if (state == State.CONNECTED) {
    if (!((GSMPhone)phone).mSST.isConcurrentVoiceAndData()) {
      startNetStatPoll();
      phone.notifyDataConnection(Phone.REASON_VOICE_CALL_ENDED);
    }
 else {
      resetPollStats();
    }
  }
 else {
    nextReconnectDelay=RECONNECT_DELAY_INITIAL_MILLIS;
    trySetupData(Phone.REASON_VOICE_CALL_ENDED);
  }
}
Program: 183580
Project: 183580
Buggy source:
public int performBackup(PackageInfo packageInfo,ParcelFileDescriptor data) throws RemoteException {
  File packageDir=new File(mDataDir,packageInfo.packageName);
  File imageFileName=new File(packageDir,DATA_FILE_NAME);
  return -1;
}

Fixed version (ground truth):
public int performBackup(PackageInfo packageInfo,ParcelFileDescriptor data) throws RemoteException {
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + packageInfo.packageName);
  int err=0;
  File packageDir=new File(mDataDir,packageInfo.packageName);
  packageDir.mkdirs();
  BackupDataInput changeSet=new BackupDataInput(data.getFileDescriptor());
  try {
    int bufSize=512;
    byte[] buf=new byte[bufSize];
    while (changeSet.readNextHeader()) {
      String key=changeSet.getKey();
      int dataSize=changeSet.getDataSize();
      if (DEBUG)       Log.v(TAG,"String_Node_Str" + key + "String_Node_Str"+ dataSize);
      if (dataSize > bufSize) {
        bufSize=dataSize;
        buf=new byte[bufSize];
      }
      changeSet.readEntityData(buf,dataSize);
      if (DEBUG)       Log.v(TAG,"String_Node_Str" + dataSize);
      File entityFile=new File(packageDir,key);
      FileOutputStream entity=new FileOutputStream(entityFile);
      try {
        entity.write(buf,0,dataSize);
      }
 catch (      IOException e) {
        Log.e(TAG,"String_Node_Str" + entityFile.getAbsolutePath());
        err=-1;
      }
 finally {
        entity.close();
      }
    }
  }
 catch (  IOException e) {
    Log.v(TAG,"String_Node_Str");
    e.printStackTrace();
    err=-1;
  }
  return err;
}
Program: 183581
Project: 183581
Buggy source:
public int endSession() throws RemoteException {
  return 0;
}

Fixed version (ground truth):
public int endSession() throws RemoteException {
  if (DEBUG)   Log.v(TAG,"String_Node_Str");
  return 0;
}
Program: 183582
Project: 183582
Buggy source:
public int startSession() throws RemoteException {
  return 0;
}

Fixed version (ground truth):
public int startSession() throws RemoteException {
  if (DEBUG)   Log.v(TAG,"String_Node_Str");
  mDataDir.mkdirs();
  return 0;
}
Program: 183583
Project: 183583
Buggy source:
public int getRestoreData(int token,PackageInfo packageInfo,ParcelFileDescriptor output) throws android.os.RemoteException {
  if (token != 0)   return -1;
  File packageDir=new File(mDataDir,packageInfo.packageName);
  File imageFile=new File(packageDir,DATA_FILE_NAME);
  return copyFileToFD(imageFile,output);
}

Fixed version (ground truth):
public int getRestoreData(int token,PackageInfo packageInfo,ParcelFileDescriptor output) throws android.os.RemoteException {
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + token + "String_Node_Str"+ packageInfo.packageName);
  if (token != 0)   return -1;
  File packageDir=new File(mDataDir,packageInfo.packageName);
  File[] blobs=packageDir.listFiles();
  int err=0;
  if (blobs != null && blobs.length > 0) {
    for (    File f : blobs) {
      err=copyFileToFD(f,output);
      if (err != 0)       break;
    }
  }
  return err;
}
Program: 183584
Project: 183584
Buggy source:
public PackageInfo[] getAppSet(int token) throws android.os.RemoteException {
  File[] packageDirs=mDataDir.listFiles(mDirFileFilter);
  ArrayList<PackageInfo> packages=new ArrayList<PackageInfo>();
  for (  File dir : packageDirs) {
    try {
      PackageInfo pkg=mPackageManager.getPackageInfo(dir.getName(),PackageManager.GET_SIGNATURES);
      if (pkg != null) {
        packages.add(pkg);
      }
    }
 catch (    NameNotFoundException e) {
    }
  }
  Log.v(TAG,"String_Node_Str" + packages.size() + "String_Node_Str");
  for (  PackageInfo p : packages) {
    Log.v(TAG,"String_Node_Str" + p.packageName);
  }
  PackageInfo[] result=new PackageInfo[packages.size()];
  return packages.toArray(result);
}

Fixed version (ground truth):
public PackageInfo[] getAppSet(int token) throws android.os.RemoteException {
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + token);
  File[] packageDirs=mDataDir.listFiles(mDirFileFilter);
  ArrayList<PackageInfo> packages=new ArrayList<PackageInfo>();
  for (  File dir : packageDirs) {
    try {
      PackageInfo pkg=mPackageManager.getPackageInfo(dir.getName(),PackageManager.GET_SIGNATURES);
      if (pkg != null) {
        packages.add(pkg);
      }
    }
 catch (    NameNotFoundException e) {
    }
  }
  if (DEBUG) {
    Log.v(TAG,"String_Node_Str" + packages.size() + "String_Node_Str");
    for (    PackageInfo p : packages) {
      Log.v(TAG,"String_Node_Str" + p.packageName);
    }
  }
  PackageInfo[] result=new PackageInfo[packages.size()];
  return packages.toArray(result);
}
Program: 183585
Project: 183585
Buggy source:
public LocalTransport(Context context){
  mContext=context;
  mPackageManager=context.getPackageManager();
}

Fixed version (ground truth):
public LocalTransport(Context context){
  if (DEBUG)   Log.v(TAG,"String_Node_Str");
  mContext=context;
  mPackageManager=context.getPackageManager();
}