Program: 94361
Project: 94361
Buggy source:
static public String wktGeometryFixer(String wktGeometry){
  String regex="String_Node_Str";
  String[] geometryArray=wktGeometry.split(regex);
  StringBuilder fixedGeometry=new StringBuilder();
  String geometryType="String_Node_Str";
  if (geometryArray.length > 1) {
    geometryType=geometryArray[0];
    if (geometryType.equalsIgnoreCase("String_Node_Str")) {
      String[] points=geometryArray[1].split("String_Node_Str");
      if (points.length == 4) {
        fixedGeometry.append("String_Node_Str");
        fixedGeometry.append(points[0]).append("String_Node_Str").append(points[1]).append("String_Node_Str");
        fixedGeometry.append(points[2]).append("String_Node_Str").append(points[1]).append("String_Node_Str");
        fixedGeometry.append(points[2]).append("String_Node_Str").append(points[3]).append("String_Node_Str");
        fixedGeometry.append(points[0]).append("String_Node_Str").append(points[3]).append("String_Node_Str");
        fixedGeometry.append(points[0]).append("String_Node_Str").append(points[1]);
        fixedGeometry.append("String_Node_Str");
        return fixedGeometry.toString();
      }
    }
 else {
      int parenthesesCount=0;
      for (int i=1; i < geometryArray.length; i++) {
        String tmpGeom=geometryArray[i];
        if (!tmpGeom.isEmpty() && !tmpGeom.equals("String_Node_Str")) {
          if (fixedGeometry.length() > 0) {
            fixedGeometry.append("String_Node_Str");
          }
          StringBuilder tmpFixed=new StringBuilder(parsePoints(geometryArray[i],geometryType));
          for (int j=0; j < parenthesesCount; j++) {
            tmpFixed=new StringBuilder("String_Node_Str" + tmpFixed + "String_Node_Str");
          }
          fixedGeometry.append(tmpFixed);
        }
        if (tmpGeom.isEmpty() && fixedGeometry.length() == 0) {
          parenthesesCount++;
        }
      }
    }
  }
  if (!geometryType.isEmpty() && fixedGeometry.length() != 0) {
    return geometryType + "String_Node_Str" + fixedGeometry+ "String_Node_Str";
  }
  return wktGeometry;
}

Fixed version (ground truth):
static public String wktGeometryFixer(String wktGeometry){
  StringBuilder fixedGeometry=new StringBuilder();
  String regex="String_Node_Str";
  String[] ga=wktGeometry.split(regex,2);
  if (ga.length > 1) {
    String geometryType=ga[0].trim().toLowerCase();
    if (geometryType.equals("String_Node_Str")) {
      String[] points=ga[1].split("String_Node_Str");
      if (points.length == 4) {
        fixedGeometry.append("String_Node_Str");
        fixedGeometry.append(points[0]).append("String_Node_Str").append(points[1]).append("String_Node_Str");
        fixedGeometry.append(points[2]).append("String_Node_Str").append(points[1]).append("String_Node_Str");
        fixedGeometry.append(points[2]).append("String_Node_Str").append(points[3]).append("String_Node_Str");
        fixedGeometry.append(points[0]).append("String_Node_Str").append(points[3]).append("String_Node_Str");
        fixedGeometry.append(points[0]).append("String_Node_Str").append(points[1]);
        fixedGeometry.append("String_Node_Str");
        return fixedGeometry.toString();
      }
    }
 else {
      fixedGeometry.append(geometryType.toUpperCase());
      fixedGeometry.append('(');
      StringBuilder subgeo=new StringBuilder();
      for (      char ch : ga[1].toCharArray()) {
        if (ch == '(' || ch == '[') {
          fixedGeometry.append('(');
        }
 else         if (ch == ')' || ch == ']') {
          if (subgeo.length() > 0) {
            fixedGeometry.append(parsePoints(subgeo.toString(),geometryType));
          }
          fixedGeometry.append(')');
          subgeo=new StringBuilder();
        }
 else         if (ch == ',') {
          if (subgeo.length() == 0) {
            fixedGeometry.append(ch);
          }
 else {
            subgeo.append(ch);
          }
        }
 else {
          subgeo.append(ch);
        }
      }
      return fixedGeometry.toString();
    }
  }
  return wktGeometry;
}