nus-yam/ex-repair huggingface dataset:
Program: 78233
Project: 78233
Buggy source:
/** 
 * Returns all available column bindings for the given element.
 * @param handle the handle of the element
 * @param includeSelf true if includes the element itself, or false only includes bindings in the containers
 * @return the list of all column bindings available.The list order is fromthe top to the given element
 */
public static List getAllColumnBindingList(DesignElementHandle handle,boolean includeSelf){
  List bindingList=new ArrayList();
  if (handle instanceof ReportElementHandle) {
    Iterator iterator=getBindingColumnIterator(handle);
    while (iterator.hasNext()) {
      bindingList.add(iterator.next());
    }
    bindingList.addAll(0,getAllColumnBindingList(handle.getContainer(),true));
  }
  return bindingList;
}

Fixed version (ground truth):
/** 
 * Returns all available column bindings for the given element.
 * @param handle the handle of the element
 * @param includeSelf true if includes the element itself, or false only includes bindings in the containers
 * @return the list of all column bindings available.The list order is fromthe top to the given element
 */
public static List getAllColumnBindingList(DesignElementHandle handle,boolean includeSelf){
  List bindingList=new ArrayList();
  if (handle instanceof ReportElementHandle) {
    Iterator iterator=getBindingColumnIterator(handle);
    while (iterator.hasNext()) {
      bindingList.add(iterator.next());
    }
    if (handle instanceof ListingHandle) {
      SlotHandle groupSlotHandle=((ListingHandle)handle).getGroups();
      for (Iterator iter=groupSlotHandle.iterator(); iter.hasNext(); ) {
        GroupHandle group=(GroupHandle)iter.next();
        for (Iterator columnIter=group.columnBindingsIterator(); columnIter.hasNext(); ) {
          bindingList.add(columnIter.next());
        }
      }
    }
    bindingList.addAll(0,getAllColumnBindingList(handle.getContainer(),true));
  }
  return bindingList;
}
Program: 78234
Project: 78234
Buggy source:
public AbstractParseState startElement(String tagName){
  if (DesignSchemaConstants.STRUCTURE_TAG.equalsIgnoreCase(tagName))   return new ActionStructureState(ActionParserHandler.this,element);
  return super.startElement(tagName);
}

Fixed version (ground truth):
public AbstractParseState startElement(String tagName){
  if (DesignSchemaConstants.REPORT_TAG.equalsIgnoreCase(tagName) || DesignSchemaConstants.LIBRARY_TAG.equalsIgnoreCase(tagName))   return new VersionState();
  return super.startElement(tagName);
}
Program: 78235
Project: 78235
Buggy source:
public void elementChanged(DesignElementHandle focus,NotificationEvent ev){
switch (ev.getEventType()) {
case NotificationEvent.CONTENT_EVENT:
case NotificationEvent.STYLE_EVENT:
{
      refresh();
      break;
    }
case NotificationEvent.PROPERTY_EVENT:
case NotificationEvent.THEME_EVENT:
case NotificationEvent.TEMPLATE_TRANSFORM_EVENT:
{
    refresh();
    this.markDirty(true);
    break;
  }
}
}

Fixed version (ground truth):
public void elementChanged(DesignElementHandle focus,NotificationEvent ev){
switch (ev.getEventType()) {
case NotificationEvent.CONTENT_EVENT:
case NotificationEvent.STYLE_EVENT:
{
      refresh();
      break;
    }
case NotificationEvent.PROPERTY_EVENT:
case NotificationEvent.THEME_EVENT:
case NotificationEvent.TEMPLATE_TRANSFORM_EVENT:
{
    refresh();
    this.markDirty(true);
    break;
  }
case NotificationEvent.LIBRARY_EVENT:
{
  reloadTheChildren();
}
}
}
Program: 78236
Project: 78236
Buggy source:
/** 
 * Convert string to date with check. JDK may do incorrect converse, for example: 2005/1/1 Local.US, format pattern is MM/dd/YY. Above conversion can be done without error, but obviously the result is not right. This method will do such a simple check, in DateFormat.SHORT case instead of all cases. Year is not lower than 0. Month is from 1 to 12. Day is from 1 to 31.  
 * @param source
 * @param locale
 * @return Date
 * @throws BirtException
 */
public static Date toDateWithCheck(String source,ULocale locale) throws BirtException {
  DateFormat dateFormat=DateFormat.getDateInstance(DateFormat.SHORT,locale);
  Date resultDate=null;
  try {
    resultDate=dateFormat.parse(source);
  }
 catch (  ParseException e) {
    return toDate(source,locale);
  }
  if (DateUtil.checkValid(dateFormat,source) == false) {
    throw new BirtException(pluginId,ResourceConstants.CONVERT_FAILS,new Object[]{source.toString(),"String_Node_Str"},resourceBundle);
  }
  return resultDate;
}

Fixed version (ground truth):
/** 
 * Convert string to date with check. JDK may do incorrect converse, for example: 2005/1/1 Local.US, format pattern is MM/dd/YY. Above conversion can be done without error, but obviously the result is not right. This method will do such a simple check, in DateFormat.SHORT case instead of all cases. Year is not lower than 0. Month is from 1 to 12. Day is from 1 to 31.  
 * @param source
 * @param locale
 * @return Date
 * @throws BirtException
 */
public static Date toDateWithCheck(String source,ULocale locale) throws BirtException {
  DateFormat dateFormat=DateFormatHolder.getDateInstance(DateFormat.SHORT,locale);
  Date resultDate=null;
  try {
    resultDate=dateFormat.parse(source);
  }
 catch (  ParseException e) {
    return toDate(source,locale);
  }
  if (DateUtil.checkValid(dateFormat,source) == false) {
    throw new BirtException(pluginId,ResourceConstants.CONVERT_FAILS,new Object[]{source.toString(),"String_Node_Str"},resourceBundle);
  }
  return resultDate;
}
Program: 78237
Project: 78237
Buggy source:
/** 
 * Resolves extends references for elements in the <code>module</code>. During the resolving procedure, cached overridden values are also distributed.
 */
protected void resolveAllElementDescendants(){
  if (module instanceof ReportDesign)   resolveElementDescendantsInSlot(ReportDesign.BODY_SLOT);
  resolveElementDescendantsInSlot(Module.COMPONENT_SLOT);
  resolveElementDescendantsInSlot(Module.DATA_SOURCE_SLOT);
  resolveElementDescendantsInSlot(Module.DATA_SET_SLOT);
  resolveElementDescendantsInSlot(Module.PARAMETER_SLOT);
}

