nus-yam/ex-repair huggingface dataset:
Program: 67270
Project: 67270
Buggy source:
protected void updateColumnHintProperties(ResultSetColumnModel model,ColumnHintHandle columnHintHandle) throws SemanticException {
  columnHintHandle.setAnalysis(model.analysis);
  columnHintHandle.setAlias(model.alias);
  columnHintHandle.setDisplayName(model.displayName);
  columnHintHandle.setHelpText(model.helpText);
}

Fixed version (ground truth):
protected void updateColumnHintProperties(ResultSetColumnModel model,ColumnHintHandle columnHintHandle) throws SemanticException {
  columnHintHandle.setAnalysis(model.analysisType);
  columnHintHandle.setAlias(model.alias);
  columnHintHandle.setDisplayName(model.displayName);
  columnHintHandle.setHelpText(model.helpText);
}
Program: 67272
Project: 67272
Buggy source:
public int canDrop(Object transfer,Object target,int operation,DNDLocation location){
  if (target != null && transfer instanceof CubeHandle) {
    SlotHandle targetSlot=getTargetSlotHandle(target,ICrosstabConstants.CROSSTAB_EXTENSION_NAME);
    if (targetSlot != null) {
      if (DNDUtil.handleValidateTargetCanContainType(targetSlot,"String_Node_Str") && DNDUtil.handleValidateTargetCanContainMore(targetSlot,0))       return DNDService.LOGIC_TRUE;
    }
 else {
      IStructuredSelection models=InsertInLayoutUtil.editPart2Model(new StructuredSelection(target));
      if (!models.isEmpty()) {
        Object model=DNDUtil.unwrapToModel(models.getFirstElement());
        if (model instanceof DesignElementHandle) {
          DesignElementHandle targetHandle=(DesignElementHandle)model;
          if (targetHandle.canContain(DEUtil.getDefaultContentName(targetHandle),ICrosstabConstants.CROSSTAB_EXTENSION_NAME))           return DNDService.LOGIC_TRUE;
        }
      }
    }
  }
  return DNDService.LOGIC_UNKNOW;
}

Fixed version (ground truth):
public int canDrop(Object transfer,Object target,int operation,DNDLocation location){
  if (target != null && transfer instanceof CubeHandle) {
    SlotHandle targetSlot=getTargetSlotHandle(target,ICrosstabConstants.CROSSTAB_EXTENSION_NAME);
    if (targetSlot != null) {
      if (DNDUtil.handleValidateTargetCanContainType(targetSlot,"String_Node_Str") && DNDUtil.handleValidateTargetCanContainMore(targetSlot,0))       return DNDService.LOGIC_TRUE;
    }
 else {
      if (target instanceof CrosstabCellEditPart) {
        Object model=DNDUtil.unwrapToModel(((CrosstabCellEditPart)target).getModel());
        if (model == null) {
          return DNDService.LOGIC_FALSE;
        }
        ExtendedItemHandle handle=null;
        String name=ReportPlugin.getDefault().getCustomName(ICrosstabConstants.CROSSTAB_EXTENSION_NAME);
        try {
          handle=CrosstabExtendedItemFactory.createCrosstabReportItem(SessionHandleAdapter.getInstance().getReportDesignHandle(),null,name);
          handle.setProperty(IReportItemModel.CUBE_PROP,(CubeHandle)transfer);
          int flag=DNDUtil.handleValidateTargetCanContain(model,handle,false);
          if (flag == DNDUtil.CONTAIN_NO) {
            return DNDService.LOGIC_FALSE;
          }
        }
 catch (        Exception e) {
          return DNDService.LOGIC_FALSE;
        }
      }
      IStructuredSelection models=InsertInLayoutUtil.editPart2Model(new StructuredSelection(target));
      if (!models.isEmpty()) {
        Object model=DNDUtil.unwrapToModel(models.getFirstElement());
        if (model instanceof DesignElementHandle) {
          DesignElementHandle targetHandle=(DesignElementHandle)model;
          if (targetHandle.canContain(DEUtil.getDefaultContentName(targetHandle),ICrosstabConstants.CROSSTAB_EXTENSION_NAME))           return DNDService.LOGIC_TRUE;
        }
      }
    }
  }
  return DNDService.LOGIC_UNKNOW;
}
Program: 67282
Project: 67282
Buggy source:
/** 
 * @param name
 * @param factTableJointColumnNames
 * @param DimJointColumnNames
 * @param dimensions
 * @param factTable
 * @param measureColumns
 * @param stopSign
 * @throws IOException
 * @throws BirtException
 */
public void createCube(String name,String[][] factTableJointColumnNames,String[][] DimJointColumnNames,IDimension[] dimensions,IDatasetIterator factTable,String[] measureColumns,long cacheSize,StopSign stopSign) throws IOException, BirtException {
  if (dimensions.length == 0) {
    throw new DataException(ResourceConstants.MISSING_DIMENSION_IN_CUBE,name);
  }
  Cube cube=new Cube(name,documentManager);
  cube.create(factTableJointColumnNames,DimJointColumnNames,dimensions,factTable,measureColumns,cacheSize,stopSign);
  cube.close();
  documentManager.flush();
}

Fixed version (ground truth):
/** 
 * @param name
 * @param factTableJointColumnNames
 * @param DimJointColumnNames
 * @param dimensions
 * @param factTable
 * @param measureColumns
 * @param stopSign
 * @throws IOException
 * @throws BirtException
 */
public void createCube(String name,String[][] factTableJointColumnNames,String[][] DimJointColumnNames,IDimension[] dimensions,IDatasetIterator factTable,String[] measureColumns,long cacheSize,StopSign stopSign,boolean suppressInvalidFacttableRow) throws IOException, BirtException {
  if (dimensions.length == 0) {
    throw new DataException(ResourceConstants.MISSING_DIMENSION_IN_CUBE,name);
  }
  Cube cube=new Cube(name,documentManager);
  cube.create(factTableJointColumnNames,DimJointColumnNames,dimensions,factTable,measureColumns,cacheSize,stopSign,suppressInvalidFacttableRow);
  cube.close();
  documentManager.flush();
}
Program: 67283
Project: 67283
Buggy source:
/** 
 * @param factTableJointColumnNames
 * @param DimJointColumnNames
 * @param dimension
 * @param iterator
 * @param measureColumnName
 * @param stopSign
 * @throws IOException
 * @throws BirtException
 */
