nus-yam/ex-repair huggingface dataset:
Program: 73677
Project: 73677
Buggy source:
public String getTypeName(){
  Object valObj=value;
  if (value instanceof NativeJavaObject) {
    valObj=((NativeJavaObject)value).unwrap();
  }
  if (valObj != null) {
    return convertArrayTypeName(valObj.getClass(),isPrimitive);
  }
  return "String_Node_Str";
}

Fixed version (ground truth):
public String getTypeName(){
  if (reservedValueType != null) {
    return reservedValueType;
  }
  Object valObj=value;
  if (value instanceof NativeJavaObject) {
    valObj=((NativeJavaObject)value).unwrap();
  }
  if (valObj != null) {
    return convertArrayTypeName(valObj.getClass(),isPrimitive);
  }
  return "String_Node_Str";
}
Program: 73678
Project: 73678
Buggy source:
public VMVariable[] getMembers(){
  return (VMVariable[])Context.call(new ContextAction(){
    public Object run(    Context arg0){
      try {
        return getMembersImpl(arg0);
      }
 catch (      Exception e) {
        StringWriter sw=new StringWriter();
        e.printStackTrace(new PrintWriter(sw));
        return new VMVariable[]{new JsVariable(sw.toString(),ERROR_LITERAL)};
      }
    }
  }
);
}

Fixed version (ground truth):
public VMVariable[] getMembers(){
  return (VMVariable[])Context.call(new ContextAction(){
    public Object run(    Context arg0){
      try {
        return getMembersImpl(arg0);
      }
 catch (      Exception e) {
        StringWriter sw=new StringWriter();
        e.printStackTrace(new PrintWriter(sw));
        return new VMVariable[]{new JsVariable(sw.toString(),ERROR_LITERAL,EXCEPTION_TYPE)};
      }
    }
  }
);
}
Program: 73679
Project: 73679
Buggy source:
private void terminated(){
  DebugPlugin.getDefault().getBreakpointManager().removeBreakpointListener(this);
  setTerminating(false);
  if (!fTerminated) {
    setTerminated(true);
    reportVM.disconnect();
    fireTerminateEvent();
  }
  breakPoints.clear();
  try {
    if (getLaunch().getLaunchConfiguration().getAttribute(IReportLaunchConstants.ATTR_OPEN_TARGET,false) && getLaunch().getLaunchConfiguration().getAttribute(IReportLaunchConstants.ATTR_TASK_TYPE,IReportLaunchConstants.TASK_TYPE_RUN_AND_RENDER) != IReportLaunchConstants.TASK_TYPE_RUN) {
      while (!getProcess().isTerminated()) {
        try {
synchronized (this) {
            wait(DELAY_TIME);
          }
        }
 catch (        InterruptedException e) {
        }
      }
      if (getProcess().getExitValue() == ReportLauncher.EXIT_OK) {
        File file=new File(getFileName());
        String fileName=ReportLauncher.getOutputFileName(tempFolder,file.getName(),launch.getLaunchConfiguration().getAttribute(IReportLaunchConstants.ATTR_TARGET_FORMAT,IReportLaunchConstants.DEFAULT_OUTPUT_FORMAT));
        if (fileName != null && new File(fileName).exists()) {
          Program.launch(fileName);
        }
      }
    }
  }
 catch (  Exception e) {
  }
}