Fixed version (ground truth):
/** 
 * Resolves extends references for elements in the <code>module</code>. During the resolving procedure, cached overridden values are also distributed.
 */
protected void resolveAllElementDescendants(){
  for (int i=0; i < module.getDefn().getSlotCount(); i++) {
    int slotId=i;
    if (slotId == ReportDesign.STYLE_SLOT || slotId == Library.THEMES_SLOT || slotId == ReportDesign.TEMPLATE_PARAMETER_DEFINITION_SLOT)     continue;
    resolveElementDescendantsInSlot(slotId);
  }
}
Program: 78238
Project: 78238
Buggy source:
public void end() throws SAXException {
  if (element.getContainer() instanceof GroupElement) {
    element=element.getContainer();
    super.end();
  }
}

Fixed version (ground truth):
public void end() throws SAXException {
  if (element instanceof TableRow)   if (element.getContainer() instanceof GroupElement)   element=element.getContainer();
  String value=text.toString();
  if (value.equalsIgnoreCase("String_Node_Str") || value.equalsIgnoreCase("String_Node_Str"))   value=DesignChoiceConstants.PAGE_BREAK_AFTER_ALWAYS;
  doEnd(value);
}
Program: 78240
Project: 78240
Buggy source:
protected void performPostTasks(Stack transStack){
  if (!isOutermostFilterTrans())   return;
  List tasks=ModelUtil.filterLayoutTasks(getPostTasks());
  for (int i=0; i < tasks.size(); i++) {
    RecordTask subTask=(RecordTask)tasks.get(i);
    subTask.doTask(this,transStack);
  }
  super.performPostTasks(transStack);
}

Fixed version (ground truth):
protected void performPostTasks(Stack transStack){
  if (!isOutermostFilterTrans())   return;
  List tasks=ModelUtil.filterLayoutTasks(getPostTasks());
  for (int i=0; i < tasks.size(); i++) {
    RecordTask subTask=(RecordTask)tasks.get(i);
    subTask.doTask(this,transStack);
  }
}
Program: 78242
Project: 78242
Buggy source:
/** 
 * Recursively collect all the descendents of the given element.
 * @param element a given element.
 * @param results the result list containing all the childs.
 */
private void getAllDescdents(DesignElement element,List results){
  List descends=element.getDerived();
  results.addAll(descends);
  for (int i=0; i < descends.size(); i++) {
    getAllDescdents((DesignElement)descends.get(i),results);
  }
}

Fixed version (ground truth):
/** 
 * Recursively collect all the descendents of the given element.
 * @param tmpElement a given element.
 * @param results the result list containing all the childs.
 */
private void getAllDescdents(DesignElement tmpElement,List results){
  List descends=tmpElement.getDerived();
  results.addAll(descends);
  for (int i=0; i < descends.size(); i++) {
    getAllDescdents((DesignElement)descends.get(i),results);
  }
}
Program: 78243
Project: 78243
Buggy source:
/** 
 * Scatters overridden values to virtual elements in the given design element.
 * @param element the design element
 * @param overriddenValues a map containing overridden values of virtual element. The key is the base id of virtual element. The value is a list containing property name/value pair.
 */
public static void distributeValues(DesignElement element,Map overriddenValues){
  ContentIterator contentIterator=new ContentIterator(element);
  while (contentIterator.hasNext()) {
    DesignElement content=(DesignElement)contentIterator.next();
    Long baseId=new Long(content.getID());
    List values=(List)overriddenValues.get(baseId);
    if (values == null || values.isEmpty())     continue;
    for (int i=0; i < values.size(); i++) {
      Property prop=(Property)values.get(i);
      if (StyledElement.STYLE_PROP.equals(prop.getName()))       ((StyledElement)content).setStyleName((String)prop.getValue());
 else       content.setProperty(prop.getName(),prop.getValue());
    }
  }
}

Fixed version (ground truth):
/** 
 * Scatters overridden values to virtual elements in the given design element.
 * @param element the design element
 * @param overriddenValues a map containing overridden values of virtual element. The key is the base id of virtual element. The value is a list containing property name/value pair.
 */
public static void distributeValues(DesignElement element,Map overriddenValues){
  if (element == null)   return;
  ContentIterator contentIterator=new ContentIterator(element);
  while (contentIterator.hasNext()) {
    DesignElement content=(DesignElement)contentIterator.next();
    Long baseId=new Long(content.getID());
    if (overriddenValues == null || overriddenValues.isEmpty())     continue;
    List values=(List)overriddenValues.get(baseId);
    if (values == null || values.isEmpty())     continue;
    for (int i=0; i < values.size(); i++) {
      Property prop=(Property)values.get(i);
      if (StyledElement.STYLE_PROP.equals(prop.getName()))       ((StyledElement)content).setStyleName((String)prop.getValue());
 else       content.setProperty(prop.getName(),prop.getValue());
    }
  }
}
Program: 78244
Project: 78244
Buggy source:
protected List getModelChildren(){
  return HandleAdapterFactory.getInstance().getReportDesignHandleAdapter().getChildren();
}

Fixed version (ground truth):
protected List getModelChildren(){
  return HandleAdapterFactory.getInstance().getReportDesignHandleAdapter(getModel()).getChildren();
}
Program: 78245
Project: 78245
Buggy source:
/** 
 * @param inputStream
 * @return
 * @throws IOException
 */
private static int getSeperator(InputStream inputStream) throws IOException {
  byte[] bytes=new byte[4];
  int len=inputStream.read(bytes);
  if (len == -1)   return RDSave.endSeparator;
 else   if (len < 4)   throw new IOException("String_Node_Str");
  return IOUtil.getInt(bytes);
}

Fixed version (ground truth):
/** 
 * @param inputStream
 * @return
 * @throws IOException
 */
