nus-yam/ex-repair huggingface dataset:
Program: 556
Project: 556
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) {
    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);
}

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;
  }
  if (mParcelledData == EMPTY_PARCEL) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str" + Integer.toHexString(System.identityHashCode(this)) + "String_Node_Str");
    if (mMap == null) {
      mMap=new ArrayMap<String,Object>(1);
    }
 else {
      mMap.erase();
    }
    mParcelledData=null;
    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: 557
Project: 557
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);
  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;
}

Fixed version (ground truth):
void readFromParcelInner(Parcel parcel,int length){
  if (length == 0) {
    mParcelledData=EMPTY_PARCEL;
    mHasFds=false;
    mFdsKnown=true;
    return;
  }
  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: 558
Project: 558
Buggy source:
/** 
 * Constructs a Bundle containing a copy of the mappings from the given Bundle.
 * @param b a Bundle to be copied.
 */
public Bundle(Bundle b){
  if (b.mParcelledData != null) {
    mParcelledData=Parcel.obtain();
    mParcelledData.appendFrom(b.mParcelledData,0,b.mParcelledData.dataSize());
    mParcelledData.setDataPosition(0);
  }
 else {
    mParcelledData=null;
  }
  if (b.mMap != null) {
    mMap=new ArrayMap<String,Object>(b.mMap);
  }
 else {
    mMap=null;
  }
  mHasFds=b.mHasFds;
  mFdsKnown=b.mFdsKnown;
  mClassLoader=b.mClassLoader;
}

Fixed version (ground truth):
/** 
 * Constructs a Bundle containing a copy of the mappings from the given Bundle.
 * @param b a Bundle to be copied.
 */
public Bundle(Bundle b){
  if (b.mParcelledData != null) {
    if (b.mParcelledData == EMPTY_PARCEL) {
      mParcelledData=EMPTY_PARCEL;
    }
 else {
      mParcelledData=Parcel.obtain();
      mParcelledData.appendFrom(b.mParcelledData,0,b.mParcelledData.dataSize());
      mParcelledData.setDataPosition(0);
    }
  }
 else {
    mParcelledData=null;
  }
  if (b.mMap != null) {
    mMap=new ArrayMap<String,Object>(b.mMap);
  }
 else {
    mMap=null;
  }
  mHasFds=b.mHasFds;
  mFdsKnown=b.mFdsKnown;
  mClassLoader=b.mClassLoader;
}
Program: 559
Project: 559
Buggy source:
@Override public synchronized String toString(){
  if (mParcelledData != null) {
    return "String_Node_Str" + mParcelledData.dataSize() + "String_Node_Str";
  }
  return "String_Node_Str" + mMap.toString() + "String_Node_Str";
}

Fixed version (ground truth):
@Override public synchronized String toString(){
  if (mParcelledData != null) {
    if (mParcelledData == EMPTY_PARCEL) {
      return "String_Node_Str";
    }
 else {
      return "String_Node_Str" + mParcelledData.dataSize() + "String_Node_Str";
    }
  }
  return "String_Node_Str" + mMap.toString() + "String_Node_Str";
}
Program: 560
Project: 560
Buggy source:
void readArrayMapInternal(ArrayMap outVal,int N,ClassLoader loader){
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  while (N > 0) {
    Object key=readValue(loader);
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + (N - 1) + "String_Node_Str"+ (key != null ? key.hashCode() : 0)+ "String_Node_Str"+ key);
    Object value=readValue(loader);
    outVal.append(key,value);
    N--;
  }
}

Fixed version (ground truth):
void readArrayMapInternal(ArrayMap outVal,int N,ClassLoader loader){
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  int startPos;
  while (N > 0) {
    if (DEBUG_ARRAY_MAP)     startPos=dataPosition();
    Object key=readValue(loader);
    Object value=readValue(loader);
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + (N - 1) + "String_Node_Str"+ (dataPosition() - startPos)+ "String_Node_Str"+ Integer.toHexString((key != null ? key.hashCode() : 0))+ "String_Node_Str"+ key);
    outVal.append(key,value);
    N--;
  }
}
Program: 561
Project: 561
Buggy source:
/** 
 * Flatten an ArrayMap into the parcel at the current dataPosition(), growing dataCapacity() if needed.  The Map keys must be String objects.
 */
