nus-yam/ex-repair huggingface dataset:
Program: 67863
Project: 67863
Buggy source:
/** 
 * Get the position id of a CubeCursor. The position id is decided by the combination of edge cursors.
 * @param cursor
 * @return
 * @throws OLAPException
 */
public static String getPositionID(CubeCursor cursor) throws OLAPException {
  StringBuffer result=new StringBuffer();
  List ordinateEdge=getAllEdges(cursor);
  for (int i=0; i < ordinateEdge.size(); i++) {
    EdgeCursor edge=(EdgeCursor)ordinateEdge.get(i);
    result.append(POSITION_DELIMITER);
    result.append(edge.getPosition());
  }
  return result.toString();
}

Fixed version (ground truth):
/** 
 * Get the position id of a CubeCursor. The position id is decided by the combination of edge cursors.
 * @param cursor
 * @return
 * @throws OLAPException
 */
public static String getPositionID(CubeCursor cursor) throws OLAPException {
  StringBuffer result=new StringBuffer();
  List ordinateEdge=getAllEdges(cursor);
  boolean isLeftTop=true;
  for (int i=0; i < ordinateEdge.size(); i++) {
    EdgeCursor edge=(EdgeCursor)ordinateEdge.get(i);
    if (edge.getPosition() != -1) {
      isLeftTop=false;
    }
  }
  if (isLeftTop) {
    result.append(POSITION_DELIMITER);
    result.append(-1);
    result.append(POSITION_DELIMITER);
    result.append(-1);
    return result.toString();
  }
  for (int i=0; i < ordinateEdge.size(); i++) {
    EdgeCursor edge=(EdgeCursor)ordinateEdge.get(i);
    result.append(POSITION_DELIMITER);
    result.append(edge.getPosition());
  }
  return result.toString();
}
Program: 67864
Project: 67864
Buggy source:
/** 
 * add a cache object into the cache system.
 * @param cache the cache object to be added.
 */
synchronized public void addCache(Cacheable cache){
  cache.getReferenceCount().set(1);
  Object cacheKey=cache.getCacheKey();
  caches.put(cacheKey,cache);
  lockedCacheSize++;
  if (systemCache != null) {
synchronized (systemCache) {
      systemCache.increaseUsedCacheSize(1);
    }
  }
  if (maxCacheSize > 0) {
    adjustFreeCaches();
  }
}

Fixed version (ground truth):
/** 
 * add a cache object into the cache system.
 * @param cache the cache object to be added.
 */
synchronized public void addCache(Cacheable cache){
  cache.getReferenceCount().set(1);
  Object cacheKey=cache.getCacheKey();
  Cacheable oldCache=caches.get(cacheKey);
  if (oldCache != null) {
    int referenceCount=oldCache.getReferenceCount().get();
    if (referenceCount >= 1) {
      throw new IllegalStateException("String_Node_Str");
    }
    if (referenceCount == 0) {
      freeCaches.remove(oldCache);
    }
 else {
      assert(systemCache != null);
synchronized (systemCache) {
        systemCache.removeCache(oldCache);
      }
    }
  }
 else {
    if (systemCache != null) {
synchronized (systemCache) {
        systemCache.increaseUsedCacheSize(1);
      }
    }
  }
  caches.put(cacheKey,cache);
  lockedCacheSize++;
  if (maxCacheSize > 0) {
    adjustFreeCaches();
  }
}
Program: 67865
Project: 67865
Buggy source:
protected void adjustFreeCaches(){
  if (freeCaches.size() <= 0) {
    return;
  }
  int releasedCacheSize=(lockedCacheSize + freeCaches.size()) - maxCacheSize;
  releasedCacheSize=releasedCacheSize > freeCaches.size() ? freeCaches.size() : releasedCacheSize;
  if (releasedCacheSize <= 0) {
    return;
  }
  Cacheable[] removedCaches=new Cacheable[releasedCacheSize];
  for (int i=0; i < releasedCacheSize; i++) {
    Cacheable freeCache=freeCaches.remove();
    if (listener != null) {
      listener.onCacheRelease(freeCache);
    }
    removedCaches[i]=freeCache;
  }
  if (systemCache != null) {
synchronized (systemCache) {
      systemCache.increaseUsedCacheSize(-releasedCacheSize);
      for (      Cacheable cache : removedCaches) {
        systemCache.addCache(cache);
      }
    }
  }
}

Fixed version (ground truth):
protected void adjustFreeCaches(){
  if (freeCaches.size() <= 0) {
    return;
  }
  int releasedCacheSize=(lockedCacheSize + freeCaches.size()) - maxCacheSize;
  releasedCacheSize=releasedCacheSize > freeCaches.size() ? freeCaches.size() : releasedCacheSize;
  if (releasedCacheSize <= 0) {
    return;
  }
  Cacheable[] removedCaches=new Cacheable[releasedCacheSize];
  for (int i=0; i < releasedCacheSize; i++) {
    Cacheable freeCache=freeCaches.remove();
    if (listener != null) {
      listener.onCacheRelease(freeCache);
    }
    removedCaches[i]=freeCache;
  }
  if (systemCache != null) {
synchronized (systemCache) {
      for (      Cacheable cache : removedCaches) {
        systemCache.addCache(cache);
      }
    }
  }
}
Program: 67866
Project: 67866
Buggy source:
public void setCacheSize(long cacheSize){
  long maxCacheBlock=cacheSize / 4096;
  if (maxCacheBlock > Integer.MAX_VALUE) {
    fs.setCacheSize(Integer.MAX_VALUE);
  }
 else {
    fs.setCacheSize((int)cacheSize);
  }
}

Fixed version (ground truth):
public void setCacheSize(long cacheSize){
  long cacheBlock=cacheSize / 4096;
  if (cacheBlock > Integer.MAX_VALUE) {
    fs.setCacheSize(Integer.MAX_VALUE);
  }
 else {
    fs.setCacheSize((int)cacheBlock);
  }
}
Program: 67867
Project: 67867
Buggy source:
synchronized public void removeFile(String name) throws IOException {
  if (readOnly) {
    throw new IOException("String_Node_Str");
  }
  Ext2Entry entry=entryTable.removeEntry(name);
  if (entry != null) {
    nodeTable.releaseNode(entry.inode);
  }
}

Fixed version (ground truth):
synchronized public void removeFile(String name) throws IOException {
  if (readOnly) {
    throw new IOException("String_Node_Str");
  }
  if (!openedFiles.isEmpty()) {
    ArrayList<Ext2File> removedFiles=new ArrayList<Ext2File>();
    for (    Ext2File file : openedFiles) {
      if (name.equals(file.getName())) {
        removedFiles.add(file);
      }
    }
    for (    Ext2File file : removedFiles) {
      file.close();
    }
  }
  Ext2Entry entry=entryTable.removeEntry(name);
  if (entry != null) {
    nodeTable.releaseNode(entry.inode);
  }
}
Program: 67868
Project: 67868
Buggy source:
public void clear() throws IOException {
  for (int i=0; i < 3; i++) {
    FatBlock cachedBlock=cachedFatBlocks[i];
    if (cachedBlock != null) {
      fs.unloadBlock(cachedBlock);
      cachedFatBlocks[i]=null;
    }
  }
}