private static int getSeperator(InputStream inputStream) throws IOException {
  byte[] bytes=new byte[4];
  int len=inputStream.read(bytes);
  if (len == -1)   return RDSave.endSeparator;
 else   if (len < 4) {
    for (int i=len; i < 4; i++) {
      bytes[i]=(byte)inputStream.read();
      if (bytes[i] == -1)       throw new IOException("String_Node_Str");
    }
  }
  return IOUtil.getInt(bytes);
}
Program: 78246
Project: 78246
Buggy source:
public Template(String reportPath) throws DesignFileException {
  ReportDesignHandle reportDesign=(ReportDesignHandle)files.get(reportPath);
  if (reportDesign == null) {
    reportDesign=SessionHandleAdapter.getInstance().getSessionHandle().openDesign(reportPath);
    files.put(reportPath,reportDesign);
  }
  name=reportDesign.getDisplayName() == null ? UIUtil.getSimpleFileName(reportDesign.getFileName()) : reportDesign.getDisplayName();
  templateDescription=reportDesign.getStringProperty(ModuleHandle.DESCRIPTION_PROP);
  if (templateDescription == null) {
    templateDescription="String_Node_Str";
  }
  picturePath=reportDesign.getIconFile() == null ? "String_Node_Str" : reportDesign.getIconFile();
  cheatSheetId=reportDesign.getCheetSheet() == null ? "String_Node_Str" : reportDesign.getCheetSheet();
  this.reportPath=reportPath;
}

Fixed version (ground truth):
public Template(String reportPath) throws DesignFileException {
  ReportDesignHandle reportDesign=(ReportDesignHandle)files.get(reportPath);
  if (reportDesign == null) {
    reportDesign=SessionHandleAdapter.getInstance().getSessionHandle().openDesign(reportPath);
    files.put(reportPath,reportDesign);
  }
  name=reportDesign.getDisplayName() == null ? UIUtil.getSimpleFileName(reportDesign.getFileName()) : reportDesign.getDisplayName();
  templateDescription=reportDesign.getStringProperty(ModuleHandle.DESCRIPTION_PROP);
  if (templateDescription == null) {
    templateDescription="String_Node_Str";
  }
  picturePath=reportDesign.getIconFile() == null ? "String_Node_Str" : reportDesign.getIconFile();
  cheatSheetId=reportDesign.getCheatSheet() == null ? "String_Node_Str" : reportDesign.getCheatSheet();
  this.reportPath=reportPath;
}
Program: 78247
Project: 78247
Buggy source:
public static int toDteDataType(String modelDataType){
}

Fixed version (ground truth):
public static int toDteDataType(String modelDataType){
  if (modelDataType == null)   return DataType.UNKNOWN_TYPE;
  if (modelDataType.equals(DesignChoiceConstants.COLUMN_DATA_TYPE_ANY))   return DataType.ANY_TYPE;
  if (modelDataType.equals(DesignChoiceConstants.COLUMN_DATA_TYPE_INTEGER))   return DataType.INTEGER_TYPE;
  if (modelDataType.equals(DesignChoiceConstants.COLUMN_DATA_TYPE_STRING))   return DataType.STRING_TYPE;
  if (modelDataType.equals(DesignChoiceConstants.COLUMN_DATA_TYPE_DATETIME))   return DataType.DATE_TYPE;
  if (modelDataType.equals(DesignChoiceConstants.COLUMN_DATA_TYPE_DECIMAL))   return DataType.DECIMAL_TYPE;
  if (modelDataType.equals(DesignChoiceConstants.COLUMN_DATA_TYPE_FLOAT))   return DataType.DOUBLE_TYPE;
  return DataType.UNKNOWN_TYPE;
}
Program: 78248
Project: 78248
Buggy source:
/** 
 * Returns the defined width in model in Pixel.
 * @return
 */
public String getDefinedWidth(){
  DimensionHandle handle=((ReportItemHandle)getHandle()).getWidth();
  if (handle.getUnits() == null || handle.getUnits().length() == 0) {
    return null;
  }
 else   if (DesignChoiceConstants.UNITS_PERCENTAGE.equals(handle.getUnits())) {
    return handle.getMeasure() + DesignChoiceConstants.UNITS_PERCENTAGE;
  }
 else {
    int px=(int)DEUtil.convertoToPixel(handle);
    if (px <= 0) {
      return null;
    }
    return String.valueOf(px);
  }
}

Fixed version (ground truth):
/** 
 * Returns the defined width in model in Pixel.
 * @return
 */
public String getDefinedWidth(){
  DimensionHandle handle=((ReportItemHandle)getHandle()).getWidth();
  if (handle.getUnits() == null || handle.getUnits().length() == 0) {
    return DEFAULT_WIDTH;
  }
 else   if (DesignChoiceConstants.UNITS_PERCENTAGE.equals(handle.getUnits())) {
    return handle.getMeasure() + DesignChoiceConstants.UNITS_PERCENTAGE;
  }
 else {
    int px=(int)DEUtil.convertoToPixel(handle);
    if (px <= 0) {
      return null;
    }
    return String.valueOf(px);
  }
}
Program: 78249
Project: 78249
Buggy source:
public AbstractParseState jumpTo(){
  if ((StringUtil.compareVersion(handler.getVersion(),"String_Node_Str") < 0) && Action.URI_MEMBER.equalsIgnoreCase(name)) {
    CompatibleURIState state=new CompatibleURIState(handler,element);
    state.setName(name);
    state.struct=struct;
    state.propDefn=propDefn;
    return state;
  }
  return null;
}

Fixed version (ground truth):
public AbstractParseState jumpTo(){
  if ((StringUtil.compareVersion(handler.getVersion(),"String_Node_Str") < 0) && (Action.URI_MEMBER.equalsIgnoreCase(name) || Action.TARGET_BOOKMARK_MEMBER.equalsIgnoreCase(name))) {
    CompatibleURIState state=new CompatibleURIState(handler,element);
    state.setName(name);
    state.struct=struct;
    state.propDefn=propDefn;
    return state;
  }
  return null;
}
Program: 78250
Project: 78250
Buggy source:
/** 
 * Constructs the design parse state with the design file parser handler. This constructor is used when this list property to parse is a property of one element.
 * @param theHandler the design file parser handler
 * @param element the element which holds this property
 */
CompatibleBoundColumnState(ModuleParserHandler theHandler,DesignElement element){
}

Fixed version (ground truth):
/** 
 * Constructs the design parse state with the design file parser handler. This constructor is used when this list property to parse is a property of one element.
 * @param theHandler the design file parser handler
 * @param element the element which holds this property
 */
CompatibleBoundColumnState(ModuleParserHandler theHandler,DesignElement element){
  super(theHandler,element);
}
Program: 78251
Project: 78251
Buggy source:
protected int invokeDataBinding(){
  BindingColumnDialog page=new BindingColumnDialog(false);
  page.setInput(itemHandle);
  return page.open();
}

Fixed version (ground truth):
protected int invokeDataBinding(){
  ColumnBindingDialog page=new ColumnBindingDialog(false);
  page.setInput(itemHandle);
  return page.open();
}
Program: 78252
Project: 78252
Buggy source:
/** 
 * Evaluate non-compiled expression
 * @param dataExpr
 * @param scope
 * @return value of dataExpr
 * @throws BirtException
 */
