nus-yam/ex-repair huggingface dataset:
Program: 1021
Project: 1021
Buggy source:
@Override public boolean bindService(Intent service,ServiceConnection conn,int flags){
  warnIfCallingFromSystemProcess();
  return bindServiceAsUser(service,conn,flags,Process.myUserHandle());
}

Fixed version (ground truth):
@Override public boolean bindService(Intent service,ServiceConnection conn,int flags){
  warnIfCallingFromSystemProcess();
  return bindServiceCommon(service,conn,flags,Process.myUserHandle());
}
Program: 1022
Project: 1022
Buggy source:
@Override public ComponentName startServiceAsUser(Intent service,UserHandle user){
  try {
    if (service.getComponent() == null && service.getPackage() == null) {
      if (getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.KITKAT) {
        IllegalArgumentException ex=new IllegalArgumentException("String_Node_Str" + service);
        Log.e(TAG,"String_Node_Str",ex);
      }
    }
    service.prepareToLeaveProcess();
    ComponentName cn=ActivityManagerNative.getDefault().startService(mMainThread.getApplicationThread(),service,service.resolveTypeIfNeeded(getContentResolver()),user.getIdentifier());
    if (cn != null) {
      if (cn.getPackageName().equals("String_Node_Str")) {
        throw new SecurityException("String_Node_Str" + service + "String_Node_Str"+ cn.getClassName());
      }
 else       if (cn.getPackageName().equals("String_Node_Str")) {
        throw new SecurityException("String_Node_Str" + service + "String_Node_Str"+ cn.getClassName());
      }
    }
    return cn;
  }
 catch (  RemoteException e) {
    return null;
  }
}

Fixed version (ground truth):
@Override public ComponentName startServiceAsUser(Intent service,UserHandle user){
  return startServiceCommon(service,user);
}
Program: 1023
Project: 1023
Buggy source:
@Override public boolean stopServiceAsUser(Intent service,UserHandle user){
  try {
    if (service.getComponent() == null && service.getPackage() == null) {
      if (getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.KITKAT) {
        IllegalArgumentException ex=new IllegalArgumentException("String_Node_Str" + service);
        Log.e(TAG,"String_Node_Str",ex);
      }
    }
    service.prepareToLeaveProcess();
    int res=ActivityManagerNative.getDefault().stopService(mMainThread.getApplicationThread(),service,service.resolveTypeIfNeeded(getContentResolver()),user.getIdentifier());
    if (res < 0) {
      throw new SecurityException("String_Node_Str" + service);
    }
    return res != 0;
  }
 catch (  RemoteException e) {
    return false;
  }
}

Fixed version (ground truth):
@Override public boolean stopServiceAsUser(Intent service,UserHandle user){
  return stopServiceCommon(service,user);
}
Program: 1024
Project: 1024
Buggy source:
/** 
 * @hide 
 */