void writeArrayMapInternal(ArrayMap<String,Object> val){
  if (val == null) {
    writeInt(-1);
    return;
  }
  final int N=val.size();
  writeInt(N);
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  for (int i=0; i < N; i++) {
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + i + "String_Node_Str"+ (val.keyAt(i) != null ? val.keyAt(i).hashCode() : 0)+ "String_Node_Str"+ val.keyAt(i));
    writeValue(val.keyAt(i));
    writeValue(val.valueAt(i));
  }
}

Fixed version (ground truth):
/** 
 * Flatten an ArrayMap into the parcel at the current dataPosition(), growing dataCapacity() if needed.  The Map keys must be String objects.
 */
void writeArrayMapInternal(ArrayMap<String,Object> val){
  if (val == null) {
    writeInt(-1);
    return;
  }
  final int N=val.size();
  writeInt(N);
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  int startPos;
  for (int i=0; i < N; i++) {
    if (DEBUG_ARRAY_MAP)     startPos=dataPosition();
    writeValue(val.keyAt(i));
    writeValue(val.valueAt(i));
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + i + "String_Node_Str"+ (dataPosition() - startPos)+ "String_Node_Str"+ Integer.toHexString(val.keyAt(i) != null ? val.keyAt(i).hashCode() : 0)+ "String_Node_Str"+ val.keyAt(i));
  }
}
Program: 562
Project: 562
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 {
      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);
  }
}

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) {
      if (mParcelledData == EMPTY_PARCEL) {
        parcel.writeInt(0);
      }
 else {
        int length=mParcelledData.dataSize();
        parcel.writeInt(length);
        parcel.writeInt(BUNDLE_MAGIC);
        parcel.appendFrom(mParcelledData,0,length);
      }
    }
 else {
      if (mMap == null || mMap.size() <= 0) {
        parcel.writeInt(0);
        return;
      }
      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: 563
Project: 563
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) {
    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);
}

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;
  }
  if (mParcelledData == EMPTY_PARCEL) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str" + Integer.toHexString(System.identityHashCode(this)) + "String_Node_Str");
    if (mMap == null) {
      mMap=new ArrayMap<String,Object>(1);
    }
 else {
      mMap.erase();
    }
    mParcelledData=null;
    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: 564
Project: 564
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);
  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;
}