public static Object evaluateRawExpression(IBaseExpression dataExpr,Scriptable scope) throws BirtException {
}

Fixed version (ground truth):
/** 
 * Evaluate non-compiled expression
 * @param dataExpr
 * @param scope
 * @return the value of raw data type, Java or Java Script
 * @throws BirtException
 */
public static Object evaluateRawExpression(IBaseExpression dataExpr,Scriptable scope) throws BirtException {
  return doEvaluateRawExpression(dataExpr,scope,false);
}
Program: 78253
Project: 78253
Buggy source:
public Object evaluate(IBaseExpression expr) throws BirtException {
  return ExprEvaluateUtil.evaluateRawExpression(expr,scope);
}

Fixed version (ground truth):
public Object evaluate(IBaseExpression expr) throws BirtException {
  return ExprEvaluateUtil.evaluateRawExpression2(expr,scope);
}
Program: 78254
Project: 78254
Buggy source:
/** 
 * Does backward compatiblility work for the extended item from BIRT 2.1M5 to BIRT 2.1.0.
 * @param jsExprs the expression from the extended item.
 * @return a map containing updated expressions.
 */
private Map handleJavaExpression(List jsExprs){
  List columns=new ArrayList();
  Map retMap=new HashMap();
  for (int i=0; i < jsExprs.size(); i++) {
    String jsExpr=(String)jsExprs.get(i);
    IColumnBinding boundColumn=ExpressionUtil.getColumnBinding(jsExpr);
    if (boundColumn == null)     continue;
    if (!columns.contains(boundColumn))     columns.add(boundColumn);
    retMap.put(jsExpr,ExpressionUtil.createRowExpression(boundColumn.getResultSetColumnName()));
  }
  DataBoundColumnUtil.setupBoundDataColumns(element,columns,handler.getModule());
  return retMap;
}

Fixed version (ground truth):
/** 
 * Does backward compatiblility work for the extended item from BIRT 2.1M5 to BIRT 2.1.0.
 * @param jsExprs the expression from the extended item.
 * @return a map containing updated expressions.
 */
private Map handleJavaExpression(List jsExprs){
  List columns=new ArrayList();
  Map retMap=new HashMap();
  List boundColumns=(List)element.getLocalProperty(handler.getModule(),ReportItem.BOUND_DATA_COLUMNS_PROP);
  for (int i=0; i < jsExprs.size(); i++) {
    String jsExpr=(String)jsExprs.get(i);
    IColumnBinding boundColumn=ExpressionUtil.getColumnBinding(jsExpr);
    if (boundColumn == null)     continue;
    String columnName=DataBoundColumnUtil.getColumnName(boundColumns,boundColumn.getBoundExpression());
    if (!columns.contains(boundColumn) && columnName == null)     columns.add(boundColumn);
    if (columnName == null)     columnName=boundColumn.getResultSetColumnName();
    retMap.put(jsExpr,ExpressionUtil.createRowExpression(columnName));
  }
  DataBoundColumnUtil.setupBoundDataColumns(element,columns,handler.getModule());
  return retMap;
}
Program: 78255
Project: 78255
Buggy source:
private Object getResultSetColumn(String name){
  if (models == null)   return null;
  for (int i=0; i < models.length; i++) {
    DataSetItemModel model=models[i];
    if (model.getDisplayName().equals(name))     return model;
  }
  return null;
}

Fixed version (ground truth):
private Object getResultSetColumn(String name){
  if (columnList.isEmpty()) {
    return null;
  }
  for (int i=0; i < columnList.size(); i++) {
    ComputedColumnHandle column=(ComputedColumnHandle)columnList.get(i);
    if (column.getName().equals(name)) {
      return column;
    }
  }
  return null;
}
Program: 78256
Project: 78256
Buggy source:
/** 
 * Gets all columns in a dataSet.
 * @param handle ReportItem object
 * @return Columns array.
 */
private String[] getDataSetColumns(ReportItemHandle handle){
  DataSetHandle dataSet=handle.getDataSet();
  if (dataSet == null)   return EMPTY;
  models=DataSetManager.getCurrentInstance().getColumns(dataSet,false);
  if (models == null)   return EMPTY;
  String[] values=new String[models.length];
  for (int i=0; i < models.length; i++) {
    values[i]=models[i].getDisplayName();
  }
  return values;
}

Fixed version (ground truth):
/** 
 * Gets all columns in a dataSet.
 * @param handle ReportItem object
 * @return Columns array.
 */
private String[] getDataSetColumns(DesignElementHandle handle){
  columnList=DEUtil.getVisiableColumnBindingsList(handle);
  if (columnList.isEmpty()) {
    return EMPTY;
  }
  String[] values=new String[columnList.size()];
  for (int i=0; i < columnList.size(); i++) {
    values[i]=((ComputedColumnHandle)columnList.get(i)).getName();
  }
  return values;
}
Program: 78257
Project: 78257
Buggy source:
/** 
 * Gets the choice set of one property
 * @param item ReportItem object
 * @param key Property key
 * @return Choice set
 */
public String[] getChoiceSet(Object item,String key){
  if (key.equals(FilterCondition.OPERATOR_MEMBER)) {
    choiceSet=ChoiceSetFactory.getStructChoiceSet(FilterCondition.FILTER_COND_STRUCT,key);
    return ChoiceSetFactory.getDisplayNamefromChoiceSet(choiceSet);
  }
  if (item instanceof GroupHandle) {
    item=((GroupHandle)item).getContainer();
  }
  if (!(item instanceof ReportItemHandle))   return EMPTY;
  return getDataSetColumns((ReportItemHandle)item);
}

Fixed version (ground truth):
/** 
 * Gets the choice set of one property
 * @param item ReportItem object
 * @param key Property key
 * @return Choice set
 */
public String[] getChoiceSet(Object item,String key){
  if (key.equals(FilterCondition.OPERATOR_MEMBER)) {
    choiceSet=ChoiceSetFactory.getStructChoiceSet(FilterCondition.FILTER_COND_STRUCT,key);
    return ChoiceSetFactory.getDisplayNamefromChoiceSet(choiceSet);
  }
  if (!(item instanceof DesignElementHandle)) {
    return EMPTY;
  }
  return getDataSetColumns((DesignElementHandle)item);
}
Program: 78258
Project: 78258
Buggy source:
private Object getResultSetColumn(String name){
  if (models == null)   return null;
  for (int i=0; i < models.length; i++) {
    DataSetItemModel model=models[i];
    if (model.getDisplayName().equals(name))     return model;
  }
  return null;
}

