Program: 100588
Project: 100588
Buggy source:
/** 
 * After you've added everything you need to the class, call this method to generate the actual class file data. This can only be called once.
 */
public byte[] makeBytes(){
  if (buf != null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (thisClass == 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  reserveBuf(10);
  setInt(buf,0,MAGIC);
  setUShort(buf,4,minorVersion);
  setUShort(buf,6,majorVersion);
  emitConstantPool();
  setUShort(buf,8,nextCPIndex);
  cachedCPEntries=null;
  int offset=reserveBuf(8);
  setUShort(buf,offset,accessFlags);
  setUShort(buf,offset + 2,thisClass);
  setUShort(buf,offset + 4,superClass);
  if (superInterfaces != null) {
    setUShort(buf,offset + 6,superInterfaces.length);
    reserveBuf(superInterfaces.length * 2);
    for (int i=0; i < superInterfaces.length; i++) {
      setUShort(buf,offset + 8 + i * 2,superInterfaces[i]);
    }
  }
 else {
    setUShort(buf,offset + 6,0);
  }
  offset=reserveBuf(2);
  int numFields=fields.size();
  setUShort(buf,offset,numFields);
  for (int i=0; i < numFields; i++) {
    emitElement(fields.get(i));
  }
  offset=reserveBuf(2);
  int numMethods=methods.size();
  setUShort(buf,offset,numMethods);
  for (int i=0; i < numMethods; i++) {
    emitElement(methods.get(i));
  }
  offset=reserveBuf(2);
  int numAttrs=classAttributes.size();
  setUShort(buf,offset,numAttrs);
  for (int i=0; i < numAttrs; i++) {
    emitElement(classAttributes.get(i));
  }
  if (buf.length == bufLen) {
    return buf;
  }
 else {
    byte[] b=new byte[bufLen];
    System.arraycopy(buf,0,b,0,bufLen);
    return b;
  }
}

Fixed version (ground truth):
/** 
 * After you've added everything you need to the class, call this method to generate the actual class file data. This can only be called once.
 */
public byte[] makeBytes() throws IllegalArgumentException {
  if (buf != null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (thisClass == 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  reserveBuf(10);
  setInt(buf,0,MAGIC);
  setUShort(buf,4,minorVersion);
  setUShort(buf,6,majorVersion);
  emitConstantPool();
  setUShort(buf,8,nextCPIndex);
  cachedCPEntries=null;
  int offset=reserveBuf(8);
  setUShort(buf,offset,accessFlags);
  setUShort(buf,offset + 2,thisClass);
  setUShort(buf,offset + 4,superClass);
  if (superInterfaces != null) {
    setUShort(buf,offset + 6,superInterfaces.length);
    reserveBuf(superInterfaces.length * 2);
    for (int i=0; i < superInterfaces.length; i++) {
      setUShort(buf,offset + 8 + i * 2,superInterfaces[i]);
    }
  }
 else {
    setUShort(buf,offset + 6,0);
  }
  offset=reserveBuf(2);
  int numFields=fields.size();
  setUShort(buf,offset,numFields);
  for (int i=0; i < numFields; i++) {
    emitElement(fields.get(i));
  }
  offset=reserveBuf(2);
  int numMethods=methods.size();
  setUShort(buf,offset,numMethods);
  for (int i=0; i < numMethods; i++) {
    emitElement(methods.get(i));
  }
  offset=reserveBuf(2);
  int numAttrs=classAttributes.size();
  setUShort(buf,offset,numAttrs);
  for (int i=0; i < numAttrs; i++) {
    emitElement(classAttributes.get(i));
  }
  if (buf.length == bufLen) {
    return buf;
  }
 else {
    byte[] b=new byte[bufLen];
    System.arraycopy(buf,0,b,0,bufLen);
    return b;
  }
}