Fixed version (ground truth):
void readFromParcelInner(Parcel parcel,int length){
  if (length == 0) {
    mParcelledData=EMPTY_PARCEL;
    mHasFds=false;
    mFdsKnown=true;
    return;
  }
  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: 565
Project: 565
Buggy source:
/** 
 * Constructs a Bundle containing a copy of the mappings from the given Bundle.
 * @param b a Bundle to be copied.
 */
public Bundle(Bundle b){
  if (b.mParcelledData != null) {
    mParcelledData=Parcel.obtain();
    mParcelledData.appendFrom(b.mParcelledData,0,b.mParcelledData.dataSize());
    mParcelledData.setDataPosition(0);
  }
 else {
    mParcelledData=null;
  }
  if (b.mMap != null) {
    mMap=new ArrayMap<String,Object>(b.mMap);
  }
 else {
    mMap=null;
  }
  mHasFds=b.mHasFds;
  mFdsKnown=b.mFdsKnown;
  mClassLoader=b.mClassLoader;
}

Fixed version (ground truth):
/** 
 * Constructs a Bundle containing a copy of the mappings from the given Bundle.
 * @param b a Bundle to be copied.
 */
public Bundle(Bundle b){
  if (b.mParcelledData != null) {
    if (b.mParcelledData == EMPTY_PARCEL) {
      mParcelledData=EMPTY_PARCEL;
    }
 else {
      mParcelledData=Parcel.obtain();
      mParcelledData.appendFrom(b.mParcelledData,0,b.mParcelledData.dataSize());
      mParcelledData.setDataPosition(0);
    }
  }
 else {
    mParcelledData=null;
  }
  if (b.mMap != null) {
    mMap=new ArrayMap<String,Object>(b.mMap);
  }
 else {
    mMap=null;
  }
  mHasFds=b.mHasFds;
  mFdsKnown=b.mFdsKnown;
  mClassLoader=b.mClassLoader;
}
Program: 566
Project: 566
Buggy source:
@Override public synchronized String toString(){
  if (mParcelledData != null) {
    return "String_Node_Str" + mParcelledData.dataSize() + "String_Node_Str";
  }
  return "String_Node_Str" + mMap.toString() + "String_Node_Str";
}

Fixed version (ground truth):
@Override public synchronized String toString(){
  if (mParcelledData != null) {
    if (mParcelledData == EMPTY_PARCEL) {
      return "String_Node_Str";
    }
 else {
      return "String_Node_Str" + mParcelledData.dataSize() + "String_Node_Str";
    }
  }
  return "String_Node_Str" + mMap.toString() + "String_Node_Str";
}
Program: 567
Project: 567
Buggy source:
void readArrayMapInternal(ArrayMap outVal,int N,ClassLoader loader){
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  while (N > 0) {
    Object key=readValue(loader);
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + (N - 1) + "String_Node_Str"+ (key != null ? key.hashCode() : 0)+ "String_Node_Str"+ key);
    Object value=readValue(loader);
    outVal.append(key,value);
    N--;
  }
}

Fixed version (ground truth):
void readArrayMapInternal(ArrayMap outVal,int N,ClassLoader loader){
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  int startPos;
  while (N > 0) {
    if (DEBUG_ARRAY_MAP)     startPos=dataPosition();
    Object key=readValue(loader);
    Object value=readValue(loader);
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + (N - 1) + "String_Node_Str"+ (dataPosition() - startPos)+ "String_Node_Str"+ Integer.toHexString((key != null ? key.hashCode() : 0))+ "String_Node_Str"+ key);
    outVal.append(key,value);
    N--;
  }
}
Program: 568
Project: 568
Buggy source:
/** 
 * Flatten an ArrayMap into the parcel at the current dataPosition(), growing dataCapacity() if needed.  The Map keys must be String objects.
 */
void writeArrayMapInternal(ArrayMap<String,Object> val){
  if (val == null) {
    writeInt(-1);
    return;
  }
  final int N=val.size();
  writeInt(N);
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  for (int i=0; i < N; i++) {
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + i + "String_Node_Str"+ (val.keyAt(i) != null ? val.keyAt(i).hashCode() : 0)+ "String_Node_Str"+ val.keyAt(i));
    writeValue(val.keyAt(i));
    writeValue(val.valueAt(i));
  }
}

Fixed version (ground truth):
/** 
 * Flatten an ArrayMap into the parcel at the current dataPosition(), growing dataCapacity() if needed.  The Map keys must be String objects.
 */