Fixed version (ground truth):
protected void clear(int level) throws IOException {
  FatBlock cachedBlock=cachedFatBlocks[level];
  if (cachedBlock != null) {
    fs.unloadBlock(cachedBlock);
    cachedFatBlocks[level]=null;
  }
}
Program: 67869
Project: 67869
Buggy source:
protected int getLastBlock(int level,FatBlock fatBlock) throws IOException {
  for (int index=1023; index >= 0; index--) {
    int blockId=fatBlock.getBlock(index);
    if (blockId > 0) {
      if (level == 0) {
        fatBlock.setBlock(index,0);
        return blockId;
      }
      FatBlock nextFatBlock=getCachedBlock(level,blockId);
      int nextBlockId=getLastBlock(level--,nextFatBlock);
      if (nextBlockId > 0) {
        return nextBlockId;
      }
      fatBlock.setBlock(index,0);
      return blockId;
    }
  }
  return -1;
}

Fixed version (ground truth):
protected int getLastBlock(int level,FatBlock fatBlock) throws IOException {
  for (int index=1023; index >= 0; index--) {
    int blockId=fatBlock.getBlock(index);
    if (blockId > 0) {
      if (level == 0) {
        fatBlock.setBlock(index,-1);
        return blockId;
      }
      FatBlock nextFatBlock=getCachedBlock(level - 1,blockId);
      int nextBlockId=getLastBlock(level - 1,nextFatBlock);
      if (nextBlockId > 0) {
        return nextBlockId;
      }
      fatBlock.setBlock(index,-1);
      clear(level - 1);
      return blockId;
    }
  }
  return -1;
}
Program: 67870
Project: 67870
Buggy source:
public int getFreeBlock() throws IOException {
  if (freeBlockList != null) {
    int blockId=freeBlockList.removeLastBlock();
    if (blockId > 0) {
      dirty=true;
      return blockId;
    }
    freeBlockList.clear();
    freeBlockList=null;
    freeNode=null;
  }
  while (!freeNodes.isEmpty()) {
    freeNode=freeNodes.removeLast();
    freeBlockList=new FreeBlockList(fs,freeNode);
    int blockId=freeBlockList.removeLastBlock();
    if (blockId > 0) {
      dirty=true;
      return blockId;
    }
    freeBlockList.clear();
    freeBlockList=null;
    freeNode=null;
  }
  return -1;
}

Fixed version (ground truth):
public int getFreeBlock() throws IOException {
  if (isLocked) {
    return -1;
  }
  if (freeBlockList != null) {
    int blockId=freeBlockList.removeLastBlock();
    if (blockId > 0) {
      dirty=true;
      return blockId;
    }
    freeBlockList.clear();
    freeBlockList=null;
    freeNode=null;
  }
  while (!freeNodes.isEmpty()) {
    freeNode=freeNodes.removeLast();
    freeBlockList=new FreeBlockList(fs,freeNode);
    int blockId=freeBlockList.removeLastBlock();
    if (blockId > 0) {
      dirty=true;
      return blockId;
    }
    freeBlockList.clear();
    freeBlockList=null;
    freeNode=null;
  }
  return -1;
}
Program: 67871
Project: 67871
Buggy source:
protected void write() throws IOException {
  if (!dirty) {
    return;
  }
  dirty=false;
  Ext2File file=new Ext2File(fs,NodeTable.INODE_FREE_TABLE,false);
  try {
    ByteArrayOutputStream buffer=new ByteArrayOutputStream(Ext2Node.NODE_SIZE);
    DataOutputStream out=new DataOutputStream(buffer);
    while (!freeNodes.isEmpty()) {
      Ext2Node freeNode=freeNodes.removeFirst();
      buffer.reset();
      freeNode.write(out);
      file.write(buffer.toByteArray(),0,Ext2Node.NODE_SIZE);
    }
    if (freeBlockList != null) {
      buffer.reset();
      freeNode.write(out);
      file.write(buffer.toByteArray(),0,Ext2Node.NODE_SIZE);
    }
    file.setLength(file.getPointer());
  }
  finally {
    file.close();
  }
}

Fixed version (ground truth):
protected void write() throws IOException {
  if (!dirty) {
    return;
  }
  dirty=false;
  Ext2File file=new Ext2File(fs,NodeTable.INODE_FREE_TABLE,false);
  try {
    isLocked=true;
    ByteArrayOutputStream buffer=new ByteArrayOutputStream(Ext2Node.NODE_SIZE);
    DataOutputStream out=new DataOutputStream(buffer);
    for (    Ext2Node freeNode : freeNodes) {
      buffer.reset();
      freeNode.write(out);
      file.write(buffer.toByteArray(),0,Ext2Node.NODE_SIZE);
    }
    if (freeBlockList != null) {
      buffer.reset();
      freeNode.write(out);
      file.write(buffer.toByteArray(),0,Ext2Node.NODE_SIZE);
    }
    file.setLength(file.getPointer());
  }
  finally {
    isLocked=false;
    file.close();
  }
}
Program: 67873
Project: 67873
Buggy source:
public ILayout createLayout(ContainerArea parent,LayoutContext context,IContent content){
switch (content.getContentType()) {
case IContent.DATA_CONTENT:
case IContent.LABEL_CONTENT:
case IContent.TEXT_CONTENT:
    if (PropertyUtil.isInlineElement(content)) {
      DimensionType width=content.getWidth();
      if (width != null) {
        return new BlockTextArea(parent,context,content);
      }
 else {
        return new InlineTextArea(parent,context,content);
      }
    }
 else {
      return new BlockTextArea(parent,context,content);
    }
case IContent.IMAGE_CONTENT:
  return new ImageAreaLayout(parent,context,(IImageContent)content);
case IContent.AUTOTEXT_CONTENT:
int type=((IAutoTextContent)content).getType();
if ((type == IAutoTextContent.TOTAL_PAGE || type == IAutoTextContent.UNFILTERED_TOTAL_PAGE) && context.getEngineTaskType() != IEngineTask.TASK_RENDER) {
context.addUnresolvedContent(content);
return new TemplateAreaLayout(parent,context,content);
}
 else {
if (PropertyUtil.isInlineElement(content)) {
  return new InlineTextArea(parent,context,content);
}
 else {
  return new BlockTextArea(parent,context,content);
}
}
default :
return null;
}
}

