Program: 8988
Project: 8988
Buggy source:
/** 
 * Returns an iterator over all member paths of the given group.
 * @param groupTree the group tree
 * @param authorizableType type of authorizables to filter.
 * @param includeInherited {@code true} to include inherited members
 * @param processedRefs helper set that contains the references that are already processed.
 * @return an iterator over all member paths
 */
@Nonnull private Iterator<String> getMembers(@Nonnull final Tree groupTree,@Nonnull final AuthorizableType authorizableType,final boolean includeInherited,@Nonnull final Set<String> processedRefs){
  return new AbstractLazyIterator<String>(){
    private MemberReferenceIterator references=new MemberReferenceIterator(groupTree,processedRefs);
    private Iterator<String> parent;
    @Override protected String getNext(){
      String next=null;
      while (next == null) {
        if (parent != null) {
          if (parent.hasNext()) {
            next=parent.next();
          }
 else {
            parent=null;
          }
        }
 else         if (!references.hasNext()) {
          break;
        }
 else {
          String value=references.next();
          next=identifierManager.getPath(PropertyValues.newWeakReference(value));
          if (next != null && (includeInherited || authorizableType != AuthorizableType.AUTHORIZABLE)) {
            Tree auth=getByPath(next);
            AuthorizableType type=UserUtil.getType(auth);
            if (includeInherited && type == AuthorizableType.GROUP) {
              parent=getMembers(auth,authorizableType,true,processedRefs);
            }
            if (authorizableType != AuthorizableType.AUTHORIZABLE && type != authorizableType) {
              next=null;
            }
          }
        }
      }
      return next;
    }
  }
;
}

Fixed version (ground truth):
/** 
 * Returns an iterator over all member paths of the given group.
 * @param groupTree the group tree
 * @param authorizableType type of authorizables to filter.
 * @param includeInherited {@code true} to include inherited members
 * @param processedRefs helper set that contains the references that are already processed.
 * @return an iterator over all member paths
 */
@Nonnull private Iterator<String> getMembers(@Nonnull final Tree groupTree,@Nonnull final AuthorizableType authorizableType,final boolean includeInherited,@Nonnull final Set<String> processedRefs){
  return new AbstractLazyIterator<String>(){
    private MemberReferenceIterator references=new MemberReferenceIterator(groupTree,processedRefs);
    private Iterator<String> parent;
    @Override protected String getNext(){
      String next=null;
      while (next == null) {
        if (parent != null) {
          if (parent.hasNext()) {
            next=parent.next();
          }
 else {
            parent=null;
          }
        }
 else         if (!references.hasNext()) {
          break;
        }
 else {
          String value=references.next();
          next=identifierManager.getPath(PropertyValues.newWeakReference(value));
          if (next != null && (includeInherited || authorizableType != AuthorizableType.AUTHORIZABLE)) {
            Tree auth=getByPath(next);
            AuthorizableType type=(auth == null) ? null : UserUtil.getType(auth);
            if (includeInherited && type == AuthorizableType.GROUP) {
              parent=getMembers(auth,authorizableType,true,processedRefs);
            }
            if (authorizableType != AuthorizableType.AUTHORIZABLE && type != authorizableType) {
              next=null;
            }
          }
        }
      }
      return next;
    }
  }
;
}