void writeArrayMapInternal(ArrayMap<String,Object> val){
  if (val == null) {
    writeInt(-1);
    return;
  }
  final int N=val.size();
  writeInt(N);
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  int startPos;
  for (int i=0; i < N; i++) {
    if (DEBUG_ARRAY_MAP)     startPos=dataPosition();
    writeValue(val.keyAt(i));
    writeValue(val.valueAt(i));
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + i + "String_Node_Str"+ (dataPosition() - startPos)+ "String_Node_Str"+ Integer.toHexString(val.keyAt(i) != null ? val.keyAt(i).hashCode() : 0)+ "String_Node_Str"+ val.keyAt(i));
  }
}
Program: 569
Project: 569
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 {
      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);
  }
}

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) {
      if (mParcelledData == EMPTY_PARCEL) {
        parcel.writeInt(0);
      }
 else {
        int length=mParcelledData.dataSize();
        parcel.writeInt(length);
        parcel.writeInt(BUNDLE_MAGIC);
        parcel.appendFrom(mParcelledData,0,length);
      }
    }
 else {
      if (mMap == null || mMap.size() <= 0) {
        parcel.writeInt(0);
        return;
      }
      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: 570
Project: 570
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) {
    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);
}

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;
  }
  if (mParcelledData == EMPTY_PARCEL) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str" + Integer.toHexString(System.identityHashCode(this)) + "String_Node_Str");
    if (mMap == null) {
      mMap=new ArrayMap<String,Object>(1);
    }
 else {
      mMap.erase();
    }
    mParcelledData=null;
    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: 571
Project: 571
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);
  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;
}

Fixed version (ground truth):
void readFromParcelInner(Parcel parcel,int length){
  if (length == 0) {
    mParcelledData=EMPTY_PARCEL;
    mHasFds=false;
    mFdsKnown=true;
    return;
  }
  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: 572
Project: 572
Buggy source:
/** 
 * Constructs a Bundle containing a copy of the mappings from the given Bundle.
 * @param b a Bundle to be copied.
 */
public Bundle(Bundle b){
  if (b.mParcelledData != null) {
    mParcelledData=Parcel.obtain();
    mParcelledData.appendFrom(b.mParcelledData,0,b.mParcelledData.dataSize());
    mParcelledData.setDataPosition(0);
  }
 else {
    mParcelledData=null;
  }
  if (b.mMap != null) {
    mMap=new ArrayMap<String,Object>(b.mMap);
  }
 else {
    mMap=null;
  }
  mHasFds=b.mHasFds;
  mFdsKnown=b.mFdsKnown;
  mClassLoader=b.mClassLoader;
}

Fixed version (ground truth):
/** 
 * Constructs a Bundle containing a copy of the mappings from the given Bundle.
 * @param b a Bundle to be copied.
 */
public Bundle(Bundle b){
  if (b.mParcelledData != null) {
    if (b.mParcelledData == EMPTY_PARCEL) {
      mParcelledData=EMPTY_PARCEL;
    }
 else {
      mParcelledData=Parcel.obtain();
      mParcelledData.appendFrom(b.mParcelledData,0,b.mParcelledData.dataSize());
      mParcelledData.setDataPosition(0);
    }
  }
 else {
    mParcelledData=null;
  }
  if (b.mMap != null) {
    mMap=new ArrayMap<String,Object>(b.mMap);
  }
 else {
    mMap=null;
  }
  mHasFds=b.mHasFds;
  mFdsKnown=b.mFdsKnown;
  mClassLoader=b.mClassLoader;
}
Program: 573
Project: 573
Buggy source:
@Override public synchronized String toString(){
  if (mParcelledData != null) {
    return "String_Node_Str" + mParcelledData.dataSize() + "String_Node_Str";
  }
  return "String_Node_Str" + mMap.toString() + "String_Node_Str";
}

Fixed version (ground truth):
@Override public synchronized String toString(){
  if (mParcelledData != null) {
    if (mParcelledData == EMPTY_PARCEL) {
      return "String_Node_Str";
    }
 else {
      return "String_Node_Str" + mParcelledData.dataSize() + "String_Node_Str";
    }
  }
  return "String_Node_Str" + mMap.toString() + "String_Node_Str";
}
Program: 574
Project: 574
Buggy source:
void readArrayMapInternal(ArrayMap outVal,int N,ClassLoader loader){
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  while (N > 0) {
    Object key=readValue(loader);
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + (N - 1) + "String_Node_Str"+ (key != null ? key.hashCode() : 0)+ "String_Node_Str"+ key);
    Object value=readValue(loader);
    outVal.append(key,value);
    N--;
  }
}