@Override public boolean bindServiceAsUser(Intent service,ServiceConnection conn,int flags,UserHandle user){
  IServiceConnection sd;
  if (conn == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (mPackageInfo != null) {
    sd=mPackageInfo.getServiceDispatcher(conn,getOuterContext(),mMainThread.getHandler(),flags);
  }
 else {
    throw new RuntimeException("String_Node_Str");
  }
  if (service.getComponent() == null && service.getPackage() == null) {
    if (getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.KITKAT) {
      IllegalArgumentException ex=new IllegalArgumentException("String_Node_Str" + service);
      Log.e(TAG,"String_Node_Str",ex);
    }
  }
  try {
    IBinder token=getActivityToken();
    if (token == null && (flags & BIND_AUTO_CREATE) == 0 && mPackageInfo != null && mPackageInfo.getApplicationInfo().targetSdkVersion < android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
      flags|=BIND_WAIVE_PRIORITY;
    }
    service.prepareToLeaveProcess();
    int res=ActivityManagerNative.getDefault().bindService(mMainThread.getApplicationThread(),getActivityToken(),service,service.resolveTypeIfNeeded(getContentResolver()),sd,flags,user.getIdentifier());
    if (res < 0) {
      throw new SecurityException("String_Node_Str" + service);
    }
    return res != 0;
  }
 catch (  RemoteException e) {
    return false;
  }
}

Fixed version (ground truth):
/** 
 * @hide 
 */
@Override public boolean bindServiceAsUser(Intent service,ServiceConnection conn,int flags,UserHandle user){
  return bindServiceCommon(service,conn,flags,user);
}
Program: 1025
Project: 1025
Buggy source:
@Override public ComponentName startService(Intent service){
  warnIfCallingFromSystemProcess();
  return startServiceAsUser(service,mUser);
}

Fixed version (ground truth):
@Override public ComponentName startService(Intent service){
  warnIfCallingFromSystemProcess();
  return startServiceCommon(service,mUser);
}
Program: 1026
Project: 1026
Buggy source:
@Override public boolean stopService(Intent service){
  warnIfCallingFromSystemProcess();
  return stopServiceAsUser(service,mUser);
}

Fixed version (ground truth):
@Override public boolean stopService(Intent service){
  warnIfCallingFromSystemProcess();
  return stopServiceCommon(service,mUser);
}
Program: 1027
Project: 1027
Buggy source:
/** 
 * TODO: optimize this later (getting just the value part of a Bundle with a single pair) once Bundle.forPair() above is implemented with a special single-value Map implementation/serialization. Note: value in single-pair Bundle may be null.
 * @hide
 */
public String getPairValue(){
  unparcel();
  int size=mMap.size();
  if (size > 1) {
    Log.w(LOG_TAG,"String_Node_Str");
  }
  if (size == 0) {
    return null;
  }
  Object o=mMap.valueAt(0);
  try {
    return (String)o;
  }
 catch (  ClassCastException e) {
    typeWarning("String_Node_Str",o,"String_Node_Str",e);
    return null;
  }
}

Fixed version (ground truth):
/** 
 * TODO: optimize this later (getting just the value part of a Bundle with a single pair) once Bundle.forPair() above is implemented with a special single-value Map implementation/serialization. Note: value in single-pair Bundle may be null.
 * @hide
 */
public String getPairValue(){
  unparcel();
  int size=mMap.size();
  if (size > 1) {
    Log.w(TAG,"String_Node_Str");
  }
  if (size == 0) {
    return null;
  }
  Object o=mMap.valueAt(0);
  try {
    return (String)o;
  }
 catch (  ClassCastException e) {
    typeWarning("String_Node_Str",o,"String_Node_Str",e);
    return null;
  }
}
Program: 1028
Project: 1028
Buggy source:
/** 
 * Writes the Bundle contents to a Parcel, typically in order for it to be passed through an IBinder connection.
 * @param parcel The parcel to copy this bundle to.
 */
public void writeToParcel(Parcel parcel,int flags){
  final boolean oldAllowFds=parcel.pushAllowFds(mAllowFds);
  try {
    if (mParcelledData != null) {
      int length=mParcelledData.dataSize();
      parcel.writeInt(length);
      parcel.writeInt(BUNDLE_MAGIC);
      parcel.appendFrom(mParcelledData,0,length);
    }
 else {
      parcel.writeInt(-1);
      parcel.writeInt(BUNDLE_MAGIC);
      int oldPos=parcel.dataPosition();
      parcel.writeArrayMapInternal(mMap);
      int newPos=parcel.dataPosition();
      parcel.setDataPosition(oldPos - 8);
      int length=newPos - oldPos;
      parcel.writeInt(length);
      parcel.setDataPosition(newPos);
    }
  }
  finally {
    parcel.restoreAllowFds(oldAllowFds);
  }
}

Fixed version (ground truth):
/** 
 * Writes the Bundle contents to a Parcel, typically in order for it to be passed through an IBinder connection.
 * @param parcel The parcel to copy this bundle to.
 */
public void writeToParcel(Parcel parcel,int flags){
  final boolean oldAllowFds=parcel.pushAllowFds(mAllowFds);
  try {
    if (mParcelledData != null) {
      int length=mParcelledData.dataSize();
      parcel.writeInt(length);
      parcel.writeInt(BUNDLE_MAGIC);
      parcel.appendFrom(mParcelledData,0,length);
    }
 else {
      int lengthPos=parcel.dataPosition();
      parcel.writeInt(-1);
      parcel.writeInt(BUNDLE_MAGIC);
      int startPos=parcel.dataPosition();
      parcel.writeArrayMapInternal(mMap);
      int endPos=parcel.dataPosition();
      parcel.setDataPosition(lengthPos);
      int length=endPos - startPos;
      parcel.writeInt(length);
      parcel.setDataPosition(endPos);
    }
  }
  finally {
    parcel.restoreAllowFds(oldAllowFds);
  }
}
Program: 1029
Project: 1029
Buggy source:
/** 
 * If the underlying data are stored as a Parcel, unparcel them using the currently assigned class loader.
 */
synchronized void unparcel(){
  if (mParcelledData == null) {
    return;
  }
  int N=mParcelledData.readInt();
  if (N < 0) {
    return;
  }
  if (mMap == null) {
    mMap=new ArrayMap<String,Object>(N);
  }
 else {
    mMap.erase();
    mMap.ensureCapacity(N);
  }
  mParcelledData.readArrayMapInternal(mMap,N,mClassLoader);
  mParcelledData.recycle();
  mParcelledData=null;
}

Fixed version (ground truth):
/** 
 * If the underlying data are stored as a Parcel, unparcel them using the currently assigned class loader.
 */
synchronized void unparcel(){
  if (mParcelledData == null) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str" + Integer.toHexString(System.identityHashCode(this)) + "String_Node_Str");
    return;
  }
  int N=mParcelledData.readInt();
  if (DEBUG)   Log.d(TAG,"String_Node_Str" + Integer.toHexString(System.identityHashCode(this)) + "String_Node_Str"+ N+ "String_Node_Str");
  if (N < 0) {
    return;
  }
  if (mMap == null) {
    mMap=new ArrayMap<String,Object>(N);
  }
 else {
    mMap.erase();
    mMap.ensureCapacity(N);
  }
  mParcelledData.readArrayMapInternal(mMap,N,mClassLoader);
  mParcelledData.recycle();
  mParcelledData=null;
  if (DEBUG)   Log.d(TAG,"String_Node_Str" + Integer.toHexString(System.identityHashCode(this)) + "String_Node_Str"+ mMap);
}
Program: 1030
Project: 1030
Buggy source:
void readFromParcelInner(Parcel parcel,int length){
  int magic=parcel.readInt();
  if (magic != BUNDLE_MAGIC) {
    throw new IllegalStateException("String_Node_Str" + Integer.toHexString(magic));
  }
  int offset=parcel.dataPosition();
  parcel.setDataPosition(offset + length);
  Parcel p=Parcel.obtain();
  p.setDataPosition(0);
  p.appendFrom(parcel,offset,length);
  p.setDataPosition(0);
  if (mMap != null) {
    if (mFdsKnown) {
      mHasFds|=p.hasFileDescriptors();
    }
    int N=p.readInt();
    p.readArrayMapSafelyInternal(mMap,N,mClassLoader);
    p.recycle();
  }
 else {
    mParcelledData=p;
    mHasFds=p.hasFileDescriptors();
    mFdsKnown=true;
  }
}

Fixed version (ground truth):
void readFromParcelInner(Parcel parcel,int length){
  int magic=parcel.readInt();
  if (magic != BUNDLE_MAGIC) {
    throw new IllegalStateException("String_Node_Str" + Integer.toHexString(magic));
  }
  int offset=parcel.dataPosition();
  parcel.setDataPosition(offset + length);
  Parcel p=Parcel.obtain();
  p.setDataPosition(0);
  p.appendFrom(parcel,offset,length);
  if (DEBUG)   Log.d(TAG,"String_Node_Str" + Integer.toHexString(System.identityHashCode(this)) + "String_Node_Str"+ length+ "String_Node_Str"+ offset);
  p.setDataPosition(0);
  mParcelledData=p;
  mHasFds=p.hasFileDescriptors();
  mFdsKnown=true;
}
Program: 1031
Project: 1031
Buggy source:
/** 
 * Read and return a new Bundle object from the parcel at the current dataPosition(), using the given class loader to initialize the class loader of the Bundle for later retrieval of Parcelable objects. Returns null if the previously written Bundle object was null.
 */
public final Bundle readBundle(ClassLoader loader){
  int length=readInt();
  if (length < 0) {
    return null;
  }
  final Bundle bundle=new Bundle(this,length);
  if (loader != null) {
    bundle.setClassLoader(loader);
  }
  return bundle;
}

Fixed version (ground truth):
/** 
 * Read and return a new Bundle object from the parcel at the current dataPosition(), using the given class loader to initialize the class loader of the Bundle for later retrieval of Parcelable objects. Returns null if the previously written Bundle object was null.
 */
public final Bundle readBundle(ClassLoader loader){
  int length=readInt();
  if (length < 0) {
    if (Bundle.DEBUG)     Log.d(TAG,"String_Node_Str" + length);
    return null;
  }
  final Bundle bundle=new Bundle(this,length);
  if (loader != null) {
    bundle.setClassLoader(loader);
  }
  return bundle;
}
Program: 1032
Project: 1032
Buggy source:
/** 
 * @hide Like  {@link #clear}, but doesn't reduce the capacity of the ArrayMap.
 */
public void erase(){
  if (mSize > 0) {
    final int N=mSize << 1;
    final Object[] array=mArray;
    for (int i=0; i < N; i++) {
      array[i]=null;
    }
  }
}

Fixed version (ground truth):
/** 
 * @hide Like  {@link #clear}, but doesn't reduce the capacity of the ArrayMap.
 */
