Program: 75101
Project: 75101
Buggy source:
/** 
 * @throws DataException
 */
private void prepare() throws DataException {
  Context cx=Context.enter();
  try {
    if (this.baseQueryDefn.getBindings() != null && this.baseQueryDefn.getBindings().size() > 0) {
      this.expressionCompiler.setDataSetMode(false);
    }
    List groups=baseQueryDefn.getGroups();
    Set groupNameSet=new HashSet();
    IGroupDefinition group;
    for (int i=0; i < groups.size(); i++) {
      group=(IGroupDefinition)groups.get(i);
      if (group.getName() == null || group.getName().trim().length() == 0)       continue;
      for (int j=0; j < groups.size(); j++) {
        if (group.getName().equals(((IGroupDefinition)groups.get(j)).getName() == null ? "String_Node_Str" : ((IGroupDefinition)groups.get(j)).getName()) && j != i)         throw new DataException(ResourceConstants.DUPLICATE_GROUP_NAME);
      }
      groupNameSet.add(group.getName());
    }
    Map map=baseQueryDefn.getBindings();
    if (map != null) {
      Iterator it=map.keySet().iterator();
      while (it.hasNext()) {
        Object key=it.next();
        IBinding binding=(IBinding)map.get(key);
        String groupName=null;
        if (binding.getExpression() != null)         groupName=binding.getExpression().getGroupName();
        if (groupName == null) {
          if (binding.getAggregatOns().size() == 0)           continue;
          groupName=binding.getAggregatOns().get(0).toString();
        }
        if ((!groupName.equals(IBaseExpression.GROUP_OVERALL)) && !groupNameSet.contains(groupName)) {
          throw new DataException(ResourceConstants.GROUP_NOT_EXIST,new Object[]{groupName,key});
        }
      }
    }
    mappingParentColumnBinding();
    for (int i=0; i <= groups.size(); i++) {
      prepareGroup(baseQueryDefn,i,cx);
    }
  }
  finally {
    Context.exit();
  }
}

Fixed version (ground truth):
/** 
 * @throws DataException
 */
private void prepare() throws DataException {
  Context cx=Context.enter();
  try {
    if (this.baseQueryDefn.getBindings() != null && this.baseQueryDefn.getBindings().size() > 0) {
      this.expressionCompiler.setDataSetMode(false);
    }
    List groups=baseQueryDefn.getGroups();
    Set groupNameSet=new HashSet();
    IGroupDefinition group;
    for (int i=0; i < groups.size(); i++) {
      group=(IGroupDefinition)groups.get(i);
      if (group.getName() == null || group.getName().trim().length() == 0)       continue;
      for (int j=0; j < groups.size(); j++) {
        if (group.getName().equals(((IGroupDefinition)groups.get(j)).getName() == null ? "String_Node_Str" : ((IGroupDefinition)groups.get(j)).getName()) && j != i)         throw new DataException(ResourceConstants.DUPLICATE_GROUP_NAME);
      }
      groupNameSet.add(group.getName());
    }
    Map map=baseQueryDefn.getBindings();
    if (map != null) {
      Iterator it=map.keySet().iterator();
      while (it.hasNext()) {
        Object key=it.next();
        IBinding binding=(IBinding)map.get(key);
        String groupName=null;
        if (binding.getExpression() != null)         groupName=binding.getExpression().getGroupName();
        if (groupName == null) {
          if (binding.getAggregatOns().size() == 0)           continue;
          groupName=binding.getAggregatOns().get(0).toString();
        }
        if ((!groupName.equals(IBaseExpression.GROUP_OVERALL)) && !groupNameSet.contains(groupName)) {
          throw new DataException(ResourceConstants.GROUP_NOT_EXIST,new Object[]{groupName,key});
        }
      }
    }
    for (int i=0; i <= groups.size(); i++) {
      prepareGroup(baseQueryDefn,i,cx);
    }
  }
  finally {
    Context.exit();
  }
}