Program: 12009
Project: 12009
Buggy source:
void appendPreparingArgs(StringBuilder buf,TestMethodMeta testMethodMeta){
  int argsLen=testMethodMeta.methodMeta.argTypes.size();
  if (argsLen > 0) {
    for (int i=0; i < argsLen; i++) {
      ArgTypeMeta argTypeMeta=testMethodMeta.methodMeta.argTypes.get(i);
      String typeName=argTypeMeta.name;
      String argName=testMethodMeta.methodMeta.argNames.get(i);
      ExtArgPattern extArgPattern=testMethodMeta.extArgPattern;
      boolean isExtArgPatternTarget=false;
      if (extArgPattern != null && isCanonicalClassNameUsed(extArgPattern.extArg.canonicalClassName,argTypeMeta.name,testMethodMeta.classMeta)) {
        isExtArgPatternTarget=true;
      }
      ExtInstantiation extInstantiation=null;
      if (config.isExtensionEnabled && config.extConfiguration.extInstantiations != null) {
        for (        ExtInstantiation ins : config.extConfiguration.extInstantiations) {
          if (isCanonicalClassNameUsed(ins.canonicalClassName,argTypeMeta.name,testMethodMeta.classMeta)) {
            extInstantiation=ins;
            for (            String newImport : ins.importList) {
              testMethodMeta.classMeta.importedList.add(newImport);
            }
            break;
          }
        }
      }
      if (isExtArgPatternTarget && extArgPattern.preAssignCode != null) {
        String[] lines=extArgPattern.preAssignCode.split(StringValue.Semicolon);
        for (        String line : lines) {
          if (line != null && line.trim().length() > 0) {
            appendTabs(buf,2);
            buf.append(line);
            buf.append(StringValue.Semicolon);
            appendCRLF(buf);
          }
        }
      }
 else       if (extInstantiation != null) {
        if (extInstantiation.preAssignCode != null && extInstantiation.preAssignCode.trim().length() > 0) {
          String[] lines=extInstantiation.preAssignCode.split(StringValue.Semicolon);
          for (          String line : lines) {
            if (line != null && line.trim().length() > 0) {
              appendTabs(buf,2);
              buf.append(line);
              buf.append(StringValue.Semicolon);
              appendCRLF(buf);
            }
          }
        }
      }
      appendTabs(buf,2);
      if (config.mockObjectFramework == MockObjectFramework.JMock2) {
        buf.append("String_Node_Str");
      }
      buf.append(typeName);
      buf.append("String_Node_Str");
      buf.append(argName);
      buf.append("String_Node_Str");
      if (isExtArgPatternTarget) {
        buf.append(extArgPattern.assignCode.trim());
        if (!extArgPattern.assignCode.endsWith(StringValue.Semicolon)) {
          buf.append(StringValue.Semicolon);
        }
      }
 else {
        buf.append(getArgValue(testMethodMeta,argTypeMeta,argName));
        buf.append(StringValue.Semicolon);
      }
      appendCRLF(buf);
      if (isExtArgPatternTarget && extArgPattern.postAssignCode != null) {
        String[] lines=extArgPattern.postAssignCode.replaceAll("String_Node_Str",argName).split(StringValue.Semicolon);
        for (        String line : lines) {
          if (line != null && line.trim().length() > 0) {
            appendTabs(buf,2);
            buf.append(line);
            buf.append(StringValue.Semicolon);
            appendCRLF(buf);
          }
        }
      }
 else       if (extInstantiation != null) {
        if (extInstantiation.postAssignCode != null && extInstantiation.postAssignCode.trim().length() > 0) {
          String[] lines=extInstantiation.postAssignCode.split(StringValue.Semicolon);
          for (          String line : lines) {
            if (line != null && line.trim().length() > 0) {
              appendTabs(buf,2);
              buf.append(line);
              buf.append(StringValue.Semicolon);
              appendCRLF(buf);
            }
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
void appendPreparingArgs(StringBuilder buf,TestMethodMeta testMethodMeta){
  int argsLen=testMethodMeta.methodMeta.argTypes.size();
  if (argsLen > 0) {
    for (int i=0; i < argsLen; i++) {
      ArgTypeMeta argTypeMeta=testMethodMeta.methodMeta.argTypes.get(i);
      String typeName=argTypeMeta.name;
      String argName=testMethodMeta.methodMeta.argNames.get(i);
      ExtArgPattern extArgPattern=testMethodMeta.extArgPattern;
      boolean isExtArgPatternTarget=false;
      if (extArgPattern != null && isCanonicalClassNameUsed(extArgPattern.extArg.canonicalClassName,argTypeMeta.name,testMethodMeta.classMeta)) {
        isExtArgPatternTarget=true;
      }
      ExtInstantiation extInstantiation=null;
      if (config.isExtensionEnabled && config.extConfiguration.extInstantiations != null) {
        for (        ExtInstantiation ins : config.extConfiguration.extInstantiations) {
          if (isCanonicalClassNameUsed(ins.canonicalClassName,argTypeMeta.name,testMethodMeta.classMeta)) {
            extInstantiation=ins;
            for (            String newImport : ins.importList) {
              testMethodMeta.classMeta.importedList.add(newImport);
            }
            break;
          }
        }
      }
      if (isExtArgPatternTarget && extArgPattern.preAssignCode != null) {
        String[] lines=extArgPattern.preAssignCode.split(StringValue.Semicolon);
        for (        String line : lines) {
          if (line != null && line.trim().length() > 0) {
            appendTabs(buf,2);
            line=line.trim().replaceAll(StringValue.CarriageReturn,"String_Node_Str").replaceAll(StringValue.LineFeed,"String_Node_Str");
            buf.append(line);
            buf.append(StringValue.Semicolon);
            appendCRLF(buf);
          }
        }
      }
 else       if (extInstantiation != null) {
        if (extInstantiation.preAssignCode != null && extInstantiation.preAssignCode.trim().length() > 0) {
          String[] lines=extInstantiation.preAssignCode.split(StringValue.Semicolon);
          for (          String line : lines) {
            if (line != null && line.trim().length() > 0) {
              appendTabs(buf,2);
              line=line.trim().replaceAll(StringValue.CarriageReturn,"String_Node_Str").replaceAll(StringValue.LineFeed,"String_Node_Str");
              buf.append(line);
              buf.append(StringValue.Semicolon);
              appendCRLF(buf);
            }
          }
        }
      }
      appendTabs(buf,2);
      if (config.mockObjectFramework == MockObjectFramework.JMock2) {
        buf.append("String_Node_Str");
      }
      buf.append(typeName);
      buf.append("String_Node_Str");
      buf.append(argName);
      buf.append("String_Node_Str");
      if (isExtArgPatternTarget) {
        buf.append(extArgPattern.assignCode.trim());
        if (!extArgPattern.assignCode.endsWith(StringValue.Semicolon)) {
          buf.append(StringValue.Semicolon);
        }
      }
 else {
        buf.append(getArgValue(testMethodMeta,argTypeMeta,argName));
        buf.append(StringValue.Semicolon);
      }
      appendCRLF(buf);
      if (isExtArgPatternTarget && extArgPattern.postAssignCode != null) {
        String[] lines=extArgPattern.postAssignCode.replaceAll("String_Node_Str",argName).split(StringValue.Semicolon);
        for (        String line : lines) {
          if (line != null && line.trim().length() > 0) {
            appendTabs(buf,2);
            line=line.trim().replaceAll(StringValue.CarriageReturn,"String_Node_Str").replaceAll(StringValue.LineFeed,"String_Node_Str");
            buf.append(line);
            buf.append(StringValue.Semicolon);
            appendCRLF(buf);
          }
        }
      }
 else       if (extInstantiation != null) {
        if (extInstantiation.postAssignCode != null && extInstantiation.postAssignCode.trim().length() > 0) {
          String[] lines=extInstantiation.postAssignCode.split(StringValue.Semicolon);
          for (          String line : lines) {
            if (line != null && line.trim().length() > 0) {
              appendTabs(buf,2);
              buf.append(line);
              buf.append(StringValue.Semicolon);
              appendCRLF(buf);
            }
          }
        }
      }
    }
  }
}