public void erase(){
  if (mSize > 0) {
    final int N=mSize << 1;
    final Object[] array=mArray;
    for (int i=0; i < N; i++) {
      array[i]=null;
    }
    mSize=0;
  }
}
Program: 1033
Project: 1033
Buggy source:
@Override public boolean bindService(Intent service,ServiceConnection conn,int flags){
  warnIfCallingFromSystemProcess();
  return bindServiceAsUser(service,conn,flags,Process.myUserHandle());
}

Fixed version (ground truth):
@Override public boolean bindService(Intent service,ServiceConnection conn,int flags){
  warnIfCallingFromSystemProcess();
  return bindServiceCommon(service,conn,flags,Process.myUserHandle());
}
Program: 1034
Project: 1034
Buggy source:
@Override public ComponentName startServiceAsUser(Intent service,UserHandle user){
  try {
    if (service.getComponent() == null && service.getPackage() == null) {
      if (getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.KITKAT) {
        IllegalArgumentException ex=new IllegalArgumentException("String_Node_Str" + service);
        Log.e(TAG,"String_Node_Str",ex);
      }
    }
    service.prepareToLeaveProcess();
    ComponentName cn=ActivityManagerNative.getDefault().startService(mMainThread.getApplicationThread(),service,service.resolveTypeIfNeeded(getContentResolver()),user.getIdentifier());
    if (cn != null) {
      if (cn.getPackageName().equals("String_Node_Str")) {
        throw new SecurityException("String_Node_Str" + service + "String_Node_Str"+ cn.getClassName());
      }
 else       if (cn.getPackageName().equals("String_Node_Str")) {
        throw new SecurityException("String_Node_Str" + service + "String_Node_Str"+ cn.getClassName());
      }
    }
    return cn;
  }
 catch (  RemoteException e) {
    return null;
  }
}

Fixed version (ground truth):
@Override public ComponentName startServiceAsUser(Intent service,UserHandle user){
  return startServiceCommon(service,user);
}
Program: 1035
Project: 1035
Buggy source:
@Override public boolean stopServiceAsUser(Intent service,UserHandle user){
  try {
    if (service.getComponent() == null && service.getPackage() == null) {
      if (getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.KITKAT) {
        IllegalArgumentException ex=new IllegalArgumentException("String_Node_Str" + service);
        Log.e(TAG,"String_Node_Str",ex);
      }
    }
    service.prepareToLeaveProcess();
    int res=ActivityManagerNative.getDefault().stopService(mMainThread.getApplicationThread(),service,service.resolveTypeIfNeeded(getContentResolver()),user.getIdentifier());
    if (res < 0) {
      throw new SecurityException("String_Node_Str" + service);
    }
    return res != 0;
  }
 catch (  RemoteException e) {
    return false;
  }
}

Fixed version (ground truth):
@Override public boolean stopServiceAsUser(Intent service,UserHandle user){
  return stopServiceCommon(service,user);
}
Program: 1036
Project: 1036
Buggy source:
/** 
 * @hide 
 */