Fixed version (ground truth):
public ILayout createLayout(ContainerArea parent,LayoutContext context,IContent content){
switch (content.getContentType()) {
case IContent.DATA_CONTENT:
case IContent.LABEL_CONTENT:
case IContent.TEXT_CONTENT:
    if (PropertyUtil.isInlineElement(content)) {
      DimensionType width=content.getWidth();
      if (width != null) {
        return new BlockTextArea(parent,context,content);
      }
 else {
        return new InlineTextArea(parent,context,content);
      }
    }
 else {
      return new BlockTextArea(parent,context,content);
    }
case IContent.IMAGE_CONTENT:
  return new ImageAreaLayout(parent,context,(IImageContent)content);
case IContent.AUTOTEXT_CONTENT:
int type=((IAutoTextContent)content).getType();
if ((type == IAutoTextContent.TOTAL_PAGE || type == IAutoTextContent.UNFILTERED_TOTAL_PAGE) && ("String_Node_Str".equalsIgnoreCase(context.getFormat()) || context.getEngineTaskType() != IEngineTask.TASK_RENDER)) {
context.addUnresolvedContent(content);
return new TemplateAreaLayout(parent,context,content);
}
 else {
if (PropertyUtil.isInlineElement(content)) {
  return new InlineTextArea(parent,context,content);
}
 else {
  return new BlockTextArea(parent,context,content);
}
}
default :
return null;
}
}
Program: 67875
Project: 67875
Buggy source:
public Control createContents(Composite parent){
  Composite composite=new Composite(parent,SWT.NONE);
  GridLayout layout=new GridLayout();
  layout.numColumns=1;
  composite.setLayout(layout);
  composite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
  addDataFetchSettingGroup(composite);
  Object handle=((DataSetEditor)getContainer()).getHandle();
  if (handle instanceof OdaDataSetHandle) {
    String extensionID=((OdaDataSetHandle)handle).getExtensionID();
    if (extensionID != null && extensionID.equalsIgnoreCase(STORED_PROCEDURE_EXTENSION_ID)) {
      addResultSetGroup(composite);
    }
  }
  return composite;
}

Fixed version (ground truth):
public Control createContents(Composite parent){
  Composite composite=new Composite(parent,SWT.NONE);
  GridLayout layout=new GridLayout();
  layout.numColumns=1;
  composite.setLayout(layout);
  composite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
  Object handle=((DataSetEditor)getContainer()).getHandle();
  if (handle instanceof OdaDataSetHandle) {
    addDataFetchSettingGroup(composite);
    String extensionID=((OdaDataSetHandle)handle).getExtensionID();
    if (extensionID != null && extensionID.equalsIgnoreCase(STORED_PROCEDURE_EXTENSION_ID)) {
      addResultSetGroup(composite);
    }
  }
  return composite;
}
Program: 67876
Project: 67876
Buggy source:
public void testExtractionWithDistinct() throws Exception {
  dataExTask.selectResultSet("String_Node_Str");
  dataExTask.setDistinctValuesOnly(true);
  IExtractionResults results=dataExTask.extract();
  IDataIterator itr=results.nextResultIterator();
  HashSet set=new HashSet();
  while (itr.next()) {
    Object value=itr.getValue(0);
    if (set.contains(value)) {
      fail("String_Node_Str");
    }
 else {
      set.add(value);
    }
  }
}

Fixed version (ground truth):
public void testExtractionWithDistinct() throws Exception {
  dataExTask.selectResultSet("String_Node_Str");
  dataExTask.setDistinctValuesOnly(true);
  dataExTask.selectColumns(new String[]{"String_Node_Str"});
  IExtractionResults results=dataExTask.extract();
  IDataIterator itr=results.nextResultIterator();
  HashSet set=new HashSet();
  while (itr.next()) {
    Object value=itr.getValue(0);
    if (set.contains(value)) {
      fail("String_Node_Str");
    }
 else {
      set.add(value);
    }
  }
}
Program: 67877
Project: 67877
Buggy source:
public void addData(int col,SheetData data){
  int rowIndex=data.getRowIndex();
  columns.get(col).add(data);
  maxRowIndex=maxRowIndex > rowIndex ? maxRowIndex : rowIndex;
  BookmarkDef bookmark=data.getBookmark();
  if (bookmark == null) {
    return;
  }
  bookmark.setColumnNo(col + 1);
  bookmark.setRowNo(rowIndex);
  bookmarks.add(bookmark);
}

Fixed version (ground truth):
public void addData(int col,SheetData data){
  if (col < getColumnCount()) {
    int rowIndex=data.getRowIndex();
    columns.get(col).add(data);
    maxRowIndex=maxRowIndex > rowIndex ? maxRowIndex : rowIndex;
    BookmarkDef bookmark=data.getBookmark();
    if (bookmark == null) {
      return;
    }
    bookmark.setColumnNo(col + 1);
    bookmark.setRowNo(rowIndex);
    bookmarks.add(bookmark);
  }
}
Program: 67878
Project: 67878
Buggy source:
/** 
 * @param index
 * @return
 */
public SheetData getColumnLastData(int index){
  ArrayList<SheetData> columnDatas=columns.get(index);
  if (!columnDatas.isEmpty())   return columnDatas.get(columnDatas.size() - 1);
  return null;
}

Fixed version (ground truth):
/** 
 * @param index
 * @return
 */
public SheetData getColumnLastData(int index){
  if (index < getColumnCount()) {
    ArrayList<SheetData> columnDatas=columns.get(index);
    if (!columnDatas.isEmpty())     return columnDatas.get(columnDatas.size() - 1);
  }
  return null;
}
Program: 67879
Project: 67879
Buggy source:
public void run(){
  if (!(getModel() instanceof DesignElementHandle)) {
    return;
  }
  if (isDelete()) {
    return;
  }
  if (((DeferredGraphicalViewer)getViewer()).getFigureCanvas() == null) {
    return;
  }
  DesignElementHandle handle=(DesignElementHandle)getModel();
  EditPart part=ReportElementEditPart.this;
  while (part != null && !(part instanceof RootEditPart)) {
    part=part.getParent();
  }
  if (getModelAdapter() == null || part == null) {
    return;
  }
  Object[] backGroundPosition=getBackgroundPosition(handle);
  Object xPosition=backGroundPosition[0];
  Object yPosition=backGroundPosition[1];
  boolean needRefresh=false;
  if (xPosition instanceof DimensionValue) {
    needRefresh=true;
  }
  if (yPosition instanceof DimensionValue) {
    needRefresh=true;
  }
  if (needRefresh) {
    refreshVisuals();
  }
}