Fixed version (ground truth):
void readArrayMapInternal(ArrayMap outVal,int N,ClassLoader loader){
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  int startPos;
  while (N > 0) {
    if (DEBUG_ARRAY_MAP)     startPos=dataPosition();
    Object key=readValue(loader);
    Object value=readValue(loader);
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + (N - 1) + "String_Node_Str"+ (dataPosition() - startPos)+ "String_Node_Str"+ Integer.toHexString((key != null ? key.hashCode() : 0))+ "String_Node_Str"+ key);
    outVal.append(key,value);
    N--;
  }
}
Program: 575
Project: 575
Buggy source:
/** 
 * Flatten an ArrayMap into the parcel at the current dataPosition(), growing dataCapacity() if needed.  The Map keys must be String objects.
 */
void writeArrayMapInternal(ArrayMap<String,Object> val){
  if (val == null) {
    writeInt(-1);
    return;
  }
  final int N=val.size();
  writeInt(N);
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  for (int i=0; i < N; i++) {
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + i + "String_Node_Str"+ (val.keyAt(i) != null ? val.keyAt(i).hashCode() : 0)+ "String_Node_Str"+ val.keyAt(i));
    writeValue(val.keyAt(i));
    writeValue(val.valueAt(i));
  }
}

Fixed version (ground truth):
/** 
 * Flatten an ArrayMap into the parcel at the current dataPosition(), growing dataCapacity() if needed.  The Map keys must be String objects.
 */
void writeArrayMapInternal(ArrayMap<String,Object> val){
  if (val == null) {
    writeInt(-1);
    return;
  }
  final int N=val.size();
  writeInt(N);
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  int startPos;
  for (int i=0; i < N; i++) {
    if (DEBUG_ARRAY_MAP)     startPos=dataPosition();
    writeValue(val.keyAt(i));
    writeValue(val.valueAt(i));
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + i + "String_Node_Str"+ (dataPosition() - startPos)+ "String_Node_Str"+ Integer.toHexString(val.keyAt(i) != null ? val.keyAt(i).hashCode() : 0)+ "String_Node_Str"+ val.keyAt(i));
  }
}
Program: 576
Project: 576
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 {
      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);
  }
}

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) {
      if (mParcelledData == EMPTY_PARCEL) {
        parcel.writeInt(0);
      }
 else {
        int length=mParcelledData.dataSize();
        parcel.writeInt(length);
        parcel.writeInt(BUNDLE_MAGIC);
        parcel.appendFrom(mParcelledData,0,length);
      }
    }
 else {
      if (mMap == null || mMap.size() <= 0) {
        parcel.writeInt(0);
        return;
      }
      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: 577
Project: 577
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) {
    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);
}

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;
  }
  if (mParcelledData == EMPTY_PARCEL) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str" + Integer.toHexString(System.identityHashCode(this)) + "String_Node_Str");
    if (mMap == null) {
      mMap=new ArrayMap<String,Object>(1);
    }
 else {
      mMap.erase();
    }
    mParcelledData=null;
    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: 578
Project: 578
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);
  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;
}