Fixed version (ground truth):
private Object getResultSetColumn(String name){
  if (columnList.isEmpty()) {
    return null;
  }
  for (int i=0; i < columnList.size(); i++) {
    ComputedColumnHandle column=(ComputedColumnHandle)columnList.get(i);
    if (column.getName().equals(name)) {
      return column;
    }
  }
  return null;
}
Program: 78259
Project: 78259
Buggy source:
/** 
 * Gets all columns in a dataSet.
 * @param item ReportItem object
 * @return Columns array.
 */
private String[] getDataSetColumns(ReportItemHandle handle){
  DataSetHandle dataSet=handle.getDataSet();
  if (dataSet == null)   return EMPTY;
  models=DataSetManager.getCurrentInstance().getColumns(dataSet,false);
  if (models == null)   return EMPTY;
  String[] values=new String[models.length];
  for (int i=0; i < models.length; i++) {
    values[i]=models[i].getDisplayName();
  }
  return values;
}

Fixed version (ground truth):
/** 
 * Gets all columns in a dataSet.
 * @param item ReportItem object
 * @return Columns array.
 */
private String[] getDataSetColumns(DesignElementHandle handle){
  columnList=DEUtil.getVisiableColumnBindingsList(handle);
  if (columnList.isEmpty()) {
    return EMPTY;
  }
  String[] values=new String[columnList.size()];
  for (int i=0; i < columnList.size(); i++) {
    values[i]=((ComputedColumnHandle)columnList.get(i)).getName();
  }
  return values;
}
Program: 78260
Project: 78260
Buggy source:
/** 
 * Gets the choice set of one property
 * @param item ReportItem object
 * @param key Property key
 * @return Choice set
 */
public String[] getChoiceSet(Object item,String key){
  if (key.equals(SortKey.DIRECTION_MEMBER)) {
    choiceSet=ChoiceSetFactory.getStructChoiceSet(SortKey.SORT_STRUCT,key);
    return ChoiceSetFactory.getDisplayNamefromChoiceSet(choiceSet);
  }
  if (item instanceof GroupHandle) {
    item=((GroupHandle)item).getContainer();
  }
  if (!(item instanceof ReportItemHandle)) {
    return EMPTY;
  }
  return getDataSetColumns((ReportItemHandle)item);
}

Fixed version (ground truth):
/** 
 * Gets the choice set of one property
 * @param item ReportItem object
 * @param key Property key
 * @return Choice set
 */
public String[] getChoiceSet(Object item,String key){
  if (key.equals(SortKey.DIRECTION_MEMBER)) {
    choiceSet=ChoiceSetFactory.getStructChoiceSet(SortKey.SORT_STRUCT,key);
    return ChoiceSetFactory.getDisplayNamefromChoiceSet(choiceSet);
  }
  if (!(item instanceof DesignElementHandle)) {
    return EMPTY;
  }
  return getDataSetColumns((DesignElementHandle)item);
}
Program: 78261
Project: 78261
Buggy source:
protected static TableHandle performInsertDataSet(DataSetHandle model) throws SemanticException {
  CachedMetaDataHandle cachedMetadata=DataSetUIUtil.getCachedMetaDataHandle(model);
  List columList=new ArrayList();
  for (Iterator iter=cachedMetadata.getResultSet().iterator(); iter.hasNext(); ) {
    ResultSetColumnHandle element=(ResultSetColumnHandle)iter.next();
    columList.add(element);
  }
  ResultSetColumnHandle[] columns=(ResultSetColumnHandle[])columList.toArray(new ResultSetColumnHandle[columList.size()]);
  TableHandle tableHandle=DesignElementFactory.getInstance().newTableItem(null,columns.length);
  setInitWidth(tableHandle);
  insertToCell(tableHandle,tableHandle.getHeader(),columns,true);
  insertToCell(tableHandle,tableHandle.getDetail(),columns,false);
  tableHandle.setDataSet(model);
  return tableHandle;
}

Fixed version (ground truth):
protected static TableHandle performInsertDataSet(DataSetHandle model) throws SemanticException {
  CachedMetaDataHandle cachedMetadata=DataSetUIUtil.getCachedMetaDataHandle(model);
  List columList=new ArrayList();
  for (Iterator iter=cachedMetadata.getResultSet().iterator(); iter.hasNext(); ) {
    ResultSetColumnHandle element=(ResultSetColumnHandle)iter.next();
    columList.add(element);
  }
  ResultSetColumnHandle[] columns=(ResultSetColumnHandle[])columList.toArray(new ResultSetColumnHandle[columList.size()]);
  TableHandle tableHandle=DesignElementFactory.getInstance().newTableItem(null,columns.length);
  setInitWidth(tableHandle);
  insertToCell(model,tableHandle,tableHandle.getHeader(),columns,true);
  insertToCell(model,tableHandle,tableHandle.getDetail(),columns,false);
  tableHandle.setDataSet(model);
  return tableHandle;
}
Program: 78264
Project: 78264
Buggy source:
public BindingExpressionProvider(DesignElementHandle handle){
  super(handle);
  if (handle instanceof ReportItemHandle) {
    dataSetHandle=((ReportItemHandle)handle).getDataSet();
  }
}

Fixed version (ground truth):
public BindingExpressionProvider(DesignElementHandle handle){
  super(handle);
  if (handle instanceof ReportItemHandle) {
    dataSetHandle=((ReportItemHandle)handle).getDataSet();
  }
 else   if (handle instanceof GroupHandle) {
    dataSetHandle=((ReportItemHandle)((GroupHandle)handle).getContainer()).getDataSet();
  }
}
Program: 78265
Project: 78265
Buggy source:
/** 
 * compile aggregate expression
 * @param context
 * @param parent
 * @param callNode
 * @throws BirtException
 */
private void compileAggregateExpr(Node parent,Node callNode,ScriptOrFnNode tree,List columnExprList) throws BirtException {
  assert(callNode.getType() == Token.CALL);
  extractArguments(callNode,tree,columnExprList);
}

Fixed version (ground truth):
/** 
 * compile aggregate expression
 * @param context
 * @param parent
 * @param callNode
 * @throws BirtException
 */