@Override public boolean bindServiceAsUser(Intent service,ServiceConnection conn,int flags,UserHandle user){
  IServiceConnection sd;
  if (conn == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (mPackageInfo != null) {
    sd=mPackageInfo.getServiceDispatcher(conn,getOuterContext(),mMainThread.getHandler(),flags);
  }
 else {
    throw new RuntimeException("String_Node_Str");
  }
  if (service.getComponent() == null && service.getPackage() == null) {
    if (getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.KITKAT) {
      IllegalArgumentException ex=new IllegalArgumentException("String_Node_Str" + service);
      Log.e(TAG,"String_Node_Str",ex);
    }
  }
  try {
    IBinder token=getActivityToken();
    if (token == null && (flags & BIND_AUTO_CREATE) == 0 && mPackageInfo != null && mPackageInfo.getApplicationInfo().targetSdkVersion < android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
      flags|=BIND_WAIVE_PRIORITY;
    }
    service.prepareToLeaveProcess();
    int res=ActivityManagerNative.getDefault().bindService(mMainThread.getApplicationThread(),getActivityToken(),service,service.resolveTypeIfNeeded(getContentResolver()),sd,flags,user.getIdentifier());
    if (res < 0) {
      throw new SecurityException("String_Node_Str" + service);
    }
    return res != 0;
  }
 catch (  RemoteException e) {
    return false;
  }
}

Fixed version (ground truth):
/** 
 * @hide 
 */
@Override public boolean bindServiceAsUser(Intent service,ServiceConnection conn,int flags,UserHandle user){
  return bindServiceCommon(service,conn,flags,user);
}
Program: 1037
Project: 1037
Buggy source:
@Override public ComponentName startService(Intent service){
  warnIfCallingFromSystemProcess();
  return startServiceAsUser(service,mUser);
}

Fixed version (ground truth):
@Override public ComponentName startService(Intent service){
  warnIfCallingFromSystemProcess();
  return startServiceCommon(service,mUser);
}
Program: 1038
Project: 1038
Buggy source:
@Override public boolean stopService(Intent service){
  warnIfCallingFromSystemProcess();
  return stopServiceAsUser(service,mUser);
}

Fixed version (ground truth):
@Override public boolean stopService(Intent service){
  warnIfCallingFromSystemProcess();
  return stopServiceCommon(service,mUser);
}
Program: 1039
Project: 1039
Buggy source:
/** 
 * TODO: optimize this later (getting just the value part of a Bundle with a single pair) once Bundle.forPair() above is implemented with a special single-value Map implementation/serialization. Note: value in single-pair Bundle may be null.
 * @hide
 */
public String getPairValue(){
  unparcel();
  int size=mMap.size();
  if (size > 1) {
    Log.w(LOG_TAG,"String_Node_Str");
  }
  if (size == 0) {
    return null;
  }
  Object o=mMap.valueAt(0);
  try {
    return (String)o;
  }
 catch (  ClassCastException e) {
    typeWarning("String_Node_Str",o,"String_Node_Str",e);
    return null;
  }
}

Fixed version (ground truth):
/** 
 * TODO: optimize this later (getting just the value part of a Bundle with a single pair) once Bundle.forPair() above is implemented with a special single-value Map implementation/serialization. Note: value in single-pair Bundle may be null.
 * @hide
 */
public String getPairValue(){
  unparcel();
  int size=mMap.size();
  if (size > 1) {
    Log.w(TAG,"String_Node_Str");
  }
  if (size == 0) {
    return null;
  }
  Object o=mMap.valueAt(0);
  try {
    return (String)o;
  }
 catch (  ClassCastException e) {
    typeWarning("String_Node_Str",o,"String_Node_Str",e);
    return null;
  }
}
Program: 1040
Project: 1040
Buggy source:
/** 
 * Writes the Bundle contents to a Parcel, typically in order for it to be passed through an IBinder connection.
 * @param parcel The parcel to copy this bundle to.
 */
public void writeToParcel(Parcel parcel,int flags){
  final boolean oldAllowFds=parcel.pushAllowFds(mAllowFds);
  try {
    if (mParcelledData != null) {
      int length=mParcelledData.dataSize();
      parcel.writeInt(length);
      parcel.writeInt(BUNDLE_MAGIC);
      parcel.appendFrom(mParcelledData,0,length);
    }
 else {
      parcel.writeInt(-1);
      parcel.writeInt(BUNDLE_MAGIC);
      int oldPos=parcel.dataPosition();
      parcel.writeArrayMapInternal(mMap);
      int newPos=parcel.dataPosition();
      parcel.setDataPosition(oldPos - 8);
      int length=newPos - oldPos;
      parcel.writeInt(length);
      parcel.setDataPosition(newPos);
    }
  }
  finally {
    parcel.restoreAllowFds(oldAllowFds);
  }
}

Fixed version (ground truth):
/** 
 * Writes the Bundle contents to a Parcel, typically in order for it to be passed through an IBinder connection.
 * @param parcel The parcel to copy this bundle to.
 */
public void writeToParcel(Parcel parcel,int flags){
  final boolean oldAllowFds=parcel.pushAllowFds(mAllowFds);
  try {
    if (mParcelledData != null) {
      int length=mParcelledData.dataSize();
      parcel.writeInt(length);
      parcel.writeInt(BUNDLE_MAGIC);
      parcel.appendFrom(mParcelledData,0,length);
    }
 else {
      int lengthPos=parcel.dataPosition();
      parcel.writeInt(-1);
      parcel.writeInt(BUNDLE_MAGIC);
      int startPos=parcel.dataPosition();
      parcel.writeArrayMapInternal(mMap);
      int endPos=parcel.dataPosition();
      parcel.setDataPosition(lengthPos);
      int length=endPos - startPos;
      parcel.writeInt(length);
      parcel.setDataPosition(endPos);
    }
  }
  finally {
    parcel.restoreAllowFds(oldAllowFds);
  }
}
Program: 1041
Project: 1041
Buggy source:
/** 
 * If the underlying data are stored as a Parcel, unparcel them using the currently assigned class loader.
 */
synchronized void unparcel(){
  if (mParcelledData == null) {
    return;
  }
  int N=mParcelledData.readInt();
  if (N < 0) {
    return;
  }
  if (mMap == null) {
    mMap=new ArrayMap<String,Object>(N);
  }
 else {
    mMap.erase();
    mMap.ensureCapacity(N);
  }
  mParcelledData.readArrayMapInternal(mMap,N,mClassLoader);
  mParcelledData.recycle();
  mParcelledData=null;
}

Fixed version (ground truth):
/** 
 * If the underlying data are stored as a Parcel, unparcel them using the currently assigned class loader.
 */
synchronized void unparcel(){
  if (mParcelledData == null) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str" + Integer.toHexString(System.identityHashCode(this)) + "String_Node_Str");
    return;
  }
  int N=mParcelledData.readInt();
  if (DEBUG)   Log.d(TAG,"String_Node_Str" + Integer.toHexString(System.identityHashCode(this)) + "String_Node_Str"+ N+ "String_Node_Str");
  if (N < 0) {
    return;
  }
  if (mMap == null) {
    mMap=new ArrayMap<String,Object>(N);
  }
 else {
    mMap.erase();
    mMap.ensureCapacity(N);
  }
  mParcelledData.readArrayMapInternal(mMap,N,mClassLoader);
  mParcelledData.recycle();
  mParcelledData=null;
  if (DEBUG)   Log.d(TAG,"String_Node_Str" + Integer.toHexString(System.identityHashCode(this)) + "String_Node_Str"+ mMap);
}
Program: 1042
Project: 1042
Buggy source:
void readFromParcelInner(Parcel parcel,int length){
  int magic=parcel.readInt();
  if (magic != BUNDLE_MAGIC) {
    throw new IllegalStateException("String_Node_Str" + Integer.toHexString(magic));
  }
  int offset=parcel.dataPosition();
  parcel.setDataPosition(offset + length);
  Parcel p=Parcel.obtain();
  p.setDataPosition(0);
  p.appendFrom(parcel,offset,length);
  p.setDataPosition(0);
  if (mMap != null) {
    if (mFdsKnown) {
      mHasFds|=p.hasFileDescriptors();
    }
    int N=p.readInt();
    p.readArrayMapSafelyInternal(mMap,N,mClassLoader);
    p.recycle();
  }
 else {
    mParcelledData=p;
    mHasFds=p.hasFileDescriptors();
    mFdsKnown=true;
  }
}

Fixed version (ground truth):
void readFromParcelInner(Parcel parcel,int length){
  int magic=parcel.readInt();
  if (magic != BUNDLE_MAGIC) {
    throw new IllegalStateException("String_Node_Str" + Integer.toHexString(magic));
  }
  int offset=parcel.dataPosition();
  parcel.setDataPosition(offset + length);
  Parcel p=Parcel.obtain();
  p.setDataPosition(0);
  p.appendFrom(parcel,offset,length);
  if (DEBUG)   Log.d(TAG,"String_Node_Str" + Integer.toHexString(System.identityHashCode(this)) + "String_Node_Str"+ length+ "String_Node_Str"+ offset);
  p.setDataPosition(0);
  mParcelledData=p;
  mHasFds=p.hasFileDescriptors();
  mFdsKnown=true;
}
Program: 1043
Project: 1043
Buggy source:
/** 
 * Read and return a new Bundle object from the parcel at the current dataPosition(), using the given class loader to initialize the class loader of the Bundle for later retrieval of Parcelable objects. Returns null if the previously written Bundle object was null.
 */
public final Bundle readBundle(ClassLoader loader){
  int length=readInt();
  if (length < 0) {
    return null;
  }
  final Bundle bundle=new Bundle(this,length);
  if (loader != null) {
    bundle.setClassLoader(loader);
  }
  return bundle;
}

Fixed version (ground truth):
/** 
 * Read and return a new Bundle object from the parcel at the current dataPosition(), using the given class loader to initialize the class loader of the Bundle for later retrieval of Parcelable objects. Returns null if the previously written Bundle object was null.
 */
public final Bundle readBundle(ClassLoader loader){
  int length=readInt();
  if (length < 0) {
    if (Bundle.DEBUG)     Log.d(TAG,"String_Node_Str" + length);
    return null;
  }
  final Bundle bundle=new Bundle(this,length);
  if (loader != null) {
    bundle.setClassLoader(loader);
  }
  return bundle;
}
Program: 1044
Project: 1044
Buggy source:
/** 
 * @hide Like  {@link #clear}, but doesn't reduce the capacity of the ArrayMap.
 */