Fixed version (ground truth):
void readFromParcelInner(Parcel parcel,int length){
  if (length == 0) {
    mParcelledData=EMPTY_PARCEL;
    mHasFds=false;
    mFdsKnown=true;
    return;
  }
  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: 579
Project: 579
Buggy source:
/** 
 * Constructs a Bundle containing a copy of the mappings from the given Bundle.
 * @param b a Bundle to be copied.
 */
public Bundle(Bundle b){
  if (b.mParcelledData != null) {
    mParcelledData=Parcel.obtain();
    mParcelledData.appendFrom(b.mParcelledData,0,b.mParcelledData.dataSize());
    mParcelledData.setDataPosition(0);
  }
 else {
    mParcelledData=null;
  }
  if (b.mMap != null) {
    mMap=new ArrayMap<String,Object>(b.mMap);
  }
 else {
    mMap=null;
  }
  mHasFds=b.mHasFds;
  mFdsKnown=b.mFdsKnown;
  mClassLoader=b.mClassLoader;
}

Fixed version (ground truth):
/** 
 * Constructs a Bundle containing a copy of the mappings from the given Bundle.
 * @param b a Bundle to be copied.
 */
public Bundle(Bundle b){
  if (b.mParcelledData != null) {
    if (b.mParcelledData == EMPTY_PARCEL) {
      mParcelledData=EMPTY_PARCEL;
    }
 else {
      mParcelledData=Parcel.obtain();
      mParcelledData.appendFrom(b.mParcelledData,0,b.mParcelledData.dataSize());
      mParcelledData.setDataPosition(0);
    }
  }
 else {
    mParcelledData=null;
  }
  if (b.mMap != null) {
    mMap=new ArrayMap<String,Object>(b.mMap);
  }
 else {
    mMap=null;
  }
  mHasFds=b.mHasFds;
  mFdsKnown=b.mFdsKnown;
  mClassLoader=b.mClassLoader;
}
Program: 580
Project: 580
Buggy source:
@Override public synchronized String toString(){
  if (mParcelledData != null) {
    return "String_Node_Str" + mParcelledData.dataSize() + "String_Node_Str";
  }
  return "String_Node_Str" + mMap.toString() + "String_Node_Str";
}

Fixed version (ground truth):
@Override public synchronized String toString(){
  if (mParcelledData != null) {
    if (mParcelledData == EMPTY_PARCEL) {
      return "String_Node_Str";
    }
 else {
      return "String_Node_Str" + mParcelledData.dataSize() + "String_Node_Str";
    }
  }
  return "String_Node_Str" + mMap.toString() + "String_Node_Str";
}
Program: 581
Project: 581
Buggy source:
void readArrayMapInternal(ArrayMap outVal,int N,ClassLoader loader){
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  while (N > 0) {
    Object key=readValue(loader);
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + (N - 1) + "String_Node_Str"+ (key != null ? key.hashCode() : 0)+ "String_Node_Str"+ key);
    Object value=readValue(loader);
    outVal.append(key,value);
    N--;
  }
}

Fixed version (ground truth):
void readArrayMapInternal(ArrayMap outVal,int N,ClassLoader loader){
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  int startPos;
  while (N > 0) {
    if (DEBUG_ARRAY_MAP)     startPos=dataPosition();
    Object key=readValue(loader);
    Object value=readValue(loader);
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + (N - 1) + "String_Node_Str"+ (dataPosition() - startPos)+ "String_Node_Str"+ Integer.toHexString((key != null ? key.hashCode() : 0))+ "String_Node_Str"+ key);
    outVal.append(key,value);
    N--;
  }
}
Program: 582
Project: 582
Buggy source:
/** 
 * Flatten an ArrayMap into the parcel at the current dataPosition(), growing dataCapacity() if needed.  The Map keys must be String objects.
 */
void writeArrayMapInternal(ArrayMap<String,Object> val){
  if (val == null) {
    writeInt(-1);
    return;
  }
  final int N=val.size();
  writeInt(N);
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  for (int i=0; i < N; i++) {
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + i + "String_Node_Str"+ (val.keyAt(i) != null ? val.keyAt(i).hashCode() : 0)+ "String_Node_Str"+ val.keyAt(i));
    writeValue(val.keyAt(i));
    writeValue(val.valueAt(i));
  }
}

Fixed version (ground truth):
/** 
 * Flatten an ArrayMap into the parcel at the current dataPosition(), growing dataCapacity() if needed.  The Map keys must be String objects.
 */
