nus-yam/ex-repair huggingface dataset:
Program: 66315
Project: 66315
Buggy source:
/** 
 * Updates chart element Fill.
 * @param eObj chart element object.
 * @param eRefObj reference chart element object.
 * @param eDefObj default chart element object.
 * @generated Don't change this method manually.
 */
protected void updateFillImpl(String name,EObject eParentObj,Fill eObj,Fill eRefObj,Fill eDefObj){
  if (eObj == null) {
    if (eRefObj != null) {
      eObj=eRefObj.copyInstance();
      ChartElementUtil.setEObjectAttribute(eParentObj,name,eObj,false);
    }
 else     if (eDefObj != null) {
      eObj=eDefObj.copyInstance();
      ChartElementUtil.setEObjectAttribute(eParentObj,name,eObj,false);
      return;
    }
  }
  if (eObj == null || (eRefObj == null && eDefObj == null)) {
    return;
  }
  if (!eObj.isSetType()) {
    if (eRefObj != null && eRefObj.isSetType()) {
      eObj.setType(eRefObj.getType());
    }
 else     if (eDefObj != null && eDefObj.isSetType()) {
      eObj.setType(eDefObj.getType());
    }
  }
}

Fixed version (ground truth):
/** 
 * Updates chart element Fill.
 * @param eObj chart element object.
 * @param eRefObj reference chart element object.
 * @param eDefObj default chart element object.
 * @generated Don't change this method manually.
 */
protected void updateFillImpl(String name,EObject eParentObj,Fill eObj,Fill eRefObj,Fill eDefObj){
  if (eObj != null || (eRefObj == null && eDefObj == null)) {
    return;
  }
  if (eRefObj != null) {
    ChartElementUtil.setEObjectAttribute(eParentObj,name,eRefObj,false);
  }
  if (eDefObj != null) {
    ChartElementUtil.setEObjectAttribute(eParentObj,name,eDefObj,false);
  }
}
Program: 66316
Project: 66316
Buggy source:
/** 
 * Returns the index of specified expression on GroupDefinition.
 * @param expr specified expression.
 * @param groupDefinitions list of <code>GroupDefinition</code>
 * @return
 * @throws ChartException
 */
private int getGroupIndex(String expr,List<IGroupDefinition> groupDefinitions) throws ChartException {
  if (expr == null) {
    return -1;
  }
  exprCodec.decode(expr);
  Set<String> bindingNameSet=exprCodec.getRowBindingNameSet();
  if (bindingNameSet.isEmpty()) {
    return -1;
  }
  for (int i=0; i < groupDefinitions.size(); i++) {
    IGroupDefinition gd=groupDefinitions.get(i);
    String exprGroupKey=gd.getKeyExpression();
    Set<String> grpBindings=exprCodec.getRowBindingNameSet(exprGroupKey);
    for (    String grpBinding : grpBindings) {
      if (bindingNameSet.contains(grpBinding)) {
        return i;
      }
    }
  }
  return -1;
}

Fixed version (ground truth):
/** 
 * Returns the index of specified expression on GroupDefinition.
 * @param expr specified expression.
 * @param groupDefinitions list of <code>GroupDefinition</code>
 * @return
 * @throws ChartException
 */
private int getGroupIndex(String expr,List<IGroupDefinition> groupDefinitions) throws ChartException {
  if (expr == null) {
    return -1;
  }
  exprCodec.decode(expr);
  Set<String> bindingNameSet=exprCodec.getRowBindingNameSet();
  boolean isJavaScript=ExpressionCodec.JAVASCRIPT.equals(exprCodec.getType());
  for (int i=0; i < groupDefinitions.size(); i++) {
    IGroupDefinition gd=groupDefinitions.get(i);
    String exprGroupKey=gd.getKeyExpression();
    if (isJavaScript) {
      if (expr.indexOf(exprGroupKey) >= 0) {
        return i;
      }
    }
    if (!bindingNameSet.isEmpty()) {
      Set<String> grpBindings=exprCodec.getRowBindingNameSet(exprGroupKey);
      for (      String grpBinding : grpBindings) {
        if (bindingNameSet.contains(grpBinding)) {
          return i;
        }
      }
    }
  }
  return -1;
}
Program: 66318
Project: 66318
Buggy source:
private static List getInputParameters(String reportDesignFile,int taskType,IReportEngine engine){
  IGetParameterDefinitionTask task=null;
  try {
    if (taskType == TASK_TYPE_RENDER) {
      task=engine.createGetParameterDefinitionTask(engine.openReportDocument(reportDesignFile).getReportRunnable());
    }
 else {
      task=engine.createGetParameterDefinitionTask(engine.openReportDesign(reportDesignFile));
    }
    ParameterFactory factory=new ParameterFactory(task);
    List parameters=factory.getRootChildren(false);
    task.close();
    task=null;
    return parameters;
  }
 catch (  EngineException e) {
    if (task != null) {
      task.close();
    }
  }
  return null;
}

Fixed version (ground truth):
private static List getInputParameters(String reportDesignFile,int taskType,IReportEngine engine){
  IGetParameterDefinitionTask task=null;
  IReportDocument document=null;
  try {
    if (taskType == TASK_TYPE_RENDER) {
      document=engine.openReportDocument(reportDesignFile);
      task=engine.createGetParameterDefinitionTask(document.getReportRunnable());
    }
 else {
      task=engine.createGetParameterDefinitionTask(engine.openReportDesign(reportDesignFile));
    }
    ParameterFactory factory=new ParameterFactory(task);
    List parameters=factory.getRootChildren(false);
    task.close();
    if (document != null) {
      document.close();
    }
    task=null;
    return parameters;
  }
 catch (  EngineException e) {
    if (task != null) {
      task.close();
    }
  }
  return null;
}
Program: 66320
Project: 66320
Buggy source:
public void keyTraversed(TraverseEvent e){
  if (e.detail == SWT.TRAVERSE_MNEMONIC && e.doit) {
    e.detail=SWT.TRAVERSE_NONE;
    openKeySelectionDialog();
  }
}

Fixed version (ground truth):
public void keyTraversed(TraverseEvent e){
  if (e.detail == SWT.TRAVERSE_MNEMONIC && e.doit) {
    e.detail=SWT.TRAVERSE_NONE;
    if (btnDisplayNameID.isEnabled()) {
      openKeySelectionDialog();
    }
  }
}
Program: 66322
Project: 66322
Buggy source:
public void keyTraversed(TraverseEvent e){
  if (e.detail == SWT.TRAVERSE_MNEMONIC && e.doit) {
    e.detail=SWT.TRAVERSE_NONE;
    openKeySelectionDialog();
  }
}