Fixed version (ground truth):
public void run(){
  if (!(getModel() instanceof DesignElementHandle)) {
    return;
  }
  if (isDelete()) {
    return;
  }
  EditPart parent=getParent();
  while (parent != null) {
    if (parent instanceof RootEditPart) {
      break;
    }
    parent=parent.getParent();
  }
  if (parent == null) {
    return;
  }
  if (((DeferredGraphicalViewer)getViewer()).getFigureCanvas() == null) {
    return;
  }
  DesignElementHandle handle=(DesignElementHandle)getModel();
  EditPart part=ReportElementEditPart.this;
  while (part != null && !(part instanceof RootEditPart)) {
    part=part.getParent();
  }
  if (getModelAdapter() == null || part == null) {
    return;
  }
  Object[] backGroundPosition=getBackgroundPosition(handle);
  Object xPosition=backGroundPosition[0];
  Object yPosition=backGroundPosition[1];
  boolean needRefresh=false;
  if (xPosition instanceof DimensionValue) {
    needRefresh=true;
  }
  if (yPosition instanceof DimensionValue) {
    needRefresh=true;
  }
  if (needRefresh) {
    refreshVisuals();
  }
}
Program: 67882
Project: 67882
Buggy source:
/** 
 * This method is called upon plug-in activation.
 * @param context bundle context
 * @exception Exception
 */