private void compileAggregateExpr(Node parent,Node callNode,ScriptOrFnNode tree,List columnExprList) throws BirtException {
  assert(callNode.getType() == Token.CALL);
  compileAggregationFunction(callNode,tree,columnExprList);
  extractArguments(callNode,tree,columnExprList);
}
Program: 78266
Project: 78266
Buggy source:
public void setBookmark(String bookmark) throws EngineException {
  long pageNumber=reportDoc.getPageNumber(bookmark);
  if (pageNumber == 0) {
    throw new EngineException("String_Node_Str",bookmark);
  }
  innerRender=new PageRender(pageNumber);
}

Fixed version (ground truth):
public void setBookmark(String bookmark) throws EngineException {
  long pageNumber=reportDoc.getPageNumber(bookmark);
  if (pageNumber <= 0) {
    throw new EngineException("String_Node_Str",bookmark);
  }
  innerRender=new PageRender(pageNumber);
}
Program: 78267
Project: 78267
Buggy source:
/** 
 * Returns the refresh rate when viewing the report.
 * @return the refresh rate
 */
public ThemeHandle getTheme(){
  Theme theme=getModule().getTheme();
  if (theme == null)   return null;
  return (ThemeHandle)theme.getHandle(getModule());
}

Fixed version (ground truth):
/** 
 * Returns the refresh rate when viewing the report.
 * @return the refresh rate
 */
public ThemeHandle getTheme(){
  Theme theme=getModule().getTheme(module);
  if (theme == null)   return null;
  return (ThemeHandle)theme.getHandle(theme.getRoot());
}
Program: 78268
Project: 78268
Buggy source:
/** 
 * @return
 */