Fixed version (ground truth):
public void keyTraversed(TraverseEvent e){
  if (e.detail == SWT.TRAVERSE_MNEMONIC && e.doit) {
    e.detail=SWT.TRAVERSE_NONE;
    if (btnDisplayNameID.isEnabled()) {
      openKeySelectionDialog();
    }
  }
}
Program: 66323
Project: 66323
Buggy source:
public void dispose(){
  reportHandle.removeValidationListener(this);
  SessionHandleAdapter.getInstance().getMediator(reportHandle).removeColleague(getSelectionSynchronizer());
}

Fixed version (ground truth):
public void dispose(){
  reportHandle.removeValidationListener(this);
  ReportMediator mediator=SessionHandleAdapter.getInstance().getMediator(reportHandle,false);
  if (mediator != null) {
    mediator.removeColleague(getSelectionSynchronizer());
  }
}
Program: 66324
Project: 66324
Buggy source:
/** 
 * The <code>Page</code> implementation of this <code>IPage</code> method disposes of this page's control (if it has one and it has not already been disposed).
 */
public void dispose(){
  selectionChangedListeners.clear();
  treeViewer=null;
  if (reportHandle != null)   SessionHandleAdapter.getInstance().getMediator(reportHandle).removeColleague(this);
  super.dispose();
}

Fixed version (ground truth):
/** 
 * The <code>Page</code> implementation of this <code>IPage</code> method disposes of this page's control (if it has one and it has not already been disposed).
 */
public void dispose(){
  selectionChangedListeners.clear();
  treeViewer=null;
  if (reportHandle != null) {
    ReportMediator mediator=SessionHandleAdapter.getInstance().getMediator(reportHandle,false);
    if (mediator != null) {
      mediator.removeColleague(this);
    }
  }
  super.dispose();
}
Program: 66325
Project: 66325
Buggy source:
public boolean layoutCheck(){
  int rowCount=getRowCount();
  int columnCount=getColumnCount();
  CrosstabCellAdapter[][] adapters=new CrosstabCellAdapter[rowCount][columnCount];
  for (int i=0; i < oldModelList.size(); i++) {
    CrosstabCellAdapter adapter=(CrosstabCellAdapter)oldModelList.get(i);
    int rowNumber=adapter.getRowNumber();
    int rowSpan=adapter.getRowSpan();
    int columnNumber=adapter.getColumnNumber();
    int columnSpan=adapter.getColumnSpan();
    for (int j=0; j < rowSpan; j++) {
      int adapterRow=rowNumber + j;
      if (adapterRow > rowCount) {
        return false;
      }
      for (int k=0; k < columnSpan; k++) {
        int adapterColumn=columnNumber + k;
        if (adapterColumn > columnCount) {
          return false;
        }
        if (adapters[adapterRow - 1][adapterColumn - 1] == null) {
          adapters[adapterRow - 1][adapterColumn - 1]=adapter;
        }
 else         if (adapters[adapterRow - 1][adapterColumn - 1] != adapter) {
          return false;
        }
      }
    }
  }
  for (int i=0; i < adapters.length; i++) {
    for (int j=0; j < adapters[i].length; j++) {
      if (adapters[i][j] == null) {
        return false;
      }
    }
  }
  return true;
}

Fixed version (ground truth):
public boolean layoutCheck(){
  int rowCount=getRowCount();
  int columnCount=getColumnCount();
  CrosstabCellAdapter[][] adapters=new CrosstabCellAdapter[rowCount][columnCount];
  for (int i=0; i < oldModelList.size(); i++) {
    CrosstabCellAdapter adapter=(CrosstabCellAdapter)oldModelList.get(i);
    int rowNumber=adapter.getRowNumber();
    int rowSpan=adapter.getRowSpan();
    int columnNumber=adapter.getColumnNumber();
    int columnSpan=adapter.getColumnSpan();
    for (int j=0; j < rowSpan; j++) {
      int adapterRow=rowNumber + j;
      if (adapterRow > rowCount) {
        return false;
      }
      for (int k=0; k < columnSpan; k++) {
        int adapterColumn=columnNumber + k;
        if (adapterColumn > columnCount) {
          return false;
        }
        if (adapters[adapterRow - 1][adapterColumn - 1] == null) {
          adapters[adapterRow - 1][adapterColumn - 1]=adapter;
        }
 else         if (adapters[adapterRow - 1][adapterColumn - 1] != adapter) {
        }
      }
    }
  }
  for (int i=0; i < adapters.length; i++) {
    for (int j=0; j < adapters[i].length; j++) {
      if (adapters[i][j] == null) {
        return false;
      }
    }
  }
  return true;
}
Program: 66326
Project: 66326
Buggy source:
/** 
 * Gets the BIRT resource path
 * @return
 * @throws URISyntaxException
 */