public void erase(){
  if (mSize > 0) {
    final int N=mSize << 1;
    final Object[] array=mArray;
    for (int i=0; i < N; i++) {
      array[i]=null;
    }
  }
}

Fixed version (ground truth):
/** 
 * @hide Like  {@link #clear}, but doesn't reduce the capacity of the ArrayMap.
 */
public void erase(){
  if (mSize > 0) {
    final int N=mSize << 1;
    final Object[] array=mArray;
    for (int i=0; i < N; i++) {
      array[i]=null;
    }
    mSize=0;
  }
}
Program: 1045
Project: 1045
Buggy source:
/** 
 * TODO: optimize this later (getting just the value part of a Bundle with a single pair) once Bundle.forPair() above is implemented with a special single-value Map implementation/serialization. Note: value in single-pair Bundle may be null.
 * @hide
 */
public String getPairValue(){
  unparcel();
  int size=mMap.size();
  if (size > 1) {
    Log.w(LOG_TAG,"String_Node_Str");
  }
  if (size == 0) {
    return null;
  }
  Object o=mMap.valueAt(0);
  try {
    return (String)o;
  }
 catch (  ClassCastException e) {
    typeWarning("String_Node_Str",o,"String_Node_Str",e);
    return null;
  }
}

Fixed version (ground truth):
/** 
 * TODO: optimize this later (getting just the value part of a Bundle with a single pair) once Bundle.forPair() above is implemented with a special single-value Map implementation/serialization. Note: value in single-pair Bundle may be null.
 * @hide
 */
public String getPairValue(){
  unparcel();
  int size=mMap.size();
  if (size > 1) {
    Log.w(TAG,"String_Node_Str");
  }
  if (size == 0) {
    return null;
  }
  Object o=mMap.valueAt(0);
  try {
    return (String)o;
  }
 catch (  ClassCastException e) {
    typeWarning("String_Node_Str",o,"String_Node_Str",e);
    return null;
  }
}
Program: 1046
Project: 1046
Buggy source:
/** 
 * Writes the Bundle contents to a Parcel, typically in order for it to be passed through an IBinder connection.
 * @param parcel The parcel to copy this bundle to.
 */
public void writeToParcel(Parcel parcel,int flags){
  final boolean oldAllowFds=parcel.pushAllowFds(mAllowFds);
  try {
    if (mParcelledData != null) {
      int length=mParcelledData.dataSize();
      parcel.writeInt(length);
      parcel.writeInt(BUNDLE_MAGIC);
      parcel.appendFrom(mParcelledData,0,length);
    }
 else {
      parcel.writeInt(-1);
      parcel.writeInt(BUNDLE_MAGIC);
      int oldPos=parcel.dataPosition();
      parcel.writeArrayMapInternal(mMap);
      int newPos=parcel.dataPosition();
      parcel.setDataPosition(oldPos - 8);
      int length=newPos - oldPos;
      parcel.writeInt(length);
      parcel.setDataPosition(newPos);
    }
  }
  finally {
    parcel.restoreAllowFds(oldAllowFds);
  }
}

Fixed version (ground truth):
/** 
 * Writes the Bundle contents to a Parcel, typically in order for it to be passed through an IBinder connection.
 * @param parcel The parcel to copy this bundle to.
 */
public void writeToParcel(Parcel parcel,int flags){
  final boolean oldAllowFds=parcel.pushAllowFds(mAllowFds);
  try {
    if (mParcelledData != null) {
      int length=mParcelledData.dataSize();
      parcel.writeInt(length);
      parcel.writeInt(BUNDLE_MAGIC);
      parcel.appendFrom(mParcelledData,0,length);
    }
 else {
      int lengthPos=parcel.dataPosition();
      parcel.writeInt(-1);
      parcel.writeInt(BUNDLE_MAGIC);
      int startPos=parcel.dataPosition();
      parcel.writeArrayMapInternal(mMap);
      int endPos=parcel.dataPosition();
      parcel.setDataPosition(lengthPos);
      int length=endPos - startPos;
      parcel.writeInt(length);
      parcel.setDataPosition(endPos);
    }
  }
  finally {
    parcel.restoreAllowFds(oldAllowFds);
  }
}
Program: 1047
Project: 1047
Buggy source:
/** 
 * If the underlying data are stored as a Parcel, unparcel them using the currently assigned class loader.
 */
synchronized void unparcel(){
  if (mParcelledData == null) {
    return;
  }
  int N=mParcelledData.readInt();
  if (N < 0) {
    return;
  }
  if (mMap == null) {
    mMap=new ArrayMap<String,Object>(N);
  }
 else {
    mMap.erase();
    mMap.ensureCapacity(N);
  }
  mParcelledData.readArrayMapInternal(mMap,N,mClassLoader);
  mParcelledData.recycle();
  mParcelledData=null;
}

Fixed version (ground truth):
/** 
 * If the underlying data are stored as a Parcel, unparcel them using the currently assigned class loader.
 */
synchronized void unparcel(){
  if (mParcelledData == null) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str" + Integer.toHexString(System.identityHashCode(this)) + "String_Node_Str");
    return;
  }
  int N=mParcelledData.readInt();
  if (DEBUG)   Log.d(TAG,"String_Node_Str" + Integer.toHexString(System.identityHashCode(this)) + "String_Node_Str"+ N+ "String_Node_Str");
  if (N < 0) {
    return;
  }
  if (mMap == null) {
    mMap=new ArrayMap<String,Object>(N);
  }
 else {
    mMap.erase();
    mMap.ensureCapacity(N);
  }
  mParcelledData.readArrayMapInternal(mMap,N,mClassLoader);
  mParcelledData.recycle();
  mParcelledData=null;
  if (DEBUG)   Log.d(TAG,"String_Node_Str" + Integer.toHexString(System.identityHashCode(this)) + "String_Node_Str"+ mMap);
}
Program: 1048
Project: 1048
Buggy source:
void readFromParcelInner(Parcel parcel,int length){
  int magic=parcel.readInt();
  if (magic != BUNDLE_MAGIC) {
    throw new IllegalStateException("String_Node_Str" + Integer.toHexString(magic));
  }
  int offset=parcel.dataPosition();
  parcel.setDataPosition(offset + length);
  Parcel p=Parcel.obtain();
  p.setDataPosition(0);
  p.appendFrom(parcel,offset,length);
  p.setDataPosition(0);
  if (mMap != null) {
    if (mFdsKnown) {
      mHasFds|=p.hasFileDescriptors();
    }
    int N=p.readInt();
    p.readArrayMapSafelyInternal(mMap,N,mClassLoader);
    p.recycle();
  }
 else {
    mParcelledData=p;
    mHasFds=p.hasFileDescriptors();
    mFdsKnown=true;
  }
}