private boolean basicCache(){
  if (dataSourceDesign == null || dataSetDesign == null)   return false;
  if (this.cacheOption == DISABLE) {
    return false;
  }
 else   if (this.cacheOption == ALWAYS) {
    if (this.alwaysCacheRowCount == 0)     return false;
  }
 else   if (dataSetDesign.getCacheRowCount() == 0) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * @return
 */
private boolean basicCache(){
  if (dataSetDesign == null)   return false;
  if (this.cacheOption == DISABLE) {
    return false;
  }
 else   if (this.cacheOption == ALWAYS) {
    if (this.alwaysCacheRowCount == 0)     return false;
  }
 else   if (dataSetDesign.getCacheRowCount() == 0) {
    return false;
  }
  return true;
}
Program: 78269
Project: 78269
Buggy source:
/** 
 * Prepares a filter expression for top(n)/bottom(n) evaluation Each top(n)/bottom(n) expression is tagged with a NEvaluator handle TODO: this code is temporary
 * @param expr
 */
public static void prepareFilterExpression(IBaseExpression expr,FilterPassController filterPass) throws DataException {
  if (expr instanceof IConditionalExpression) {
    ConditionalExpression ce=(ConditionalExpression)expr;
    int operator=ce.getOperator();
    if (operator == IConditionalExpression.OP_TOP_N || operator == IConditionalExpression.OP_TOP_PERCENT || operator == IConditionalExpression.OP_BOTTOM_N || operator == IConditionalExpression.OP_BOTTOM_PERCENT) {
      Object handle=expr.getHandle();
      if (handle instanceof NEvaluator) {
        return;
      }
      NEvaluator evaluator=NEvaluator.newInstance(operator,ce.getExpression(),ce.getOperand1(),filterPass);
      expr.setHandle(evaluator);
    }
  }
}

Fixed version (ground truth):
/** 
 * Prepares a filter expression for top(n)/bottom(n) evaluation Each top(n)/bottom(n) expression is tagged with a NEvaluator handle TODO: this code is temporary
 * @param expr
 */
public static void prepareFilterExpression(IBaseExpression expr,FilterPassController filterPass,IExecutorHelper helper) throws DataException {
  if (expr instanceof IConditionalExpression) {
    ConditionalExpression ce=(ConditionalExpression)expr;
    int operator=ce.getOperator();
    if (operator == IConditionalExpression.OP_TOP_N || operator == IConditionalExpression.OP_TOP_PERCENT || operator == IConditionalExpression.OP_BOTTOM_N || operator == IConditionalExpression.OP_BOTTOM_PERCENT) {
      Object handle=expr.getHandle();
      if (handle instanceof NEvaluator) {
        return;
      }
      NEvaluator evaluator=NEvaluator.newInstance(operator,ce.getExpression(),ce.getOperand1(),filterPass,helper);
      expr.setHandle(evaluator);
    }
  }
}
Program: 78270
Project: 78270
Buggy source:
/** 
 * Evaluate a filter expression.
 * @param cx
 * @param filter
 * @return
 * @throws DataException
 */
private Object evaluteFilterExpression(Context cx,IFilterDefinition filter) throws DataException {
  IBaseExpression expr=filter.getExpression();
  FilterUtil.prepareFilterExpression(expr,filterPass);
  Object result=ScriptEvalUtil.evalExpr(expr,cx,this.groupProcessor.getExpressionProcessor().getScope(),"String_Node_Str",0);
  if (result == null) {
    Object info=null;
    if (expr instanceof IScriptExpression)     info=((IScriptExpression)expr).getText();
 else     info=expr;
    throw new DataException(ResourceConstants.INVALID_EXPRESSION_IN_FILTER,info);
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Evaluate a filter expression.
 * @param cx
 * @param filter
 * @return
 * @throws DataException
 */
private Object evaluteFilterExpression(Context cx,IFilterDefinition filter) throws DataException {
  IBaseExpression expr=filter.getExpression();
  FilterUtil.prepareFilterExpression(expr,filterPass,this.populator.getEventHandler().getExecutorHelper());
  Object result=ScriptEvalUtil.evalExpr(expr,cx,this.groupProcessor.getExpressionProcessor().getScope(),"String_Node_Str",0);
  if (result == null) {
    Object info=null;
    if (expr instanceof IScriptExpression)     info=((IScriptExpression)expr).getText();
 else     info=expr;
    throw new DataException(ResourceConstants.INVALID_EXPRESSION_IN_FILTER,info);
  }
  return result;
}
Program: 78271
Project: 78271
Buggy source:
public void setDataSetMode(boolean isDataSetMode){
  this.helper.setDataSetMode(isDataSetMode);
}

Fixed version (ground truth):
public void setDataSetMode(boolean isDataSetMode){
  this.isDataSetMode=isDataSetMode;
  this.helper.setDataSetMode(isDataSetMode);
}
Program: 78272
Project: 78272
Buggy source:
/** 
 * @param resultSetMetaData
 * @param resultIterator
 * @param scope
 */
public ExpressionProcessor(IResultClass metaData,IResultIterator resultIterator,DataSetRuntime dataSet,BaseQuery query){
  helper=new ExpressionParseHelper(metaData,dataSet.getScriptScope());
  helper.setQuery(query);
  this.metaData=metaData;
  this.query=query;
  this.resultIterator=resultIterator;
  this.dataSet=dataSet;
}

Fixed version (ground truth):
/** 
 * @param resultSetMetaData
 * @param resultIterator
 * @param scope
 */
public ExpressionProcessor(IResultClass metaData,IResultIterator resultIterator,DataSetRuntime dataSet,BaseQuery query){
  helper=new ExpressionParseHelper(metaData,dataSet.getScriptScope());
  helper.setDataSetMode(this.isDataSetMode);
  helper.setQuery(query);
  this.metaData=metaData;
  this.query=query;
  this.resultIterator=resultIterator;
  this.dataSet=dataSet;
}
Program: 78276
Project: 78276
Buggy source:
/** 
 * Returns the position where the cell resides in the row.
 * @param cell the cell handle
 * @return the position indexing from 0
 */
protected static int findCellPosition(CellHandle cell){
}

Fixed version (ground truth):
/** 
 * Returns the position where the cell resides in the row.
 * @param row the row handle
 * @param columnToInsert the column number to insert, count from 1
 * @param insert whether insert mode
 * @return the position indexing from 1
 */
protected int findCellPosition(RowHandle row,int columnToInsert,boolean insert){
  SlotHandle cells=row.getCells();
  for (int i=0; i < cells.getCount(); i++) {
    CellHandle cell=(CellHandle)cells.get(i);
    int cellPos=getCellPosition(cell);
    if (columnToInsert == cellPos)     return insert ? (i + 1) : i;
 else     if (columnToInsert < cellPos)     return i;
  }
  return -1;
}
Program: 78277
Project: 78277
Buggy source:
/** 
 * Returns insert positions of <code>copiedCells</code>. Each element in the return value is an integer, which can be <ul> <li>0 -- insert to the beginning of row <li>an integer between 0 and the maximal position <li>-1 -- insert to the end of the row </ul>
 * @param copiedCells a list containing cells that is to be inserted.
 * @param originalCells a list containing cells that is to be deleted.
 * @param columnIndex the column index where copied cells are pasted
 * @param isInsert <code>true</code> if this is an insert and paste action. Otherwise <code>false</code>.
 * @return an array containing insert positions
 */
private int[] getInsertPosition(List copiedCells,List originalCells,int columnIndex,boolean isInsert){
  int[] insertPosition=null;
  int columnCount=adapter.getColumnCount();
  if (isInsert && (columnIndex == 0 || columnIndex == columnCount - 1)) {
    insertPosition=new int[copiedCells.size()];
    if (columnIndex == 0)     Arrays.fill(insertPosition,0);
 else     Arrays.fill(insertPosition,-1);
  }
 else {
    int[] copiedRowSpans=new int[copiedCells.size()];
    int[] originalPositions=new int[originalCells.size()];
    int[] originalRowSpans=new int[originalCells.size()];
    for (int i=0; i < originalCells.size(); i++) {
      CellContextInfo contextInfo=(CellContextInfo)originalCells.get(i);
      CellHandle cell=contextInfo.getCell().handle(adapter.getModule());
      originalPositions[i]=ColumnBandAdapter.findCellPosition(cell);
      originalRowSpans[i]=contextInfo.getRowSpan();
    }
    for (int i=0; i < copiedCells.size(); i++) {
      CellContextInfo contextInfo=(CellContextInfo)copiedCells.get(i);
      copiedRowSpans[i]=contextInfo.getRowSpan();
    }
    insertPosition=getIndexToAdd(originalPositions,originalRowSpans,copiedRowSpans);
  }
  return insertPosition;
}

Fixed version (ground truth):
/** 
 * Returns insert positions of <code>copiedCells</code> if the cells are inserted to the beginning of row or at the end of the row. Each element in the return value is an integer, which can be <ul> <li>0 -- insert to the beginning of row <li>-1 -- insert to the end of the row </ul> And for other cases, the position is not calculated here.
 * @param size the size of the array to be return.
 * @param columnIndex the column index where copied cells are pasted
 * @param isInsert <code>true</code> if this is an insert and paste action. Otherwise <code>false</code>.
 * @return an array containing insert positions
 */
private int[] getInsertPosition(int size,int columnIndex,boolean isInsert){
  int[] insertPosition=null;
  int columnCount=adapter.getColumnCount();
  if (isInsert && (columnIndex == 0 || columnIndex == columnCount - 1)) {
    insertPosition=new int[size];
    if (columnIndex == 0)     Arrays.fill(insertPosition,0);
 else     Arrays.fill(insertPosition,-1);
  }
  return insertPosition;
}
Program: 78278
Project: 78278
Buggy source:
/** 
 * Returns the library handle with the given namespace.
 * @param namespace the library namespace
 * @return the library handle with the given namespace
 */
public LibraryHandle getLibrary(String namespace){
  Module library=module.getLibraryWithNamespace(namespace,IModuleNameSpace.ONE_LEVEL);
  if (library == null)   return null;
  return (LibraryHandle)library.getHandle(library);
}

Fixed version (ground truth):
/** 
 * Returns the library handle with the given namespace.
 * @param namespace the library namespace
 * @return the library handle with the given namespace
 */
public LibraryHandle getLibrary(String namespace){
  Module library=module.getLibraryWithNamespace(namespace,IModuleNameSpace.DIRECTLY_INCLUDED_LEVEL);
  if (library == null)   return null;
  return (LibraryHandle)library.getHandle(library);
}
Program: 78279
Project: 78279
Buggy source:
/** 
 * Returns the libraries this report design includes directly. Each in the returned list is the instance of <code>LibraryHandle</code>.
 * @return the libraries this report design includes directly.
 */
public List getLibraries(){
  return getLibraries(IModuleNameSpace.ONE_LEVEL);
}

Fixed version (ground truth):
/** 
 * Returns the libraries this report design includes directly. Each in the returned list is the instance of <code>LibraryHandle</code>.
 * @return the libraries this report design includes directly.
 */
public List getLibraries(){
  return getLibraries(IModuleNameSpace.DIRECTLY_INCLUDED_LEVEL);
}
Program: 78280
Project: 78280
Buggy source:
/** 
 * Returns all theme element handles that this modules and the included modules contain.
 * @return all theme element handles that this modules and the includedmodules contain.
 */
public List getAllThemes(){
  List elementList=module.getModuleNameSpace(Module.THEME_NAME_SPACE).getElements(IModuleNameSpace.ONE_LEVEL);
  return generateHandleList(elementList);
}

Fixed version (ground truth):
/** 
 * Returns all theme element handles that this modules and the included modules contain.
 * @return all theme element handles that this modules and the includedmodules contain.
 * @deprecated from BIRT 2.1.0. Replaced by {@link #getVisibleThemes(int)}
 */
public List getAllThemes(){
  List elementList=module.getModuleNameSpace(Module.THEME_NAME_SPACE).getElements(IModuleNameSpace.DIRECTLY_INCLUDED_LEVEL);
  return generateHandleList(elementList);
}
Program: 78281
Project: 78281
Buggy source:
/** 
 * Returns all theme element handles that this module contain.
 * @return all theme element handles that this module contain.
 */
public List getVisibleThemes(){
  List elementList=module.getModuleNameSpace(Module.THEME_NAME_SPACE).getElements(IModuleNameSpace.NATIVE_LEVEL);
  return generateHandleList(elementList);
}

Fixed version (ground truth):
/** 
 * Returns theme handles according the input level.
 * @param level an <code>int</code> value, which should be the one defined in <code>IVisibleLevelControl</code>.
 * @return theme handles according the input level
 */
public List getVisibleThemes(int level){
  List elementList=module.getModuleNameSpace(Module.THEME_NAME_SPACE).getElements(level);
  return generateHandleList(elementList);
}
Program: 78282
Project: 78282
Buggy source:
/** 
 * Returns only libraries this module includes directly.
 * @return list of libraries.
 */
public List getLibraries(){
  return getLibraries(IModuleNameSpace.ONE_LEVEL);
}

Fixed version (ground truth):
/** 
 * Returns only libraries this module includes directly.
 * @return list of libraries.
 */
public List getLibraries(){
  return getLibraries(IModuleNameSpace.DIRECTLY_INCLUDED_LEVEL);
}
Program: 78285
Project: 78285
Buggy source:
private String getColumnName(String value){
  CachedMetaDataHandle cmdh=null;
  try {
    cmdh=DataSetUIUtil.getCachedMetaDataHandle(dataSet);
  }
 catch (  SemanticException e) {
  }
  if (cmdh != null) {
    for (Iterator iter=cmdh.getResultSet().iterator(); iter.hasNext(); ) {
      ResultSetColumnHandle element=(ResultSetColumnHandle)iter.next();
      if (value.equalsIgnoreCase(DEUtil.getColumnExpression(element.getColumnName()))) {
        return element.getColumnName();
      }
    }
  }
  return null;
}

Fixed version (ground truth):
private String getColumnName(String value){
  CachedMetaDataHandle cmdh=null;
  try {
    cmdh=DataSetUIUtil.getCachedMetaDataHandle(dataSet);
  }
 catch (  SemanticException e) {
  }
  if (cmdh != null) {
    for (Iterator iter=cmdh.getResultSet().iterator(); iter.hasNext(); ) {
      ResultSetColumnHandle element=(ResultSetColumnHandle)iter.next();
      if (DEUtil.getColumnExpression(element.getColumnName()).equalsIgnoreCase(value)) {
        return element.getColumnName();
      }
    }
  }
  return null;
}
Program: 78286
Project: 78286
Buggy source:
private String[] getDataSets(){
  return (String[])DEUtil.getDataSets().toArray(new String[0]);
}

Fixed version (ground truth):
private String[] getDataSets(){
  return ChoiceSetFactory.getDataSets();
}
Program: 78287
Project: 78287
Buggy source:
/** 
 * Creates builder for given element
 * @param handle
 * @return
 */
public Object createBuilder(DesignElementHandle handle){
  if (handle instanceof TextItemHandle) {
    return new TextEditor(UIUtil.getDefaultShell(),TextEditor.DLG_TITLE_NEW,(TextItemHandle)handle);
  }
  if (handle instanceof TextDataHandle) {
    ExpressionBuilder dialog=new ExpressionBuilder(UIUtil.getDefaultShell(),((TextDataHandle)handle).getValueExpr());
    dialog.setExpressionProvier(new ExpressionProvider(handle));
    return (dialog);
  }
  if (handle instanceof DataItemHandle) {
    BindingColumnDialog dialog=new BindingColumnDialog();
    dialog.setInput((ReportItemHandle)handle);
    return (dialog);
  }
  if (handle instanceof ImageHandle) {
    ImageBuilder dialog=new ImageBuilder(UIUtil.getDefaultShell(),ImageBuilder.DLG_TITLE_NEW);
    dialog.setInput(handle);
    return dialog;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Creates builder for given element
 * @param handle
 * @return
 */
public Object createBuilder(DesignElementHandle handle){
  if (handle instanceof TextItemHandle) {
    return new TextEditor(UIUtil.getDefaultShell(),TextEditor.DLG_TITLE_NEW,(TextItemHandle)handle);
  }
  if (handle instanceof TextDataHandle) {
    ExpressionBuilder dialog=new ExpressionBuilder(UIUtil.getDefaultShell(),((TextDataHandle)handle).getValueExpr());
    dialog.setExpressionProvier(new ExpressionProvider(handle));
    return (dialog);
  }
  if (handle instanceof DataItemHandle) {
    BindingColumnDialog dialog=new BindingColumnDialog(true);
    dialog.setInput((ReportItemHandle)handle);
    return (dialog);
  }
  if (handle instanceof ImageHandle) {
    ImageBuilder dialog=new ImageBuilder(UIUtil.getDefaultShell(),ImageBuilder.DLG_TITLE_NEW);
    dialog.setInput(handle);
    return dialog;
  }
  return null;
}
Program: 78289
Project: 78289
Buggy source:
private void setKeyExpression(String key){
  keyChooser.deselectAll();
  if (StringUtil.isBlank(key)) {
    keyChooser.setText("String_Node_Str");
    return;
  }
  keyChooser.setText(key);
}

Fixed version (ground truth):
private void setKeyExpression(String key){
  keyChooser.deselectAll();
  key=StringUtil.trimString(key);
  if (StringUtil.isBlank(key)) {
    keyChooser.setText("String_Node_Str");
    return;
  }
  for (int i=0; i < columnList.size(); i++) {
    if (key.equals(DEUtil.getExpression(columnList.get(i)))) {
      keyChooser.select(i);
      return;
    }
  }
  keyChooser.setText(key);
}