Fixed version (ground truth):
private void terminated(){
  DebugPlugin.getDefault().getBreakpointManager().removeBreakpointListener(this);
  setTerminating(false);
  if (!fTerminated) {
    setTerminated(true);
    reportVM.disconnect();
    fireTerminateEvent();
  }
  breakPoints.clear();
  try {
    if (getLaunch().getLaunchConfiguration().getAttribute(IReportLaunchConstants.ATTR_OPEN_TARGET,false) && getLaunch().getLaunchConfiguration().getAttribute(IReportLaunchConstants.ATTR_TASK_TYPE,IReportLaunchConstants.DEFAULT_TASK_TYPE) != IReportLaunchConstants.TASK_TYPE_RUN) {
      while (!getProcess().isTerminated()) {
        try {
synchronized (this) {
            wait(DELAY_TIME);
          }
        }
 catch (        InterruptedException e) {
        }
      }
      if (getProcess().getExitValue() == ReportLauncher.EXIT_OK) {
        File file=new File(getFileName());
        String fileName=ReportLauncher.getOutputFileName(tempFolder,file.getName(),launch.getLaunchConfiguration().getAttribute(IReportLaunchConstants.ATTR_TARGET_FORMAT,IReportLaunchConstants.DEFAULT_TARGET_FORMAT));
        if (fileName != null && new File(fileName).exists()) {
          Program.launch(fileName);
        }
      }
    }
  }
 catch (  Exception e) {
  }
}
Program: 73680
Project: 73680
Buggy source:
void init(ILaunchConfiguration configuration){
  engineConfig=new LauncherEngineConfig();
  IReportEngineFactory factory=(IReportEngineFactory)Platform.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
  engine=factory.createReportEngine(engineConfig);
  engine.changeLogLevel(Level.WARNING);
  configEngine();
  try {
    fileName=covertVariables(configuration.getAttribute(ATTR_REPORT_FILE_NAME,"String_Node_Str"));
    engineHome=covertVariables(configuration.getAttribute(ATTR_ENGINE_HOME,"String_Node_Str"));
    tempFolder=covertVariables(configuration.getAttribute(ATTR_TEMP_FOLDER,"String_Node_Str"));
    useDefaultEngineHome=configuration.getAttribute(ATTR_USE_DEFULT_ENGINE_HOME,true);
    targetFormat=configuration.getAttribute(ATTR_TARGET_FORMAT,DEFAULT_OUTPUT_FORMAT);
    isOpenTargetFile=configuration.getAttribute(ATTR_OPEN_TARGET,false);
    debugType=configuration.getAttribute(ATTR_DEBUG_TYPE,DEBUG_TYPE_ALL);
    taskType=configuration.getAttribute(ATTR_TASK_TYPE,TASK_TYPE_RUN_AND_RENDER);
  }
 catch (  CoreException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
void init(ILaunchConfiguration configuration){
  engineConfig=new LauncherEngineConfig();
  IReportEngineFactory factory=(IReportEngineFactory)Platform.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
  engine=factory.createReportEngine(engineConfig);
  engine.changeLogLevel(Level.WARNING);
  configEngine();
  try {
    fileName=covertVariables(configuration.getAttribute(ATTR_REPORT_FILE_NAME,"String_Node_Str"));
    engineHome=covertVariables(configuration.getAttribute(ATTR_ENGINE_HOME,"String_Node_Str"));
    tempFolder=covertVariables(configuration.getAttribute(ATTR_TEMP_FOLDER,"String_Node_Str"));
    useDefaultEngineHome=configuration.getAttribute(ATTR_USE_DEFULT_ENGINE_HOME,true);
    targetFormat=configuration.getAttribute(ATTR_TARGET_FORMAT,DEFAULT_TARGET_FORMAT);
    isOpenTargetFile=configuration.getAttribute(ATTR_OPEN_TARGET,false);
    debugType=configuration.getAttribute(ATTR_DEBUG_TYPE,DEFAULT_DEBUG_TYPE);
    taskType=configuration.getAttribute(ATTR_TASK_TYPE,DEFAULT_TASK_TYPE);
  }
 catch (  CoreException e) {
    e.printStackTrace();
  }
}
Program: 73683
Project: 73683
Buggy source:
public void setDefaults(ILaunchConfigurationWorkingCopy configuration){
  configuration.setAttribute(ATTR_REPORT_FILE_NAME,getDefaultFileName());
  configuration.setAttribute(ATTR_ENGINE_HOME,"String_Node_Str");
  configuration.setAttribute(ATTR_TEMP_FOLDER,getDefaultTempFolder());
  configuration.setAttribute(ATTR_OPEN_TARGET,false);
  configuration.setAttribute(ATTR_TARGET_FORMAT,DEFAULT_OUTPUT_FORMAT);
  configuration.setAttribute(ATTR_USE_DEFULT_ENGINE_HOME,true);
  configuration.setAttribute(ATTR_DEBUG_TYPE,DEBUG_TYPE_ALL);
  configuration.setAttribute(ATTR_TASK_TYPE,TASK_TYPE_RUN_AND_RENDER);
}

Fixed version (ground truth):
public void setDefaults(ILaunchConfigurationWorkingCopy configuration){
  configuration.setAttribute(ATTR_REPORT_FILE_NAME,getDefaultFileName());
  configuration.setAttribute(ATTR_ENGINE_HOME,"String_Node_Str");
  configuration.setAttribute(ATTR_TEMP_FOLDER,getDefaultTempFolder());
  configuration.setAttribute(ATTR_OPEN_TARGET,false);
  configuration.setAttribute(ATTR_TARGET_FORMAT,DEFAULT_TARGET_FORMAT);
  configuration.setAttribute(ATTR_USE_DEFULT_ENGINE_HOME,true);
  configuration.setAttribute(ATTR_DEBUG_TYPE,DEFAULT_DEBUG_TYPE);
  configuration.setAttribute(ATTR_TASK_TYPE,DEFAULT_TASK_TYPE);
}
Program: 73684
Project: 73684
Buggy source:
/** 
 * Test disable some column binding on MemoryCache.
 * @throws Exception
 */
public void testMemoryCacheColumnBinding() throws Exception {
  incomprehensiveColumnBinding();
}

Fixed version (ground truth):
/** 
 * Test disable some column binding on MemoryCache.
 * @throws Exception
 */
public void testMemoryCacheColumnBinding() throws Exception {
  String initialStr=System.getProperty("String_Node_Str");
  System.setProperty("String_Node_Str","String_Node_Str");
  incomprehensiveColumnBinding();
  System.setProperty("String_Node_Str",initialStr == null ? "String_Node_Str" : initialStr);
}
Program: 73686
Project: 73686
Buggy source:
/** 
 * @param expression
 * @return
 */
protected String getExpressionForEvaluator(String expression){
  return expression;
}

Fixed version (ground truth):
/** 
 * @param expression
 * @return
 */
protected String getExpressionForEvaluator(String expression){
  return ExpressionUtil.createJSRowExpression(expression);
}
Program: 73687
Project: 73687
Buggy source:
/** 
 * @param query
 * @param categorySD
 * @param categoryGroupDefinition
 * @param valueExprMap
 */
private void bindSortOnCategorySeries(BaseQueryDefinition query,SeriesDefinition categorySD,GroupDefinition categoryGroupDefinition,Map valueExprMap){
  String baseSortExpr=getValidSortExpr(categorySD);
  if (categorySD.isSetSorting() && baseSortExpr != null) {
    if (ChartReportItemUtil.isBaseGroupingDefined(categorySD)) {
      String baseExpr=((Query)categorySD.getDesignTimeSeries().getDataDefinition().get(0)).getDefinition();
      if (baseExpr.equals(getValidSortExpr(categorySD))) {
        categoryGroupDefinition.setSortDirection(ChartReportItemUtil.convertToDtESortDirection(categorySD.getSorting()));
      }
 else {
        SortDefinition sd=new SortDefinition();
        sd.setSortDirection(ChartReportItemUtil.convertToDtESortDirection(categorySD.getSorting()));
        String newValueSeriesExpr=(String)valueExprMap.get(baseSortExpr);
        if (newValueSeriesExpr != null) {
          categorySD.getSortKey().setDefinition(newValueSeriesExpr);
          sd.setExpression(newValueSeriesExpr);
        }
 else {
          sd.setExpression(baseSortExpr);
        }
        categoryGroupDefinition.addSort(sd);
      }
    }
 else {
      SortDefinition sd=new SortDefinition();
      sd.setExpression(baseSortExpr);
      sd.setSortDirection(ChartReportItemUtil.convertToDtESortDirection(categorySD.getSorting()));
      query.addSort(sd);
    }
  }
}

Fixed version (ground truth):
/** 
 * @param query
 * @param categorySD
 * @param categoryGroupDefinition
 * @param valueExprMap
 */
private void bindSortOnCategorySeries(BaseQueryDefinition query,SeriesDefinition categorySD,GroupDefinition categoryGroupDefinition,Map valueExprMap){
  String baseSortExpr=getValidSortExpr(categorySD);
  if (categorySD.isSetSorting() && baseSortExpr != null) {
    if (ChartReportItemUtil.isBaseGroupingDefined(categorySD)) {
      String baseExpr=((Query)categorySD.getDesignTimeSeries().getDataDefinition().get(0)).getDefinition();
      if (baseExpr.equals(getValidSortExpr(categorySD))) {
        categoryGroupDefinition.setSortDirection(ChartReportItemUtil.convertToDtESortDirection(categorySD.getSorting()));
      }
 else {
        SortDefinition sd=new SortDefinition();
        sd.setSortDirection(ChartReportItemUtil.convertToDtESortDirection(categorySD.getSorting()));
        String[] nameNewExprArray=(String[])valueExprMap.get(baseSortExpr);
        if (nameNewExprArray != null && nameNewExprArray.length == 2) {
          updateQueryDefinitionForSortOnAggregateExpression(categorySD.getSortKey(),nameNewExprArray[0],nameNewExprArray[1]);
          sd.setExpression(nameNewExprArray[1]);
        }
 else {
          sd.setExpression(baseSortExpr);
        }
        categoryGroupDefinition.addSort(sd);
      }
    }
 else {
      SortDefinition sd=new SortDefinition();
      sd.setExpression(baseSortExpr);
      sd.setSortDirection(ChartReportItemUtil.convertToDtESortDirection(categorySD.getSorting()));
      query.addSort(sd);
    }
  }
}
Program: 73688
Project: 73688
Buggy source:
/** 
 * Create Y grouping definition.
 * @param orthSD
 * @return
 */
private GroupDefinition createOrthogonalGroupingDefinition(SeriesDefinition orthSD){
  if (ChartReportItemUtil.isYGroupingDefined(orthSD)) {
    DataType dataType=null;
    GroupingUnitType groupUnit=null;
    double groupIntervalRange=0;
    String yGroupExpr=orthSD.getQuery().getDefinition();
    if (orthSD.getGrouping() != null && orthSD.getGrouping().isSetGroupType()) {
      dataType=orthSD.getGrouping().getGroupType();
      groupUnit=orthSD.getGrouping().getGroupingUnit();
      groupIntervalRange=orthSD.getGrouping().getGroupingInterval();
    }
    String name=generateUniqueBindingName(yGroupExpr);
    GroupDefinition yGroupDefinition=new GroupDefinition(name);
    yGroupDefinition.setKeyExpression(yGroupExpr);
    yGroupDefinition.setInterval(ChartReportItemUtil.convertToDtEGroupUnit(dataType,groupUnit,groupIntervalRange));
    yGroupDefinition.setIntervalRange(ChartReportItemUtil.convertToDtEIntervalRange(dataType,groupUnit,groupIntervalRange));
    if (orthSD.isSetSorting()) {
      yGroupDefinition.setSortDirection(ChartReportItemUtil.convertToDtESortDirection(orthSD.getSorting()));
    }
    return yGroupDefinition;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Create Y grouping definition.
 * @param orthSD
 * @return
 */
private GroupDefinition createOrthogonalGroupingDefinition(SeriesDefinition orthSD){
  if (ChartReportItemUtil.isYGroupingDefined(orthSD)) {
    DataType dataType=null;
    GroupingUnitType groupUnit=null;
    double groupIntervalRange=0;
    String yGroupExpr=orthSD.getQuery().getDefinition();
    SeriesGrouping yGroupingInterval=orthSD.getQuery().getGrouping();
    if (yGroupingInterval != null && yGroupingInterval.isSetGroupType()) {
      dataType=yGroupingInterval.getGroupType();
      groupUnit=yGroupingInterval.getGroupingUnit();
      groupIntervalRange=yGroupingInterval.getGroupingInterval();
    }
    String name=generateUniqueBindingName(yGroupExpr);
    GroupDefinition yGroupDefinition=new GroupDefinition(name);
    yGroupDefinition.setKeyExpression(yGroupExpr);
    yGroupDefinition.setInterval(ChartReportItemUtil.convertToDtEGroupUnit(dataType,groupUnit,groupIntervalRange));
    yGroupDefinition.setIntervalRange(ChartReportItemUtil.convertToDtEIntervalRange(dataType,groupUnit,groupIntervalRange));
    if (orthSD.isSetSorting()) {
      yGroupDefinition.setSortDirection(ChartReportItemUtil.convertToDtESortDirection(orthSD.getSorting()));
    }
    return yGroupDefinition;
  }
  return null;
}
Program: 73689
Project: 73689
Buggy source:
/** 
 * Convert interval range from Chart's to DtE's.
 * @param dataType
 * @param groupUnitType
 * @param intervalRange
 * @since BIRT 2.3
 */
public static double convertToDtEIntervalRange(DataType dataType,GroupingUnitType groupUnitType,double intervalRange){
  double range=intervalRange;
  if (Double.isNaN(intervalRange)) {
    range=0;
  }
  if (dataType == DataType.DATE_TIME_LITERAL && range <= 0) {
    range=1;
  }
 else   if (dataType == DataType.TEXT_LITERAL) {
    if (groupUnitType == GroupingUnitType.STRING_LITERAL) {
      if (range >= 1) {
        return (long)(range + 1);
      }
    }
    return (long)range;
  }
  return range;
}

Fixed version (ground truth):
/** 
 * Convert interval range from Chart's to DtE's.
 * @param dataType
 * @param groupUnitType
 * @param intervalRange
 * @since BIRT 2.3
 */
public static double convertToDtEIntervalRange(DataType dataType,GroupingUnitType groupUnitType,double intervalRange){
  double range=intervalRange;
  if (Double.isNaN(intervalRange)) {
    range=0;
  }
  if (dataType == DataType.DATE_TIME_LITERAL && range <= 0) {
    range=1;
  }
 else   if (dataType == DataType.TEXT_LITERAL) {
    return (long)range;
  }
  return range;
}
Program: 73690
Project: 73690
Buggy source:
/** 
 * @throws BirtException
 * @throws DataException
 * @throws IOException
 */
private void incomprehensiveColumnBinding() throws BirtException, DataException, IOException {
  this.GEN_add_group=true;
  this.GEN_add_subquery=true;
  this.GEN_print=true;
  this.USE_DATE_IN_COLUMNBINDING=false;
  this.genBasicIV();
  this.closeArchiveWriter();
  DataEngineContext deContext2=newContext(DataEngineContext.MODE_UPDATE,fileName,fileName);
  myPreDataEngine=DataEngine.newDataEngine(deContext2);
  this.UPDATE_add_same_group=true;
  this.UPDATE_add_subquery=1;
  this.updatePreBasicIV();
  this.closeArchiveReader();
  this.closeArchiveWriter();
  DataEngineContext deContext3=newContext(DataEngineContext.MODE_PRESENTATION,fileName,fileName);
  myPreDataEngine=DataEngine.newDataEngine(deContext3);
  this.PRE_execute_query=false;
  this.preBasicIV();
  this.checkOutputFile();
}

Fixed version (ground truth):
/** 
 * @throws BirtException
 * @throws DataException
 * @throws IOException
 */
private void incomprehensiveColumnBinding() throws BirtException, DataException, IOException {
  this.GEN_add_group=true;
  this.GEN_add_subquery=true;
  this.GEN_print=true;
  this.USE_DATE_IN_COLUMNBINDING=false;
  this.genBasicIV();
  this.closeArchiveWriter();
  DataEngineContext deContext2=newContext(DataEngineContext.MODE_UPDATE,fileName,fileName);
  myPreDataEngine=DataEngine.newDataEngine(deContext2);
  this.UPDATE_add_same_group=true;
  this.UPDATE_add_subquery=1;
  this.updatePreBasicIV();
  this.closeArchiveReader();
  this.closeArchiveWriter();
  myPreDataEngine.shutdown();
  DataEngineContext deContext3=newContext(DataEngineContext.MODE_PRESENTATION,fileName,fileName);
  myPreDataEngine=DataEngine.newDataEngine(deContext3);
  this.PRE_execute_query=false;
  this.preBasicIV();
  this.checkOutputFile();
  myPreDataEngine.shutdown();
}
Program: 73693
Project: 73693
Buggy source:
public IPreparedQuery getPreparedQuery(){
  return null;
}

Fixed version (ground truth):
public IPreparedQuery getPreparedQuery(){
  return this.pQuery;
}
Program: 73694
Project: 73694
Buggy source:
/** 
 * @param context
 * @param queryResultID
 * @throws DataException
 */
public CachedQueryResults(String tempDir,String queryResultID) throws DataException {
  Object[] params={tempDir,queryResultID};
  logger.entering(CachedQueryResults.class.getName(),"String_Node_Str",params);
  this.queryResultID=queryResultID;
  this.resultIterator=new CacheResultIterator(tempDir,this);
  logger.exiting(CachedQueryResults.class.getName(),"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * @param context
 * @param queryResultID
 * @throws DataException
 */
public CachedQueryResults(String tempDir,String queryResultID,IPreparedQuery preparedQuery) throws DataException {
  Object[] params={tempDir,queryResultID};
  logger.entering(CachedQueryResults.class.getName(),"String_Node_Str",params);
  this.queryResultID=queryResultID;
  this.resultIterator=new CacheResultIterator(tempDir,this);
  this.pQuery=preparedQuery;
  logger.exiting(CachedQueryResults.class.getName(),"String_Node_Str");
}
Program: 73695
Project: 73695
Buggy source:
public IQueryResults getQueryResults(String queryResultID) throws DataException {
  if (context.getMode() == DataEngineContext.MODE_PRESENTATION) {
    return new QueryResults(this.session.getTempDir(),this.context,queryResultID);
  }
  if (context.getMode() == DataEngineContext.MODE_GENERATION || context.getMode() == DataEngineContext.DIRECT_PRESENTATION) {
    return new CachedQueryResults(session.getTempDir(),queryResultID);
  }
  return null;
}

Fixed version (ground truth):
public IQueryResults getQueryResults(String queryResultID) throws DataException {
  if (context.getMode() == DataEngineContext.MODE_PRESENTATION) {
    return new QueryResults(this.session.getTempDir(),this.context,queryResultID);
  }
  if (context.getMode() == DataEngineContext.MODE_GENERATION || context.getMode() == DataEngineContext.DIRECT_PRESENTATION) {
    return new CachedQueryResults(session.getTempDir(),queryResultID,null);
  }
  return null;
}
Program: 73696
Project: 73696
Buggy source:
public IQueryResults execute(IBaseQueryResults outerResults,Scriptable scope) throws DataException {
  try {
    if (context == null)     return new CachedQueryResults(tempDir,this.queryDefn.getQueryResultsID());
 else     return new QueryResults(this.tempDir,this.context,this.queryDefn.getQueryResultsID(),outerResults);
  }
 catch (  BirtException e) {
    throw DataException.wrap(e);
  }
}

Fixed version (ground truth):
public IQueryResults execute(IBaseQueryResults outerResults,Scriptable scope) throws DataException {
  try {
    if (context == null)     return new CachedQueryResults(tempDir,this.queryDefn.getQueryResultsID(),this);
 else     return new QueryResults(this.tempDir,this.context,this.queryDefn.getQueryResultsID(),outerResults);
  }
 catch (  BirtException e) {
    throw DataException.wrap(e);
  }
}
Program: 73698
Project: 73698
Buggy source:
/** 
 * Constructor.
 * @param columnMetas
 */
ResultMeta(List columnMetas){
  this.columnMetaMap=new HashMap();
  this.indexMap=new HashMap();
  this.nullValueReplacer=new Object[columnMetas.size()];
  for (int i=0; i < columnMetas.size(); i++) {
    ColumnMeta columnMeta=(ColumnMeta)columnMetas.get(i);
    columnMeta.setIndex(i + 1);
    this.columnMetaMap.put(columnMeta.getName(),columnMeta);
    this.indexMap.put(new Integer(i + 1),columnMeta);
    if (columnMeta.isLevelKey() || columnMeta.isMeasure()) {
      this.nullValueReplacer[i]=createNullValueReplacer(columnMeta.getType());
    }
  }
}

Fixed version (ground truth):
/** 
 * Constructor.
 * @param columnMetas
 */
ResultMeta(List columnMetas){
  this.columnMetaMap=new HashMap();
  this.indexMap=new HashMap();
  this.nullValueReplacer=new Object[columnMetas.size()];
  for (int i=0; i < columnMetas.size(); i++) {
    ColumnMeta columnMeta=(ColumnMeta)columnMetas.get(i);
    columnMeta.setIndex(i + 1);
    this.columnMetaMap.put(columnMeta.getName(),columnMeta);
    this.indexMap.put(new Integer(i + 1),columnMeta);
    if (columnMeta.isLevelKey()) {
      this.nullValueReplacer[i]=createNullValueReplacer(columnMeta.getType());
    }
  }
}
Program: 73699
Project: 73699
Buggy source:
/** 
 * @param report
 * @param appContext
 */
protected void doPrepareQuery(Report report,Map appContext){
  this.appContext=appContext;
  List queries=report.getQueries();
  for (int i=0; i < queries.size(); i++) {
    IDataQueryDefinition query=(IDataQueryDefinition)queries.get(i);
    try {
      IBasePreparedQuery preparedQuery=dteSession.prepare(query,appContext);
      queryMap.put(query,preparedQuery);
    }
 catch (    BirtException e) {
      logger.log(Level.SEVERE,e.getMessage(),e);
      context.addException(report.getReportDesign(),e);
    }
  }
}

Fixed version (ground truth):
/** 
 * @param report
 * @param appContext
 */
protected void doPrepareQuery(Report report,Map appContext){
  this.appContext=appContext;
  List queries=report.getQueries();
  int queriesSize=queries.size();
  IDataQueryDefinition[] queryArray=new IDataQueryDefinition[queriesSize];
  for (int index=0; index < queriesSize; index++) {
    queryArray[index]=(IDataQueryDefinition)queries.get(index);
  }
  try {
    this.dteSession.registerQueries(queryArray);
  }
 catch (  AdapterException ae) {
    logger.log(Level.SEVERE,ae.getMessage(),ae);
    context.addException(report.getReportDesign(),ae);
  }
  for (int index=0; index < queriesSize; index++) {
    try {
      IBasePreparedQuery preparedQuery=dteSession.prepare(queryArray[index],appContext);
      queryMap.put(queryArray[index],preparedQuery);
    }
 catch (    BirtException e) {
      logger.log(Level.SEVERE,e.getMessage(),e);
      context.addException(report.getReportDesign(),e);
    }
  }
}
Program: 73701
Project: 73701
Buggy source:
public void testAddHour() throws BirtException {
  String[] scripts=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  Calendar c=Calendar.getInstance();
  c.clear();
  c.set(2005,10,22);
  Date d1=new Date(c.getTimeInMillis());
  c.clear();
  c.set(2006,10,5);
  Date d2=new Date(c.getTimeInMillis());
  c.clear();
  c.set(1795,10,15,10,0,0);
  Date d3=new Date(c.getTimeInMillis());
  c.clear();
  c.set(1970,0,22,0,0,0);
  Date d4=new Date(c.getTimeInMillis());
  c.clear();
  Date[] values=new Date[]{d1,d2,d3,d4};
  for (int i=0; i < values.length; i++) {
    assertEquals(cx.evaluateString(scope,scripts[i],"String_Node_Str",1,null),values[i]);
  }
}

Fixed version (ground truth):
public void testAddHour() throws BirtException {
  String[] scripts=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  Calendar c=Calendar.getInstance();
  c.clear();
  c.set(2005,10,22);
  Date d1=new Date(c.getTimeInMillis());
  c.clear();
  c.set(2006,10,5);
  Date d2=new Date(c.getTimeInMillis());
  c.clear();
  c.set(1795,10,15,10,0,0);
  Date d3=new Date(c.getTimeInMillis());
  c.clear();
  c.set(1970,0,22,0,0,0);
  c.clear();
  Date[] values=new Date[]{d1,d2,d3,null};
  for (int i=0; i < values.length; i++) {
    assertEquals(cx.evaluateString(scope,scripts[i],"String_Node_Str",1,null),values[i]);
  }
}
Program: 73703
Project: 73703
Buggy source:
/** 
 * This is a utility function that will create an unique file name with the timestamp information in the file name and append the file name into the directory name. For example, if the directory name is C:\Log, the returned file name will be C:\Log\ReportEngine_2005_02_26_11_26_56.log.
 * @param directoryName -the directory name of the log file.
 * @return An unique Log file name which is the directory name plus the filename.
 */
private static String generateUniqueLogFileName(String directoryName){
  SimpleDateFormat df=new SimpleDateFormat("String_Node_Str");
  String dateTimeString=df.format(new Date());
  if (directoryName == null)   directoryName="String_Node_Str";
 else   if (directoryName.length() > 0)   directoryName+=System.getProperty("String_Node_Str");
  return new String(directoryName + "String_Node_Str" + dateTimeString+ "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * This is a utility function that will create an unique file name with the timestamp information in the file name and append the file name into the directory name. For example, if the directory name is C:\Log, the returned file name will be C:\Log\ReportEngine_2005_02_26_11_26_56.log.
 * @param directoryName -the directory name of the log file.
 * @return An unique Log file name which is the directory name plus the filename.
 */
private static String generateUniqueLogFileName(String directoryName,String fileName){
  if (fileName == null) {
    SimpleDateFormat df=new SimpleDateFormat("String_Node_Str");
    String dateTimeString=df.format(new Date());
    fileName="String_Node_Str" + dateTimeString + "String_Node_Str";
  }
  if (directoryName == null)   directoryName="String_Node_Str";
 else   if (directoryName.length() > 0)   directoryName+=System.getProperty("String_Node_Str");
  return new String(directoryName + fileName);
}
Program: 73704
Project: 73704
Buggy source:
/** 
 * This function should only called by the main application that starts BIRT. It will add a new log handler to the global BIRT logger.
 * @param directoryName -the directory name of the log file (e.g. C:\Log). The final file name will be the directory name plus an unique file name. For example, if the directory name is C:\Log, the log file name will be something like C:\Log\ReportEngine_2005_02_26_11_26_56.log
 * @param logLevel -the log level to be set. If logLevel is null, it will be ignored.
 */
public static void startEngineLogging(Logger logger,String directoryName,Level logLevel){
  Logger rootLogger=Logger.getLogger(BIRT_NAME_SPACE);
  if (sharedHandler == null) {
    sharedHandler=new EngineLoggerHandler(rootLogger);
    sharedHandler.setLevel(Level.ALL);
    rootLogger.addHandler(sharedHandler);
  }
  if (fileLogger != null) {
    closeFileLogger(fileLogger);
    fileLogger=null;
  }
  if (logger != null && isValidLogger(logger)) {
    userLogger=logger;
    sharedHandler.setSharedLogger(userLogger);
  }
 else {
    if (directoryName != null) {
      dirName=directoryName;
    }
    if (logLevel == null) {
      logLevel=rootLogger.getLevel();
    }
    if (logLevel != Level.OFF && dirName != null) {
      fileLogger=createFileLogger(dirName);
      sharedHandler.setSharedLogger(fileLogger);
    }
    rootLogger.setLevel(logLevel);
  }
  rootLogger.setUseParentHandlers(false);
}

Fixed version (ground truth):
/** 
 * This function should only called by the main application that starts BIRT. It will add a new log handler to the global BIRT logger.
 * @param directoryName -the directory name of the log file (e.g. C:\Log). The final file name will be the directory name plus an unique file name. For example, if the directory name is C:\Log, the log file name will be something like C:\Log\ReportEngine_2005_02_26_11_26_56.log
 * @param logLevel -the log level to be set. If logLevel is null, it will be ignored.
 */
public static void startEngineLogging(Logger logger,String directoryName,String file,Level logLevel){
  Logger rootLogger=Logger.getLogger(BIRT_NAME_SPACE);
  if (sharedHandler == null) {
    sharedHandler=new EngineLoggerHandler(rootLogger);
    sharedHandler.setLevel(Level.ALL);
    rootLogger.addHandler(sharedHandler);
  }
  if (fileLogger != null) {
    closeFileLogger(fileLogger);
    fileLogger=null;
  }
  if (logger != null && isValidLogger(logger)) {
    userLogger=logger;
    sharedHandler.setSharedLogger(userLogger);
  }
 else {
    if (directoryName != null) {
      dirName=directoryName;
    }
    if (file != null) {
      fileName=file;
    }
    if (logLevel == null) {
      logLevel=rootLogger.getLevel();
    }
    if (logLevel != Level.OFF && (dirName != null || fileName != null)) {
      fileLogger=createFileLogger(dirName,fileName);
      sharedHandler.setSharedLogger(fileLogger);
    }
    rootLogger.setLevel(logLevel);
  }
  rootLogger.setUseParentHandlers(false);
}
Program: 73705
Project: 73705
Buggy source:
private static Logger createFileLogger(String dirName){
  try {
    File directory=new File(dirName);
    if (!directory.exists()) {
      if (!directory.mkdirs())       throw new IOException("String_Node_Str" + dirName + "String_Node_Str");
    }
 else {
      if (directory.isFile())       throw new IOException("String_Node_Str" + dirName + "String_Node_Str");
    }
    Handler logFileHandler=new FileHandler(generateUniqueLogFileName(dirName),true);
    logFileHandler.setFormatter(new SimpleFormatter());
    logFileHandler.setLevel(Level.FINEST);
    Logger logger=Logger.getAnonymousLogger();
    logger.addHandler(logFileHandler);
    return logger;
  }
 catch (  SecurityException e) {
    logger.log(Level.WARNING,e.getMessage(),e);
  }
catch (  IOException e) {
    logger.log(Level.WARNING,e.getMessage(),e);
  }
  return null;
}

Fixed version (ground truth):
private static Logger createFileLogger(String dirName,String fileName){
  try {
    if (dirName != null) {
      File directory=new File(dirName);
      if (!directory.exists()) {
        if (!directory.mkdirs())         throw new IOException("String_Node_Str" + dirName + "String_Node_Str");
      }
 else {
        if (directory.isFile())         throw new IOException("String_Node_Str" + dirName + "String_Node_Str");
      }
    }
    Handler logFileHandler=new FileHandler(generateUniqueLogFileName(dirName,fileName),true);
    logFileHandler.setFormatter(new SimpleFormatter());
    logFileHandler.setLevel(Level.FINEST);
    Logger logger=Logger.getAnonymousLogger();
    logger.addHandler(logFileHandler);
    return logger;
  }
 catch (  SecurityException e) {
    logger.log(Level.WARNING,e.getMessage(),e);
  }
catch (  IOException e) {
    logger.log(Level.WARNING,e.getMessage(),e);
  }
  return null;
}
Program: 73706
Project: 73706
Buggy source:
/** 
 * Change the log level to the newLevel
 * @param newLevel -new log level
 */
public static void changeLogLevel(Level newLevel){
  if (newLevel != null) {
    if (userLogger != null) {
      if (newLevel != Level.OFF && fileLogger == null && dirName != null) {
        fileLogger=createFileLogger(dirName);
        if (fileLogger != null) {
          sharedHandler.setSharedLogger(fileLogger);
        }
      }
    }
    Logger rootLogger=Logger.getLogger(BIRT_NAME_SPACE);
    rootLogger.setLevel(newLevel);
  }
}

Fixed version (ground truth):
/** 
 * Change the log level to the newLevel
 * @param newLevel -new log level
 */
public static void changeLogLevel(Level newLevel){
  if (newLevel != null) {
    if (userLogger != null) {
      if (newLevel != Level.OFF && fileLogger == null && (dirName != null || fileName != null)) {
        fileLogger=createFileLogger(dirName,fileName);
        if (fileLogger != null) {
          sharedHandler.setSharedLogger(fileLogger);
        }
      }
    }
    Logger rootLogger=Logger.getLogger(BIRT_NAME_SPACE);
    rootLogger.setLevel(newLevel);
  }
}
Program: 73707
Project: 73707
Buggy source:
/** 
 * set up engine logging
 */
private void intializeLogger(){
  Logger logger=null;
  String dest=null;
  Level level=Level.WARNING;
  if (config != null) {
    logger=config.getLogger();
    dest=config.getLogDirectory();
    level=config.getLogLevel();
    if (level == null) {
      level=Level.WARNING;
    }
  }
  EngineLogger.startEngineLogging(logger,dest,level);
}

Fixed version (ground truth):
/** 
 * set up engine logging
 */
private void intializeLogger(){
  Logger logger=null;
  String dest=null;
  String file=null;
  Level level=Level.WARNING;
  if (config != null) {
    logger=config.getLogger();
    dest=config.getLogDirectory();
    file=config.getLogFile();
    level=config.getLogLevel();
    if (level == null) {
      level=Level.WARNING;
    }
  }
  EngineLogger.startEngineLogging(logger,dest,file,level);
}
Program: 73708
Project: 73708
Buggy source:
public void setLogger(Logger logger){
  if (logger != null) {
    EngineLogger.startEngineLogging(logger,null,null);
  }
}

Fixed version (ground truth):
public void setLogger(Logger logger){
  if (logger != null) {
    EngineLogger.startEngineLogging(logger,null,null,null);
  }
}
Program: 73711
Project: 73711
Buggy source:
private void updatePredefinedQueries(){
  CubeHandle cube=getCube();
  if (cube == null) {
    getContext().addPredefinedQuery(ChartUIConstants.QUERY_CATEGORY,null);
    getContext().addPredefinedQuery(ChartUIConstants.QUERY_VALUE,null);
    getContext().addPredefinedQuery(ChartUIConstants.QUERY_OPTIONAL,null);
  }
 else {
    List measures=ChartReportItemUtil.getAllMeasures(cube);
    if (!measures.isEmpty()) {
      String[] exprs=new String[measures.size()];
      for (int i=0; i < exprs.length; i++) {
        exprs[i]=ExpressionUtil.createJSMeasureExpression(((MeasureHandle)measures.get(i)).getName());
      }
      getContext().addPredefinedQuery(ChartUIConstants.QUERY_VALUE,exprs);
    }
    List levels=ChartReportItemUtil.getAllLevels(cube);
    if (!levels.isEmpty()) {
      String[] exprs=new String[levels.size()];
      for (int i=0; i < exprs.length; i++) {
        LevelHandle level=(LevelHandle)levels.get(i);
        exprs[i]=ExpressionUtil.createJSDimensionExpression(level.getContainer().getContainer().getName(),level.getName());
      }
      getContext().addPredefinedQuery(ChartUIConstants.QUERY_CATEGORY,exprs);
      getContext().addPredefinedQuery(ChartUIConstants.QUERY_OPTIONAL,exprs);
    }
  }
  fireEvent(btnBinding,EVENT_QUERY);
}

Fixed version (ground truth):
private void updatePredefinedQueries(){
  CubeHandle cube=getCube();
  if (cube == null) {
    getContext().addPredefinedQuery(ChartUIConstants.QUERY_CATEGORY,null);
    getContext().addPredefinedQuery(ChartUIConstants.QUERY_VALUE,null);
    getContext().addPredefinedQuery(ChartUIConstants.QUERY_OPTIONAL,null);
  }
 else {
    List measures=ChartReportItemUtil.getAllMeasures(cube);
    if (!measures.isEmpty()) {
      String[] exprs=new String[measures.size()];
      for (int i=0; i < exprs.length; i++) {
        exprs[i]=ExpressionUtil.createJSMeasureExpression(((MeasureHandle)measures.get(i)).getName());
      }
      getContext().addPredefinedQuery(ChartUIConstants.QUERY_VALUE,exprs);
    }
    List levels=ChartReportItemUtil.getAllLevels(cube);
    if (!levels.isEmpty()) {
      String[] exprs=new String[levels.size()];
      for (int i=0; i < exprs.length; i++) {
        exprs[i]=ChartReportItemUtil.createDimensionExpression((LevelHandle)levels.get(i));
      }
      getContext().addPredefinedQuery(ChartUIConstants.QUERY_CATEGORY,exprs);
      getContext().addPredefinedQuery(ChartUIConstants.QUERY_OPTIONAL,exprs);
    }
  }
  fireEvent(btnBinding,EVENT_QUERY);
}
Program: 73712
Project: 73712
Buggy source:
private CrosstabCellHandle getLevelCell(CrosstabViewHandle xtab){
  DimensionViewHandle dim=xtab.getDimension(0);
  if (dim != null) {
    LevelViewHandle level=dim.getLevel(0);
    if (level != null) {
      return level.getCell();
    }
  }
  return null;
}

Fixed version (ground truth):
private CrosstabCellHandle getLevelCell(CrosstabViewHandle xtab){
  if (xtab == null) {
    return null;
  }
  DimensionViewHandle dim=xtab.getDimension(0);
  if (dim != null) {
    LevelViewHandle level=dim.getLevel(0);
    if (level != null) {
      return level.getCell();
    }
  }
  return null;
}
Program: 73713
Project: 73713
Buggy source:
public boolean next(){
  try {
    EdgeCursor edge=getEdge();
    return edge.next();
  }
 catch (  OLAPException e) {
    logger.log(e);
  }
  return false;
}

Fixed version (ground truth):
public boolean next(){
  iIndex++;
  try {
    EdgeCursor subEdge=getSubEdge();
    if (subEdge != null) {
      if (subEdge.next()) {
        return true;
      }
      lstBreaks.add(new Integer(iIndex));
      subEdge.first();
      return getMainEdge().next();
    }
 else {
      return getMainEdge().next();
    }
  }
 catch (  OLAPException e) {
    logger.log(e);
  }
  return false;
}
Program: 73714
Project: 73714
Buggy source:
/** 
 * The constructor.
 * @param set
 * @param definition
 */
public BIRTCubeResultSetEvaluator(ICubeResultSet set){
  this.rs=set;
}

Fixed version (ground truth):
public BIRTCubeResultSetEvaluator(ICubeResultSet rs){
  this.rs=rs;
}
Program: 73715
Project: 73715
Buggy source:
public Object evaluate(String expression){
  Object result=null;
  try {
    result=rs.getCubeCursor().getObject(ChartCubeQueryHelper.getBindingName(expression));
  }
 catch (  OLAPException e) {
    logger.log(e);
  }
  return result;
}

Fixed version (ground truth):
public Object evaluate(String expression){
  Object result=null;
  try {
    result=getCubeCursor().getObject(ChartCubeQueryHelper.getBindingName(expression));
  }
 catch (  OLAPException e) {
    logger.log(e);
  }
  return result;
}
Program: 73716
Project: 73716
Buggy source:
public boolean first(){
  try {
    EdgeCursor edge=getEdge();
    return edge.first();
  }
 catch (  OLAPException e) {
    logger.log(e);
  }
  return false;
}

Fixed version (ground truth):
public boolean first(){
  try {
    getMainEdge().first();
    EdgeCursor subEdge=getSubEdge();
    if (subEdge != null) {
      subEdge.first();
    }
    bWithoutSub=getCubeCursor().getOrdinateEdge().size() <= 1;
    return true;
  }
 catch (  OLAPException e) {
    logger.log(e);
  }
  return false;
}
Program: 73717
Project: 73717
Buggy source:
public IDataRowExpressionEvaluator prepareRowExpressionEvaluator(Chart cm,List columnExpression,int rowCount,boolean isStringType) throws ChartException {
  ClassLoader oldContextLoader=Thread.currentThread().getContextClassLoader();
  ClassLoader parentLoader=oldContextLoader;
  if (parentLoader == null)   parentLoader=this.getClass().getClassLoader();
  ClassLoader newContextLoader=getCustomScriptClassLoader(parentLoader);
  Thread.currentThread().setContextClassLoader(newContextLoader);
  try {
    DataRequestSession session=prepareDataRequestSession(getMaxRow());
    BaseQueryHelper cbqh=new BaseQueryHelper(itemHandle,cm);
    QueryDefinition queryDefn=(QueryDefinition)cbqh.createBaseQuery(columnExpression);
    resetParametersForDataPreview(getDataSetFromHandle(),queryDefn);
    IQueryResults actualResultSet=session.executeQuery(queryDefn,null,itemHandle.getPropertyHandle(ExtendedItemHandle.FILTER_PROP).iterator(),ChartReportItemUtil.getColumnDataBindings(itemHandle));
    if (actualResultSet != null) {
      return new ChartBuilderGrupedQueryResultSetEvaluator(actualResultSet.getResultIterator(),ChartReportItemUtil.hasAggregation(cm));
    }
  }
 catch (  BirtException e) {
    throw new ChartException(ChartReportItemUIActivator.ID,ChartException.DATA_BINDING,e);
  }
 finally {
    Thread.currentThread().setContextClassLoader(oldContextLoader);
  }
  return null;
}

Fixed version (ground truth):
public IDataRowExpressionEvaluator prepareRowExpressionEvaluator(Chart cm,List columnExpression,int rowCount,boolean isStringType) throws ChartException {
  ClassLoader oldContextLoader=Thread.currentThread().getContextClassLoader();
  ClassLoader parentLoader=oldContextLoader;
  if (parentLoader == null)   parentLoader=this.getClass().getClassLoader();
  ClassLoader newContextLoader=getCustomScriptClassLoader(parentLoader);
  Thread.currentThread().setContextClassLoader(newContextLoader);
  try {
    DataRequestSession session=prepareDataRequestSession(getMaxRow());
    BaseQueryHelper cbqh=new BaseQueryHelper(itemHandle,cm);
    QueryDefinition queryDefn=(QueryDefinition)cbqh.createBaseQuery(columnExpression);
    resetParametersForDataPreview(getDataSetFromHandle(),queryDefn);
    IQueryResults actualResultSet=session.executeQuery(queryDefn,null,itemHandle.getPropertyHandle(ExtendedItemHandle.FILTER_PROP).iterator(),ChartReportItemUtil.getColumnDataBindings(itemHandle));
    if (actualResultSet != null) {
      return new ChartBuilderGroupedQueryResultSetEvaluator(actualResultSet.getResultIterator(),ChartReportItemUtil.hasAggregation(cm));
    }
  }
 catch (  BirtException e) {
    throw new ChartException(ChartReportItemUIActivator.ID,ChartException.DATA_BINDING,e);
  }
 finally {
    Thread.currentThread().setContextClassLoader(oldContextLoader);
  }
  return null;
}
Program: 73718
Project: 73718
Buggy source:
/** 
 * Validates current script.
 */
protected void validate(){
  try {
    validator.validate(false);
  }
 catch (  ParseException e) {
    return;
  }
}

Fixed version (ground truth):
/** 
 * Validates current script.
 */
protected void validate(){
  try {
    validator.validate(true,false);
  }
 catch (  ParseException e) {
    return;
  }
}
Program: 73719
Project: 73719
Buggy source:
/** 
 * Validates the contents of this editor.
 */
public void doValidate(){
  Image image=null;
  String message=null;
  if (scriptValidator == null) {
    return;
  }
  try {
    scriptValidator.validate();
    image=ReportPlatformUIImages.getImage(IReportGraphicConstants.ICON_SCRIPT_NOERROR);
    message=Messages.getString("String_Node_Str");
  }
 catch (  ParseException e) {
    image=ReportPlatformUIImages.getImage(IReportGraphicConstants.ICON_SCRIPT_ERROR);
    message=e.getLocalizedMessage();
  }
 finally {
    setValidateIcon(image,message);
    setFocus();
  }
}

Fixed version (ground truth):
/** 
 * Validates the contents of this editor.
 */
public void doValidate(){
  Image image=null;
  String message=null;
  if (scriptValidator == null) {
    return;
  }
  try {
    scriptValidator.validate(true,true);
    image=ReportPlatformUIImages.getImage(IReportGraphicConstants.ICON_SCRIPT_NOERROR);
    message=Messages.getString("String_Node_Str");
  }
 catch (  ParseException e) {
    image=ReportPlatformUIImages.getImage(IReportGraphicConstants.ICON_SCRIPT_ERROR);
    message=e.getLocalizedMessage();
  }
 finally {
    setValidateIcon(image,message);
    setFocus();
  }
}
Program: 73720
Project: 73720
Buggy source:
/** 
 * Validates the current script.
 * @return <code>true</code> if no error was found, <code>false</code>otherwise.
 */
protected boolean validateScript(){
  if (sourceViewer == null) {
    return false;
  }
  String errorMessage=null;
  try {
    new ScriptValidator(sourceViewer).validate();
    setMessage(Messages.getString("String_Node_Str"),IMessageProvider.INFORMATION);
    return true;
  }
 catch (  ParseException e) {
    int offset=e.getErrorOffset();
    int row=sourceViewer.getTextWidget().getLineAtOffset(offset) + 1;
    int column=offset - sourceViewer.getTextWidget().getOffsetAtLine(row - 1) + 1;
    errorMessage=Messages.getFormattedString("String_Node_Str",new Object[]{Integer.toString(row),Integer.toString(column),e.getLocalizedMessage()});
    return false;
  }
 finally {
    setErrorMessage(errorMessage);
  }
}

Fixed version (ground truth):
/** 
 * Validates the current script.
 * @return <code>true</code> if no error was found, <code>false</code>otherwise.
 */
protected boolean validateScript(){
  if (sourceViewer == null) {
    return false;
  }
  String errorMessage=null;
  try {
    new ScriptValidator(sourceViewer).validate(true,true);
    setMessage(Messages.getString("String_Node_Str"),IMessageProvider.INFORMATION);
    return true;
  }
 catch (  ParseException e) {
    int offset=e.getErrorOffset();
    int row=sourceViewer.getTextWidget().getLineAtOffset(offset) + 1;
    int column=offset - sourceViewer.getTextWidget().getOffsetAtLine(row - 1) + 1;
    errorMessage=Messages.getFormattedString("String_Node_Str",new Object[]{Integer.toString(row),Integer.toString(column),e.getLocalizedMessage()});
    return false;
  }
 finally {
    setErrorMessage(errorMessage);
  }
}
Program: 73721
Project: 73721
Buggy source:
/** 
 * initializes numeric format pattern
 * @param patternStr ths string used for formatting numeric data
 */
public void applyPattern(String patternStr){
  try {
    this.formatPattern=patternStr;
    hexFlag=false;
    if (this.formatPattern == null) {
      numberFormat=NumberFormat.getInstance(locale.toLocale());
      numberFormat.setGroupingUsed(false);
      decimalFormat=new DecimalFormat("String_Node_Str",new DecimalFormatSymbols(locale.toLocale()));
      decimalFormat.setGroupingUsed(false);
      return;
    }
    if (patternStr.length() == 1) {
      handleSingleCharFormatString(patternStr.charAt(0));
      return;
    }
    handleNamedFormats(patternStr);
  }
 catch (  Exception illeagueE) {
    logger.log(Level.WARNING,illeagueE.getMessage(),illeagueE);
  }
}

Fixed version (ground truth):
/** 
 * initializes numeric format pattern
 * @param patternStr ths string used for formatting numeric data
 */
public void applyPattern(String patternStr){
  try {
    this.formatPattern=patternStr;
    hexFlag=false;
    if (this.formatPattern == null) {
      numberFormat=NumberFormat.getInstance(locale.toLocale());
      numberFormat.setGroupingUsed(false);
      DecimalFormatSymbols symbols=new DecimalFormatSymbols(locale.toLocale());
      decimalSeparator=symbols.getDecimalSeparator();
      decimalFormat=new DecimalFormat("String_Node_Str",new DecimalFormatSymbols(locale.toLocale()));
      decimalFormat.setGroupingUsed(false);
      return;
    }
    if (patternStr.length() == 1) {
      handleSingleCharFormatString(patternStr.charAt(0));
      return;
    }
    handleNamedFormats(patternStr);
  }
 catch (  Exception illeagueE) {
    logger.log(Level.WARNING,illeagueE.getMessage(),illeagueE);
  }
}
Program: 73723
Project: 73723
Buggy source:
protected boolean calculateEnabled(){
  if (getSelectedObjects().size() != 1) {
    return false;
  }
  EditPart part=(EditPart)getSelectedObjects().get(0);
  Object model=part.getModel();
  if (!(model instanceof ReportItemHandle) && model instanceof IAdaptable) {
    model=((IAdaptable)model).getAdapter(DesignElementHandle.class);
  }
  if (!(model instanceof ReportItemHandle)) {
    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)) {
    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;
}