public void start(BundleContext context) throws Exception {
  super.start(context);
  bundleContext=context;
  plugin.getPluginPreferences().setDefault(WebViewer.MASTER_PAGE_CONTENT,true);
  plugin.getPluginPreferences().setDefault(WebViewer.PREVIEW_MAXROW,DEFAULT_MAX_ROWS);
  plugin.getPluginPreferences().setDefault(WebViewer.PREVIEW_MAXCUBEROWLEVEL,DEFAULT_MAX_CUBEROWLEVELS);
  plugin.getPluginPreferences().setDefault(WebViewer.PREVIEW_MAXCUBECOLUMNLEVEL,DEFAULT_MAX_CUBECOLUMNLEVELS);
  plugin.getPluginPreferences().setDefault(WebViewer.PREVIEW_MAXINMEMORYCUBESIZE,DEFAULT_MAX_IN_MEMORY_CUBE_SIZE);
  plugin.getPluginPreferences().setDefault(WebViewer.USER_LOCALE,ULocale.getDefault().getDisplayName());
  plugin.getPluginPreferences().setDefault(WebViewer.USER_TIME_ZONE,TimeZone.getDefault().getID());
  plugin.getPluginPreferences().setDefault(WebViewer.BIDI_ORIENTATION,WebViewer.BIDI_ORIENTATION_AUTO);
  if (plugin.getStateLocation() != null)   System.setProperty(BIRT_VIEWER_WORKING_PATH,plugin.getStateLocation().toOSString());
  String rootPath=getFilePath("String_Node_Str");
  if (rootPath != null)   System.setProperty(BIRT_VIEWER_ROOT_PATH,rootPath);
  System.setProperty(BIRT_IS_DESIGNER,"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * This method is called upon plug-in activation.
 * @param context bundle context
 * @exception Exception
 */
public void start(BundleContext context) throws Exception {
  super.start(context);
  bundleContext=context;
  plugin.getPluginPreferences().setDefault(WebViewer.MASTER_PAGE_CONTENT,true);
  plugin.getPluginPreferences().setDefault(WebViewer.PREVIEW_MAXROW,DEFAULT_MAX_ROWS);
  plugin.getPluginPreferences().setDefault(WebViewer.PREVIEW_MAXCUBEROWLEVEL,DEFAULT_MAX_CUBEROWLEVELS);
  plugin.getPluginPreferences().setDefault(WebViewer.PREVIEW_MAXCUBECOLUMNLEVEL,DEFAULT_MAX_CUBECOLUMNLEVELS);
  plugin.getPluginPreferences().setDefault(WebViewer.PREVIEW_MAXINMEMORYCUBESIZE,DEFAULT_MAX_IN_MEMORY_CUBE_SIZE);
  plugin.getPluginPreferences().setDefault(WebViewer.USER_LOCALE,ULocale.getDefault().getDisplayName());
  plugin.getPluginPreferences().setDefault(WebViewer.USER_TIME_ZONE,TimeZone.getDefault().getID());
  plugin.getPluginPreferences().setDefault(WebViewer.BIDI_ORIENTATION,WebViewer.BIDI_ORIENTATION_AUTO);
  if (plugin.getStateLocation() != null)   System.setProperty(BIRT_VIEWER_WORKING_PATH,plugin.getStateLocation().toOSString());
  String rootPath=getFilePath("String_Node_Str");
  if (rootPath != null)   System.setProperty(BIRT_VIEWER_ROOT_PATH,rootPath);
  System.setProperty(BIRT_IS_DESIGNER,"String_Node_Str");
  IWebAppInfo dummy=WebViewer.getCurrentWebApp();
}
Program: 67883
Project: 67883
Buggy source:
private int getFilterType(IFilterDefinition filter,Set<DimLevel> dimLevelInCubeQuery) throws DataException {
  if (!(filter instanceof ICubeFilterDefinition))   return CubeQueryExecutor.DIMENSION_FILTER;
  ICubeFilterDefinition cubeFilter=(ICubeFilterDefinition)filter;
  if (cubeFilter.getTargetLevel() != null)   return CubeQueryExecutor.DIMENSION_FILTER;
  Set<DimLevel> refDimLevels=OlapExpressionCompiler.getReferencedDimLevel(filter.getExpression(),this.defn.getBindings());
  if (refDimLevels.size() > 0)   return CubeQueryExecutor.FACTTABLE_FILTER;
  return CubeQueryExecutor.AGGR_MEASURE_FILTER;
}

Fixed version (ground truth):
private int getFilterType(IFilterDefinition filter,Set<DimLevel> dimLevelInCubeQuery) throws DataException {
  if (!(filter instanceof ICubeFilterDefinition)) {
    if (filter.getExpression() instanceof ICollectionConditionalExpression) {
      Collection<IScriptExpression> exprs=((ICollectionConditionalExpression)(filter.getExpression())).getExpr();
      Set dimensionSet=new HashSet();
      Iterator<IScriptExpression> exprsIterator=exprs.iterator();
      while (exprsIterator.hasNext()) {
        dimensionSet.add(OlapExpressionUtil.getTargetDimLevel(exprsIterator.next().getText()).getDimensionName());
      }
      if (dimensionSet.size() == 1)       return CubeQueryExecutor.DIMENSION_FILTER;
 else       return CubeQueryExecutor.FACTTABLE_FILTER;
    }
    return CubeQueryExecutor.DIMENSION_FILTER;
  }
  ICubeFilterDefinition cubeFilter=(ICubeFilterDefinition)filter;
  if (cubeFilter.getTargetLevel() != null)   return CubeQueryExecutor.DIMENSION_FILTER;
  Set<DimLevel> refDimLevels=OlapExpressionCompiler.getReferencedDimLevel(filter.getExpression(),this.defn.getBindings());
  if (refDimLevels.size() > 0)   return CubeQueryExecutor.FACTTABLE_FILTER;
  return CubeQueryExecutor.AGGR_MEASURE_FILTER;
}
Program: 67886
Project: 67886
Buggy source:
/** 
 * Check whether filter in query contains aggregation. If aggregation is TOPN,BOTTOMN,TOPPERCENT,BOTTMEPERCENT return true. else return false;
 * @return
 * @throws DataException 
 */
public static boolean isValidExpressionInQueryFilter(IBaseExpression expression,ScriptContext context) throws DataException {
  if (expression instanceof IScriptExpression) {
    String text=((IScriptExpression)expression).getText();
    AggregateRegistry aggrReg=new AggregateRegistry(){
      public int register(      AggregateExpression aggregationExpr){
        return -1;
      }
    }
;
    ExpressionCompiler expressionCompiler=new ExpressionCompiler();
    CompiledExpression expr=expressionCompiler.compile(text,aggrReg,context);
    return flattenFilterExpression(expr);
  }
 else   if (expression instanceof IConditionalExpression) {
    IScriptExpression expr=((IConditionalExpression)expression).getExpression();
    IBaseExpression oprand1=((IConditionalExpression)expression).getOperand1();
    IBaseExpression oprand2=((IConditionalExpression)expression).getOperand2();
    return isValidExpressionInQueryFilter(expr,context) && isValidExpressionInQueryFilter(oprand1,context) && isValidExpressionInQueryFilter(oprand2,context);
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Check whether filter in query contains aggregation. If aggregation is TOPN,BOTTOMN,TOPPERCENT,BOTTMEPERCENT return true. else return false;
 * @return
 * @throws DataException 
 */
public static boolean isValidExpressionInQueryFilter(IBaseExpression expression,ScriptContext context) throws DataException {
  if (expression instanceof IScriptExpression) {
    String text=((IScriptExpression)expression).getText();
    if (text.trim().length() == 0)     return true;
    AggregateRegistry aggrReg=new AggregateRegistry(){
      public int register(      AggregateExpression aggregationExpr){
        return -1;
      }
    }
;
    ExpressionCompiler expressionCompiler=new ExpressionCompiler();
    CompiledExpression expr=expressionCompiler.compile(text,aggrReg,context);
    return flattenFilterExpression(expr);
  }
 else   if (expression instanceof IConditionalExpression) {
    IScriptExpression expr=((IConditionalExpression)expression).getExpression();
    IBaseExpression oprand1=((IConditionalExpression)expression).getOperand1();
    IBaseExpression oprand2=((IConditionalExpression)expression).getOperand2();
    return isValidExpressionInQueryFilter(expr,context) && isValidExpressionInQueryFilter(oprand1,context) && isValidExpressionInQueryFilter(oprand2,context);
  }
  return true;
}
Program: 67888
Project: 67888
Buggy source:
/** 
 * @param context
 * @throws DataException 
 */
public StreamManager(DataEngineContext context,QueryResultInfo queryResultInfo) throws DataException {
  this.context=context;
  this.rootQueryResultID=queryResultInfo.getRootQueryResultID();
  this.parentQueryResultID=queryResultInfo.getParentQueryResultID();
  this.selfQueryResultID=queryResultInfo.getSelfQueryResultID();
  this.subQueryName=queryResultInfo.getSubQueryName();
  this.subQueryID=subQueryName == null ? null : QueryResultIDUtil.buildSubQueryID(subQueryName,queryResultInfo.getIndex());
  this.cachedStreamManagers=new HashMap();
  this.metaManagers=new HashMap();
  this.dataMetaManagers=new HashMap();
  VersionManager vm=new VersionManager(context);
  if (context.getMode() == DataEngineContext.MODE_GENERATION) {
    vm.setVersion(VersionManager.getLatestVersion());
    this.version=VersionManager.getLatestVersion();
  }
 else {
    this.version=vm.getVersion();
  }
}

Fixed version (ground truth):
/** 
 * @param context
 * @throws DataException 
 */
public StreamManager(DataEngineContext context,QueryResultInfo queryResultInfo) throws DataException {
  this.context=context;
  this.rootQueryResultID=queryResultInfo.getRootQueryResultID();
  this.parentQueryResultID=queryResultInfo.getParentQueryResultID();
  this.selfQueryResultID=queryResultInfo.getSelfQueryResultID();
  this.subQueryName=queryResultInfo.getSubQueryName();
  this.subQueryID=subQueryName == null ? null : QueryResultIDUtil.buildSubQueryID(subQueryName,queryResultInfo.getIndex());
  this.cachedStreamManagers=new HashMap();
  this.metaManagers=new HashMap();
  this.dataMetaManagers=new HashMap();
  VersionManager vm=new VersionManager(context);
  if (context.getMode() == DataEngineContext.MODE_GENERATION) {
    vm.setVersion(VersionManager.getLatestVersion());
    this.version=VersionManager.getLatestVersion();
  }
 else   if (context.getMode() == DataEngineContext.MODE_UPDATE && this.rootQueryResultID == null) {
    if (this.context.hasInStream(null,null,DataEngineContext.VERSION_INFO_STREAM) == false) {
      this.version=VersionManager.getLatestVersion();
    }
 else     this.version=vm.getVersion();
  }
 else {
    this.version=vm.getVersion();
  }
}
Program: 67889
Project: 67889
Buggy source:
/** 
 * @throws IOException
 */
public void close() throws IOException {
}

Fixed version (ground truth):
/** 
 * @throws IOException
 */
public void close() throws IOException {
  diskIndex.close();
}
Program: 67890
Project: 67890
Buggy source:
/** 
 * @param factTableName
 * @param stopSign
 * @return
 * @throws IOException
 */
public FactTable load(String factTableName,StopSign stopSign) throws IOException {
  int segmentNumber=0;
  IDocumentObject documentObject=documentManager.openDocumentObject(NamingUtil.getFactTableName(factTableName));
  DimensionInfo[] dimensionInfo=new DimensionInfo[documentObject.readInt()];
  for (int i=0; i < dimensionInfo.length; i++) {
    dimensionInfo[i]=new DimensionInfo();
    dimensionInfo[i].dimensionName=documentObject.readString();
    dimensionInfo[i].dimensionLength=documentObject.readInt();
  }
  MeasureInfo[] measureInfo=new MeasureInfo[documentObject.readInt()];
  for (int i=0; i < measureInfo.length; i++) {
    measureInfo[i]=new MeasureInfo(documentObject.readString(),documentObject.readInt());
  }
  segmentNumber=documentObject.readInt();
  int[] dimensionMemberCount=new int[dimensionInfo.length];
  for (int i=0; i < dimensionInfo.length; i++) {
    dimensionMemberCount[i]=dimensionInfo[i].dimensionLength;
  }
  DimensionDivision[] subDimensions=calculateDimensionDivision(dimensionMemberCount,segmentNumber);
  return new FactTable(factTableName,documentManager,dimensionInfo,measureInfo,segmentNumber,subDimensions);
}

Fixed version (ground truth):
/** 
 * @param factTableName
 * @param stopSign
 * @return
 * @throws IOException
 */
public FactTable load(String factTableName,StopSign stopSign) throws IOException {
  int segmentNumber=0;
  IDocumentObject documentObject=documentManager.openDocumentObject(NamingUtil.getFactTableName(factTableName));
  DimensionInfo[] dimensionInfo=new DimensionInfo[documentObject.readInt()];
  for (int i=0; i < dimensionInfo.length; i++) {
    dimensionInfo[i]=new DimensionInfo();
    dimensionInfo[i].dimensionName=documentObject.readString();
    dimensionInfo[i].dimensionLength=documentObject.readInt();
  }
  MeasureInfo[] measureInfo=new MeasureInfo[documentObject.readInt()];
  for (int i=0; i < measureInfo.length; i++) {
    measureInfo[i]=new MeasureInfo(documentObject.readString(),documentObject.readInt());
  }
  segmentNumber=documentObject.readInt();
  int[] dimensionMemberCount=new int[dimensionInfo.length];
  for (int i=0; i < dimensionInfo.length; i++) {
    dimensionMemberCount[i]=dimensionInfo[i].dimensionLength;
  }
  DimensionDivision[] subDimensions=calculateDimensionDivision(dimensionMemberCount,segmentNumber);
  documentObject.close();
  return new FactTable(factTableName,documentManager,dimensionInfo,measureInfo,segmentNumber,subDimensions);
}
Program: 67891
Project: 67891
Buggy source:
/** 
 * Moves down one segment from its current segment of the iterator.
 * @return
 * @throws IOException
 */
private boolean nextSegment() throws IOException {
  while (true) {
    if (stopSign.isStopped()) {
      return false;
    }
    if (!traversalor.next()) {
      return false;
    }
    currentSubDim=traversalor.getIntArray();
    String FTSUDocName=FTSUDocumentObjectNamingUtil.getDocumentObjectName(NamingUtil.getFactTableName(factTable.getName()),getSubDimensionIndex());
    if (!factTable.getDocumentManager().exist(FTSUDocName)) {
      continue;
    }
    currentSegment=factTable.getDocumentManager().openDocumentObject(FTSUDocName);
    for (int i=0; i < dimensionIndex.length; i++) {
      if (dimensionIndex[i] != -1) {
        SelectedSubDimension selectedSubDimension=((SelectedSubDimension)selectedSubDim[i].get(currentSubDim[i]));
        selectedPosOfCurSegment[i]=new int[selectedSubDimension.end - selectedSubDimension.start + 1];
        for (int j=0; j < selectedSubDimension.end - selectedSubDimension.start + 1; j++) {
          selectedPosOfCurSegment[i][j]=((Integer)selectedPos[dimensionIndex[i]].get(selectedSubDimension.start + j)).intValue();
        }
      }
    }
    break;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Moves down one segment from its current segment of the iterator.
 * @return
 * @throws IOException
 */
private boolean nextSegment() throws IOException {
  while (true) {
    if (stopSign.isStopped()) {
      return false;
    }
    if (!traversalor.next()) {
      return false;
    }
    currentSubDim=traversalor.getIntArray();
    String FTSUDocName=FTSUDocumentObjectNamingUtil.getDocumentObjectName(NamingUtil.getFactTableName(factTable.getName()),getSubDimensionIndex());
    if (!factTable.getDocumentManager().exist(FTSUDocName)) {
      continue;
    }
    if (currentSegment != null)     currentSegment.close();
    currentSegment=factTable.getDocumentManager().openDocumentObject(FTSUDocName);
    for (int i=0; i < dimensionIndex.length; i++) {
      if (dimensionIndex[i] != -1) {
        SelectedSubDimension selectedSubDimension=((SelectedSubDimension)selectedSubDim[i].get(currentSubDim[i]));
        selectedPosOfCurSegment[i]=new int[selectedSubDimension.end - selectedSubDimension.start + 1];
        for (int j=0; j < selectedSubDimension.end - selectedSubDimension.start + 1; j++) {
          selectedPosOfCurSegment[i][j]=((Integer)selectedPos[dimensionIndex[i]].get(selectedSubDimension.start + j)).intValue();
        }
      }
    }
    break;
  }
  return true;
}
Program: 67892
Project: 67892
Buggy source:
/** 
 * @param iIndex
 * @return
 */
private final Fill getPaletteColor(int iIndex){
  final Fill fiClone=FillUtil.getPaletteFill(pa.getEntries(),iIndex);
  pie.updateTranslucency(fiClone,ps);
  return fiClone;
}

Fixed version (ground truth):
/** 
 * @param iIndex
 * @return
 */
private final Fill getPaletteColor(int iIndex,DataPointHints dph){
  Fill fiClone=FillUtil.getPaletteFill(pa.getEntries(),iIndex);
  pie.updateTranslucency(fiClone,ps);
  if (dph != null && dph.getOrthogonalValue() instanceof Double) {
    fiClone=FillUtil.convertFill(fiClone,((Double)dph.getOrthogonalValue()).doubleValue(),null);
  }
  return fiClone;
}
Program: 67894
Project: 67894
Buggy source:
public Report getReportIR(ReportDesignHandle designHandle){
  try {
    InputStream stream=archive.getStream(DESIGN_IR_STREAM);
    EngineIRReader reader=new EngineIRReader();
    Report reportIR=reader.read(stream);
    reportIR.setVersion(getVersion());
    reader.link(reportIR,designHandle);
    return reportIR;
  }
 catch (  IOException ioex) {
    logger.log(Level.FINE,"String_Node_Str",ioex);
  }
  return null;
}

Fixed version (ground truth):
public Report getReportIR(ReportDesignHandle designHandle){
  InputStream stream=null;
  try {
    stream=archive.getStream(DESIGN_IR_STREAM);
    EngineIRReader reader=new EngineIRReader();
    Report reportIR=reader.read(stream);
    reportIR.setVersion(getVersion());
    reader.link(reportIR,designHandle);
    return reportIR;
  }
 catch (  IOException ioex) {
    logger.log(Level.FINE,"String_Node_Str",ioex);
  }
 finally {
    if (stream != null) {
      try {
        stream.close();
      }
 catch (      IOException ignored) {
      }
      stream=null;
    }
  }
  return null;
}
Program: 67895
Project: 67895
Buggy source:
public void update(){
  FormEditor editor=UIUtil.getActiveReportEditor();
  setEnabled(editor != null);
  if (editor != null) {
    setChecked(editor.getActivePageInstance().getId().equals(pageId));
  }
}

Fixed version (ground truth):
public void update(){
  FormEditor editor=UIUtil.getActiveReportEditor();
  setEnabled(editor != null);
  if (editor != null && editor.getActivePageInstance() != null && editor.getActivePageInstance().getId() != null) {
    setChecked(editor.getActivePageInstance().getId().equals(pageId));
  }
}
Program: 67896
Project: 67896
Buggy source:
public boolean isEnabled(){
  if (getSelectedObjects().size() != 1) {
    return false;
  }
  Object obj=super.getSelectedObjects().getFirstElement();
  if (obj instanceof EmbeddedImageHandle) {
    return true;
  }
  if (obj instanceof ReportElementHandle) {
    if (obj instanceof GroupHandle) {
      return !((GroupHandle)obj).getPropertyHandle(IGroupElementModel.GROUP_NAME_PROP).isReadOnly();
    }
    return ((ReportElementHandle)obj).getDefn().getNameOption() != MetaDataConstants.NO_NAME && ((ReportElementHandle)obj).canEdit();
  }
  return false;
}

Fixed version (ground truth):
public boolean isEnabled(){
  if (getSelectedObjects().size() != 1) {
    return false;
  }
  Object obj=super.getSelectedObjects().getFirstElement();
  if (obj instanceof EmbeddedImageHandle) {
    return true;
  }
  if (obj instanceof ReportElementHandle) {
    if (obj instanceof GroupHandle) {
      return !((GroupHandle)obj).getPropertyHandle(IGroupElementModel.GROUP_NAME_PROP).isReadOnly();
    }
    return ((ReportElementHandle)obj).getDefn().getNameOption() != MetaDataConstants.NO_NAME && ((ReportElementHandle)obj).canEdit();
  }
  if (obj instanceof ContentElementHandle) {
    return ((ContentElementHandle)obj).getDefn().getNameOption() != MetaDataConstants.NO_NAME && ((ContentElementHandle)obj).canEdit();
  }
  return false;
}
Program: 67897
Project: 67897
Buggy source:
/** 
 * This method renders the 'shadow' at an offset from the text 'rotated rectangle' subsequently rendered.
 * @param ipr
 * @param iLabelPosition The position of the label w.r.t. the location specified by 'lo'
 * @param lo The location (specified as a 2d point) where the text is to be rendered
 * @param la The chart model structure containing the encapsulated text (and attributes) to be rendered
 */
public final void renderShadowAtLocation(IPrimitiveRenderer ipr,int iLabelPosition,Location lo,Label la) throws ChartException {
  if (!ChartUtil.isShadowDefined(la)) {
    return;
  }
  final ColorDefinition cdShadow=la.getShadowColor();
  if (cdShadow == null) {
    throw new ChartException(ChartDeviceSwtActivator.ID,ChartException.RENDERING,"String_Node_Str",Messages.getResourceBundle(_sxs.getULocale()));
  }
switch (iLabelPosition & POSITION_MASK) {
case ABOVE:
    showTopValue(ipr,lo,la,false);
  break;
case BELOW:
showBottomValue(ipr,lo,la,false);
break;
case LEFT:
showLeftValue(ipr,lo,la,false);
break;
case RIGHT:
showRightValue(ipr,lo,la,false);
break;
}
}

Fixed version (ground truth):
/** 
 * This method renders the 'shadow' at an offset from the text 'rotated rectangle' subsequently rendered.
 * @param ipr
 * @param iLabelPosition The position of the label w.r.t. the location specified by 'lo'
 * @param lo The location (specified as a 2d point) where the text is to be rendered
 * @param la The chart model structure containing the encapsulated text (and attributes) to be rendered
 */
@Override public final void renderShadowAtLocation(IPrimitiveRenderer ipr,int iLabelPosition,Location lo,Label la) throws ChartException {
  if (!ChartUtil.isShadowDefined(la)) {
    return;
  }
  final ColorDefinition cdShadow=la.getShadowColor();
  if (cdShadow == null) {
    throw new ChartException(ChartDeviceSwtActivator.ID,ChartException.RENDERING,"String_Node_Str",Messages.getResourceBundle(_sxs.getULocale()));
  }
switch (iLabelPosition & POSITION_MASK) {
case ABOVE:
    showTopValue(ipr,lo,la,false);
  break;
case BELOW:
showBottomValue(ipr,lo,la,false);
break;
case LEFT:
showLeftValue(ipr,lo,la,false);
break;
case RIGHT:
showRightValue(ipr,lo,la,false);
break;
}
}
Program: 67901
Project: 67901
Buggy source:
private IResultIterator executeQuery(DataRequestSession dteSession,QueryDefinition queryDefn) throws BirtException {
  IPreparedQuery query=dteSession.prepare(queryDefn,getAppContext());
  IQueryResults result=(IQueryResults)dteSession.execute(query,null,executionContext.getScriptContext());
  return result.getResultIterator();
}

Fixed version (ground truth):
private IResultIterator executeQuery(DataRequestSession dteSession,QueryDefinition queryDefn) throws BirtException {
  IPreparedQuery query=dteSession.prepare(queryDefn);
  IQueryResults result=(IQueryResults)dteSession.execute(query,null,executionContext.getScriptContext());
  return result.getResultIterator();
}
Program: 67902
Project: 67902
Buggy source:
private IResultIterator getResultSetForParameter(AbstractScalarParameterHandle parameter){
  ModuleHandle report=executionContext.getDesign();
  DataSetHandle dataSet=report.findDataSet(parameter.getDataSetName());
  IResultIterator iterator=null;
  if (dataSet != null) {
    try {
      DataRequestSession dteSession=createDataSession(dataSet);
      QueryDefinition queryDefn=createQueryDefinition(dataSet);
      ParameterHelper.addParameterBinding(queryDefn,parameter,dteSession.getModelAdaptor());
      ParameterHelper.addParameterSortBy(queryDefn,parameter,dteSession.getModelAdaptor());
      iterator=executeQuery(dteSession,queryDefn);
    }
 catch (    BirtException ex) {
      log.log(Level.WARNING,ex.getMessage(),ex);
      executionContext.addException(dataSet,ex);
    }
  }
  return iterator;
}

Fixed version (ground truth):
private IResultIterator getResultSetForParameter(AbstractScalarParameterHandle parameter){
  ModuleHandle report=executionContext.getDesign();
  DataSetHandle dataSet=report.findDataSet(parameter.getDataSetName());
  IResultIterator iterator=null;
  if (dataSet != null) {
    try {
      DataRequestSession dteSession=createDataSession(dataSet);
      dteSession.getDataSessionContext().setAppContext(getAppContext());
      QueryDefinition queryDefn=createQueryDefinition(dataSet);
      ParameterHelper.addParameterBinding(queryDefn,parameter,dteSession.getModelAdaptor());
      ParameterHelper.addParameterSortBy(queryDefn,parameter,dteSession.getModelAdaptor());
      iterator=executeQuery(dteSession,queryDefn);
    }
 catch (    BirtException ex) {
      log.log(Level.WARNING,ex.getMessage(),ex);
      executionContext.addException(dataSet,ex);
    }
  }
  return iterator;
}
Program: 67903
Project: 67903
Buggy source:
private IResultIterator getResultSetOfCascadingGroup(CascadingParameterGroupHandle parameterGroup){
  if (parameterGroup == null)   return null;
  DataSetHandle dataSet=parameterGroup.getDataSet();
  if (dataSet != null) {
    try {
      QueryDefinition queryDefn=createQueryDefinition(dataSet);
      DataRequestSession dteSession=createDataSession(dataSet);
      Iterator iter=parameterGroup.getParameters().iterator();
      while (iter.hasNext()) {
        Object parameter=iter.next();
        if (parameter instanceof ScalarParameterHandle) {
          ParameterHelper.addParameterBinding(queryDefn,(ScalarParameterHandle)parameter,dteSession.getModelAdaptor());
          ParameterHelper.addParameterSortBy(queryDefn,(ScalarParameterHandle)parameter,dteSession.getModelAdaptor());
        }
      }
      return executeQuery(dteSession,queryDefn);
    }
 catch (    BirtException ex) {
      log.log(Level.WARNING,ex.getMessage(),ex);
      executionContext.addException(dataSet,ex);
    }
  }
  return null;
}

Fixed version (ground truth):
private IResultIterator getResultSetOfCascadingGroup(CascadingParameterGroupHandle parameterGroup){
  if (parameterGroup == null)   return null;
  DataSetHandle dataSet=parameterGroup.getDataSet();
  if (dataSet != null) {
    try {
      QueryDefinition queryDefn=createQueryDefinition(dataSet);
      DataRequestSession dteSession=createDataSession(dataSet);
      dteSession.getDataSessionContext().setAppContext(getAppContext());
      Iterator iter=parameterGroup.getParameters().iterator();
      while (iter.hasNext()) {
        Object parameter=iter.next();
        if (parameter instanceof ScalarParameterHandle) {
          ParameterHelper.addParameterBinding(queryDefn,(ScalarParameterHandle)parameter,dteSession.getModelAdaptor());
          ParameterHelper.addParameterSortBy(queryDefn,(ScalarParameterHandle)parameter,dteSession.getModelAdaptor());
        }
      }
      return executeQuery(dteSession,queryDefn);
    }
 catch (    BirtException ex) {
      log.log(Level.WARNING,ex.getMessage(),ex);
      executionContext.addException(dataSet,ex);
    }
  }
  return null;
}
Program: 67906
Project: 67906
Buggy source:
private void applyPatternAttributes(){
  if (digitSubstitution) {
    DecimalFormatSymbols symbols=getICUDecimalSymbols(locale.toLocale());
    if (decimalFormat instanceof DecimalFormat) {
      ((DecimalFormat)decimalFormat).setDecimalFormatSymbols(symbols);
    }
    if (numberFormat instanceof DecimalFormat) {
      ((DecimalFormat)numberFormat).setDecimalFormatSymbols(symbols);
    }
  }
  if (decimalFormat instanceof DecimalFormat) {
    ((DecimalFormat)decimalFormat).setRoundingMode(roundingMode);
  }
  if (numberFormat instanceof DecimalFormat) {
    ((DecimalFormat)numberFormat).setRoundingMode(roundingMode);
  }
}

Fixed version (ground truth):
private void applyPatternAttributes(){
  if (digitSubstitution) {
    DecimalFormatSymbols symbols=getICUDecimalSymbols(locale.toLocale());
    if (decimalFormat instanceof DecimalFormat) {
      ((DecimalFormat)decimalFormat).setDecimalFormatSymbols(symbols);
    }
    if (numberFormat instanceof DecimalFormat) {
      ((DecimalFormat)numberFormat).setDecimalFormatSymbols(symbols);
    }
  }
}
Program: 67907
Project: 67907
Buggy source:
private void setStateOfLabel(){
  Axis ax=getAxisForProcessing();
  boolean isLabelEnabled=ax.getLabel().isVisible();
  fdcFont.setEnabled(isLabelEnabled);
  cbStaggered.setEnabled(!isChart3D(ax) && isLabelEnabled);
  setToggleButtonEnabled(BUTTON_LABEL,isLabelEnabled);
}

Fixed version (ground truth):
private void setStateOfLabel(){
  Axis ax=getAxisForProcessing();
  boolean isLabelEnabled=ax.getLabel().isVisible();
  fdcFont.setEnabled(isLabelEnabled);
  cbStaggered.setEnabled(!isChart3D() && isLabelEnabled);
  setToggleButtonEnabled(BUTTON_LABEL,isLabelEnabled);
}
Program: 67909
Project: 67909
Buggy source:
protected boolean isChart3D(Axis ax){
  if (getChart() instanceof ChartWithAxes) {
    return (getChart().getDimension() == ChartDimension.THREE_DIMENSIONAL_LITERAL);
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
protected boolean isChart3D(){
  if (getChart() instanceof ChartWithAxes) {
    return (getChart().getDimension() == ChartDimension.THREE_DIMENSIONAL_LITERAL);
  }
  return false;
}
Program: 67911
Project: 67911
Buggy source:
/** 
 * Returns value of aggregate function parameters.
 * @param orthSD
 * @param baseSD
 * @param orthQuery
 * @since 2.5
 */
public static String[] getAggFunParameters(SeriesDefinition orthSD,SeriesDefinition baseSD,Query orthQuery){
  if (baseSD.getGrouping() != null && baseSD.getGrouping().isEnabled()) {
    SeriesGrouping grouping=orthSD.getGrouping();
    if (grouping != null && grouping.isEnabled()) {
      return grouping.getAggregateParameters().toArray(new String[0]);
    }
 else     if (orthQuery != null && orthQuery.getGrouping() != null) {
      return orthQuery.getGrouping().getAggregateParameters().toArray(new String[0]);
    }
    return baseSD.getGrouping().getAggregateParameters().toArray(new String[0]);
  }
 else {
    if (orthQuery != null && orthQuery.getGrouping() != null && orthQuery.getGrouping().isEnabled()) {
      return orthQuery.getGrouping().getAggregateParameters().toArray(new String[0]);
    }
    return orthSD.getGrouping().getAggregateParameters().toArray(new String[0]);
  }
}

Fixed version (ground truth):
/** 
 * Returns value of aggregate function parameters.
 * @param orthSD
 * @param baseSD
 * @param orthQuery
 * @since 2.5
 */
public static String[] getAggFunParameters(SeriesDefinition orthSD,SeriesDefinition baseSD,Query orthQuery){
  if (baseSD.getGrouping() != null && baseSD.getGrouping().isEnabled()) {
    SeriesGrouping grouping=orthSD.getGrouping();
    if (grouping != null && grouping.isEnabled()) {
      return grouping.getAggregateParameters().toArray(new String[0]);
    }
 else     if (orthQuery != null && orthQuery.getGrouping() != null && orthQuery.getGrouping().isEnabled()) {
      return orthQuery.getGrouping().getAggregateParameters().toArray(new String[0]);
    }
    return baseSD.getGrouping().getAggregateParameters().toArray(new String[0]);
  }
 else {
    if (orthQuery != null && orthQuery.getGrouping() != null && orthQuery.getGrouping().isEnabled()) {
      return orthQuery.getGrouping().getAggregateParameters().toArray(new String[0]);
    }
    return orthSD.getGrouping().getAggregateParameters().toArray(new String[0]);
  }
}