Fixed version (ground truth):
void readFromParcelInner(Parcel parcel,int length){
  int magic=parcel.readInt();
  if (magic != BUNDLE_MAGIC) {
    throw new IllegalStateException("String_Node_Str" + Integer.toHexString(magic));
  }
  int offset=parcel.dataPosition();
  parcel.setDataPosition(offset + length);
  Parcel p=Parcel.obtain();
  p.setDataPosition(0);
  p.appendFrom(parcel,offset,length);
  if (DEBUG)   Log.d(TAG,"String_Node_Str" + Integer.toHexString(System.identityHashCode(this)) + "String_Node_Str"+ length+ "String_Node_Str"+ offset);
  p.setDataPosition(0);
  mParcelledData=p;
  mHasFds=p.hasFileDescriptors();
  mFdsKnown=true;
}
Program: 1049
Project: 1049
Buggy source:
/** 
 * Read and return a new Bundle object from the parcel at the current dataPosition(), using the given class loader to initialize the class loader of the Bundle for later retrieval of Parcelable objects. Returns null if the previously written Bundle object was null.
 */
public final Bundle readBundle(ClassLoader loader){
  int length=readInt();
  if (length < 0) {
    return null;
  }
  final Bundle bundle=new Bundle(this,length);
  if (loader != null) {
    bundle.setClassLoader(loader);
  }
  return bundle;
}

Fixed version (ground truth):
/** 
 * Read and return a new Bundle object from the parcel at the current dataPosition(), using the given class loader to initialize the class loader of the Bundle for later retrieval of Parcelable objects. Returns null if the previously written Bundle object was null.
 */
public final Bundle readBundle(ClassLoader loader){
  int length=readInt();
  if (length < 0) {
    if (Bundle.DEBUG)     Log.d(TAG,"String_Node_Str" + length);
    return null;
  }
  final Bundle bundle=new Bundle(this,length);
  if (loader != null) {
    bundle.setClassLoader(loader);
  }
  return bundle;
}
Program: 1050
Project: 1050
Buggy source:
/** 
 * @hide Like  {@link #clear}, but doesn't reduce the capacity of the ArrayMap.
 */
public void erase(){
  if (mSize > 0) {
    final int N=mSize << 1;
    final Object[] array=mArray;
    for (int i=0; i < N; i++) {
      array[i]=null;
    }
  }
}

Fixed version (ground truth):
/** 
 * @hide Like  {@link #clear}, but doesn't reduce the capacity of the ArrayMap.
 */
public void erase(){
  if (mSize > 0) {
    final int N=mSize << 1;
    final Object[] array=mArray;
    for (int i=0; i < N; i++) {
      array[i]=null;
    }
    mSize=0;
  }
}
Program: 1051
Project: 1051
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  String action=intent.getAction();
  if (action.equals(Intent.ACTION_SCREEN_ON)) {
    mWifiController.sendMessage(CMD_SCREEN_ON);
  }
 else   if (action.equals(Intent.ACTION_SCREEN_OFF)) {
    mWifiController.sendMessage(CMD_SCREEN_OFF);
  }
 else   if (action.equals(Intent.ACTION_BATTERY_CHANGED)) {
    int pluggedType=intent.getIntExtra("String_Node_Str",0);
    mWifiController.sendMessage(CMD_BATTERY_CHANGED,pluggedType,0,null);
  }
 else   if (action.equals(BluetoothAdapter.ACTION_CONNECTION_STATE_CHANGED)) {
    int state=intent.getIntExtra(BluetoothAdapter.EXTRA_CONNECTION_STATE,BluetoothAdapter.STATE_DISCONNECTED);
    mWifiStateMachine.sendBluetoothAdapterStateChange(state);
  }
 else   if (action.equals(TelephonyIntents.ACTION_EMERGENCY_CALLBACK_MODE_CHANGED)) {
    boolean emergencyMode=intent.getBooleanExtra("String_Node_Str",false);
    mWifiController.sendMessage(CMD_EMERGENCY_MODE_CHANGED,emergencyMode ? 1 : 0,0);
  }
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  String action=intent.getAction();
  if (action.equals(Intent.ACTION_SCREEN_ON)) {
    mWifiController.sendMessage(CMD_SCREEN_ON);
  }
 else   if (action.equals(Intent.ACTION_USER_PRESENT)) {
    mWifiController.sendMessage(CMD_USER_PRESENT);
  }
 else   if (action.equals(Intent.ACTION_SCREEN_OFF)) {
    mWifiController.sendMessage(CMD_SCREEN_OFF);
  }
 else   if (action.equals(Intent.ACTION_BATTERY_CHANGED)) {
    int pluggedType=intent.getIntExtra("String_Node_Str",0);
    mWifiController.sendMessage(CMD_BATTERY_CHANGED,pluggedType,0,null);
  }
 else   if (action.equals(BluetoothAdapter.ACTION_CONNECTION_STATE_CHANGED)) {
    int state=intent.getIntExtra(BluetoothAdapter.EXTRA_CONNECTION_STATE,BluetoothAdapter.STATE_DISCONNECTED);
    mWifiStateMachine.sendBluetoothAdapterStateChange(state);
  }
 else   if (action.equals(TelephonyIntents.ACTION_EMERGENCY_CALLBACK_MODE_CHANGED)) {
    boolean emergencyMode=intent.getBooleanExtra("String_Node_Str",false);
    mWifiController.sendMessage(CMD_EMERGENCY_MODE_CHANGED,emergencyMode ? 1 : 0,0);
  }
}
Program: 1052
Project: 1052
Buggy source:
private void registerForBroadcasts(){
  IntentFilter intentFilter=new IntentFilter();
  intentFilter.addAction(Intent.ACTION_SCREEN_ON);
  intentFilter.addAction(Intent.ACTION_SCREEN_OFF);
  intentFilter.addAction(Intent.ACTION_BATTERY_CHANGED);
  intentFilter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION);
  intentFilter.addAction(BluetoothAdapter.ACTION_CONNECTION_STATE_CHANGED);
  intentFilter.addAction(TelephonyIntents.ACTION_EMERGENCY_CALLBACK_MODE_CHANGED);
  mContext.registerReceiver(mReceiver,intentFilter);
}