public void create(String[][] factTableJointColumnNames,String[][] DimJointColumnNames,IDimension[] dimension,IDatasetIterator iterator,String[] measureColumnName,long cacheSize,StopSign stopSign) throws IOException, BirtException {
  IDocumentObject documentObject=documentManager.createDocumentObject(NamingUtil.getCubeDocName(name));
  documentObject.writeString(name);
  documentObject.writeInt(dimension.length);
  for (int i=0; i < dimension.length; i++) {
    documentObject.writeString(dimension[i].getName());
  }
  this.dimension=dimension;
  Dimension[] tDimensions=new Dimension[dimension.length];
  for (int i=0; i < tDimensions.length; i++) {
    tDimensions[i]=(Dimension)dimension[i];
  }
  FactTableAccessor factTableConstructor=new FactTableAccessor(documentManager);
  factTableConstructor.setMemoryCacheSize(cacheSize);
  factTable=factTableConstructor.saveFactTable(name,factTableJointColumnNames,DimJointColumnNames,iterator,tDimensions,measureColumnName,stopSign);
  documentObject.close();
  documentManager.flush();
}

Fixed version (ground truth):
/** 
 * @param factTableJointColumnNames
 * @param DimJointColumnNames
 * @param dimension
 * @param iterator
 * @param measureColumnName
 * @param stopSign
 * @throws IOException
 * @throws BirtException
 */
public void create(String[][] factTableJointColumnNames,String[][] DimJointColumnNames,IDimension[] dimension,IDatasetIterator iterator,String[] measureColumnName,long cacheSize,StopSign stopSign,boolean suppressInvalidFacttableRow) throws IOException, BirtException {
  IDocumentObject documentObject=documentManager.createDocumentObject(NamingUtil.getCubeDocName(name));
  documentObject.writeString(name);
  documentObject.writeInt(dimension.length);
  for (int i=0; i < dimension.length; i++) {
    documentObject.writeString(dimension[i].getName());
  }
  this.dimension=dimension;
  Dimension[] tDimensions=new Dimension[dimension.length];
  for (int i=0; i < tDimensions.length; i++) {
    tDimensions[i]=(Dimension)dimension[i];
  }
  FactTableAccessor factTableConstructor=new FactTableAccessor(documentManager);
  factTableConstructor.setMemoryCacheSize(cacheSize);
  factTable=factTableConstructor.saveFactTable(name,factTableJointColumnNames,DimJointColumnNames,iterator,tDimensions,measureColumnName,stopSign,suppressInvalidFacttableRow);
  documentObject.close();
  documentManager.flush();
}
Program: 67286
Project: 67286
Buggy source:
/** 
 * @param appContext
 * @param hierHandle
 * @return
 * @throws AdapterException
 * @throws BirtException
 */
private DataSetIterator createDataSetIterator(Map appContext,TabularHierarchyHandle hierHandle,String cubeName) throws AdapterException, BirtException {
  List<ColumnMeta> metaList=new ArrayList<ColumnMeta>();
  IQueryDefinition defn=sessionImpl.createQuery(sessionImpl,hierHandle,metaList,cubeName);
  return new DataSetIterator(this.sessionImpl,defn,metaList,appContext);
}

Fixed version (ground truth):
/** 
 * @param appContext
 * @param hierHandle
 * @return
 * @throws AdapterException
 * @throws BirtException
 */
private DataSetIterator createDataSetIterator(Map appContext,TabularHierarchyHandle hierHandle,String cubeName) throws AdapterException, BirtException {
  List<ColumnMeta> metaList=new ArrayList<ColumnMeta>();
  IQueryDefinition defn=sessionImpl.createQuery(sessionImpl,hierHandle,metaList,cubeName);
  return new DataSetIterator(this.sessionImpl,defn,metaList,appContext,null,null);
}
Program: 67287
Project: 67287
Buggy source:
public IBaseQueryResults execute(IBasePreparedQuery query,IBaseQueryResults outerResults,ScriptContext context) throws AdapterException {
  try {
    IDataScriptEngine engine=(IDataScriptEngine)context.getScriptEngine(IDataScriptEngine.ENGINE_NAME);
    Scriptable scope=engine.getJSScope(context);
    if (query instanceof IPreparedQuery) {
      return ((IPreparedQuery)query).execute(outerResults,scope);
    }
 else     if (query instanceof IPreparedCubeQuery) {
      String queryName=((IPreparedCubeQuery)query).getCubeQueryDefinition().getName();
      if (this.cubeHandleMap.get(queryName) != null) {
        this.materializeCube((CubeHandle)this.cubeHandleMap.get(queryName),this.sessionContext.getAppContext());
        this.cubeHandleMap.remove(queryName);
      }
      return ((IPreparedCubeQuery)query).execute(outerResults,scope);
    }
    return null;
  }
 catch (  BirtException e) {
    throw new AdapterException(ResourceConstants.EXCEPTION_ERROR,e);
  }
}

Fixed version (ground truth):
public IBaseQueryResults execute(IBasePreparedQuery query,IBaseQueryResults outerResults,ScriptContext context) throws AdapterException {
  try {
    IDataScriptEngine engine=(IDataScriptEngine)context.getScriptEngine(IDataScriptEngine.ENGINE_NAME);
    Scriptable scope=engine.getJSScope(context);
    if (query instanceof IPreparedQuery) {
      return ((IPreparedQuery)query).execute(outerResults,scope);
    }
 else     if (query instanceof IPreparedCubeQuery) {
      String queryName=((IPreparedCubeQuery)query).getCubeQueryDefinition().getName();
      if (this.cubeHandleMap.get(queryName) != null) {
        this.materializeCube((CubeHandle)this.cubeHandleMap.get(queryName),this.sessionContext.getAppContext(),false);
        this.cubeHandleMap.remove(queryName);
      }
      return ((IPreparedCubeQuery)query).execute(outerResults,scope);
    }
    return null;
  }
 catch (  BirtException e) {
    throw new AdapterException(ResourceConstants.EXCEPTION_ERROR,e);
  }
}
Program: 67288
Project: 67288
Buggy source:
/** 
 * @param cubeHandle
 * @param appContext
 * @param stopSign
 * @throws BirtException
 */
void materializeCube(CubeHandle cubeHandle,Map appContext) throws BirtException {
  int mode=this.sessionContext.getDataEngineContext().getMode();
  try {
    if (appContext == null)     appContext=sessionContext.getAppContext();
    String memoryUsage=(String)(appContext.get(DataEngine.MEMORY_USAGE));
    MemoryUsageSetting.setMemoryUsage(memoryUsage);
    if (mode == DataEngineContext.DIRECT_PRESENTATION) {
      int size=0;
      if (appContext != null) {
        Integer value=DataTypeUtil.toInteger(appContext.get(DataEngine.IN_MEMORY_CUBE_SIZE));
        if (value != null && value.intValue() > 0) {
          size=value.intValue();
        }
      }
      CubeMaterializer cm=getCubeMaterializer(size);
      createCube((TabularCubeHandle)cubeHandle,cm,appContext);
    }
 else     if (mode == DataEngineContext.MODE_GENERATION) {
      CubeMaterializer cm=getCubeMaterializer(0);
      createCube((TabularCubeHandle)cubeHandle,cm,appContext);
      cm.saveCubeToReportDocument(cubeHandle.getQualifiedName(),this.sessionContext.getDocumentWriter(),this.dataEngine.getSession().getStopSign());
    }
  }
 catch (  Exception e) {
    throw new DataException(ResourceConstants.EXCEPTION_ERROR,e);
  }
}

