Program: 74907
Project: 74907
Buggy source:
/** 
 * Parses the input string into a unformatted string type.
 * @param str the input string to parse
 * @return the string
 * @throws ParseException if the specified string cannot be parsed according to specified pattern.
 */
public String parser(String str) throws ParseException {
  if (formatPattern == null || "String_Node_Str".equals(formatPattern) || formatPattern.indexOf("String_Node_Str") > -1 || formatPattern.indexOf("String_Node_Str") > -1) {
    return str;
  }
  StringBuffer orig=new StringBuffer(str);
  StringBuffer fstr=new StringBuffer("String_Node_Str");
  StringBuffer ret=new StringBuffer("String_Node_Str");
  for (int i=0; i < formatPattern.length(); i++) {
    if (formatPattern.charAt(i) != '!' && formatPattern.charAt(i) != '>' && formatPattern.charAt(i) != '<') {
      fstr.append(formatPattern.charAt(i));
    }
  }
  char fc=' ';
  int lenPattern=fstr.length();
  int lenFormatStr=orig.length();
  if (lenPattern > lenFormatStr) {
    if (dir) {
      for (int k=lenFormatStr; k < lenPattern; k++) {
        if (fstr.charAt(k) != '&') {
          throw new ParseException("String_Node_Str" + orig.toString() + "String_Node_Str",k);
        }
        orig.append("String_Node_Str");
      }
    }
 else {
      for (int k=0; k < lenPattern - lenFormatStr; k++) {
        if (fstr.charAt(lenPattern - lenFormatStr - k- 1) != '&') {
          throw new ParseException("String_Node_Str" + orig.toString() + "String_Node_Str",0);
        }
        orig.insert(0,"String_Node_Str");
      }
    }
  }
 else   if (lenPattern < lenFormatStr) {
    if (dir) {
      for (int k=lenPattern; k < lenFormatStr; k++) {
        fstr.append('&');
      }
    }
 else {
      for (int k=lenPattern; k < lenFormatStr; k++) {
        fstr.insert(0,'&');
      }
    }
  }
  int index=0;
  int count=lenPattern > lenFormatStr ? lenPattern : lenFormatStr;
  for (int i=0; i < count; i++) {
    fc=fstr.charAt(i);
switch (fc) {
case ('@'):
      if (orig.charAt(index) != ' ') {
        ret.append(orig.charAt(index));
      }
    index++;
  break;
case ('&'):
ret.append(orig.charAt(index));
index++;
break;
case ('<'):
case ('>'):
return str;
default :
if (orig.charAt(index) != fstr.charAt(i)) {
throw new ParseException("String_Node_Str" + orig.toString() + "String_Node_Str",index);
}
index++;
break;
}
}
return ret.toString();
}

Fixed version (ground truth):
/** 
 * Parses the input string into a unformatted string type.
 * @param str the input string to parse
 * @return the string
 * @throws ParseException if the specified string cannot be parsed according to specified pattern.
 */
public String parser(String str) throws ParseException {
  if (formatPattern == null || "String_Node_Str".equals(formatPattern) || formatPattern.indexOf("String_Node_Str") > -1 || formatPattern.indexOf("String_Node_Str") > -1) {
    return str;
  }
  StringBuffer orig=new StringBuffer(str);
  StringBuffer fstr=new StringBuffer("String_Node_Str");
  StringBuffer ret=new StringBuffer("String_Node_Str");
  for (int i=0; i < formatPattern.length(); i++) {
    if (formatPattern.charAt(i) != '!' && formatPattern.charAt(i) != '>' && formatPattern.charAt(i) != '<' && formatPattern.charAt(i) != '^') {
      fstr.append(formatPattern.charAt(i));
    }
  }
  char fc=' ';
  int lenPattern=fstr.length();
  int lenFormatStr=orig.length();
  if (lenPattern > lenFormatStr) {
    if (dir) {
      for (int k=lenFormatStr; k < lenPattern; k++) {
        if (fstr.charAt(k) != '&') {
          throw new ParseException("String_Node_Str" + orig.toString() + "String_Node_Str",k);
        }
        orig.append("String_Node_Str");
      }
    }
 else {
      for (int k=0; k < lenPattern - lenFormatStr; k++) {
        if (fstr.charAt(lenPattern - lenFormatStr - k- 1) != '&') {
          throw new ParseException("String_Node_Str" + orig.toString() + "String_Node_Str",0);
        }
        orig.insert(0,"String_Node_Str");
      }
    }
  }
 else   if (lenPattern < lenFormatStr) {
    if (dir) {
      for (int k=lenPattern; k < lenFormatStr; k++) {
        fstr.append('&');
      }
    }
 else {
      for (int k=lenPattern; k < lenFormatStr; k++) {
        fstr.insert(0,'&');
      }
    }
  }
  int index=0;
  int count=lenPattern > lenFormatStr ? lenPattern : lenFormatStr;
  for (int i=0; i < count; i++) {
    fc=fstr.charAt(i);
switch (fc) {
case ('@'):
      if (orig.charAt(index) != ' ') {
        ret.append(orig.charAt(index));
      }
    index++;
  break;
case ('&'):
ret.append(orig.charAt(index));
index++;
break;
case ('<'):
case ('>'):
return str;
default :
if (orig.charAt(index) != fstr.charAt(i)) {
throw new ParseException("String_Node_Str" + orig.toString() + "String_Node_Str",index);
}
index++;
break;
}
}
return ret.toString();
}