Fixed version (ground truth):
private void registerForBroadcasts(){
  IntentFilter intentFilter=new IntentFilter();
  intentFilter.addAction(Intent.ACTION_SCREEN_ON);
  intentFilter.addAction(Intent.ACTION_USER_PRESENT);
  intentFilter.addAction(Intent.ACTION_SCREEN_OFF);
  intentFilter.addAction(Intent.ACTION_BATTERY_CHANGED);
  intentFilter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION);
  intentFilter.addAction(BluetoothAdapter.ACTION_CONNECTION_STATE_CHANGED);
  intentFilter.addAction(TelephonyIntents.ACTION_EMERGENCY_CALLBACK_MODE_CHANGED);
  mContext.registerReceiver(mReceiver,intentFilter);
}
Program: 1054
Project: 1054
Buggy source:
boolean installKeys(android.security.KeyStore keyStore,String name){
  boolean ret=true;
  String privKeyName=Credentials.USER_PRIVATE_KEY + name;
  String userCertName=Credentials.USER_CERTIFICATE + name;
  String caCertName=Credentials.CA_CERTIFICATE + name;
  if (mClientCertificate != null) {
    byte[] privKeyData=mClientPrivateKey.getEncoded();
    ret=keyStore.importKey(privKeyName,privKeyData,Process.WIFI_UID,KeyStore.FLAG_ENCRYPTED);
    if (ret == false) {
      return ret;
    }
    ret=putCertInKeyStore(keyStore,userCertName,mClientCertificate);
    if (ret == false) {
      keyStore.delKey(privKeyName,Process.WIFI_UID);
      return ret;
    }
  }
  if (mCaCert != null) {
    ret=putCertInKeyStore(keyStore,caCertName,mCaCert);
    if (ret == false) {
      if (mClientCertificate != null) {
        keyStore.delKey(privKeyName,Process.WIFI_UID);
        keyStore.delete(userCertName,Process.WIFI_UID);
      }
      return ret;
    }
  }
  if (mClientCertificate != null) {
    setClientCertificateAlias(name);
    mClientPrivateKey=null;
    mClientCertificate=null;
  }
  if (mCaCert != null) {
    setCaCertificateAlias(name);
    mCaCert=null;
  }
  return ret;
}

Fixed version (ground truth):
boolean installKeys(android.security.KeyStore keyStore,String name){
  boolean ret=true;
  String privKeyName=Credentials.USER_PRIVATE_KEY + name;
  String userCertName=Credentials.USER_CERTIFICATE + name;
  String caCertName=Credentials.CA_CERTIFICATE + name;
  if (mClientCertificate != null) {
    byte[] privKeyData=mClientPrivateKey.getEncoded();
    if (isHardwareBackedKey(mClientPrivateKey)) {
      if (DBG)       Slog.d(TAG,"String_Node_Str" + name + "String_Node_Str"+ "String_Node_Str");
      ret=keyStore.importKey(privKeyName,privKeyData,Process.WIFI_UID,KeyStore.FLAG_NONE);
    }
 else {
      if (DBG)       Slog.d(TAG,"String_Node_Str" + name + "String_Node_Str");
      ret=keyStore.importKey(privKeyName,privKeyData,Process.WIFI_UID,KeyStore.FLAG_ENCRYPTED);
      mNeedsSoftwareKeystore=true;
    }
    if (ret == false) {
      return ret;
    }
    ret=putCertInKeyStore(keyStore,userCertName,mClientCertificate);
    if (ret == false) {
      keyStore.delKey(privKeyName,Process.WIFI_UID);
      return ret;
    }
  }
  if (mCaCert != null) {
    ret=putCertInKeyStore(keyStore,caCertName,mCaCert);
    if (ret == false) {
      if (mClientCertificate != null) {
        keyStore.delKey(privKeyName,Process.WIFI_UID);
        keyStore.delete(userCertName,Process.WIFI_UID);
      }
      return ret;
    }
  }
  if (mClientCertificate != null) {
    setClientCertificateAlias(name);
    mClientPrivateKey=null;
    mClientCertificate=null;
  }
  if (mCaCert != null) {
    setCaCertificateAlias(name);
    mCaCert=null;
  }
  return ret;
}
Program: 1055
Project: 1055
Buggy source:
void removeKeys(KeyStore keyStore){
  String client=getFieldValue(CLIENT_CERT_KEY,CLIENT_CERT_PREFIX);
  if (!TextUtils.isEmpty(client)) {
    keyStore.delKey(Credentials.USER_PRIVATE_KEY + client,Process.WIFI_UID);
    keyStore.delete(Credentials.USER_CERTIFICATE + client,Process.WIFI_UID);
  }
  String ca=getFieldValue(CA_CERT_KEY,CA_CERT_PREFIX);
  if (!TextUtils.isEmpty(ca)) {
    keyStore.delete(Credentials.CA_CERTIFICATE + ca,Process.WIFI_UID);
  }
}

Fixed version (ground truth):
void removeKeys(KeyStore keyStore){
  String client=getFieldValue(CLIENT_CERT_KEY,CLIENT_CERT_PREFIX);
  if (!TextUtils.isEmpty(client)) {
    if (DBG)     Slog.d(TAG,"String_Node_Str");
    keyStore.delKey(Credentials.USER_PRIVATE_KEY + client,Process.WIFI_UID);
    keyStore.delete(Credentials.USER_CERTIFICATE + client,Process.WIFI_UID);
  }
  String ca=getFieldValue(CA_CERT_KEY,CA_CERT_PREFIX);
  if (!TextUtils.isEmpty(ca)) {
    if (DBG)     Slog.d(TAG,"String_Node_Str");
    keyStore.delete(Credentials.CA_CERTIFICATE + ca,Process.WIFI_UID);
  }
}
Program: 1056
Project: 1056
Buggy source:
private boolean putCertInKeyStore(android.security.KeyStore keyStore,String name,Certificate cert){
  try {
    byte[] certData=Credentials.convertToPem(cert);
    return keyStore.put(name,certData,Process.WIFI_UID,KeyStore.FLAG_ENCRYPTED);
  }
 catch (  IOException e1) {
    return false;
  }
catch (  CertificateException e2) {
    return false;
  }
}

Fixed version (ground truth):
private boolean putCertInKeyStore(android.security.KeyStore keyStore,String name,Certificate cert){
  try {
    byte[] certData=Credentials.convertToPem(cert);
    if (DBG)     Slog.d(TAG,"String_Node_Str" + name + "String_Node_Str");
    return keyStore.put(name,certData,Process.WIFI_UID,KeyStore.FLAG_NONE);
  }
 catch (  IOException e1) {
    return false;
  }
catch (  CertificateException e2) {
    return false;
  }
}
Program: 1057
Project: 1057
Buggy source:
/** 
 * What a Terrible Failure: Report an exception that should never happen. Similar to   {@link #wtf(String,Throwable)}, with a message as well.
 * @param tag Used to identify the source of a log message.
 * @param msg The message you would like logged.
 * @param tr An exception to log.  May be null.
 */
public static int wtf(String tag,String msg,Throwable tr){
  TerribleFailure what=new TerribleFailure(msg,tr);
  int bytes=println_native(LOG_ID_MAIN,ASSERT,tag,msg + '\n' + getStackTraceString(tr));
  sWtfHandler.onTerribleFailure(tag,what);
  return bytes;
}

