Program: 91820
Project: 91820
Buggy source:
/** 
 * Returns   {@code true} if the given texts are equal, optionally ignoring case and filtered-out characters.This method is sometime used for comparing identifiers in a lenient way. <p><b>Example:</b> the following call compares the two strings ignoring case and any characters which are not  {@linkplain Character#isLetterOrDigit(int) letter or digit}. In particular, spaces and punctuation characters like   {@code '_'} and {@code '-'} areignored:</p> {@preformat javaassert equalsFiltered("WGS84", "WGS_84", Characters.Filter.LETTERS_AND_DIGITS, true) == true;}
 * @param s1          the first characters sequence to compare, or {@code null}.
 * @param s2          the second characters sequence to compare, or {@code null}.
 * @param filter      the subset of characters to compare, or {@code null} for comparing all characters.
 * @param ignoreCase  {@code true} for comparing cases, or {@code false} for requiring exact match.
 * @return {@code true} if both arguments are {@code null} or if the two given texts are equal,optionally ignoring case and filtered-out characters.
 */
public static boolean equalsFiltered(final CharSequence s1,final CharSequence s2,final Characters.Filter filter,final boolean ignoreCase){
  if (s1 == s2) {
    return true;
  }
  if (s1 == null || s2 == null) {
    return false;
  }
  if (filter == null) {
    return ignoreCase ? equalsIgnoreCase(s1,s2) : equals(s1,s2);
  }
  final int lg1=s1.length();
  final int lg2=s2.length();
  int i1=0, i2=0;
  while (i1 < lg1) {
    int c1=codePointAt(s1,i1);
    final int n=charCount(c1);
    if (filter.contains(c1)) {
      int c2;
      do {
        if (i2 >= lg2) {
          return false;
        }
        c2=codePointAt(s2,i2);
        i2+=charCount(c2);
      }
 while (!filter.contains(c2));
      if (c1 != c2 && !(ignoreCase && equalsIgnoreCase(c1,c2))) {
        return false;
      }
    }
    i1+=n;
  }
  while (i2 < lg2) {
    final int s=codePointAt(s2,i2);
    if (filter.contains(s)) {
      return false;
    }
    i2+=charCount(s);
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Returns   {@code true} if the given texts are equal, optionally ignoring case and filtered-out characters.This method is sometime used for comparing identifiers in a lenient way. <p><b>Example:</b> the following call compares the two strings ignoring case and any characters which are not  {@linkplain Character#isLetterOrDigit(int) letter or digit}. In particular, spaces and punctuation characters like   {@code '_'} and {@code '-'} areignored:</p> {@preformat javaassert equalsFiltered("WGS84", "WGS_84", Characters.Filter.LETTERS_AND_DIGITS, true) == true;}
 * @param s1          the first characters sequence to compare, or {@code null}.
 * @param s2          the second characters sequence to compare, or {@code null}.
 * @param filter      the subset of characters to compare, or {@code null} for comparing all characters.
 * @param ignoreCase  {@code true} for ignoring cases, or {@code false} for requiring exact match.
 * @return {@code true} if both arguments are {@code null} or if the two given texts are equal,optionally ignoring case and filtered-out characters.
 */
public static boolean equalsFiltered(final CharSequence s1,final CharSequence s2,final Characters.Filter filter,final boolean ignoreCase){
  if (s1 == s2) {
    return true;
  }
  if (s1 == null || s2 == null) {
    return false;
  }
  if (filter == null) {
    return ignoreCase ? equalsIgnoreCase(s1,s2) : equals(s1,s2);
  }
  final int lg1=s1.length();
  final int lg2=s2.length();
  int i1=0, i2=0;
  while (i1 < lg1) {
    int c1=codePointAt(s1,i1);
    final int n=charCount(c1);
    if (filter.contains(c1)) {
      int c2;
      do {
        if (i2 >= lg2) {
          return false;
        }
        c2=codePointAt(s2,i2);
        i2+=charCount(c2);
      }
 while (!filter.contains(c2));
      if (c1 != c2 && !(ignoreCase && equalsIgnoreCase(c1,c2))) {
        return false;
      }
    }
    i1+=n;
  }
  while (i2 < lg2) {
    final int s=codePointAt(s2,i2);
    if (filter.contains(s)) {
      return false;
    }
    i2+=charCount(s);
  }
  return true;
}