Program: 40121
Project: 40121
Buggy source:
private ClassWriter.Element[] makeMethodAttributes(int m,ClassWriter w,CodeReader oldCode,Compiler.Output output,MethodData md) throws InvalidClassFileException {
  CodeWriter code=makeNewCode(w,output);
  int codeAttrCount=0;
  LineNumberTableWriter lines=null;
  LocalVariableTableWriter locals=null;
  StackMapTableWriter stacks=null;
  if (oldCode != null) {
    lines=makeNewLines(w,oldCode,output);
    if (lines != null) {
      codeAttrCount++;
    }
    locals=makeNewLocals(w,oldCode,output);
    if (locals != null) {
      codeAttrCount++;
    }
    if (oldCode.getClassReader().getMajorVersion() > 50) {
      try {
        List<StackMapFrame> sm=StackMapTableReader.readStackMap(oldCode);
        String[][] varTypes=null;
        int[] newToOld=output.getNewBytecodesToOldBytecodes();
        int[][] vars=LocalVariableTableReader.makeVarMap(oldCode);
        if (vars != null) {
          varTypes=new String[newToOld.length][];
          for (int i=0; i < newToOld.length; i++) {
            int idx=newToOld[i];
            if (idx != -1 && vars[idx] != null) {
              varTypes[i]=new String[vars[idx].length / 2];
              for (int j=1; j < vars[idx].length; j+=2) {
                int type=vars[idx][j];
                varTypes[i][j / 2]=type == 0 ? null : oldCode.getClassReader().getCP().getCPUtf8(type);
              }
            }
          }
        }
        stacks=new StackMapTableWriter(w,md,output,cha,varTypes,sm);
        codeAttrCount++;
      }
 catch (      IOException|FailureException e) {
        e.printStackTrace();
      }
    }
  }
  ClassWriter.Element[] codeAttributes=new ClassWriter.Element[codeAttrCount];
  int codeAttrIndex=0;
  if (lines != null) {
    codeAttributes[codeAttrIndex++]=lines;
  }
  if (locals != null) {
    codeAttributes[codeAttrIndex++]=locals;
  }
  if (stacks != null) {
    codeAttributes[codeAttrIndex++]=stacks;
  }
  code.setAttributes(codeAttributes);
  ClassReader.AttrIterator iter=new ClassReader.AttrIterator();
  cr.initMethodAttributeIterator(m,iter);
  int methodAttrCount=iter.getRemainingAttributesCount();
  if (oldCode == null) {
    methodAttrCount++;
  }
  ClassWriter.Element[] methodAttributes=new ClassWriter.Element[methodAttrCount];
  for (int i=0; iter.isValid(); iter.advance()) {
    if (iter.getName().equals("String_Node_Str")) {
      methodAttributes[i]=code;
      code=null;
      if (oldCode == null) {
        throw new Error("String_Node_Str");
      }
    }
 else {
      methodAttributes[i]=new ClassWriter.RawElement(cr.getBytes(),iter.getRawOffset(),iter.getRawSize());
    }
    i++;
  }
  if (oldCode == null) {
    if (code == null) {
      throw new Error("String_Node_Str");
    }
    methodAttributes[methodAttrCount - 1]=code;
  }
  return methodAttributes;
}

Fixed version (ground truth):
private ClassWriter.Element[] makeMethodAttributes(int m,ClassWriter w,CodeReader oldCode,Compiler.Output output,MethodData md) throws InvalidClassFileException {
  CodeWriter code=makeNewCode(w,output);
  int codeAttrCount=0;
  LineNumberTableWriter lines=null;
  LocalVariableTableWriter locals=null;
  StackMapTableWriter stacks=null;
  if (oldCode != null) {
    lines=makeNewLines(w,oldCode,output);
    if (lines != null) {
      codeAttrCount++;
    }
    locals=makeNewLocals(w,oldCode,output);
    if (locals != null) {
      codeAttrCount++;
    }
    if (oldCode.getClassReader().getMajorVersion() > 50) {
      try {
        List<StackMapFrame> sm=StackMapTableReader.readStackMap(oldCode);
        String[][] varTypes=null;
        int[] newToOld=output.getNewBytecodesToOldBytecodes();
        int[][] vars=LocalVariableTableReader.makeVarMap(oldCode);
        if (vars != null) {
          varTypes=new String[newToOld.length][];
          for (int i=0; i < newToOld.length; i++) {
            int idx=newToOld[i];
            if (idx != -1 && vars[idx] != null) {
              varTypes[i]=new String[vars[idx].length / 2];
              for (int j=1; j < vars[idx].length; j+=2) {
                int type=vars[idx][j];
                varTypes[i][j / 2]=type == 0 ? null : oldCode.getClassReader().getCP().getCPUtf8(type);
              }
            }
          }
        }
        stacks=new StackMapTableWriter(w,md,output,cha,varTypes);
        codeAttrCount++;
      }
 catch (      IOException|FailureException e) {
        e.printStackTrace();
      }
    }
  }
  ClassWriter.Element[] codeAttributes=new ClassWriter.Element[codeAttrCount];
  int codeAttrIndex=0;
  if (lines != null) {
    codeAttributes[codeAttrIndex++]=lines;
  }
  if (locals != null) {
    codeAttributes[codeAttrIndex++]=locals;
  }
  if (stacks != null) {
    codeAttributes[codeAttrIndex++]=stacks;
  }
  code.setAttributes(codeAttributes);
  ClassReader.AttrIterator iter=new ClassReader.AttrIterator();
  cr.initMethodAttributeIterator(m,iter);
  int methodAttrCount=iter.getRemainingAttributesCount();
  if (oldCode == null) {
    methodAttrCount++;
  }
  ClassWriter.Element[] methodAttributes=new ClassWriter.Element[methodAttrCount];
  for (int i=0; iter.isValid(); iter.advance()) {
    if (iter.getName().equals("String_Node_Str")) {
      methodAttributes[i]=code;
      code=null;
      if (oldCode == null) {
        throw new Error("String_Node_Str");
      }
    }
 else {
      methodAttributes[i]=new ClassWriter.RawElement(cr.getBytes(),iter.getRawOffset(),iter.getRawSize());
    }
    i++;
  }
  if (oldCode == null) {
    if (code == null) {
      throw new Error("String_Node_Str");
    }
    methodAttributes[methodAttrCount - 1]=code;
  }
  return methodAttributes;
}