Fixed version (ground truth):
static int wtf(int logId,String tag,String msg,Throwable tr){
  TerribleFailure what=new TerribleFailure(msg,tr);
  int bytes=println_native(logId,ASSERT,tag,msg + '\n' + getStackTraceString(tr));
  sWtfHandler.onTerribleFailure(tag,what);
  return bytes;
}
Program: 1058
Project: 1058
Buggy source:
void dumpFilteredSummaryLocked(PrintWriter pw,String header,String prefix,int[] screenStates,int[] memStates,int[] procStates,int[] sortProcStates,long now,long totalTime,String reqPackage){
  ArrayList<ProcessState> procs=collectProcessesLocked(screenStates,memStates,procStates,sortProcStates,now,reqPackage);
  if (procs.size() > 0) {
    if (header != null) {
      pw.println();
      pw.println(header);
    }
    dumpProcessSummaryLocked(pw,prefix,procs,screenStates,memStates,sortProcStates,now,totalTime);
  }
}

Fixed version (ground truth):
void dumpFilteredSummaryLocked(PrintWriter pw,String header,String prefix,int[] screenStates,int[] memStates,int[] procStates,int[] sortProcStates,long now,long totalTime,String reqPackage,boolean activeOnly){
  ArrayList<ProcessState> procs=collectProcessesLocked(screenStates,memStates,procStates,sortProcStates,now,reqPackage,activeOnly);
  if (procs.size() > 0) {
    if (header != null) {
      pw.println();
      pw.println(header);
    }
    dumpProcessSummaryLocked(pw,prefix,procs,screenStates,memStates,sortProcStates,now,totalTime);
  }
}
Program: 1059
Project: 1059
Buggy source:
public void setExecuting(boolean executing,int memFactor,long now){
  if (mActive <= 0) {
    throw new IllegalStateException("String_Node_Str" + this + "String_Node_Str"+ mActive);
  }
  final int state=executing ? memFactor : STATE_NOTHING;
  if (mExecState != state) {
    if (mExecState != STATE_NOTHING) {
      addDuration(SERVICE_EXEC + (mExecState * SERVICE_COUNT),now - mExecStartTime);
    }
 else     if (executing) {
      mExecCount++;
    }
    mExecState=state;
    mExecStartTime=now;
    updateRunning(memFactor,now);
  }
}

Fixed version (ground truth):
public void setExecuting(boolean executing,int memFactor,long now){
  if (mOwner == null) {
    Slog.wtf(TAG,"String_Node_Str" + this + "String_Node_Str");
  }
  final int state=executing ? memFactor : STATE_NOTHING;
  if (mExecState != state) {
    if (mExecState != STATE_NOTHING) {
      addDuration(SERVICE_EXEC + (mExecState * SERVICE_COUNT),now - mExecStartTime);
    }
 else     if (executing) {
      mExecCount++;
    }
    mExecState=state;
    mExecStartTime=now;
    updateRunning(memFactor,now);
  }
}
Program: 1060
Project: 1060
Buggy source:
private void ensureNotDead(){
  if (!mDead) {
    return;
  }
  throw new IllegalStateException("String_Node_Str" + mName + "String_Node_Str"+ mPackage+ "String_Node_Str"+ mUid+ "String_Node_Str"+ mCommonProcess.mName);
}

Fixed version (ground truth):
private void ensureNotDead(){
  if (!mDead) {
    return;
  }
  Slog.wtfStack(TAG,"String_Node_Str" + mName + "String_Node_Str"+ mPackage+ "String_Node_Str"+ mUid+ "String_Node_Str"+ mCommonProcess.mName);
}
Program: 1061
Project: 1061
Buggy source:
public ProcessStats.ServiceState getServiceStateLocked(String packageName,int uid,String processName,String className){
  final ProcessStats.PackageState as=getPackageStateLocked(packageName,uid);
  ProcessStats.ServiceState ss=as.mServices.get(className);
  if (ss != null) {
    return ss;
  }
  final ProcessStats.ProcessState ps=processName != null ? getProcessStateLocked(packageName,uid,processName) : null;
  ss=new ProcessStats.ServiceState(this,packageName,className,processName,ps);
  as.mServices.put(className,ss);
  return ss;
}

Fixed version (ground truth):
public ProcessStats.ServiceState getServiceStateLocked(String packageName,int uid,String processName,String className){
  final ProcessStats.PackageState as=getPackageStateLocked(packageName,uid);
  ProcessStats.ServiceState ss=as.mServices.get(className);
  if (ss != null) {
    if (DEBUG)     Slog.d(TAG,"String_Node_Str" + ss);
    return ss;
  }
  final ProcessStats.ProcessState ps=processName != null ? getProcessStateLocked(packageName,uid,processName) : null;
  ss=new ProcessStats.ServiceState(this,packageName,className,processName,ps);
  as.mServices.put(className,ss);
  if (DEBUG)   Slog.d(TAG,"String_Node_Str" + ss + "String_Node_Str"+ ps);
  return ss;
}
Program: 1062
Project: 1062
Buggy source:
private int[] readTableFromParcel(Parcel in,String name,String what){
  final int size=in.readInt();
  if (size < 0) {
    Slog.w(TAG,"String_Node_Str" + what + "String_Node_Str"+ size);
    return BAD_TABLE;
  }
  if (size == 0) {
    return null;
  }
  final int[] table=new int[size];
  for (int i=0; i < size; i++) {
    table[i]=in.readInt();
    if (DEBUG)     Slog.i(TAG,"String_Node_Str" + name + "String_Node_Str"+ i+ "String_Node_Str"+ ProcessStats.printLongOffset(table[i]));
    if (!validateLongOffset(table[i])) {
      Slog.w(TAG,"String_Node_Str" + what + "String_Node_Str"+ ProcessStats.printLongOffset(table[i]));
      return null;
    }
  }
  return table;
}

Fixed version (ground truth):
private int[] readTableFromParcel(Parcel in,String name,String what){
  final int size=in.readInt();
  if (size < 0) {
    Slog.w(TAG,"String_Node_Str" + what + "String_Node_Str"+ size);
    return BAD_TABLE;
  }
  if (size == 0) {
    return null;
  }
  final int[] table=new int[size];
  for (int i=0; i < size; i++) {
    table[i]=in.readInt();
    if (DEBUG_PARCEL)     Slog.i(TAG,"String_Node_Str" + name + "String_Node_Str"+ i+ "String_Node_Str"+ ProcessStats.printLongOffset(table[i]));
    if (!validateLongOffset(table[i])) {
      Slog.w(TAG,"String_Node_Str" + what + "String_Node_Str"+ ProcessStats.printLongOffset(table[i]));
      return null;
    }
  }
  return table;
}
Program: 1063
Project: 1063
Buggy source:
public void makeActive(){
  if (mActive == 0) {
    mProc.incActiveServices();
  }
  mActive++;
}

Fixed version (ground truth):
public void makeActive(){
  ensureNotDead();
  mActive=true;
}
Program: 1064
Project: 1064
Buggy source:
public void makeInactive(){
  mActive--;
  if (mActive == 0) {
    mProc.decActiveServices();
  }
}

Fixed version (ground truth):
public void makeInactive(){
  mActive=false;
}