Fixed version (ground truth):
/** 
 * @param cubeHandle
 * @param appContext
 * @param stopSign
 * @throws BirtException
 */
void materializeCube(CubeHandle cubeHandle,Map appContext,boolean isTransient) throws BirtException {
  int mode=this.sessionContext.getDataEngineContext().getMode();
  try {
    if (appContext == null)     appContext=sessionContext.getAppContext();
    String memoryUsage=(String)(appContext.get(DataEngine.MEMORY_USAGE));
    MemoryUsageSetting.setMemoryUsage(memoryUsage);
    if (mode == DataEngineContext.DIRECT_PRESENTATION) {
      int size=0;
      if (appContext != null) {
        Integer value=DataTypeUtil.toInteger(appContext.get(DataEngine.IN_MEMORY_CUBE_SIZE));
        if (value != null && value.intValue() > 0) {
          size=value.intValue();
        }
      }
      CubeMaterializer cm=getCubeMaterializer(size);
      createCube((TabularCubeHandle)cubeHandle,cm,appContext,isTransient);
    }
 else     if (mode == DataEngineContext.MODE_GENERATION) {
      CubeMaterializer cm=getCubeMaterializer(0);
      createCube((TabularCubeHandle)cubeHandle,cm,appContext,isTransient);
      cm.saveCubeToReportDocument(cubeHandle.getQualifiedName(),this.sessionContext.getDocumentWriter(),this.dataEngine.getSession().getStopSign());
    }
  }
 catch (  Exception e) {
    throw new DataException(ResourceConstants.EXCEPTION_ERROR,e);
  }
}
Program: 67291
Project: 67291
Buggy source:
/** 
 * Create DataSetIterator for fact table.
 * @param session
 * @param cubeHandle
 * @throws BirtException
 */
public DataSetIterator(DataRequestSessionImpl session,IQueryDefinition query,List<ColumnMeta> meta,Map appContext) throws BirtException {
  this.calendar=Calendar.getInstance(session.getDataSessionContext().getDataEngineContext().getLocale());
  this.calendar.setTimeZone(session.getDataSessionContext().getDataEngineContext().getTimeZone());
  this.calendar.clear();
  this.calendar.set(0,0,1,0,0,0);
  this.nullTime=this.calendar.getTimeInMillis();
  this.calendar.clear();
  executeQuery(session,query,appContext);
  this.metadata=new ResultMeta(meta);
}

Fixed version (ground truth):
/** 
 * Create DataSetIterator for fact table.
 * @param session
 * @param cubeHandle
 * @throws BirtException
 */
