Program: 12962
Project: 12962
Buggy source:
/** 
 * Converts all special characters to encoded-entities
 * @param s input string
 * @param encodeType the type of encoding
 * @param exceptions force these characters to be encoded
 * @return encoded string
 */
private static String encode(String s,String encodeType,char... exceptions){
  Map<String,String> encodeMap;
  List<Character> accept=new LinkedList<Character>(getAcceptedChars());
  for (  char c : exceptions) {
    accept.remove(Character.valueOf(c));
  }
  if (encodeType.equalsIgnoreCase("String_Node_Str")) {
    encodeMap=getHtmlEncode();
  }
 else   if (encodeType.equalsIgnoreCase("String_Node_Str")) {
    encodeMap=getXmlEncode();
  }
 else {
    throw new IllegalArgumentException("String_Node_Str");
  }
  StringBuilder b=new StringBuilder(s.length());
  for (int i=0; i < s.length(); i++) {
    char ch=s.charAt(i);
    if (accept.contains(Character.valueOf(ch))) {
      b.append(ch);
    }
 else {
      StringBuilder b2=new StringBuilder();
      if (Character.isWhitespace(ch)) {
        b2.append("String_Node_Str").append((int)ch).append("String_Node_Str");
      }
 else       if (Character.isISOControl(ch)) {
      }
 else       if (Character.isHighSurrogate(ch)) {
        int codePoint;
        if (i + 1 < s.length() && Character.isSurrogatePair(ch,s.charAt(i + 1)) && Character.isDefined(codePoint=(Character.toCodePoint(ch,s.charAt(i + 1))))) {
          b2.append("String_Node_Str").append(codePoint).append("String_Node_Str");
        }
        i++;
      }
 else       if (Character.isLowSurrogate(ch)) {
        i++;
      }
 else       if (Character.isDefined(ch)) {
        b2.append("String_Node_Str").append((int)ch).append("String_Node_Str");
      }
      if (encodeMap.containsKey(b2.toString())) {
        b.append(encodeMap.get(b2.toString()));
      }
 else {
        b.append(b2.toString());
      }
    }
  }
  return b.toString();
}

Fixed version (ground truth):
/** 
 * Converts all special characters to encoded-entities
 * @param s input string
 * @param encodeType the type of encoding
 * @param exceptions force these characters to be encoded
 * @return encoded string
 */
private static String encode(String s,String encodeType,char... exceptions){
  Map<String,String> encodeMap;
  List<Character> accept=new LinkedList<Character>(getAcceptedChars());
  for (  char c : exceptions) {
    accept.remove(Character.valueOf(c));
  }
  if (encodeType.equalsIgnoreCase("String_Node_Str")) {
    encodeMap=getHtmlEncode();
  }
 else   if (encodeType.equalsIgnoreCase("String_Node_Str")) {
    encodeMap=getXmlEncode();
  }
 else {
    throw new IllegalArgumentException("String_Node_Str");
  }
  StringBuilder b=new StringBuilder(s.length());
  for (int i=0; i < s.length(); i++) {
    char ch=s.charAt(i);
    if (accept.contains(Character.valueOf(ch))) {
      b.append(ch);
    }
 else {
      StringBuilder b2=new StringBuilder();
      if (Character.isISOControl(ch)) {
      }
 else       if (Character.isWhitespace(ch)) {
        b2.append("String_Node_Str").append((int)ch).append("String_Node_Str");
      }
 else       if (Character.isHighSurrogate(ch)) {
        int codePoint;
        if (i + 1 < s.length() && Character.isSurrogatePair(ch,s.charAt(i + 1)) && Character.isDefined(codePoint=(Character.toCodePoint(ch,s.charAt(i + 1))))) {
          b2.append("String_Node_Str").append(codePoint).append("String_Node_Str");
        }
        i++;
      }
 else       if (Character.isLowSurrogate(ch)) {
        i++;
      }
 else       if (Character.isDefined(ch)) {
        b2.append("String_Node_Str").append((int)ch).append("String_Node_Str");
      }
      if (encodeMap.containsKey(b2.toString())) {
        b.append(encodeMap.get(b2.toString()));
      }
 else {
        b.append(b2.toString());
      }
    }
  }
  return b.toString();
}