Program: 20600
Project: 20600
Buggy source:
private Element buildBeanElement(String contentsString){
  String packageName=null;
  Matcher matcher=packageRegex.matcher(contentsString);
  if (matcher.find()) {
    packageName=matcher.group(1);
  }
  String className=null;
  matcher=classNameRegex.matcher(contentsString);
  if (matcher.find()) {
    className=matcher.group(1);
  }
 else {
    return null;
  }
  Element beanElement=document.createElement("String_Node_Str");
  String classNameLower=className.substring(0,1).toLowerCase() + className.substring(1);
  beanElement.setAttribute("String_Node_Str",classNameLower);
  if (packageName != null) {
    beanElement.setAttribute("String_Node_Str",packageName + "String_Node_Str" + className);
  }
  Pattern constructorRegex=Pattern.compile("String_Node_Str" + className + "String_Node_Str");
  matcher=constructorRegex.matcher(contentsString);
  List<String> constructors=new ArrayList<String>();
  boolean defaultConstructor=false;
  while (matcher.find()) {
    String parameters=matcher.group(1).trim();
    if (parameters.isEmpty()) {
      defaultConstructor=true;
      break;
    }
    constructors.add(parameters);
  }
  if (!defaultConstructor && constructors.size() == 1) {
    matcher=parameterRegex.matcher(constructors.get(0));
    int index=0;
    while (matcher.find()) {
      String type=matcher.group(1);
      String name=matcher.group(2);
      Element constructorArgElement=document.createElement("String_Node_Str");
      if (wrappers.contains(type) || primatives.contains(type)) {
        if (wrappers.contains(type)) {
          type="String_Node_Str" + type;
        }
        constructorArgElement.setAttribute("String_Node_Str",type);
        constructorArgElement.setAttribute("String_Node_Str","String_Node_Str");
      }
 else {
        constructorArgElement.setAttribute("String_Node_Str",name);
      }
      constructorArgElement.setAttribute("String_Node_Str",index + "String_Node_Str");
      index++;
      beanElement.appendChild(constructorArgElement);
    }
  }
  matcher=publicFieldRegex.matcher(contentsString);
  while (matcher.find()) {
    String type=matcher.group(1);
    String name=matcher.group(2);
    String value=matcher.group(4);
    Element propertyElement=document.createElement("String_Node_Str");
    propertyElement.setAttribute("String_Node_Str",name);
    if (primatives.contains(type) || wrappers.contains(type)) {
      propertyElement.setAttribute("String_Node_Str",value);
    }
 else {
      String typeLower=type.substring(0,1).toLowerCase() + type.substring(1);
      propertyElement.setAttribute("String_Node_Str",typeLower);
    }
    beanElement.appendChild(propertyElement);
  }
  matcher=setterRegex.matcher(contentsString);
  while (matcher.find()) {
    String name=matcher.group(1);
    String type=matcher.group(2);
    Element propertyElement=document.createElement("String_Node_Str");
    name=name.substring(0,1).toLowerCase() + name.substring(1);
    propertyElement.setAttribute("String_Node_Str",name);
    if (primatives.contains(type) || wrappers.contains(type)) {
      propertyElement.setAttribute("String_Node_Str","String_Node_Str");
    }
 else {
      String typeLower=type.substring(0,1).toLowerCase() + type.substring(1);
      propertyElement.setAttribute("String_Node_Str",typeLower);
    }
    beanElement.appendChild(propertyElement);
  }
  return beanElement;
}

Fixed version (ground truth):
/** 
 * Creates the &lt;bean /&gt; element.
 * @param javaSource the Java source code
 * @return the &lt;bean /&gt; element or null if there were no public classes.
 */
private Element buildBeanElement(String javaSource){
  Matcher matcher;
  String className=null;
  matcher=classNameRegex.matcher(javaSource);
  if (matcher.find()) {
    className=matcher.group(1);
  }
 else {
    return null;
  }
  String packageName=null;
  matcher=packageRegex.matcher(javaSource);
  if (matcher.find()) {
    packageName=matcher.group(1);
  }
  Element beanElement=document.createElement("String_Node_Str");
  String classNameLower=className.substring(0,1).toLowerCase() + className.substring(1);
  beanElement.setAttribute("String_Node_Str",classNameLower);
  String classAttr=(packageName == null) ? className : packageName + "String_Node_Str" + className;
  beanElement.setAttribute("String_Node_Str",classAttr);
  Pattern constructorRegex=Pattern.compile("String_Node_Str" + className + "String_Node_Str");
  matcher=constructorRegex.matcher(javaSource);
  List<String> constructors=new ArrayList<String>();
  boolean defaultConstructor=false;
  while (matcher.find()) {
    String parameters=matcher.group(1);
    if (parameters.isEmpty()) {
      defaultConstructor=true;
      break;
    }
    constructors.add(parameters);
  }
  if (!defaultConstructor && constructors.size() == 1) {
    matcher=parameterRegex.matcher(constructors.get(0));
    int index=0;
    while (matcher.find()) {
      String type=matcher.group(1);
      Element constructorArgElement=document.createElement("String_Node_Str");
      if (wrappers.contains(type) || primatives.contains(type)) {
        if (wrappers.contains(type)) {
          type="String_Node_Str" + type;
        }
        constructorArgElement.setAttribute("String_Node_Str",type);
        constructorArgElement.setAttribute("String_Node_Str","String_Node_Str");
      }
 else {
        String typeLower=type.substring(0,1).toLowerCase() + type.substring(1);
        constructorArgElement.setAttribute("String_Node_Str",typeLower);
      }
      constructorArgElement.setAttribute("String_Node_Str",index + "String_Node_Str");
      index++;
      beanElement.appendChild(constructorArgElement);
    }
  }
  matcher=publicFieldRegex.matcher(javaSource);
  while (matcher.find()) {
    String type=matcher.group(1);
    String name=matcher.group(2);
    String value=matcher.group(4);
    Element propertyElement=document.createElement("String_Node_Str");
    propertyElement.setAttribute("String_Node_Str",name);
    if (primatives.contains(type) || wrappers.contains(type)) {
      propertyElement.setAttribute("String_Node_Str",value);
    }
 else {
      String typeLower=type.substring(0,1).toLowerCase() + type.substring(1);
      propertyElement.setAttribute("String_Node_Str",typeLower);
    }
    beanElement.appendChild(propertyElement);
  }
  matcher=setterRegex.matcher(javaSource);
  while (matcher.find()) {
    String name=matcher.group(1);
    String type=matcher.group(2);
    Element propertyElement=document.createElement("String_Node_Str");
    name=name.substring(0,1).toLowerCase() + name.substring(1);
    propertyElement.setAttribute("String_Node_Str",name);
    if (primatives.contains(type) || wrappers.contains(type)) {
      propertyElement.setAttribute("String_Node_Str","String_Node_Str");
    }
 else {
      String typeLower=type.substring(0,1).toLowerCase() + type.substring(1);
      propertyElement.setAttribute("String_Node_Str",typeLower);
    }
    beanElement.appendChild(propertyElement);
  }
  return beanElement;
}