public URI getReportDesignPath(){
  if (Utility.getReportModuleHandle() == null || Utility.getReportModuleHandle().getSystemId() == null) {
    return null;
  }
  try {
    return new URI(Utility.getReportModuleHandle().getSystemId().getPath());
  }
 catch (  URISyntaxException e) {
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Gets the BIRT resource path
 * @return
 * @throws URISyntaxException
 */
public URI getReportDesignPath(){
  if (Utility.getReportModuleHandle() == null || Utility.getReportModuleHandle().getSystemId() == null) {
    return null;
  }
  try {
    return Utility.getReportModuleHandle().getSystemId().toURI();
  }
 catch (  URISyntaxException e) {
    return null;
  }
}
Program: 66327
Project: 66327
Buggy source:
public IPath getInputPath(IEditorInput input){
  if (input instanceof IURIEditorInput) {
    return new Path(((IURIEditorInput)input).getURI().getPath());
  }
  return null;
}

Fixed version (ground truth):
public IPath getInputPath(IEditorInput input){
  if (input instanceof IURIEditorInput) {
    return new Path(((IURIEditorInput)input).getURI().getPath());
  }
  if (input instanceof IFileEditorInput) {
    return ((IFileEditorInput)input).getFile().getLocation();
  }
  return null;
}
Program: 66330
Project: 66330
Buggy source:
/** 
 * Returns the 1-based index of the outermost group in which the current row is the first row.  For example, if a query contain N groups  (group with index 1 being the outermost group, and group with  index N being the innermost group), and this function returns a value M, it indicates that the  current row is the first row in groups with  indexes (M, M+1, ..., N ).
 * @return	The 1-based index of the outermost group in which the current row is the first row; (N+1) if the current row is not at the start of any group;
 */
public int getStartingGroupLevel() throws DataException {
  checkHasCurrentRow();
  if (cacheProvider.getCurrentIndex() == 0)   return 0;
  if (groups.length == 0)   return 1;
  int childGroupIdx=cacheProvider.getCurrentIndex();
  int currentGroupIdx=leafGroupIdx;
  int level;
  for (level=groups.length - 1; level >= 0; level--) {
    GroupInfo currentGroup=findGroup(level,currentGroupIdx);
    if (childGroupIdx == currentGroup.firstChild) {
      childGroupIdx=currentGroupIdx;
      currentGroupIdx=currentGroup.parent;
      continue;
    }
    break;
  }
  return level + 2;
}

Fixed version (ground truth):
/** 
 * Returns the 1-based index of the outermost group in which the current row is the first row. For example, if a query contain N groups (group with index 1 being the outermost group, and group with index N being the innermost group), and this function returns a value M, it indicates that the current row is the first row in groups with indexes (M, M+1, ..., N ).
 * @return	The 1-based index of the outermost group in whichthe current row is the first row; (N+1) if the current row is not at the start of any group;
 */
public int getStartingGroupLevel() throws DataException {
  checkHasCurrentRow();
  if (cacheProvider.getCurrentIndex() == 0)   return 0;
  if (groups.length == 0)   return 1;
  int childGroupIdx=cacheProvider.getCurrentIndex();
  int currentGroupIdx=leafGroupIdx;
  int level;
  for (level=groups.length - 1; level >= 0; level--) {
    GroupInfo currentGroup=findGroup(level,currentGroupIdx);
    if (childGroupIdx == currentGroup.firstChild) {
      childGroupIdx=currentGroupIdx;
      currentGroupIdx=currentGroup.parent;
      continue;
    }
    break;
  }
  return level + 2;
}
Program: 66331
Project: 66331
Buggy source:
private GroupInfo findGroup(int groupLevel,int groupIndex){
  if (groupIndex >= groups[groupLevel].size())   return null;
 else   return (GroupInfo)groups[groupLevel].get(groupIndex);
}

Fixed version (ground truth):
private GroupInfo findGroup(int groupLevel,int groupIndex){
  if (groupIndex >= groups[groupLevel].size())   return null;
 else {
    try {
      return (GroupInfo)groups[groupLevel].get(groupIndex);
    }
 catch (    Exception e) {
      return null;
    }
  }
}
Program: 66332
Project: 66332
Buggy source:
/** 
 * Gets the index of the current group at the specified group level. The index starts at 0  
 */
public int getCurrentGroupIndex(int groupLevel) throws DataException {
  checkHasCurrentRow();
  if (groupLevel == 0)   return 0;
  if (groupLevel < 0 || groupLevel > groups.length)   throw new DataException(ResourceConstants.INVALID_GROUP_LEVEL,Integer.valueOf(groupLevel));
  int currentGroupIdx=leafGroupIdx;
  int level;
  for (level=groups.length - 1; level > groupLevel - 1; level--) {
    GroupInfo currentGroup=findGroup(level,currentGroupIdx);
    currentGroupIdx=currentGroup.parent;
  }
  return currentGroupIdx;
}

Fixed version (ground truth):
/** 
 * Gets the index of the current group at the specified group level. The index starts at 0
 */
public int getCurrentGroupIndex(int groupLevel) throws DataException {
  checkHasCurrentRow();
  if (groupLevel == 0)   return 0;
  if (groupLevel < 0 || groupLevel > groups.length)   throw new DataException(ResourceConstants.INVALID_GROUP_LEVEL,Integer.valueOf(groupLevel));
  int currentGroupIdx=leafGroupIdx;
  int level;
  for (level=groups.length - 1; level > groupLevel - 1; level--) {
    GroupInfo currentGroup=findGroup(level,currentGroupIdx);
    currentGroupIdx=currentGroup.parent;
  }
  return currentGroupIdx;
}
Program: 66333
Project: 66333
Buggy source:
/** 
 * Returns the 1-based index of the outermost group in which the current row is the last row.  For example, if a query contain N groups  (group with index 1 being the outermost group, and group with  index N being the innermost group), and this function returns a value M, it indicates that the  current row is the last row in groups with  indexes (M, M+1, ..., N ). 
 * @return	The 1-based index of the outermost group in which the current row is the last row; (N+1) if the current row is not at the end of any group;
 */
public int getEndingGroupLevel() throws DataException {
  checkHasCurrentRow();
  if (cacheProvider.getCurrentIndex() == cacheProvider.getCount() - 1)   return 0;
  if (groups.length == 0)   return 1;
  int childGroupIdx=cacheProvider.getCurrentIndex();
  int currentGroupIdx=leafGroupIdx;
  int level;
  for (level=groups.length - 1; level >= 0; level--) {
    GroupInfo nextGroup=findGroup(level,currentGroupIdx + 1);
    if (nextGroup != null && childGroupIdx == nextGroup.firstChild - 1) {
      childGroupIdx=currentGroupIdx;
      currentGroupIdx=findGroup(level,currentGroupIdx).parent;
      continue;
    }
    break;
  }
  return level + 2;
}

Fixed version (ground truth):
/** 
 * Returns the 1-based index of the outermost group in which the current row is the last row. For example, if a query contain N groups (group with index 1 being the outermost group, and group with index N being the innermost group), and this function returns a value M, it indicates that the current row is the last row in groups with indexes (M, M+1, ..., N ).
 * @return	The 1-based index of the outermost group in whichthe current row is the last row; (N+1) if the current row is not at the end of any group;
 */
public int getEndingGroupLevel() throws DataException {
  checkHasCurrentRow();
  if (cacheProvider.getCurrentIndex() == cacheProvider.getCount() - 1)   return 0;
  if (groups.length == 0)   return 1;
  int childGroupIdx=cacheProvider.getCurrentIndex();
  int currentGroupIdx=leafGroupIdx;
  int level;
  for (level=groups.length - 1; level >= 0; level--) {
    GroupInfo nextGroup=findGroup(level,currentGroupIdx + 1);
    if (nextGroup != null && childGroupIdx == nextGroup.firstChild - 1) {
      childGroupIdx=currentGroupIdx;
      currentGroupIdx=findGroup(level,currentGroupIdx).parent;
      continue;
    }
    break;
  }
  return level + 2;
}
Program: 66334
Project: 66334
Buggy source:
/** 
 * Advance the leaf group with offset.
 * @param offset
 * @throws DataException 
 */
public void move() throws DataException {
  if (groups.length > 0) {
    binaryMove();
  }
}

Fixed version (ground truth):
/** 
 * Advance the leaf group with offset.
 * @param offset
 * @throws DataException
 */
public void move() throws DataException {
  if (groups.length > 0) {
    binaryMove();
  }
}
Program: 66335
Project: 66335
Buggy source:
public void performRequest(ReportRequest request){
  if (ReportRequest.OPEN_EDITOR.equals(request.getType()) && (request.getSelectionModelList().size() == 1)) {
    if (request.getSelectionModelList().get(0) instanceof MasterPageHandle) {
      handleOpenMasterPage(request);
      return;
    }
    if (request.getSelectionModelList().get(0) instanceof ScriptObjectNode) {
      handleOpenScriptPage(request);
      return;
    }
  }
}

Fixed version (ground truth):
public void performRequest(ReportRequest request){
  if (ReportRequest.OPEN_EDITOR.equals(request.getType()) && (request.getSelectionModelList().size() == 1)) {
    if (request.getSelectionModelList().get(0) instanceof MasterPageHandle) {
      handleOpenMasterPage(request);
      return;
    }
    if (request.getSelectionModelList().get(0) instanceof ScriptObjectNode) {
      ScriptObjectNode node=(ScriptObjectNode)request.getSelectionModelList().get(0);
      if (node.getParent() instanceof PropertyHandle) {
        PropertyHandle proHandle=(PropertyHandle)node.getParent();
        if (proHandle.getElementHandle().getModuleHandle().equals(getModel())) {
          handleOpenScriptPage(request);
        }
      }
      return;
    }
  }
}
Program: 66336
Project: 66336
Buggy source:
public int canDrop(Object transfer,Object target,int operation,DNDLocation location){
  if (transfer instanceof VariableElementHandle && target instanceof EditPart) {
    EditPart editPart=(EditPart)target;
    editPart.getRoot().getModel();
    if (editPart.getModel() instanceof ReportDesignHandle || editPart.getModel() instanceof DesignElementHandle || (editPart.getModel() instanceof SlotHandle)) {
      if (editPart.getModel() instanceof SlotHandle) {
        int slot_id=((SlotHandle)editPart.getModel()).getSlotID();
        if (slot_id == ISimpleMasterPageModel.PAGE_HEADER_SLOT || slot_id == ISimpleMasterPageModel.PAGE_FOOTER_SLOT) {
          if (((SlotHandle)editPart.getModel()).getCount() > 0)           return DNDService.LOGIC_FALSE;
 else           return DNDService.LOGIC_TRUE;
        }
 else         if (slot_id == ISimpleMasterPageModel.PAGE_HEADER_SLOT) {
          return DNDService.LOGIC_TRUE;
        }
      }
      if (getMasterPageHandle(editPart) != null || ((VariableElementHandle)transfer).getType().equals(DesignChoiceConstants.VARIABLE_TYPE_REPORT))       return DNDService.LOGIC_TRUE;
 else       return DNDService.LOGIC_FALSE;
    }
  }
  return DNDService.LOGIC_UNKNOW;
}

Fixed version (ground truth):
public int canDrop(Object transfer,Object target,int operation,DNDLocation location){
  if (transfer instanceof VariableElementHandle && target instanceof EditPart) {
    EditPart editPart=(EditPart)target;
    editPart.getRoot().getModel();
    if (editPart.getModel() instanceof ReportDesignHandle || editPart.getModel() instanceof DesignElementHandle || (editPart.getModel() instanceof SlotHandle)) {
      if (editPart.getModel() instanceof SlotHandle) {
        int slot_id=((SlotHandle)editPart.getModel()).getSlotID();
        if (slot_id == ISimpleMasterPageModel.PAGE_HEADER_SLOT || slot_id == ISimpleMasterPageModel.PAGE_FOOTER_SLOT) {
          if (((SlotHandle)editPart.getModel()).getCount() > 0)           return DNDService.LOGIC_FALSE;
 else           return DNDService.LOGIC_TRUE;
        }
 else         if (slot_id == ISimpleMasterPageModel.PAGE_HEADER_SLOT) {
          return DNDService.LOGIC_TRUE;
        }
      }
      if (getMasterPageHandle(editPart) != null || DesignChoiceConstants.VARIABLE_TYPE_REPORT.equals(((VariableElementHandle)transfer).getType()))       return DNDService.LOGIC_TRUE;
 else       return DNDService.LOGIC_FALSE;
    }
  }
  return DNDService.LOGIC_UNKNOW;
}
Program: 66338
Project: 66338
Buggy source:
/** 
 * It is used to test flush. Once the archive file is flushed, the stream should be flushed automactially. test steps: <ol> <li>create a archive file</li> <li>. create a reader and writer.</li> <li>create a output stream using the writer and input stream for reader.</li> <li>write some data into the output stream</li> <li>read the data from the input stream, different.</li> <li>flush the archive file</li> <li>read the data from the input stream, same.</li> </ol>
 */
public void testFlush() throws IOException {
  ArchiveFile af=new ArchiveFile("String_Node_Str","String_Node_Str");
  try {
    ArchiveReader reader=new ArchiveReader(af);
    ArchiveWriter writer=new ArchiveWriter(af);
    OutputStream out=writer.createOutputStream("String_Node_Str");
    InputStream in=reader.getInputStream("String_Node_Str");
    out.write(12);
    assertEquals(0,in.available());
    af.flush();
    assertEquals(1,in.available());
    int v=in.read();
    assertEquals(12,v);
    v=in.read();
    assertEquals(-1,v);
    in.close();
    out.close();
    reader.close();
    writer.finish();
  }
  finally {
    af.close();
    new File("String_Node_Str").delete();
  }
}

Fixed version (ground truth):
/** 
 * It is used to test flush. Once the archive file is flushed, the stream should be flushed automatically. test steps: <ol> <li>create a archive file</li> <li>. create a reader and writer.</li> <li>create a output stream using the writer and input stream for reader.</li> <li>write some data into the output stream</li> <li>read the data from the input stream, different.</li> <li>flush the archive file</li> <li>read the data from the input stream, same.</li> </ol>
 */
public void testFlush() throws IOException {
  ArchiveFile af=new ArchiveFile("String_Node_Str","String_Node_Str");
  try {
    ArchiveReader reader=new ArchiveReader(af);
    ArchiveWriter writer=new ArchiveWriter(af);
    OutputStream out=writer.createOutputStream("String_Node_Str");
    InputStream in=reader.getInputStream("String_Node_Str");
    out.write(12);
    assertEquals(0,in.available());
    af.flush();
    assertEquals(1,in.available());
    int v=in.read();
    assertEquals(12,v);
    v=in.read();
    assertEquals(-1,v);
    in.close();
    out.close();
    reader.close();
    writer.finish();
  }
  finally {
    af.close();
    new File("String_Node_Str").delete();
  }
}
Program: 66339
Project: 66339
Buggy source:
public void testReadWrite() throws IOException {
  ArchiveFile af=new ArchiveFile("String_Node_Str","String_Node_Str");
  try {
    ArchiveEntry entry=af.createEntry("String_Node_Str");
    entry.write(100);
    assertEquals(1,entry.getLength());
    entry.refresh();
    entry.close();
  }
  finally {
    af.close();
    new File("String_Node_Str").delete();
  }
}

Fixed version (ground truth):
/** 
 * Demonstrate how to use the archive entry and input/output stream
 */
public void testReadWrite() throws IOException {
  ArchiveFile af=new ArchiveFile("String_Node_Str","String_Node_Str");
  try {
    ArchiveWriter writer=new ArchiveWriter(af);
    ArchiveReader reader=new ArchiveReader(af);
    ArchiveEntry entry1=af.createEntry("String_Node_Str");
    entry1.write(0,new byte[]{0,0,0,1},0,4);
    assertEquals(4,entry1.getLength());
    RAInputStream in=reader.getInputStream("String_Node_Str");
    assertEquals(1,in.readInt());
    in.close();
    entry1.close();
    RAOutputStream out=writer.createOutputStream("String_Node_Str");
    out.writeInt(2);
    in=reader.getInputStream("String_Node_Str");
    assertEquals(0,in.available());
    af.flush();
    assertEquals(2,in.readInt());
    out.writeInt(3);
    out.close();
    assertEquals(3,in.readInt());
  }
  finally {
    af.close();
    new File("String_Node_Str").delete();
  }
}
Program: 66340
Project: 66340
Buggy source:
public void onRow(Row4Aggregation row) throws IOException, DataException {
  Row4Aggregation newRow=new Row4Aggregation();
  if (row.getLevelMembers().length != newMemberSize && orignalLevelCount == newMemberSize) {
    Member[] nMembers=new Member[newMemberSize];
    System.arraycopy(row.getLevelMembers(),0,nMembers,0,firstTimeLevel);
    Member[] timeMember=cubeDimensionReader.getLevelMembers(timeDimensionIndex,endLevelIndex,row.getDimPos()[timeDimensionIndex]);
    System.arraycopy(timeMember,0,nMembers,firstTimeLevel,timeMember.length);
    if ((orignalLevelCount - (lowestTimeLevel + 1)) > 0) {
      System.arraycopy(row.getLevelMembers(),lowestTimeLevel + 1,nMembers,firstTimeLevel + timeMember.length,orignalLevelCount - (lowestTimeLevel + 1));
    }
    newRow.setLevelMembers(nMembers);
    newRow.setDimPos(row.getDimPos());
    newRow.setMeasures(row.getMeasures());
    newRow.setMeasureList(row.getMeasureList());
    newRow.setParameterValues(row.getParameterValues());
  }
 else {
    newRow=row;
  }
  if (this.existReferenceDate) {
    sortedFactRows.push(newRow);
  }
 else {
    factRows.add(newRow);
  }
}

Fixed version (ground truth):
public void onRow(Row4Aggregation row) throws IOException, DataException {
  Row4Aggregation newRow=new Row4Aggregation();
  if (row.getLevelMembers().length != newMemberSize || orignalLevelCount != newMemberSize) {
    Member[] nMembers=new Member[newMemberSize];
    System.arraycopy(row.getLevelMembers(),0,nMembers,0,firstTimeLevel);
    Member[] timeMember=cubeDimensionReader.getLevelMembers(timeDimensionIndex,endLevelIndex,row.getDimPos()[timeDimensionIndex]);
    System.arraycopy(timeMember,0,nMembers,firstTimeLevel,timeMember.length);
    if ((orignalLevelCount - (lowestTimeLevel + 1)) > 0) {
      System.arraycopy(row.getLevelMembers(),lowestTimeLevel + 1,nMembers,firstTimeLevel + timeMember.length,orignalLevelCount - (lowestTimeLevel + 1));
    }
    newRow.setLevelMembers(nMembers);
    newRow.setDimPos(row.getDimPos());
    newRow.setMeasures(row.getMeasures());
    newRow.setMeasureList(row.getMeasureList());
    newRow.setParameterValues(row.getParameterValues());
  }
 else {
    newRow=row;
  }
  if (this.existReferenceDate) {
    sortedFactRows.push(newRow);
  }
 else {
    factRows.add(newRow);
  }
}
Program: 66342
Project: 66342
Buggy source:
private static boolean equal(AggregationFunctionDefinition func1,AggregationFunctionDefinition func2){
  if (!ComparatorUtil.isEqualObject(func1.getFunctionName(),func2.getFunctionName()))   return false;
  if (!ComparatorUtil.isEqualObject(func1.getMeasureName(),func2.getMeasureName()))   return false;
  if (!ComparatorUtil.isEqualObject(func1.getParaCol(),func2.getParaCol()))   return false;
  if (!ComparatorUtil.isEqualObject(func1.getParaValue(),func2.getParaValue()))   return false;
  if (func1.getFilterEvalHelper() == null && func2.getFilterEvalHelper() == null)   return false;
  return true;
}

Fixed version (ground truth):
private static boolean equal(AggregationFunctionDefinition func1,AggregationFunctionDefinition func2){
  if (!ComparatorUtil.isEqualObject(func1.getFunctionName(),func2.getFunctionName()))   return false;
  if (!ComparatorUtil.isEqualObject(func1.getMeasureName(),func2.getMeasureName()))   return false;
  if (!ComparatorUtil.isEqualObject(func1.getParaCol(),func2.getParaCol()))   return false;
  if (!ComparatorUtil.isEqualObject(func1.getParaValue(),func2.getParaValue()))   return false;
  if (func1.getFilterEvalHelper() != null || func2.getFilterEvalHelper() != null)   return false;
  return true;
}
Program: 66343
Project: 66343
Buggy source:
public void onRow(Row4Aggregation row) throws IOException, DataException {
  Row4Aggregation newRow=new Row4Aggregation();
  if (this.existReferenceDate) {
    Member[] nMembers=new Member[newMemberSize];
    System.arraycopy(row.getLevelMembers(),0,nMembers,0,firstTimeLevel);
    Member[] timeMember=cubeDimensionReader.getLevelMembers(timeDimensionIndex,endLevelIndex,row.getDimPos()[timeDimensionIndex]);
    System.arraycopy(timeMember,0,nMembers,firstTimeLevel,timeMember.length);
    if ((orignalLevelCount - (lowestTimeLevel + 1)) > 0) {
      System.arraycopy(row.getLevelMembers(),lowestTimeLevel + 1,nMembers,firstTimeLevel + timeMember.length,orignalLevelCount - (lowestTimeLevel + 1));
    }
    newRow.setLevelMembers(nMembers);
    newRow.setDimPos(row.getDimPos());
    newRow.setMeasures(row.getMeasures());
    newRow.setMeasureList(row.getMeasureList());
    newRow.setParameterValues(row.getParameterValues());
    sortedFactRows.push(newRow);
  }
 else {
    factRows.add(row);
  }
}

Fixed version (ground truth):
public void onRow(Row4Aggregation row) throws IOException, DataException {
  Row4Aggregation newRow=new Row4Aggregation();
  if (row.getLevelMembers().length != newMemberSize) {
    Member[] nMembers=new Member[newMemberSize];
    System.arraycopy(row.getLevelMembers(),0,nMembers,0,firstTimeLevel);
    Member[] timeMember=cubeDimensionReader.getLevelMembers(timeDimensionIndex,endLevelIndex,row.getDimPos()[timeDimensionIndex]);
    System.arraycopy(timeMember,0,nMembers,firstTimeLevel,timeMember.length);
    if ((orignalLevelCount - (lowestTimeLevel + 1)) > 0) {
      System.arraycopy(row.getLevelMembers(),lowestTimeLevel + 1,nMembers,firstTimeLevel + timeMember.length,orignalLevelCount - (lowestTimeLevel + 1));
    }
    newRow.setLevelMembers(nMembers);
    newRow.setDimPos(row.getDimPos());
    newRow.setMeasures(row.getMeasures());
    newRow.setMeasureList(row.getMeasureList());
    newRow.setParameterValues(row.getParameterValues());
  }
 else {
    newRow=row;
  }
  if (this.existReferenceDate) {
    sortedFactRows.push(newRow);
  }
 else {
    factRows.add(newRow);
  }
}
Program: 66344
Project: 66344
Buggy source:
public void onRow(Row4Aggregation row) throws IOException, DataException {
  Row4Aggregation newRow=new Row4Aggregation();
  if (row.getLevelMembers().length != newMemberSize) {
    Member[] nMembers=new Member[newMemberSize];
    System.arraycopy(row.getLevelMembers(),0,nMembers,0,firstTimeLevel);
    Member[] timeMember=cubeDimensionReader.getLevelMembers(timeDimensionIndex,endLevelIndex,row.getDimPos()[timeDimensionIndex]);
    System.arraycopy(timeMember,0,nMembers,firstTimeLevel,timeMember.length);
    if ((orignalLevelCount - (lowestTimeLevel + 1)) > 0) {
      System.arraycopy(row.getLevelMembers(),lowestTimeLevel + 1,nMembers,firstTimeLevel + timeMember.length,orignalLevelCount - (lowestTimeLevel + 1));
    }
    newRow.setLevelMembers(nMembers);
    newRow.setDimPos(row.getDimPos());
    newRow.setMeasures(row.getMeasures());
    newRow.setMeasureList(row.getMeasureList());
    newRow.setParameterValues(row.getParameterValues());
  }
 else {
    newRow=row;
  }
  if (this.existReferenceDate) {
    sortedFactRows.push(newRow);
  }
 else {
    factRows.add(newRow);
  }
}

Fixed version (ground truth):
public void onRow(Row4Aggregation row) throws IOException, DataException {
  Row4Aggregation newRow=new Row4Aggregation();
  if (row.getLevelMembers().length != newMemberSize && orignalLevelCount == newMemberSize) {
    Member[] nMembers=new Member[newMemberSize];
    System.arraycopy(row.getLevelMembers(),0,nMembers,0,firstTimeLevel);
    Member[] timeMember=cubeDimensionReader.getLevelMembers(timeDimensionIndex,endLevelIndex,row.getDimPos()[timeDimensionIndex]);
    System.arraycopy(timeMember,0,nMembers,firstTimeLevel,timeMember.length);
    if ((orignalLevelCount - (lowestTimeLevel + 1)) > 0) {
      System.arraycopy(row.getLevelMembers(),lowestTimeLevel + 1,nMembers,firstTimeLevel + timeMember.length,orignalLevelCount - (lowestTimeLevel + 1));
    }
    newRow.setLevelMembers(nMembers);
    newRow.setDimPos(row.getDimPos());
    newRow.setMeasures(row.getMeasures());
    newRow.setMeasureList(row.getMeasureList());
    newRow.setParameterValues(row.getParameterValues());
  }
 else {
    newRow=row;
  }
  if (this.existReferenceDate) {
    sortedFactRows.push(newRow);
  }
 else {
    factRows.add(newRow);
  }
}
Program: 66346
Project: 66346
Buggy source:
/** 
 * Creates chart filter factory instance according to specified item handle.
 * @param item
 * @return
 * @throws ExtendedElementException
 */
public static ChartFilterFactory createChartFilterFactory(Object item) throws ExtendedElementException {
  if (item instanceof ExtendedItemHandle) {
    return getChartFilterFactory(((ExtendedItemHandle)item).getReportItem());
  }
 else   if (item instanceof IReportItem) {
    return createChartFilterFactory((IReportItem)item);
  }
  return new ChartFilterFactory();
}

Fixed version (ground truth):
/** 
 * Creates chart filter factory instance according to specified item handle.
 * @param item
 * @return filter factory
 * @throws ExtendedElementException
 */
public static ChartFilterFactory createChartFilterFactory(Object item) throws ExtendedElementException {
  if (item instanceof ExtendedItemHandle) {
    return getChartFilterFactory(((ExtendedItemHandle)item).getReportItem());
  }
 else   if (item instanceof IReportItem) {
    return createChartFilterFactory(item);
  }
  return new ChartFilterFactory();
}
Program: 66347
Project: 66347
Buggy source:
/** 
 * @return
 */
public URLValue getURLValue(){
  return fURLValue;
}

Fixed version (ground truth):
public URLValue getURLValue(){
  return fURLValue;
}
Program: 66348
Project: 66348
Buggy source:
private int getHyperlinkBuilderCommand(){
  int type=this.fTriggerMatrix.getType();
  if ((type & TriggerSupportMatrix.TYPE_DATAPOINT) == TriggerSupportMatrix.TYPE_DATAPOINT) {
    return IUIServiceProvider.COMMAND_HYPERLINK_DATAPOINTS;
  }
  if ((type & TriggerSupportMatrix.TYPE_LEGEND) == TriggerSupportMatrix.TYPE_LEGEND) {
    return IUIServiceProvider.COMMAND_HYPERLINK_LEGEND;
  }
  return IUIServiceProvider.COMMAND_HYPERLINK;
}

Fixed version (ground truth):
private int getHyperlinkBuilderCommand(){
  int type=this.fTriggerMatrix.getType();
  if ((type & TriggerSupportMatrix.TYPE_DATAPOINT) == TriggerSupportMatrix.TYPE_DATAPOINT) {
    boolean useCube=fContext.getDataServiceProvider().checkState(IDataServiceProvider.HAS_CUBE) || fContext.getDataServiceProvider().checkState(IDataServiceProvider.SHARE_CROSSTAB_QUERY);
    if (useCube) {
      return IUIServiceProvider.COMMAND_HYPERLINK_DATAPOINTS_SIMPLE;
    }
    return IUIServiceProvider.COMMAND_HYPERLINK_DATAPOINTS;
  }
  if ((type & TriggerSupportMatrix.TYPE_LEGEND) == TriggerSupportMatrix.TYPE_LEGEND) {
    return IUIServiceProvider.COMMAND_HYPERLINK_LEGEND;
  }
  return IUIServiceProvider.COMMAND_HYPERLINK;
}
Program: 66349
Project: 66349
Buggy source:
private int getHyperlinkBuilderCommand(){
  int type=this.triggerMatrix.getType();
  if ((type & TriggerSupportMatrix.TYPE_DATAPOINT) == TriggerSupportMatrix.TYPE_DATAPOINT) {
    return IUIServiceProvider.COMMAND_HYPERLINK_DATAPOINTS;
  }
  if ((type & TriggerSupportMatrix.TYPE_LEGEND) == TriggerSupportMatrix.TYPE_LEGEND) {
    return IUIServiceProvider.COMMAND_HYPERLINK_LEGEND;
  }
  return IUIServiceProvider.COMMAND_HYPERLINK;
}

Fixed version (ground truth):
private int getHyperlinkBuilderCommand(){
  int type=this.triggerMatrix.getType();
  if ((type & TriggerSupportMatrix.TYPE_DATAPOINT) == TriggerSupportMatrix.TYPE_DATAPOINT) {
    boolean useCube=wizardContext.getDataServiceProvider().checkState(IDataServiceProvider.HAS_CUBE) || wizardContext.getDataServiceProvider().checkState(IDataServiceProvider.SHARE_CROSSTAB_QUERY);
    if (useCube) {
      return IUIServiceProvider.COMMAND_HYPERLINK_DATAPOINTS_SIMPLE;
    }
    return IUIServiceProvider.COMMAND_HYPERLINK_DATAPOINTS;
  }
  if ((type & TriggerSupportMatrix.TYPE_LEGEND) == TriggerSupportMatrix.TYPE_LEGEND) {
    return IUIServiceProvider.COMMAND_HYPERLINK_LEGEND;
  }
  return IUIServiceProvider.COMMAND_HYPERLINK;
}
Program: 66350
Project: 66350
Buggy source:
/** 
 * This method will be used by the Chart Builder UI to invoke numerous builder by a specified command.
 * @param command
 * @param inData
 * @return
 * @throws ChartException
 */
public Object invoke(Command command,Object... inData) throws ChartException ;

Fixed version (ground truth):
/** 
 * This method will be used by the Chart Builder UI to invoke numerous builder by a specified command.
 * @param command
 * @param inData
 * @return any objects that caller needs
 * @throws ChartException
 */
public Object invoke(Command command,Object... inData) throws ChartException ;
Program: 66351
Project: 66351
Buggy source:
/** 
 * @param dataEngine
 * @param queryDefns
 * @throws DataException
 */
void populateCachedDataSets(DataEngineImpl dataEngine,IDataQueryDefinition[] qds) throws DataException {
  if (qds != null) {
    queryDefns.addAll(Arrays.asList(qds));
    List temp=new ArrayList();
    List temp2=new ArrayList();
    this.cachedDataSetNames.clear();
    for (    IDataQueryDefinition query : queryDefns) {
      if (query instanceof IQueryDefinition) {
        IQueryDefinition qd=(IQueryDefinition)query;
        String dataSetName=qd.getDataSetName();
        if (dataSetName != null) {
          IBaseDataSetDesign design=dataEngine.getDataSetDesign(dataSetName);
          if (design instanceof ICacheable)           this.populateDataSetNames(dataEngine.getDataSetDesign(dataSetName),dataEngine,temp2);
          if (qd.getParentQuery() != null && qd.getInputParamBindings().size() == 0) {
            for (int i=0; i < temp2.size(); i++) {
              this.cachedDataSetNames.add(temp2.get(i));
            }
          }
          temp.addAll(temp2);
        }
      }
    }
    Set tempSet=new HashSet();
    for (int i=0; i < temp.size(); i++) {
      if (tempSet.contains(temp.get(i)))       this.cachedDataSetNames.add(temp.get(i));
 else       tempSet.add(temp.get(i));
    }
  }
}

Fixed version (ground truth):
/** 
 * @param dataEngine
 * @param queryDefns
 * @throws DataException
 */
void populateCachedDataSets(DataEngineImpl dataEngine,IDataQueryDefinition[] qds) throws DataException {
  if (qds != null) {
    queryDefns.addAll(Arrays.asList(qds));
    List temp=new ArrayList();
    List temp2=new ArrayList();
    this.cachedDataSetNames.clear();
    for (    IDataQueryDefinition query : queryDefns) {
      if (query instanceof IQueryDefinition) {
        IQueryDefinition qd=(IQueryDefinition)query;
        String dataSetName=qd.getDataSetName();
        if (dataSetName != null) {
          IBaseDataSetDesign design=dataEngine.getDataSetDesign(dataSetName);
          if (design instanceof ICacheable)           this.populateDataSetNames(dataEngine.getDataSetDesign(dataSetName),dataEngine,temp2);
          if (qd.getParentQuery() != null && qd.getInputParamBindings().size() == 0) {
            for (int i=0; i < temp2.size(); i++) {
              this.cachedDataSetNames.add(temp2.get(i));
            }
          }
          temp.addAll(temp2);
        }
      }
      temp2.clear();
    }
    Set tempSet=new HashSet();
    for (int i=0; i < temp.size(); i++) {
      if (tempSet.contains(temp.get(i)))       this.cachedDataSetNames.add(temp.get(i));
 else       tempSet.add(temp.get(i));
    }
  }
}
Program: 66352
Project: 66352
Buggy source:
private AggregationFunctionDefinition getFunctionName(AggregationDefinition[] aggregations) throws DataException {
  AggregationFunctionDefinition func=null;
  for (int i=0; i < aggregations.length; i++) {
    AggregationFunctionDefinition[] aggrFunc=aggregations[i].getAggregationFunctions();
    if (aggrFunc == null)     continue;
    for (int j=0; j < aggrFunc.length; j++) {
      if (func == null && aggrFunc[j].getFilterEvalHelper() == null) {
        func=aggrFunc[j];
      }
 else {
        if (func != null && !equal(func,aggrFunc[j]))         return null;
      }
    }
  }
  if (func != null && isSimepleFunction(func.getFunctionName()) && existReferenceDate)   return func;
 else   return null;
}

Fixed version (ground truth):
private AggregationFunctionDefinition getFunctionName(AggregationDefinition[] aggregations) throws DataException {
  AggregationFunctionDefinition func=null;
  for (int i=0; i < aggregations.length; i++) {
    AggregationFunctionDefinition[] aggrFunc=aggregations[i].getAggregationFunctions();
    if (aggrFunc == null)     continue;
    for (int j=0; j < aggrFunc.length; j++) {
      if (func == null && aggrFunc[j].getFilterEvalHelper() == null) {
        func=aggrFunc[j];
      }
 else {
        if (func != null && !equal(func,aggrFunc[j]))         return null;
      }
    }
  }
  if (func != null && isSimepleFunction(func.getFunctionName()) && !existReferenceDate)   return func;
 else   return null;
}
Program: 66353
Project: 66353
Buggy source:
private static boolean existReferenceDate(AggregationDefinition[] aggregations) throws DataException {
  for (int i=0; i < aggregations.length; i++) {
    AggregationFunctionDefinition[] aggrFunc=aggregations[i].getAggregationFunctions();
    if (aggrFunc == null)     continue;
    for (int j=0; j < aggrFunc.length; j++) {
      if (aggrFunc[j].getTimeFunction() != null && aggrFunc[j].getTimeFunction().getReferenceDate() != null) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
private static boolean existReferenceDate(AggregationDefinition[] aggregations) throws DataException {
  for (int i=0; i < aggregations.length; i++) {
    AggregationFunctionDefinition[] aggrFunc=aggregations[i].getAggregationFunctions();
    if (aggrFunc == null)     continue;
    for (int j=0; j < aggrFunc.length; j++) {
      if ((aggrFunc[j].getTimeFunction() != null && aggrFunc[j].getTimeFunction().getReferenceDate() != null) || (aggrFunc[j].getTimeFunctionFilter() != null && aggrFunc[j].getTimeFunctionFilter().getReferenceDate() != null)) {
        return true;
      }
    }
  }
  return false;
}
Program: 66356
Project: 66356
Buggy source:
public int getNodeIndex(){
  return Integer.valueOf(sNodeIndex).intValue();
}

Fixed version (ground truth):
public int getNodeIndex(){
  return nodeIndex;
}
Program: 66357
Project: 66357
Buggy source:
public DefaultRegisteredSubtaskEntryImpl(String sNodeIndex,String sNodePath,String sDisplayName,ISubtaskSheet sheet){
  try {
    this.sNodeIndex=Integer.valueOf(sNodeIndex).toString();
  }
 catch (  NumberFormatException e) {
    sNodeIndex="String_Node_Str";
  }
  this.sNodePath=sNodePath;
  this.sDisplayName=sDisplayName;
  this.sheetImpl=sheet;
}

Fixed version (ground truth):
public DefaultRegisteredSubtaskEntryImpl(String sNodeIndex,String sNodePath,String sDisplayName,ISubtaskSheet sheet){
  try {
    double nodeIndexWithPriority=Double.valueOf(sNodeIndex);
    nodeIndex=(int)nodeIndexWithPriority;
    priority=(int)(nodeIndexWithPriority * 10 - nodeIndex * 10);
  }
 catch (  NumberFormatException e) {
  }
  this.sNodePath=sNodePath;
  this.sDisplayName=sDisplayName;
  this.sheetImpl=sheet;
}
Program: 66358
Project: 66358
Buggy source:
private static AggregationFunctionDefinition getFunctionName(AggregationDefinition[] aggregations) throws DataException {
  AggregationFunctionDefinition func=null;
  for (int i=0; i < aggregations.length; i++) {
    AggregationFunctionDefinition[] aggrFunc=aggregations[i].getAggregationFunctions();
    if (aggrFunc == null)     continue;
    for (int j=0; j < aggrFunc.length; j++) {
      if (func == null && aggrFunc[j].getFilterEvalHelper() == null) {
        func=aggrFunc[j];
      }
 else {
        if (func != null && !equal(func,aggrFunc[j]))         return null;
      }
    }
  }
  if (func != null && isSimepleFunction(func.getFunctionName()))   return func;
 else   return null;
}

Fixed version (ground truth):
private static AggregationFunctionDefinition getFunctionName(AggregationDefinition[] aggregations) throws DataException {
  AggregationFunctionDefinition func=null;
  for (int i=0; i < aggregations.length; i++) {
    AggregationFunctionDefinition[] aggrFunc=aggregations[i].getAggregationFunctions();
    if (aggrFunc == null)     continue;
    for (int j=0; j < aggrFunc.length; j++) {
      if (func == null && aggrFunc[j].getFilterEvalHelper() == null) {
        func=aggrFunc[j];
      }
 else {
        if (func != null && !equal(func,aggrFunc[j]))         return null;
      }
    }
  }
  if (func != null && isSimepleFunction(func.getFunctionName()) && func.getTimeFunction() == null)   return func;
 else   return null;
}
Program: 66359
Project: 66359
Buggy source:
private void doCalculate(int functionIndex) throws DataException {
  for (int i=0; i < currentRowList.size(); i++) {
    if (!getFilterResult(currentRowList.get(i),functionIndex))     continue;
    Object[] para=getAccumulatorParameter(currentRowList.get(i),functionIndex);
    for (int j=0; j < currentFilterList[functionIndex].size(); j++) {
      this.accumulators[currentFilterList[functionIndex].get(j).cellPosition][functionIndex].onRow(para);
    }
  }
}

Fixed version (ground truth):
private void doCalculate(int functionIndex) throws DataException {
  for (int i=0; i < currentRowList.size(); i++) {
    if (!getFilterResult(currentRowList.get(i),functionIndex))     continue;
    while (currentRowList.get(i).nextMeasures()) {
      Object[] para=getAccumulatorParameter(currentRowList.get(i),functionIndex);
      for (int j=0; j < currentFilterList[functionIndex].size(); j++) {
        this.accumulators[currentFilterList[functionIndex].get(j).cellPosition][functionIndex].onRow(para);
      }
    }
  }
}