void writeArrayMapInternal(ArrayMap<String,Object> val){
  if (val == null) {
    writeInt(-1);
    return;
  }
  final int N=val.size();
  writeInt(N);
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  int startPos;
  for (int i=0; i < N; i++) {
    if (DEBUG_ARRAY_MAP)     startPos=dataPosition();
    writeValue(val.keyAt(i));
    writeValue(val.valueAt(i));
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + i + "String_Node_Str"+ (dataPosition() - startPos)+ "String_Node_Str"+ Integer.toHexString(val.keyAt(i) != null ? val.keyAt(i).hashCode() : 0)+ "String_Node_Str"+ val.keyAt(i));
  }
}
Program: 583
Project: 583
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 {
      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);
  }
}

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) {
      if (mParcelledData == EMPTY_PARCEL) {
        parcel.writeInt(0);
      }
 else {
        int length=mParcelledData.dataSize();
        parcel.writeInt(length);
        parcel.writeInt(BUNDLE_MAGIC);
        parcel.appendFrom(mParcelledData,0,length);
      }
    }
 else {
      if (mMap == null || mMap.size() <= 0) {
        parcel.writeInt(0);
        return;
      }
      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: 584
Project: 584
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) {
    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);
}

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;
  }
  if (mParcelledData == EMPTY_PARCEL) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str" + Integer.toHexString(System.identityHashCode(this)) + "String_Node_Str");
    if (mMap == null) {
      mMap=new ArrayMap<String,Object>(1);
    }
 else {
      mMap.erase();
    }
    mParcelledData=null;
    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: 585
Project: 585
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);
  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;
}

Fixed version (ground truth):
void readFromParcelInner(Parcel parcel,int length){
  if (length == 0) {
    mParcelledData=EMPTY_PARCEL;
    mHasFds=false;
    mFdsKnown=true;
    return;
  }
  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: 586
Project: 586
Buggy source:
/** 
 * Constructs a Bundle containing a copy of the mappings from the given Bundle.
 * @param b a Bundle to be copied.
 */
public Bundle(Bundle b){
  if (b.mParcelledData != null) {
    mParcelledData=Parcel.obtain();
    mParcelledData.appendFrom(b.mParcelledData,0,b.mParcelledData.dataSize());
    mParcelledData.setDataPosition(0);
  }
 else {
    mParcelledData=null;
  }
  if (b.mMap != null) {
    mMap=new ArrayMap<String,Object>(b.mMap);
  }
 else {
    mMap=null;
  }
  mHasFds=b.mHasFds;
  mFdsKnown=b.mFdsKnown;
  mClassLoader=b.mClassLoader;
}

Fixed version (ground truth):
/** 
 * Constructs a Bundle containing a copy of the mappings from the given Bundle.
 * @param b a Bundle to be copied.
 */
public Bundle(Bundle b){
  if (b.mParcelledData != null) {
    if (b.mParcelledData == EMPTY_PARCEL) {
      mParcelledData=EMPTY_PARCEL;
    }
 else {
      mParcelledData=Parcel.obtain();
      mParcelledData.appendFrom(b.mParcelledData,0,b.mParcelledData.dataSize());
      mParcelledData.setDataPosition(0);
    }
  }
 else {
    mParcelledData=null;
  }
  if (b.mMap != null) {
    mMap=new ArrayMap<String,Object>(b.mMap);
  }
 else {
    mMap=null;
  }
  mHasFds=b.mHasFds;
  mFdsKnown=b.mFdsKnown;
  mClassLoader=b.mClassLoader;
}
Program: 587
Project: 587
Buggy source:
@Override public synchronized String toString(){
  if (mParcelledData != null) {
    return "String_Node_Str" + mParcelledData.dataSize() + "String_Node_Str";
  }
  return "String_Node_Str" + mMap.toString() + "String_Node_Str";
}

Fixed version (ground truth):
@Override public synchronized String toString(){
  if (mParcelledData != null) {
    if (mParcelledData == EMPTY_PARCEL) {
      return "String_Node_Str";
    }
 else {
      return "String_Node_Str" + mParcelledData.dataSize() + "String_Node_Str";
    }
  }
  return "String_Node_Str" + mMap.toString() + "String_Node_Str";
}