public DataSetIterator(DataRequestSessionImpl session,IQueryDefinition query,List<ColumnMeta> meta,Map appContext,SecurityListener listener,String dimensionName) throws BirtException {
  this.calendar=Calendar.getInstance(session.getDataSessionContext().getDataEngineContext().getLocale());
  this.calendar.setTimeZone(session.getDataSessionContext().getDataEngineContext().getTimeZone());
  this.calendar.clear();
  this.calendar.set(0,0,1,0,0,0);
  this.nullTime=this.calendar.getTimeInMillis();
  this.calendar.clear();
  this.securityListener=listener;
  this.dimName=dimensionName;
  if (this.securityListener != null) {
    List<IFilterDefinition> additionalFilters4TransientProcessing=this.securityListener.populateSecurityFilter(this.dimName,appContext);
    if (additionalFilters4TransientProcessing != null)     query.getFilters().addAll(additionalFilters4TransientProcessing);
  }
  executeQuery(session,query,appContext);
  this.metadata=new ResultMeta(meta);
}
Program: 67292
Project: 67292
Buggy source:
protected boolean calculateEnabled(){
  List selected=getSelectedObjects();
  if (selected.size() != 1 || !(selected.get(0) instanceof EditPart)) {
    return false;
  }
  EditPart part=(EditPart)selected.get(0);
  Object model=part.getModel();
  if (!(model instanceof ReportItemHandle) && model instanceof IAdaptable) {
    model=((IAdaptable)model).getAdapter(DesignElementHandle.class);
  }
  if (!(model instanceof ReportItemHandle) || DEUtil.isReferenceElement((ReportItemHandle)model)) {
    return false;
  }
  Object[] objs=ElementAdapterManager.getAdapters(model,IReportItemViewProvider.class);
  if (objs == null || objs.length > 1) {
    return false;
  }
  if (((ReportItemHandle)model).getViews().size() != 0) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
protected boolean calculateEnabled(){
  List selected=getSelectedObjects();
  if (selected.size() != 1 || !(selected.get(0) instanceof EditPart)) {
    return false;
  }
  EditPart part=(EditPart)selected.get(0);
  Object model=part.getModel();
  if (!(model instanceof ReportItemHandle) && model instanceof IAdaptable) {
    model=((IAdaptable)model).getAdapter(DesignElementHandle.class);
  }
  if (!(model instanceof ReportItemHandle) || DEUtil.isReferenceElement((ReportItemHandle)model)) {
    return false;
  }
  Object[] objs=ElementAdapterManager.getAdapters(model,IReportItemViewProvider.class);
  if (objs == null || objs.length > 1) {
    return false;
  }
  if (((ReportItemHandle)model).getViews().size() != 0 || !((ReportItemHandle)model).canAddView("String_Node_Str")) {
    return false;
  }
  return true;
}
Program: 67293
Project: 67293
Buggy source:
private Element createEmbeddeImage(BufferedImage img){
  if (img == null) {
    return null;
  }
  int width=img.getWidth();
  int height=img.getHeight();
  ImageWriter iw=ImageWriterFactory.instance().createByFormatName("String_Node_Str");
  ByteArrayOutputStream baos=new ByteArrayOutputStream(8192 * 2);
  String sUrl=null;
  try {
    final ImageOutputStream ios=SecurityUtil.newImageOutputStream(baos);
    ImageWriteParam iwp=iw.getDefaultWriteParam();
    iw.setOutput(ios);
    iw.write((IIOMetadata)null,new IIOImage(img,null,null),iwp);
    img.flush();
    ios.close();
    sUrl=SVGImage.BASE64 + new String(Base64.encodeBase64(baos.toByteArray()));
  }
 catch (  Exception ex) {
    logger.log(ex);
  }
 finally {
    iw.dispose();
  }
  Element elem=dom.createElement("String_Node_Str");
  elem.setAttribute("String_Node_Str","String_Node_Str" + img.hashCode());
  elem.setAttribute("String_Node_Str","String_Node_Str");
  elem.setAttribute("String_Node_Str","String_Node_Str");
  elem.setAttribute("String_Node_Str",Integer.toString(width));
  elem.setAttribute("String_Node_Str",Integer.toString(height));
  elem.setAttribute("String_Node_Str",sUrl);
  return elem;
}

Fixed version (ground truth):
private Element createEmbeddeImage(BufferedImage img){
  if (img == null) {
    return null;
  }
  int width=img.getWidth();
  int height=img.getHeight();
  ImageWriter iw=ImageWriterFactory.instance().createByFormatName("String_Node_Str");
  ByteArrayOutputStream baos=new ByteArrayOutputStream(8192 * 2);
  String sUrl=null;
  try {
    final ImageOutputStream ios=SecurityUtil.newImageOutputStream(baos);
    ImageWriteParam iwp=iw.getDefaultWriteParam();
    iw.setOutput(ios);
    iw.write((IIOMetadata)null,new IIOImage(img,null,null),iwp);
    img.flush();
    ios.close();
    sUrl=SVGImage.BASE64 + new String(Base64.encodeBase64(baos.toByteArray()));
  }
 catch (  Exception ex) {
    logger.log(ex);
  }
 finally {
    iw.dispose();
  }
  Element elemG=dom.createElement("String_Node_Str");
  elemG.setAttribute("String_Node_Str","String_Node_Str" + img.hashCode());
  Element elem=dom.createElement("String_Node_Str");
  elem.setAttribute("String_Node_Str","String_Node_Str");
  elem.setAttribute("String_Node_Str","String_Node_Str");
  elem.setAttribute("String_Node_Str",Integer.toString(width));
  elem.setAttribute("String_Node_Str",Integer.toString(height));
  elem.setAttribute("String_Node_Str",sUrl);
  elemG.appendChild(elem);
  return elemG;
}
Program: 67295
Project: 67295
Buggy source:
public String getKeyValue() throws DataException {
  try {
    if (keyValue != null) {
      if (keyValue instanceof String)       return (String)this.keyValue;
      if (keyValue instanceof SoftReference) {
        String result=((SoftReference<String>)keyValue).get();
        if (result != null)         return result;
      }
    }
    if (keyStream == null)     return null;
    this.keyStream.seek(this.keyOffset);
    this.keyValue=new SoftReference<String>(IOUtil.readString(new DataInputStream(this.keyStream)));
    return ((SoftReference<String>)this.keyValue).get();
  }
 catch (  IOException e) {
    throw new DataException(e.getLocalizedMessage(),e);
  }
}

Fixed version (ground truth):
public String getKeyValue() throws DataException {
  try {
    if (keyValue != null) {
      if (keyValue instanceof String)       return (String)this.keyValue;
      if (keyValue instanceof SoftReference) {
        String result=((SoftReference<String>)keyValue).get();
        if (result != null)         return result;
      }
    }
    if (keyStream == null)     return null;
synchronized (this.keyStream) {
      if (keyValue != null) {
        if (keyValue instanceof String)         return (String)this.keyValue;
        if (keyValue instanceof SoftReference) {
          String result=((SoftReference<String>)keyValue).get();
          if (result != null)           return result;
        }
      }
      this.keyStream.seek(this.keyOffset);
      this.keyValue=new SoftReference<String>(IOUtil.readString(new DataInputStream(this.keyStream)));
    }
    return ((SoftReference<String>)this.keyValue).get();
  }
 catch (  IOException e) {
    throw new DataException(e.getLocalizedMessage(),e);
  }
}
Program: 67296
Project: 67296
Buggy source:
private void setEnabledForButtons(){
  if (isCubeMode()) {
    boolean inheritXTab=getDataServiceProvider().checkState(IDataServiceProvider.INHERIT_CUBE);
    if (inheritXTab) {
      btnFilters.setEnabled(false);
      btnBinding.setEnabled(false);
    }
 else {
      boolean disabled=getDataServiceProvider().isInXTabAggrCell() || getDataServiceProvider().isInXTabMeasureCell();
      btnFilters.setEnabled(!disabled && !getDataServiceProvider().isInheritColumnsGroups());
      btnBinding.setEnabled(!getDataServiceProvider().isInheritColumnsGroups() && getDataServiceProvider().isInvokingSupported() || getDataServiceProvider().isSharedBinding());
    }
    btnParameters.setEnabled(false);
  }
 else {
    btnFilters.setEnabled(hasDataSet() && !getDataServiceProvider().isInheritColumnsGroups());
    btnParameters.setEnabled(getDataServiceProvider().getDataSet() != null && getDataServiceProvider().isInvokingSupported());
    btnBinding.setEnabled(hasDataSet() && !getDataServiceProvider().isInheritColumnsGroups() && (getDataServiceProvider().isInvokingSupported() || getDataServiceProvider().isSharedBinding()));
  }
}

Fixed version (ground truth):
private void setEnabledForButtons(){
  if (isCubeMode()) {
    boolean inheritXTab=getDataServiceProvider().checkState(IDataServiceProvider.INHERIT_CUBE);
    if (inheritXTab) {
      btnFilters.setEnabled(false);
      btnBinding.setEnabled(false);
    }
 else {
      boolean disabled=getDataServiceProvider().isInXTabAggrCell() || getDataServiceProvider().isInXTabMeasureCell();
      btnFilters.setEnabled(!disabled && (getDataServiceProvider().checkState(IDataServiceProvider.HAS_CUBE) || !getDataServiceProvider().isInheritColumnsGroups()));
      btnBinding.setEnabled((getDataServiceProvider().checkState(IDataServiceProvider.HAS_CUBE) || !getDataServiceProvider().isInheritColumnsGroups()) && getDataServiceProvider().isInvokingSupported() || getDataServiceProvider().isSharedBinding());
    }
    btnParameters.setEnabled(false);
  }
 else {
    btnFilters.setEnabled(hasDataSet() && !getDataServiceProvider().isInheritColumnsGroups());
    btnParameters.setEnabled(getDataServiceProvider().getDataSet() != null && getDataServiceProvider().isInvokingSupported());
    btnBinding.setEnabled(hasDataSet() && !getDataServiceProvider().isInheritColumnsGroups() && (getDataServiceProvider().isInvokingSupported() || getDataServiceProvider().isSharedBinding()));
  }
}
Program: 67297
Project: 67297
Buggy source:
public static void completeParamDefalutValues(IEngineTask engineTask,ModuleHandle moduleHandle){
  List paramsList=moduleHandle.getAllParameters();
  for (int i=0; i < paramsList.size(); i++) {
    Object parameterObject=paramsList.get(i);
    if (parameterObject instanceof ScalarParameterHandle) {
      ScalarParameterHandle parameterHandle=(ScalarParameterHandle)parameterObject;
      if (parameterHandle.getDefaultValueList() == null || parameterHandle.getDefaultValueList().size() == 0) {
        engineTask.setParameter(parameterHandle.getName(),getDummyDefaultValue(parameterHandle),parameterHandle.getDisplayName());
      }
    }
 else     if (parameterObject instanceof DynamicFilterParameterHandle) {
      List defaultValue=((DynamicFilterParameterHandle)parameterObject).getDefaultValueList();
      if (defaultValue == null || defaultValue.size() == 0) {
        engineTask.setParameter(((DynamicFilterParameterHandle)parameterObject).getName(),"String_Node_Str",((DynamicFilterParameterHandle)parameterObject).getDisplayName());
      }
    }
  }
}

Fixed version (ground truth):
public static void completeParamDefalutValues(IEngineTask engineTask,ModuleHandle moduleHandle){
  List paramsList=moduleHandle.getAllParameters();
  for (int i=0; i < paramsList.size(); i++) {
    Object parameterObject=paramsList.get(i);
    if (parameterObject instanceof ScalarParameterHandle) {
      ScalarParameterHandle parameterHandle=(ScalarParameterHandle)parameterObject;
      if (parameterHandle.getDefaultValueList() == null || parameterHandle.getDefaultValueList().size() == 0) {
        String paramType=parameterHandle.getParamType();
        if (DesignChoiceConstants.SCALAR_PARAM_TYPE_MULTI_VALUE.equals(paramType)) {
          engineTask.setParameter(parameterHandle.getName(),new Object[]{getDummyDefaultValue(parameterHandle)},parameterHandle.getDisplayName());
        }
 else         engineTask.setParameter(parameterHandle.getName(),getDummyDefaultValue(parameterHandle),parameterHandle.getDisplayName());
      }
    }
 else     if (parameterObject instanceof DynamicFilterParameterHandle) {
      List defaultValue=((DynamicFilterParameterHandle)parameterObject).getDefaultValueList();
      if (defaultValue == null || defaultValue.size() == 0) {
        engineTask.setParameter(((DynamicFilterParameterHandle)parameterObject).getName(),"String_Node_Str",((DynamicFilterParameterHandle)parameterObject).getDisplayName());
      }
    }
  }
}
Program: 67299
Project: 67299
Buggy source:
public IAggregationResultSet[] execute(IAggregationResultSet[] rs,BirtCubeView view,CubeQueryExecutorHelper cubeQueryExecutorHelper) throws IOException {
  ICubeQueryDefinition query=view.getCubeQueryDefinition();
  IEdgeDefinition columnEdge=query.getEdge(ICubeQueryDefinition.COLUMN_EDGE);
  IEdgeDefinition rowEdge=query.getEdge(ICubeQueryDefinition.ROW_EDGE);
  IMirroredDefinition columnMirror=null, rowMirror=null;
  if (columnEdge != null)   columnMirror=columnEdge.getMirroredDefinition();
  if (rowEdge != null)   rowMirror=rowEdge.getMirroredDefinition();
  int index=0;
  if (columnEdge != null) {
    if (columnMirror != null) {
      rs[index]=new MirroredAggregationResultSet(rs[index],new MirrorMetaInfo(columnMirror,columnEdge,view),cubeQueryExecutorHelper.getColumnSort());
    }
    index++;
  }
  if (rowMirror != null) {
    rs[index]=new MirroredAggregationResultSet(rs[index],new MirrorMetaInfo(rowMirror,rowEdge,view),cubeQueryExecutorHelper.getRowSort());
  }
  return rs;
}

Fixed version (ground truth):
public IAggregationResultSet[] execute(IAggregationResultSet[] rs,BirtCubeView view,CubeQueryExecutorHelper cubeQueryExecutorHelper) throws IOException, DataException {
  ICubeQueryDefinition query=view.getCubeQueryDefinition();
  IEdgeDefinition columnEdge=query.getEdge(ICubeQueryDefinition.COLUMN_EDGE);
  IEdgeDefinition rowEdge=query.getEdge(ICubeQueryDefinition.ROW_EDGE);
  IMirroredDefinition columnMirror=null, rowMirror=null;
  if (columnEdge != null)   columnMirror=columnEdge.getMirroredDefinition();
  if (rowEdge != null)   rowMirror=rowEdge.getMirroredDefinition();
  int index=0;
  if (columnEdge != null) {
    if (columnMirror != null) {
      rs[index]=new MirroredAggregationResultSet(rs[index],new MirrorMetaInfo(columnMirror,columnEdge,view),cubeQueryExecutorHelper.getColumnSort());
    }
    index++;
  }
  if (rowMirror != null) {
    rs[index]=new MirroredAggregationResultSet(rs[index],new MirrorMetaInfo(rowMirror,rowEdge,view),cubeQueryExecutorHelper.getRowSort());
  }
  if (rowMirror != null || columnMirror != null) {
    boolean hasAggregationSort=false;
    List sort=cubeQueryExecutorHelper.getColumnSort();
    for (int i=0; i < sort.size(); i++) {
      if (sort.get(i) instanceof AggrSortDefinition && ((AggrSortDefinition)sort.get(i)).getAxisQualifierLevel().length > 0) {
        hasAggregationSort=true;
        break;
      }
    }
    if (!hasAggregationSort) {
      sort=cubeQueryExecutorHelper.getRowSort();
      for (int i=0; i < sort.size(); i++) {
        if (sort.get(i) instanceof AggrSortDefinition && ((AggrSortDefinition)sort.get(i)).getAxisQualifierLevel().length > 0) {
          hasAggregationSort=true;
          break;
        }
      }
    }
    if (hasAggregationSort) {
      for (int i=0; i < rs.length; i++) {
        if (rs[i].getAggregationCount() == 0) {
          rs[i]=sortAggregationResultSet(rs[i]);
        }
      }
      cubeQueryExecutorHelper.applyAggrSort(rs);
    }
  }
  return rs;
}
Program: 67300
Project: 67300
Buggy source:
protected ChartPreviewPainterBase(ChartWizardContext wizardContext){
  this.wizardContext=wizardContext;
  this.chart=wizardContext.getModel();
  if (this.chart != null) {
    chart=chart.copyInstance();
  }
}

Fixed version (ground truth):
protected ChartPreviewPainterBase(ChartWizardContext wizardContext){
  this.wizardContext=wizardContext;
}
Program: 67302
Project: 67302
Buggy source:
protected void enableInput(boolean val){
  operator.setEnabled(val);
  if (valueVisible != 3) {
    if (expressionValue1 != null)     expressionValue1.setEnabled(val);
    if (expressionValue2 != null)     expressionValue2.setEnabled(val);
    if (andLable != null) {
      andLable.setEnabled(val);
    }
  }
 else {
    setControlEnable(valueListComposite,val);
    if (val) {
      checkAddButtonStatus();
      checkEditDelButtonStatus();
    }
  }
}

Fixed version (ground truth):
protected void enableInput(boolean val){
  operator.setEnabled(val);
  if (valueVisible != 3) {
    if (expressionValue1 != null) {
      expressionValue1.setEnabled(val);
      ExpressionButtonUtil.getExpressionButton(expressionValue1).getControl().setEnabled(val);
    }
    if (expressionValue2 != null) {
      expressionValue2.setEnabled(val);
      ExpressionButtonUtil.getExpressionButton(expressionValue2).getControl().setEnabled(val);
    }
    if (andLable != null) {
      andLable.setEnabled(val);
    }
  }
 else {
    setControlEnable(valueListComposite,val);
    if (val) {
      checkAddButtonStatus();
      checkEditDelButtonStatus();
    }
  }
}
Program: 67305
Project: 67305
Buggy source:
private int create2ValueComposite(Composite condition){
  if (expressionValue1 != null && !expressionValue1.isDisposed()) {
    return 0;
  }
  if (valueListComposite != null && !valueListComposite.isDisposed()) {
    valueListComposite.dispose();
    valueListComposite=null;
  }
  GridData expgd=new GridData();
  expgd.widthHint=100;
  expressionValue1=new Combo(condition,SWT.NONE);
  expressionValue1.setLayoutData(expgd);
  expressionValue1.addModifyListener(new ModifyListener(){
    public void modifyText(    ModifyEvent e){
      updateButtons();
    }
  }
);
  expressionValue1.addListener(SWT.Verify,expValueVerifyListener);
  expressionValue1.addListener(SWT.Selection,expValueSelectionListener);
  refreshList();
  expressionValue1.setItems(popupItems);
  dummy1=createDummy(condition,3);
  andLable=new Label(condition,SWT.NONE);
  andLable.setText(Messages.getString("String_Node_Str"));
  andLable.setEnabled(false);
  dummy2=createDummy(condition,3);
  expressionValue2=new Combo(condition,SWT.NONE);
  expressionValue2.setLayoutData(expgd);
  expressionValue2.addModifyListener(new ModifyListener(){
    public void modifyText(    ModifyEvent e){
      updateButtons();
    }
  }
);
  expressionValue2.addListener(SWT.Verify,expValueVerifyListener);
  expressionValue2.addListener(SWT.Selection,expValueSelectionListener);
  expressionValue2.setItems(popupItems);
  if (operator.getItemCount() > 0 && operator.getSelectionIndex() == -1) {
    operator.select(0);
  }
  condition.getParent().layout(true,true);
  return 1;
}

Fixed version (ground truth):
private int create2ValueComposite(Composite condition){
  if (expressionValue1 != null && !expressionValue1.isDisposed()) {
    return 0;
  }
  if (valueListComposite != null && !valueListComposite.isDisposed()) {
    valueListComposite.dispose();
    valueListComposite=null;
  }
  GridData expgd=new GridData();
  expgd.widthHint=100;
  expressionValue1=createExpressionValue(condition);
  expressionValue1.setLayoutData(expgd);
  expressionValue1.add(CHOICE_SELECT_VALUE);
  dummy1=createDummy(condition,3);
  andLable=new Label(condition,SWT.NONE);
  andLable.setText(Messages.getString("String_Node_Str"));
  andLable.setEnabled(false);
  dummy2=createDummy(condition,3);
  expressionValue2=createExpressionValue(condition);
  expressionValue2.setLayoutData(expgd);
  expressionValue2.add(CHOICE_SELECT_VALUE);
  if (operator.getItemCount() > 0 && operator.getSelectionIndex() == -1) {
    operator.select(0);
  }
  condition.getParent().layout(true,true);
  return 1;
}
Program: 67306
Project: 67306
Buggy source:
public void widgetSelected(SelectionEvent e){
  String value=getValueForOperator(operator.getText());
  valueVisible=determineValueVisible(value);
  if (valueVisible == 3) {
    int ret=createValueListComposite(operator.getParent());
    if (ret != 0) {
      if (inputHandle != null) {
        valueList=new ArrayList(inputHandle.getValue1List());
      }
      tableViewer.setInput(valueList);
    }
  }
 else {
    int ret=create2ValueComposite(operator.getParent());
    if (ret != 0 && inputHandle != null) {
      expressionValue1.setText(DEUtil.resolveNull(inputHandle.getValue1()));
      expressionValue2.setText(DEUtil.resolveNull(inputHandle.getValue2()));
    }
  }
  if (valueVisible == 0) {
    expressionValue1.setVisible(false);
    expressionValue2.setVisible(false);
    andLable.setVisible(false);
  }
 else   if (valueVisible == 1) {
    expressionValue1.setVisible(true);
    expressionValue2.setVisible(false);
    andLable.setVisible(false);
  }
 else   if (valueVisible == 2) {
    expressionValue1.setVisible(true);
    expressionValue2.setVisible(true);
    andLable.setVisible(true);
    andLable.setEnabled(true);
  }
  updateButtons();
}

Fixed version (ground truth):
public void widgetSelected(SelectionEvent e){
  String value=getValueForOperator(operator.getText());
  valueVisible=determineValueVisible(value);
  if (valueVisible == 3) {
    int ret=createValueListComposite(operator.getParent());
    if (ret != 0) {
      if (inputHandle != null) {
        valueList=new ArrayList(inputHandle.getValue1List());
      }
      tableViewer.setInput(valueList);
    }
  }
 else {
    int ret=create2ValueComposite(operator.getParent());
    if (ret != 0 && inputHandle != null) {
      expressionValue1.setText(DEUtil.resolveNull(inputHandle.getValue1()));
      expressionValue2.setText(DEUtil.resolveNull(inputHandle.getValue2()));
    }
  }
  if (valueVisible == 0) {
    expressionValue1.setVisible(false);
    ExpressionButtonUtil.getExpressionButton(expressionValue1).getControl().setVisible(false);
    expressionValue2.setVisible(false);
    ExpressionButtonUtil.getExpressionButton(expressionValue2).getControl().setVisible(false);
    andLable.setVisible(false);
  }
 else   if (valueVisible == 1) {
    expressionValue1.setVisible(true);
    ExpressionButtonUtil.getExpressionButton(expressionValue1).getControl().setVisible(true);
    expressionValue2.setVisible(false);
    ExpressionButtonUtil.getExpressionButton(expressionValue2).getControl().setVisible(false);
    andLable.setVisible(false);
  }
 else   if (valueVisible == 2) {
    expressionValue1.setVisible(true);
    ExpressionButtonUtil.getExpressionButton(expressionValue1).getControl().setVisible(true);
    expressionValue2.setVisible(true);
    ExpressionButtonUtil.getExpressionButton(expressionValue2).getControl().setVisible(true);
    andLable.setVisible(true);
    andLable.setEnabled(true);
  }
  updateButtons();
}
Program: 67307
Project: 67307
Buggy source:
/** 
 * Find the inner level index from specified expression.
 * @param expr
 * @return
 */
private int findInnerLevelIndex(String expr,List<String> levelNames){
  int index=-1;
  if (ChartUtil.isEmpty(expr)) {
    return index;
  }
  ExpressionCodec exprCodec=ChartModelHelper.instance().createExpressionCodec();
  Collection<String> bindingNames=exprCodec.getBindingNames(expr);
  for (  String bindName : bindingNames) {
    int levelIndex=levelNames.indexOf(bindName);
    if (levelIndex > index) {
      index=levelIndex;
    }
  }
  return index;
}

Fixed version (ground truth):
/** 
 * Find the inner level index from specified expression.
 * @param expr
 * @param levelNames
 * @param cubeBindingMap
 * @return
 */
private int findInnerLevelIndex(String expr,List<String> levelNames,Map<String,String> cubeBindingMap){
  int index=-1;
  if (ChartUtil.isEmpty(expr)) {
    return index;
  }
  ExpressionCodec exprCodec=ChartModelHelper.instance().createExpressionCodec();
  Collection<String> bindingNames=exprCodec.getBindingNames(expr);
  for (  String bindName : bindingNames) {
    String cubeBindingExpr=cubeBindingMap.get(bindName);
    if (cubeBindingExpr == null) {
      continue;
    }
    String[] lNames=exprCodec.getLevelNames(cubeBindingExpr);
    for (int i=1; i < lNames.length; i++) {
      int levelIndex=levelNames.indexOf(lNames[i]);
      if (levelIndex > index) {
        index=levelIndex;
      }
    }
  }
  return index;
}
Program: 67309
Project: 67309
Buggy source:
/** 
 * Returns level names in edge definition.
 * @param ed
 * @return
 */
private List getLevelNames(IEdgeDefinition ed){
  List levelNames=new ArrayList();
  List<IDimensionDefinition> dimensions=ed.getDimensions();
  for (  IDimensionDefinition d : dimensions) {
    List<IHierarchyDefinition> hieDefs=d.getHierarchy();
    for (    IHierarchyDefinition hd : hieDefs) {
      List<ILevelDefinition> levels=hd.getLevels();
      for (      ILevelDefinition ld : levels) {
        levelNames.add(ld.getName());
      }
    }
  }
  return levelNames;
}

Fixed version (ground truth):
/** 
 * Returns level names in edge definition.
 * @param ed
 * @return
 */
private List<String> getLevelNames(IEdgeDefinition ed){
  List<String> levelNames=new ArrayList<String>();
  List<IDimensionDefinition> dimensions=ed.getDimensions();
  for (  IDimensionDefinition d : dimensions) {
    List<IHierarchyDefinition> hieDefs=d.getHierarchy();
    for (    IHierarchyDefinition hd : hieDefs) {
      List<ILevelDefinition> levels=hd.getLevels();
      for (      ILevelDefinition ld : levels) {
        levelNames.add(ld.getName());
      }
    }
  }
  return levelNames;
}
Program: 67311
Project: 67311
Buggy source:
private IAggregationResultSet populateResultSet(IAggregationResultSet aggregationRsFromCube,List<IEdgeDrillFilter[]> drillFilters) throws IOException, DataException {
  if (aggregationRsFromCube.getAllLevels() == null || aggregationRsFromCube.getAllLevels().length == 0)   return aggregationRsFromCube;
  DrilledAggregateResultSet rs=new DrilledAggregateResultSet(aggregationRsFromCube,drillFilters);
  return rs;
}

Fixed version (ground truth):
private IAggregationResultSet populateResultSet(IAggregationResultSet aggregationRsFromCube,List<IEdgeDrillFilter[]> drillFilters) throws IOException, DataException {
  if (aggregationRsFromCube.getAllLevels() == null || aggregationRsFromCube.getAllLevels().length == 0 || aggregationRsFromCube.length() == 0)   return aggregationRsFromCube;
  DrilledAggregateResultSet rs=new DrilledAggregateResultSet(aggregationRsFromCube,drillFilters);
  return rs;
}
Program: 67313
Project: 67313
Buggy source:
/** 
 * Clean the error message in the wizard dialog.
 */
public void removeErrors(){
  this.errorMessage=null;
  wizard.getDialog().setErrorMessage(null);
}

Fixed version (ground truth):
/** 
 * Clean the error message in the wizard dialog.
 */
public void removeErrors(){
  this.errorMessage=null;
  if (!wizard.isDisposed()) {
    wizard.getDialog().setErrorMessage(null);
  }
}
Program: 67314
Project: 67314
Buggy source:
public void dispose(){
  Iterator<ITask> tasks=availableTasks.values().iterator();
  while (tasks.hasNext()) {
    tasks.next().dispose();
  }
}

Fixed version (ground truth):
public void dispose(){
  isDisposed=true;
  Iterator<ITask> tasks=availableTasks.values().iterator();
  while (tasks.hasNext()) {
    tasks.next().dispose();
  }
}
Program: 67316
Project: 67316
Buggy source:
private void initOptions(){
  ConfigurableOption wrappingText=initializeWrappingText();
  ConfigurableOption chartDpi=new ConfigurableOption(CHART_DPI);
  chartDpi.setDisplayName(getMessage("String_Node_Str"));
  chartDpi.setDataType(IConfigurableOption.DataType.INTEGER);
  chartDpi.setDisplayType(IConfigurableOption.DisplayType.TEXT);
  chartDpi.setDefaultValue(new Integer(192));
  chartDpi.setToolTip("String_Node_Str");
  chartDpi.setDescription(getMessage("String_Node_Str"));
  ConfigurableOption hideGridlines=new ConfigurableOption(HIDE_GRIDLINES);
  hideGridlines.setDisplayName(getMessage("String_Node_Str"));
  hideGridlines.setDataType(IConfigurableOption.DataType.BOOLEAN);
  hideGridlines.setDisplayType(IConfigurableOption.DisplayType.CHECKBOX);
  hideGridlines.setDefaultValue(Boolean.FALSE);
  hideGridlines.setToolTip(null);
  hideGridlines.setDescription(getMessage("String_Node_Str"));
  options=new IConfigurableOption[]{wrappingText,chartDpi};
}

Fixed version (ground truth):
private void initOptions(){
  ConfigurableOption wrappingText=initializeWrappingText();
  ConfigurableOption chartDpi=new ConfigurableOption(CHART_DPI);
  chartDpi.setDisplayName(getMessage("String_Node_Str"));
  chartDpi.setDataType(IConfigurableOption.DataType.INTEGER);
  chartDpi.setDisplayType(IConfigurableOption.DisplayType.TEXT);
  chartDpi.setDefaultValue(new Integer(192));
  chartDpi.setToolTip(getMessage("String_Node_Str"));
  chartDpi.setDescription(getMessage("String_Node_Str"));
  ConfigurableOption hideGridlines=new ConfigurableOption(HIDE_GRIDLINES);
  hideGridlines.setDisplayName(getMessage("String_Node_Str"));
  hideGridlines.setDataType(IConfigurableOption.DataType.BOOLEAN);
  hideGridlines.setDisplayType(IConfigurableOption.DisplayType.CHECKBOX);
  hideGridlines.setDefaultValue(Boolean.FALSE);
  hideGridlines.setToolTip(null);
  hideGridlines.setDescription(getMessage("String_Node_Str"));
  options=new IConfigurableOption[]{wrappingText,chartDpi};
}
Program: 67317
Project: 67317
Buggy source:
public boolean performFinish(){
  if (!canFinish())   return false;
  if (useTransaction) {
    Utility.getCommandStack().startTrans(CREATE_DATA_SET_TRANS_NAME);
  }
  dataSetHandle=dataSetPage.createSelectedDataSet();
  if (dataSetHandle != null) {
    if (dataSetHandle instanceof ScriptDataSetHandle) {
      columnDefPage.saveResult(dataSetHandle);
    }
    if (useTransaction) {
      Utility.getCommandStack().commit();
    }
    try {
      createSelectedDataSetTearDown(dataSetHandle);
      DataSetUIUtil.updateColumnCache(dataSetHandle,false);
    }
 catch (    Exception e) {
      if (e instanceof SWTException) {
        SWTException swtException=(SWTException)e;
        if (swtException.code == SWT.ERROR_WIDGET_DISPOSED)         Utility.log(e);
      }
      ExceptionHandler.handle(e);
    }
  }
 else {
    if (useTransaction) {
      Utility.getCommandStack().rollback();
    }
    return false;
  }
  return true;
}

Fixed version (ground truth):
public boolean performFinish(){
  if (!canFinish())   return false;
  if (useTransaction) {
    Utility.getCommandStack().startTrans(CREATE_DATA_SET_TRANS_NAME);
  }
  dataSetHandle=dataSetPage.createSelectedDataSet();
  if (dataSetHandle != null) {
    if (dataSetHandle instanceof ScriptDataSetHandle) {
      columnDefPage.saveResult(dataSetHandle);
    }
    if (useTransaction) {
      Utility.getCommandStack().commit();
    }
    try {
      createSelectedDataSetTearDown(dataSetHandle);
      DataSetUIUtil.updateColumnCache(dataSetHandle,false);
    }
 catch (    Exception e) {
      if (e instanceof SWTException) {
        SWTException swtException=(SWTException)e;
        if (swtException.code == SWT.ERROR_WIDGET_DISPOSED)         Utility.log(e);
      }
      Throwable cause=e.getCause();
      if (cause != null && (cause instanceof org.eclipse.birt.data.engine.core.DataException)) {
        Logger logger=Logger.getLogger(DefaultDataSetWizard.class.getName());
        logger.log(Level.WARNING,e.getLocalizedMessage(),e);
      }
 else {
        ExceptionHandler.handle(e);
      }
    }
  }
 else {
    if (useTransaction) {
      Utility.getCommandStack().rollback();
    }
    return false;
  }
  return true;
}
Program: 67318
Project: 67318
Buggy source:
/** 
 * handle style image
 * @param uri uri in style image
 * @param isBackground Is this image a used for a background?
 * @return
 */
public String handleStyleImage(String uri,boolean isBackground){
  ReportDesignHandle design=(ReportDesignHandle)runnable.getDesignHandle();
  URL url=design.findResource(uri,IResourceLocator.IMAGE,reportContext.getAppContext());
  if (url == null) {
    return uri;
  }
  uri=url.toExternalForm();
  Image image=null;
  if (isBackground && SvgFile.isSvg(uri)) {
    try {
      byte[] buffer=SvgFile.transSvgToArray(uri);
      image=new Image(buffer,uri,"String_Node_Str");
    }
 catch (    IOException e) {
      image=new Image(uri);
    }
  }
 else {
    image=new Image(uri);
  }
  image.setReportRunnable(runnable);
  image.setRenderOption(renderOption);
  String imgUri=null;
  if (imageHandler != null) {
switch (image.getSource()) {
case IImage.URL_IMAGE:
      imgUri=imageHandler.onURLImage(image,reportContext);
    break;
case IImage.FILE_IMAGE:
  imgUri=imageHandler.onFileImage(image,reportContext);
break;
case IImage.CUSTOM_IMAGE:
imgUri=imageHandler.onCustomImage(image,reportContext);
break;
case IImage.INVALID_IMAGE:
break;
default :
assert(false);
}
}
return imgUri;
}

Fixed version (ground truth):
/** 
 * handle style image
 * @param uri uri in style image
 * @param isBackground Is this image a used for a background?
 * @return
 */
public String handleStyleImage(String uri,boolean isBackground){
  ReportDesignHandle design=(ReportDesignHandle)runnable.getDesignHandle();
  URL url=design.findResource(uri,IResourceLocator.IMAGE,reportContext.getAppContext());
  if (url == null) {
    return uri;
  }
  uri=url.toExternalForm();
  Image image=null;
  if (isBackground) {
    try {
      byte[] buffer=SvgFile.transSvgToArray(uri);
      image=new Image(buffer,uri,"String_Node_Str");
    }
 catch (    Exception e) {
      image=new Image(uri);
    }
  }
 else {
    image=new Image(uri);
  }
  image.setReportRunnable(runnable);
  image.setRenderOption(renderOption);
  String imgUri=null;
  if (imageHandler != null) {
switch (image.getSource()) {
case IImage.URL_IMAGE:
      imgUri=imageHandler.onURLImage(image,reportContext);
    break;
case IImage.FILE_IMAGE:
  imgUri=imageHandler.onFileImage(image,reportContext);
break;
case IImage.CUSTOM_IMAGE:
imgUri=imageHandler.onCustomImage(image,reportContext);
break;
case IImage.INVALID_IMAGE:
break;
default :
assert(false);
}
}
return imgUri;
}
Program: 67320
Project: 67320
Buggy source:
public static byte[] getImageData(String imageURI) throws IOException {
  byte[] imageData=null;
  if (SvgFile.isSvg(imageURI)) {
    imageData=SvgFile.transSvgToArray(imageURI);
  }
 else {
    imageData=getNonSVGImageData(imageURI);
  }
  return imageData;
}

Fixed version (ground truth):
public static byte[] getImageData(String imageURI) throws IOException {
  byte[] imageData=null;
  if (SvgFile.isSvg(imageURI)) {
    try {
      imageData=SvgFile.transSvgToArray(imageURI);
    }
 catch (    Exception e) {
      logger.log(Level.WARNING,e.getMessage());
    }
  }
 else {
    imageData=getNonSVGImageData(imageURI);
  }
  return imageData;
}