nus-yam/ex-repair huggingface dataset:
Program: 66497
Project: 66497
Buggy source:
protected IExtractionResults extractQuery(DataSetHandle dataset) throws BirtException {
  QueryDefinition newQuery=constructQuery(dataset);
  DataRequestSession session=executionContext.getDataEngine().getDTESession();
  final ModelDteApiAdapter apiAdapter=new ModelDteApiAdapter(executionContext);
  apiAdapter.defineDataSet(dataset,session);
  session.registerQueries(new IQueryDefinition[]{newQuery});
  IBasePreparedQuery preparedQuery=session.prepare(newQuery);
  IQueryResults result=(IQueryResults)session.execute(preparedQuery,null,executionContext.getScriptContext());
  ResultMetaData metadata=new ResultMetaData(result.getResultMetaData());
  return new ExtractionResults(result,metadata,null,0,maxRow){
    public void close(){
      super.close();
      apiAdapter.close();
    }
  }
;
}

Fixed version (ground truth):
protected IExtractionResults extractQuery(DataSetHandle dataset) throws BirtException {
  QueryDefinition newQuery=constructQuery(dataset);
  DataRequestSession session=executionContext.getDataEngine().getDTESession();
  ModelDteApiAdapter apiAdapter=new ModelDteApiAdapter(executionContext);
  apiAdapter.defineDataSet(dataset,session);
  session.registerQueries(new IQueryDefinition[]{newQuery});
  IBasePreparedQuery preparedQuery=session.prepare(newQuery);
  IQueryResults result=(IQueryResults)session.execute(preparedQuery,null,executionContext.getScriptContext());
  ResultMetaData metadata=new ResultMetaData(result.getResultMetaData());
  return new ExtractionResults(result,metadata,null,0,maxRow);
}
Program: 66498
Project: 66498
Buggy source:
public void shutdown(){
  dteSession.shutdown();
  queryCache.close();
  adapter.close();
  if (factory != null) {
    factory.closeDataEngine(this);
  }
}

Fixed version (ground truth):
public void shutdown(){
  dteSession.shutdown();
  queryCache.close();
  if (factory != null) {
    factory.closeDataEngine(this);
  }
}
Program: 66501
Project: 66501
Buggy source:
private void refactorCubeQueryDefinition(ICubeQueryDefinition query) throws DataException, AdapterException {
  List bindings=query.getBindings();
  List levelExprList=getAllAggrOns(query);
  for (int i=0; i < bindings.size(); i++) {
    IBinding binding=(IBinding)bindings.get(i);
    if (binding.getAggrFunction() != null) {
      if (IBuildInAggregation.TOTAL_TOP_N_FUNC.equals(binding.getAggrFunction()) || IBuildInAggregation.TOTAL_BOTTOM_N_FUNC.equals(binding.getAggrFunction()) || IBuildInAggregation.TOTAL_TOP_N_FUNC.equals(binding.getAggrFunction())|| IBuildInAggregation.TOTAL_TOP_N_FUNC.equals(binding.getAggrFunction())) {
        throw new AdapterException(ResourceConstants.UNSUPPORTED_AGGR_IN_BINDING,new Object[]{binding.getBindingName()});
      }
    }
    String measureName=OlapExpressionUtil.getMeasure(binding.getExpression());
    if (measureName != null) {
      if (binding.getAggrFunction() == null) {
        String aggrFunc=getAggrFunction(query,measureName);
        binding.setAggrFunction(aggrFunc);
        if (binding.getAggregatOns().size() == 0) {
          for (Iterator itr=levelExprList.iterator(); itr.hasNext(); ) {
            binding.addAggregateOn(itr.next().toString());
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
private void refactorCubeQueryDefinition(ICubeQueryDefinition query) throws DataException, AdapterException {
  List bindings=query.getBindings();
  List levelExprList=getAllAggrOns(query);
  for (int i=0; i < bindings.size(); i++) {
    IBinding binding=(IBinding)bindings.get(i);
    String measureName=OlapExpressionUtil.getMeasure(binding.getExpression());
    if (measureName != null) {
      if (binding.getAggrFunction() == null) {
        String aggrFunc=getAggrFunction(query,measureName);
        binding.setAggrFunction(aggrFunc);
        if (binding.getAggregatOns().size() == 0) {
          for (Iterator itr=levelExprList.iterator(); itr.hasNext(); ) {
            binding.addAggregateOn(itr.next().toString());
          }
        }
      }
    }
  }
}
Program: 66502
Project: 66502
Buggy source:
public boolean next() throws DataException {
  if (this.index < this.cachedRows.size() - 1) {
    this.index++;
    return true;
  }
 else   if (this.index == this.cachedRows.size() - 1) {
    boolean result=this.source.next();
    this.index++;
    if (result) {
      this.cachedRows.add(new ResultObjectHolder(this.source.getCurrentResult(),this.source.getStartingGroupLevel(),this.source.getEndingGroupLevel(),source.getGroupIndex()));
    }
    return result;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
public boolean next() throws DataException {
  if (this.index < this.cachedRows.size() - 1) {
    this.source.saveToDataSetStream(this.getCurrentResult());
    this.index++;
    if (index == this.cachedRows.size() - 1) {
      this.source.saveToDataSetStream(this.getCurrentResult());
    }
    return true;
  }
 else   if (this.index == this.cachedRows.size() - 1) {
    boolean result=this.source.next();
    this.index++;
    if (result) {
      this.cachedRows.add(new ResultObjectHolder(this.source.getCurrentResult(),this.source.getStartingGroupLevel(),this.source.getEndingGroupLevel(),source.getGroupIndex()));
    }
    return result;
  }
 else {
    return false;
  }
}
Program: 66503
Project: 66503
Buggy source:
public boolean next() throws DataException {
  if (currResultObj == null)   return false;
  if (this.streamsWrapper != null && currResultObj != null) {
    try {
      if (dataSetStream != null) {
        int colCount=this.populateResultClass(this.currResultObj.getResultClass()).getFieldCount();
        IOUtil.writeLong(dataSetLenStream,offset);
        offset+=ResultSetUtil.writeResultObject(new DataOutputStream(dataSetStream),currResultObj,colCount,resultSetNameSet,streamsWrapper.getOutputStringTable(getResultClass()),streamsWrapper.getStreamForIndex(getResultClass(),handler.getAppContext()),this.rowCount - 1);
      }
    }
 catch (    IOException e) {
      throw new DataException(e.getLocalizedMessage(),e);
    }
  }
  try {
    this.groupCalculator.next(this.rowResultSet.getIndex());
    this.groupCalculator.registerPreviousResultObject(this.currResultObj);
    this.currResultObj=this.rowResultSet.next();
    this.groupCalculator.registerCurrentResultObject(this.currResultObj);
    this.groupCalculator.registerNextResultObject(this.rowResultSet.getNext());
  }
 catch (  DataException e) {
    this.currResultObj=null;
    throw e;
  }
  if (this.currResultObj != null)   rowCount++;
  return this.currResultObj != null;
}

Fixed version (ground truth):
public boolean next() throws DataException {
  if (currResultObj == null)   return false;
  saveToDataSetStream(currResultObj);
  try {
    this.groupCalculator.next(this.rowResultSet.getIndex());
    this.groupCalculator.registerPreviousResultObject(this.currResultObj);
    this.currResultObj=this.rowResultSet.next();
    this.groupCalculator.registerCurrentResultObject(this.currResultObj);
    this.groupCalculator.registerNextResultObject(this.rowResultSet.getNext());
  }
 catch (  DataException e) {
    this.currResultObj=null;
    throw e;
  }
  if (this.currResultObj != null)   rowCount++;
  return this.currResultObj != null;
}
Program: 66504
Project: 66504
Buggy source:
/** 
 * clear unused column hints
 * @throws BirtException
 */
private final void clearUnusedColumnHints(DataSetHandle dataSetHandle,IResultMetaData metaData) throws BirtException {
  PropertyHandle handle=dataSetHandle.getPropertyHandle(DataSetHandle.COLUMN_HINTS_PROP);
  if (handle != null && handle.getListValue() != null) {
    ArrayList list=handle.getListValue();
    int count=list.size();
    for (int n=count - 1; n >= 0; n--) {
      ColumnHint hint=(ColumnHint)list.get(n);
      String columnName=(String)hint.getProperty(handle.getModule(),ColumnHint.COLUMN_NAME_MEMBER);
      boolean found=false;
      if (!isEmpty(hint,handle.getModule().getModuleHandle())) {
        for (int m=0; m < metaData.getColumnCount() && !found; m++) {
          found=columnName.equals(metaData.getColumnName(m + 1));
        }
        if (!found) {
          try {
            handle.removeItem(hint);
          }
 catch (          PropertyValueException e) {
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * clear unused column hints
 * @throws BirtException
 */
private final void clearUnusedColumnHints(DataSetHandle dataSetHandle,IResultMetaData metaData) throws BirtException {
  PropertyHandle handle=dataSetHandle.getPropertyHandle(DataSetHandle.COLUMN_HINTS_PROP);
  if (handle != null && handle.getListValue() != null) {
    ArrayList list=handle.getListValue();
    int count=list.size();
    for (int n=count - 1; n >= 0; n--) {
      ColumnHint hint=(ColumnHint)list.get(n);
      String columnName=(String)hint.getProperty(handle.getModule(),ColumnHint.COLUMN_NAME_MEMBER);
      String alias=(String)hint.getProperty(handle.getModule(),ColumnHint.ALIAS_MEMBER);
      boolean found=false;
      if (!isEmpty(hint,handle.getModule().getModuleHandle())) {
        for (int m=0; m < metaData.getColumnCount() && !found; m++) {
          String name=metaData.getColumnName(m + 1);
          if (name != null && (name.equals(columnName)) || name.equals(alias)) {
            found=true;
            break;
          }
        }
        if (!found) {
          try {
            handle.removeItem(hint);
          }
 catch (          PropertyValueException e) {
          }
        }
      }
    }
  }
}
Program: 66506
Project: 66506
Buggy source:
/** 
 * @param d
 * @return
 */
private static Calendar getCalendar(Date d){
  Calendar c=null;
  if (d instanceof java.sql.Date) {
    c=Calendar.getInstance(TimeZone.getDefault(),defaultLocale);
  }
 else {
    c=Calendar.getInstance(timeZone,defaultLocale);
  }
  if (d == null) {
    c.clear();
    c.set(1970,0,1);
  }
 else {
    c.setTime(d);
  }
  return c;
}

Fixed version (ground truth):
/** 
 * @param d
 * @return
 */
private static Calendar getCalendar(Date d){
  Calendar c=null;
  if (d instanceof java.sql.Date) {
    c=Calendar.getInstance(TimeZone.getDefault(),defaultLocale);
  }
 else {
    c=Calendar.getInstance(timeZone,defaultLocale);
  }
  c.setMinimalDaysInFirstWeek(1);
  if (d == null) {
    c.clear();
    c.set(1970,0,1);
  }
 else {
    c.setTime(d);
  }
  return c;
}
Program: 66507
Project: 66507
Buggy source:
public boolean next() throws DataException {
  if (currResultObj == null)   return false;
  if (this.streamsWrapper != null && currResultObj != null) {
    try {
      if (dataSetStream != null) {
        int colCount=this.populateResultClass(this.currResultObj.getResultClass()).getFieldCount();
        IOUtil.writeLong(dataSetLenStream,offset);
        offset+=ResultSetUtil.writeResultObject(new DataOutputStream(dataSetStream),currResultObj,colCount,resultSetNameSet,streamsWrapper.getOutputStringTable(getResultClass()),streamsWrapper.getStreamForIndex(getResultClass(),handler.getAppContext()),this.rowCount - 1);
      }
    }
 catch (    IOException e) {
      throw new DataException(e.getLocalizedMessage(),e);
    }
  }
  try {
    this.groupCalculator.next();
    this.groupCalculator.registerPreviousResultObject(this.currResultObj);
    this.currResultObj=this.rowResultSet.next();
    this.groupCalculator.registerCurrentResultObject(this.currResultObj);
  }
 catch (  DataException e) {
    this.currResultObj=null;
    throw e;
  }
  if (this.currResultObj != null)   rowCount++;
  return this.currResultObj != null;
}

Fixed version (ground truth):
public boolean next() throws DataException {
  if (currResultObj == null)   return false;
  if (this.streamsWrapper != null && currResultObj != null) {
    try {
      if (dataSetStream != null) {
        int colCount=this.populateResultClass(this.currResultObj.getResultClass()).getFieldCount();
        IOUtil.writeLong(dataSetLenStream,offset);
        offset+=ResultSetUtil.writeResultObject(new DataOutputStream(dataSetStream),currResultObj,colCount,resultSetNameSet,streamsWrapper.getOutputStringTable(getResultClass()),streamsWrapper.getStreamForIndex(getResultClass(),handler.getAppContext()),this.rowCount - 1);
      }
    }
 catch (    IOException e) {
      throw new DataException(e.getLocalizedMessage(),e);
    }
  }
  try {
    this.groupCalculator.registerCurrentResultObject(this.currResultObj);
    this.groupCalculator.registerPreviousResultObject(this.previewObj);
    this.previewObj=this.currResultObj;
    this.currResultObj=this.rowResultSet.next();
    this.groupCalculator.registerNextResultObject(this.currResultObj);
    this.groupCalculator.next();
  }
 catch (  DataException e) {
    this.currResultObj=null;
    throw e;
  }
  if (this.currResultObj != null)   rowCount++;
  return this.currResultObj != null;
}
Program: 66508
Project: 66508
Buggy source:
public int getStartingGroupLevel() throws DataException {
  return this.groupCalculator.getStartingGroup();
}

Fixed version (ground truth):
public int getStartingGroupLevel() throws DataException {
  this.groupCalculator.registerCurrentResultObject(this.currResultObj);
  this.groupCalculator.registerPreviousResultObject(this.previewObj);
  return this.groupCalculator.getStartingGroup();
}
Program: 66509
Project: 66509
Buggy source:
public int getEndingGroupLevel() throws DataException {
  this.groupCalculator.registerNextResultObject(this.rowResultSet.getNext());
  return this.groupCalculator.getEndingGroup();
}

Fixed version (ground truth):
public int getEndingGroupLevel() throws DataException {
  this.groupCalculator.registerCurrentResultObject(this.currResultObj);
  this.groupCalculator.registerNextResultObject(this.rowResultSet.getNext());
  return this.groupCalculator.getEndingGroup();
}
Program: 66511
Project: 66511
Buggy source:
public void update(AbstractArea area) throws BirtException {
  super.update(area);
  if (currentIP + area.getAllocatedWidth() > getContentWidth()) {
    setNeedClip(true);
  }
}

Fixed version (ground truth):
public void update(AbstractArea area) throws BirtException {
  super.update(area);
  if (currentIP + area.getAllocatedWidth() > getContentWidth() || area.getX() < 0) {
    setNeedClip(true);
  }
}
Program: 66512
Project: 66512
Buggy source:
public boolean canFinish(){
  return dataSetPage.canFinish() && columnDefPage.isPageComplete();
}

Fixed version (ground truth):
public boolean canFinish(){
  return dataSetPage.isPageComplete() && dataSetPage.canFinish() && columnDefPage.isPageComplete();
}
Program: 66513
Project: 66513
Buggy source:
public boolean canFinish(){
  try {
    if (m_designSession != null)     return m_designSession.getNewWizard().canFinish();
 else {
      if (this.nextPage != null) {
        return nextPage.isPageComplete() && isPageComplete();
      }
      return isPageComplete();
    }
  }
 catch (  OdaException e) {
    return false;
  }
}

Fixed version (ground truth):
public boolean canFinish(){
  if (!validStatus())   return false;
  try {
    if (m_designSession != null)     return m_designSession.getNewWizard().canFinish();
 else {
      if (this.nextPage != null) {
        return nextPage.isPageComplete();
      }
      return isPageComplete();
    }
  }
 catch (  OdaException e) {
    return false;
  }
}
Program: 66514
Project: 66514
Buggy source:
public boolean canFinish(){
  return dataSetPage.isPageComplete() && dataSetPage.canFinish() && columnDefPage.isPageComplete();
}

Fixed version (ground truth):
public boolean canFinish(){
  return dataSetPage.canFinish() && columnDefPage.isPageComplete();
}
Program: 66515
Project: 66515
Buggy source:
private List convertDeleteList(List list){
  List retValue=new ArrayList();
  for (int i=0; i < list.size(); i++) {
    Object obj=list.get(i);
    if (obj instanceof IStructuredSelection) {
      List objs=((IStructuredSelection)obj).toList();
      for (int j=0; j < objs.size(); j++) {
        if (objs.get(j) instanceof SlotHandle) {
          List temsps=((SlotHandle)objs.get(j)).getContents();
          for (int k=0; k < temsps.size(); k++) {
            retValue.add(temsps.get(k));
          }
        }
 else         if (objs.get(j) instanceof MeasureGroupHandle) {
          retValue.addAll(((MeasureGroupHandle)objs.get(j)).getContents(MeasureGroupHandle.MEASURES_PROP));
        }
 else {
          retValue.add(objs.get(j));
        }
      }
    }
 else {
      retValue.add(obj);
    }
  }
  return retValue;
}

Fixed version (ground truth):
private List convertDeleteList(List list){
  List retValue=new ArrayList();
  for (int i=0; i < list.size(); i++) {
    Object obj=list.get(i);
    if (obj instanceof IStructuredSelection) {
      List objs=((IStructuredSelection)obj).toList();
      for (int j=0; j < objs.size(); j++) {
        if (objs.get(j) instanceof SlotHandle) {
          List temsps=((SlotHandle)objs.get(j)).getContents();
          for (int k=0; k < temsps.size(); k++) {
            retValue.add(temsps.get(k));
          }
        }
 else         if (objs.get(j) instanceof MeasureGroupHandle) {
          retValue.addAll(((MeasureGroupHandle)objs.get(j)).getContents(MeasureGroupHandle.MEASURES_PROP));
        }
 else {
          retValue.add(objs.get(j));
        }
      }
    }
 else     if (obj instanceof MeasureGroupHandle) {
      retValue.addAll(((MeasureGroupHandle)obj).getContents(MeasureGroupHandle.MEASURES_PROP));
    }
 else {
      retValue.add(obj);
    }
  }
  return retValue;
}
Program: 66516
Project: 66516
Buggy source:
/** 
 * @param source
 * @return
 */
public static PatternKey getPatterKey(String source){
  int colonNumber=0;
  int blankNumber=0;
  int hyphenNumber=0;
  int dotNumber=0;
  int timeZomeNumber=0;
  boolean beLastBlank=false;
  for (int i=0; i < source.length(); i++) {
switch (source.charAt(i)) {
case ':':
{
        beLastBlank=false;
        colonNumber++;
        break;
      }
case ' ':
{
      if (!beLastBlank) {
        blankNumber++;
      }
      beLastBlank=true;
      break;
    }
case '-':
{
    beLastBlank=false;
    if (blankNumber == 0) {
      hyphenNumber++;
    }
 else {
      timeZomeNumber++;
    }
    break;
  }
case '.':
{
  beLastBlank=false;
  dotNumber++;
  break;
}
case '+':
case 'z':
case 'Z':
{
beLastBlank=false;
timeZomeNumber++;
break;
}
}
if (timeZomeNumber > 0) {
break;
}
}
if (hyphenNumber == 0 && colonNumber == 0 && source.length() > 4) {
return null;
}
return (new PatternKey(colonNumber,blankNumber,hyphenNumber,dotNumber,timeZomeNumber));
}

Fixed version (ground truth):
/** 
 * @param source
 * @return
 */
public static PatternKey getPatterKey(String source){
  int colonNumber=0;
  int blankNumber=0;
  int hyphenNumber=0;
  int dotNumber=0;
  int timeZomeNumber=0;
  boolean beLastBlank=false;
  for (int i=0; i < source.length(); i++) {
switch (source.charAt(i)) {
case ':':
{
        beLastBlank=false;
        colonNumber++;
        break;
      }
case ' ':
{
      if (!beLastBlank) {
        blankNumber++;
      }
      beLastBlank=true;
      break;
    }
case '-':
{
    beLastBlank=false;
    if (blankNumber == 0) {
      hyphenNumber++;
    }
 else {
      timeZomeNumber++;
    }
    break;
  }
case '.':
{
  beLastBlank=false;
  dotNumber++;
  break;
}
case '+':
case 'z':
case 'Z':
{
beLastBlank=false;
timeZomeNumber++;
break;
}
}
if (timeZomeNumber > 0) {
break;
}
}
if (hyphenNumber == 0 && colonNumber == 0 && !isValidYear(source)) {
return null;
}
return (new PatternKey(colonNumber,blankNumber,hyphenNumber,dotNumber,timeZomeNumber));
}
Program: 66517
Project: 66517
Buggy source:
public ModelDteApiAdapter(ExecutionContext context) throws BirtException {
  this.context=context;
  this.jsScope=((IDataScriptEngine)context.getScriptContext().getScriptEngine(IDataScriptEngine.ENGINE_NAME)).getJSScope(context.getScriptContext());
}

Fixed version (ground truth):
public ModelDteApiAdapter(ExecutionContext context) throws BirtException {
  this.context=context;
  scriptContext=context.getScriptContext();
  this.jsScope=((IDataScriptEngine)scriptContext.getScriptEngine(IDataScriptEngine.ENGINE_NAME)).getJSScope(scriptContext);
}
Program: 66518
Project: 66518
Buggy source:
protected IExtractionResults extractQuery(DataSetHandle dataset) throws BirtException {
  QueryDefinition newQuery=constructQuery(dataset);
  DataRequestSession session=executionContext.getDataEngine().getDTESession();
  ModelDteApiAdapter apiAdapter=new ModelDteApiAdapter(executionContext);
  apiAdapter.defineDataSet(dataset,session);
  session.registerQueries(new IQueryDefinition[]{newQuery});
  IBasePreparedQuery preparedQuery=session.prepare(newQuery);
  IQueryResults result=(IQueryResults)session.execute(preparedQuery,null,executionContext.getScriptContext());
  ResultMetaData metadata=new ResultMetaData(result.getResultMetaData());
  return new ExtractionResults(result,metadata,null,0,maxRow);
}

Fixed version (ground truth):
protected IExtractionResults extractQuery(DataSetHandle dataset) throws BirtException {
  QueryDefinition newQuery=constructQuery(dataset);
  DataRequestSession session=executionContext.getDataEngine().getDTESession();
  ModelDteApiAdapter apiAdapter=new ModelDteApiAdapter(executionContext);
  apiAdapter.defineDataSet(dataset,session);
  session.registerQueries(new IQueryDefinition[]{newQuery});
  IBasePreparedQuery preparedQuery=session.prepare(newQuery);
  IQueryResults result=(IQueryResults)session.execute(preparedQuery,null,executionContext.getScriptContext());
  ResultMetaData metadata=new ResultMetaData(result.getResultMetaData());
  apiAdapter.close();
  return new ExtractionResults(result,metadata,null,0,maxRow);
}
Program: 66519
Project: 66519
Buggy source:
public void shutdown(){
  dteSession.shutdown();
  queryCache.close();
  if (factory != null) {
    factory.closeDataEngine(this);
  }
}

Fixed version (ground truth):
public void shutdown(){
  dteSession.shutdown();
  queryCache.close();
  adapter.close();
  if (factory != null) {
    factory.closeDataEngine(this);
  }
}
Program: 66522
Project: 66522
Buggy source:
/** 
 * @param pageOverflow the pageOverflow to set
 */
public void setPageOverflow(String pageOverflow){
  this.pageOverflow=pageOverflow;
}

Fixed version (ground truth):
/** 
 * @param pageOverflow the pageOverflow to set
 */
public void setPageOverflow(int pageOverflow){
  this.pageOverflow=pageOverflow;
}
Program: 66523
Project: 66523
Buggy source:
/** 
 * @return the pageOverflow
 */
public String getPageOverflow(){
  return pageOverflow;
}

Fixed version (ground truth):
/** 
 * @return the pageOverflow
 */
public int getPageOverflow(){
  return pageOverflow;
}
Program: 66526
Project: 66526
Buggy source:
/** 
 * Constructor. This is for runAndRender task.
 * @param locale
 * @param isEmbeddable
 * @param isRtl
 * @param isMasterPageContent
 * @param format
 * @param svg
 * @param isDesigner
 */
public ViewerHTMLActionHandler(Locale locale,TimeZone timeZone,boolean isRtl,boolean isMasterPageContent,String format,Boolean svg,String isDesigner){
  this.locale=locale;
  this.timeZone=timeZone;
  this.isRtl=isRtl;
  this.isMasterPageContent=isMasterPageContent;
  this.hostFormat=format;
  this.svg=svg;
  this.isDesigner=isDesigner;
}

Fixed version (ground truth):
/** 
 * Constructor. This is for runAndRender task.
 * @param locale
 * @param isEmbeddable
 * @param isRtl
 * @param isMasterPageContent
 * @param format
 * @param svg
 * @param isDesigner
 */
public ViewerHTMLActionHandler(Locale locale,TimeZone timeZone,boolean isRtl,boolean isMasterPageContent,String format,Boolean svg,String isDesigner){
  this.locale=locale;
  this.timeZone=timeZone;
  this.isRtl=isRtl;
  this.isMasterPageContent=isMasterPageContent ? null : Boolean.FALSE;
  this.hostFormat=format;
  this.svg=svg ? Boolean.TRUE : null;
  this.isDesigner=isDesigner;
}
Program: 66527
Project: 66527
Buggy source:
/** 
 * Used in the filter select value dialog in dataset editor
 * @param expression
 * @param dataSetHandle
 * @param binding
 * @param useDataSetFilter
 * @return
 * @throws BirtException
 */
public static List getSelectValueList(Expression expression,DataSetHandle dataSetHandle,boolean useDataSetFilter) throws BirtException {
}

Fixed version (ground truth):
/** 
 * Used in the filter select value dialog in dataset editor
 * @param expression
 * @param dataSetHandle
 * @param binding
 * @param useDataSetFilter
 * @return
 * @throws BirtException
 */
public static List getSelectValueList(Expression expression,DataSetHandle dataSetHandle,boolean useDataSetFilter) throws BirtException {
  ScriptExpression expr=null;
  DataSetHandle targetHandle=dataSetHandle;
  Map appContext=new HashMap();
  DataSetPreviewer previewer=null;
  try {
    if (!useDataSetFilter) {
      IDesignElement element=dataSetHandle.copy();
      ((DataSet)element).setProperty(IDataSetModel.FILTER_PROP,new ArrayList());
      targetHandle=ExternalUIUtil.newDataSetHandle(dataSetHandle,(DesignElement)element);
    }
    previewer=new DataSetPreviewer(targetHandle,0,PreviewType.RESULTSET);
    DataModelAdapter adapter=new DataModelAdapter(new DataSessionContext(DataSessionContext.MODE_DIRECT_PRESENTATION,targetHandle.getModuleHandle()));
    expr=adapter.adaptExpression(expression);
    boolean startsWithRow=ExpressionUtility.isColumnExpression(expr.getText(),true);
    boolean startsWithDataSetRow=ExpressionUtility.isColumnExpression(expr.getText(),false);
    if (!startsWithRow && !startsWithDataSetRow) {
      throw new DataException(Messages.getString("String_Node_Str"));
    }
    String dataSetColumnName=null;
    if (startsWithDataSetRow) {
      dataSetColumnName=ExpressionUtil.getColumnName(expr.getText());
    }
 else {
      dataSetColumnName=ExpressionUtil.getColumnBindingName(expr.getText());
    }
    ResourceIdentifiers identifiers=new ResourceIdentifiers();
    String resouceIDs=ResourceIdentifiers.ODA_APP_CONTEXT_KEY_CONSUMER_RESOURCE_IDS;
    identifiers.setApplResourceBaseURI(DTPUtil.getInstance().getBIRTResourcePath());
    identifiers.setDesignResourceBaseURI(DTPUtil.getInstance().getReportDesignPath());
    appContext.put(resouceIDs,identifiers);
    AppContextPopulator.populateApplicationContext(targetHandle,appContext);
    previewer.open(appContext,getEngineConfig(targetHandle.getModuleHandle()));
    IResultIterator itr=previewer.preview();
    Set visitedValues=new HashSet();
    Object value=null;
    while (itr.next()) {
      if (visitedValues.size() > 10000) {
        break;
      }
      value=itr.getValue(dataSetColumnName);
      if (!visitedValues.contains(value)) {
        visitedValues.add(value);
      }
    }
    if (visitedValues.isEmpty())     return Collections.EMPTY_LIST;
    return new ArrayList(visitedValues);
  }
  finally {
    AppContextResourceReleaser.release(appContext);
    if (previewer != null)     previewer.close();
  }
}
Program: 66528
Project: 66528
Buggy source:
protected IExtractionResults extractQuery(DataSetHandle dataset) throws BirtException {
  QueryDefinition newQuery=constructQuery(dataset);
  DataRequestSession session=executionContext.getDataEngine().getDTESession();
  ModelDteApiAdapter apiAdapter=new ModelDteApiAdapter(executionContext);
  apiAdapter.defineDataSet(dataset,session);
  session.registerQueries(new IQueryDefinition[]{newQuery});
  IBasePreparedQuery preparedQuery=session.prepare(newQuery);
  IQueryResults result=(IQueryResults)session.execute(preparedQuery,null,executionContext.getScriptContext());
  ResultMetaData metadata=new ResultMetaData(result.getResultMetaData());
  apiAdapter.close();
  return new ExtractionResults(result,metadata,null,0,maxRow);
}

Fixed version (ground truth):
protected IExtractionResults extractQuery(DataSetHandle dataset) throws BirtException {
  QueryDefinition newQuery=constructQuery(dataset);
  DataRequestSession session=executionContext.getDataEngine().getDTESession();
  final ModelDteApiAdapter apiAdapter=new ModelDteApiAdapter(executionContext);
  apiAdapter.defineDataSet(dataset,session);
  session.registerQueries(new IQueryDefinition[]{newQuery});
  IBasePreparedQuery preparedQuery=session.prepare(newQuery);
  IQueryResults result=(IQueryResults)session.execute(preparedQuery,null,executionContext.getScriptContext());
  ResultMetaData metadata=new ResultMetaData(result.getResultMetaData());
  return new ExtractionResults(result,metadata,null,0,maxRow){
    public void close(){
      super.close();
      apiAdapter.close();
    }
  }
;
}
Program: 66530
Project: 66530
Buggy source:
private Chunk processLineBreak(){
  Chunk lineBreakChunk=null;
  if (chunkText[currentPos] == '\n') {
    lineBreakChunk=Chunk.HARD_LINE_BREAK;
    lineBreakChunk.setText("String_Node_Str");
    lineBreakChunk.setOffset(currentPos);
  }
 else   if (chunkText[currentPos] == '\r') {
    lineBreakChunk=Chunk.HARD_LINE_BREAK;
    lineBreakChunk.setOffset(currentPos);
    if (currentPos + 1 < chunkText.length && chunkText[currentPos + 1] == '\n') {
      lineBreakChunk.setText("String_Node_Str");
    }
 else {
      lineBreakChunk.setText("String_Node_Str");
    }
  }
  if (lineBreakChunk != null) {
    return processLineBreak(lineBreakChunk);
  }
  return null;
}

Fixed version (ground truth):
private Chunk processLineBreak(){
  Chunk lineBreakChunk=null;
  if (chunkText[currentPos] == '\n') {
    lineBreakChunk=new LineBreakChunk("String_Node_Str");
    lineBreakChunk.setOffset(currentPos);
  }
 else   if (chunkText[currentPos] == '\r') {
    lineBreakChunk=new LineBreakChunk("String_Node_Str");
    lineBreakChunk.setOffset(currentPos);
    if (currentPos + 1 < chunkText.length && chunkText[currentPos + 1] == '\n') {
      lineBreakChunk.setText("String_Node_Str");
    }
 else {
      lineBreakChunk.setText("String_Node_Str");
    }
  }
  if (lineBreakChunk != null) {
    return processLineBreak(lineBreakChunk);
  }
  return null;
}
Program: 66532
Project: 66532
Buggy source:
public List<IBookmarkInfo> getBookmarkInfos(Locale locale) throws EngineException {
  if (!isComplete()) {
    return null;
  }
  ArrayList<IBookmarkInfo> results=new ArrayList<IBookmarkInfo>();
  loadCoreStreamLazily();
  if (indexReader != null) {
    try {
      List<BookmarkContent> bookmarks=indexReader.getBookmarkContents();
      if (bookmarks == null) {
        return null;
      }
      ReportDesignHandle report=this.getReportDesign();
      for (      BookmarkContent bookmark : bookmarks) {
        long designId=bookmark.getElementId();
        DesignElementHandle handle=report.getElementByID(designId);
        if (handle == null)         continue;
        String elementType=handle.getDefn().getName();
        String displayName=null;
        if (handle instanceof ReportItemHandle) {
          displayName=((ReportItemHandle)handle).getBookmarkDisplayName();
        }
        if (locale != null) {
          if (handle instanceof ReportElementHandle) {
            ReportElementHandle elementHandle=(ReportElementHandle)handle;
            displayName=ModuleUtil.getExternalizedValue(elementHandle,bookmark.getBookmark(),displayName,ULocale.forLocale(locale));
          }
        }
        results.add(new BookmarkInfo(bookmark.getBookmark(),displayName,elementType));
      }
    }
 catch (    IOException ex) {
      throw new EngineException(MessageConstants.BOOKMARK_FETCHING_EXCEPTION,ex);
    }
  }
  return results;
}

Fixed version (ground truth):
public List<IBookmarkInfo> getBookmarkInfos(Locale locale) throws EngineException {
  if (!isComplete()) {
    return null;
  }
  ArrayList<IBookmarkInfo> results=new ArrayList<IBookmarkInfo>();
  loadCoreStreamLazily();
  if (indexReader != null) {
    try {
      List<BookmarkContent> bookmarks=indexReader.getBookmarkContents();
      if (bookmarks == null) {
        return null;
      }
      ReportDesignHandle report=this.getReportDesign();
      for (      BookmarkContent bookmark : bookmarks) {
        String bookmarkString=bookmark.getBookmark();
        if (bookmarkString.startsWith(ExecutorManager.BOOKMARK_PREFIX)) {
          continue;
        }
        long designId=bookmark.getElementId();
        DesignElementHandle handle=report.getElementByID(designId);
        if (handle == null)         continue;
        String elementType=handle.getDefn().getName();
        String displayName=null;
        if (handle instanceof ReportItemHandle) {
          displayName=((ReportItemHandle)handle).getBookmarkDisplayName();
        }
        if (locale != null) {
          if (handle instanceof ReportElementHandle) {
            ReportElementHandle elementHandle=(ReportElementHandle)handle;
            displayName=ModuleUtil.getExternalizedValue(elementHandle,bookmarkString,displayName,ULocale.forLocale(locale));
          }
        }
        results.add(new BookmarkInfo(bookmarkString,displayName,elementType));
      }
    }
 catch (    IOException ex) {
      throw new EngineException(MessageConstants.BOOKMARK_FETCHING_EXCEPTION,ex);
    }
  }
  return results;
}
Program: 66533
Project: 66533
Buggy source:
@Override public void doSave(StreamManager manager) throws DataException {
  this.streamManager=manager;
  if (this.streamManager != null) {
    this.tempOutput=(RAOutputStream)streamManager.getOutStream(DataEngineContext.PROGRESSIVE_VIEWING_GROUP_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE);
    try {
      IOUtil.writeInt(this.tempOutput,this.groupBys.length);
    }
 catch (    IOException e) {
      throw new DataException(e.getLocalizedMessage(),e);
    }
  }
}

Fixed version (ground truth):
public void doSave(StreamManager manager) throws DataException {
  this.streamManager=manager;
  if (this.streamManager != null) {
    this.tempOutput=(RAOutputStream)streamManager.getOutStream(DataEngineContext.PROGRESSIVE_VIEWING_GROUP_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE);
    try {
      IOUtil.writeInt(this.tempOutput,this.groupBys.length);
    }
 catch (    IOException e) {
      throw new DataException(e.getLocalizedMessage(),e);
    }
  }
}
Program: 66534
Project: 66534
Buggy source:
@Override public int getEndingGroup() throws DataException {
  return this.getBreakingGroup(current,next);
}

Fixed version (ground truth):
public int getEndingGroup() throws DataException {
  return this.getBreakingGroup(current,next);
}
Program: 66535
Project: 66535
Buggy source:
@Override public int getStartingGroup() throws DataException {
  return this.getBreakingGroup(previous,current);
}

Fixed version (ground truth):
public int getStartingGroup() throws DataException {
  return this.getBreakingGroup(previous,current);
}
Program: 66536
Project: 66536
Buggy source:
@Override public void close() throws DataException {
  try {
    if (this.tempOutput != null) {
      this.tempOutput.close();
    }
  }
 catch (  IOException e) {
    throw new DataException(e.getLocalizedMessage(),e);
  }
}

Fixed version (ground truth):
public void close() throws DataException {
  try {
    if (this.tempOutput != null) {
      this.tempOutput.close();
    }
  }
 catch (  IOException e) {
    throw new DataException(e.getLocalizedMessage(),e);
  }
}
Program: 66537
Project: 66537
Buggy source:
@Override public void registerPreviousResultObject(IResultObject previous){
  this.previous=previous;
}

Fixed version (ground truth):
public void registerPreviousResultObject(IResultObject previous){
  this.previous=previous;
}
Program: 66538
Project: 66538
Buggy source:
@Override public void registerCurrentResultObject(IResultObject current){
  this.current=current;
}

Fixed version (ground truth):
public void registerCurrentResultObject(IResultObject current){
  this.current=current;
}
Program: 66539
Project: 66539
Buggy source:
@Override public void registerNextResultObject(IResultObject next){
  this.next=next;
}

Fixed version (ground truth):
public void registerNextResultObject(IResultObject next){
  this.next=next;
}
Program: 66540
Project: 66540
Buggy source:
@Override public void next(boolean hasNext) throws DataException {
}

Fixed version (ground truth):
public void next(boolean hasNext) throws DataException {
}
Program: 66541
Project: 66541
Buggy source:
@Override public int[] getGroupStartAndEndIndex(int groupIndex) throws DataException {
  if (this.groupStartingEndingIndex != null)   return this.groupStartingEndingIndex.get(groupIndex);
  this.groupStartingEndingIndex=new ArrayList<int[]>();
  List<List<Integer>> temp=new ArrayList<List<Integer>>();
  for (int i=0; i <= this.groupCount; i++)   temp.add(new ArrayList<Integer>());
  for (int i=0; i < this.cacheProvider.getCount(); i++) {
    int starting=this.getStartingGroupLevel(i);
    int ending=this.getEndingGroupLevel(i);
    for (int j=starting; j < temp.size(); j++) {
      temp.get(j).add(i);
    }
    for (int j=ending; j < temp.size(); j++) {
      temp.get(j).add(i + 1);
    }
  }
  for (int i=0; i < temp.size(); i++) {
    List<Integer> tempArray=temp.get(i);
    int[] startingEnding=new int[tempArray.size()];
    for (int j=0; j < tempArray.size(); j++)     startingEnding[j]=tempArray.get(j);
    this.groupStartingEndingIndex.add(startingEnding);
  }
  return this.groupStartingEndingIndex.get(groupIndex);
}

Fixed version (ground truth):
public int[] getGroupStartAndEndIndex(int groupIndex) throws DataException {
  if (this.groupStartingEndingIndex != null)   return this.groupStartingEndingIndex.get(groupIndex);
  this.groupStartingEndingIndex=new ArrayList<int[]>();
  List<List<Integer>> temp=new ArrayList<List<Integer>>();
  for (int i=0; i <= this.groupCount; i++)   temp.add(new ArrayList<Integer>());
  for (int i=0; i < this.cacheProvider.getCount(); i++) {
    int starting=this.getStartingGroupLevel(i);
    int ending=this.getEndingGroupLevel(i);
    for (int j=starting; j < temp.size(); j++) {
      temp.get(j).add(i);
    }
    for (int j=ending; j < temp.size(); j++) {
      temp.get(j).add(i + 1);
    }
  }
  for (int i=0; i < temp.size(); i++) {
    List<Integer> tempArray=temp.get(i);
    int[] startingEnding=new int[tempArray.size()];
    for (int j=0; j < tempArray.size(); j++)     startingEnding[j]=tempArray.get(j);
    this.groupStartingEndingIndex.add(startingEnding);
  }
  return this.groupStartingEndingIndex.get(groupIndex);
}
Program: 66542
Project: 66542
Buggy source:
@Override public void move() throws DataException {
}

Fixed version (ground truth):
public void move() throws DataException {
}
Program: 66543
Project: 66543
Buggy source:
@Override public int getEndingGroupLevel() throws DataException {
  return this.getEndingGroupLevel(this.cacheProvider.getCurrentIndex());
}

Fixed version (ground truth):
public int getEndingGroupLevel() throws DataException {
  return this.getEndingGroupLevel(this.cacheProvider.getCurrentIndex());
}
Program: 66544
Project: 66544
Buggy source:
@Override public void last(int groupLevel) throws DataException {
  if (this.getEndingGroupLevel() <= groupLevel)   return;
 else {
    while (this.cacheProvider.next()) {
      if (this.getEndingGroupLevel() <= groupLevel)       return;
    }
  }
}

Fixed version (ground truth):
public void last(int groupLevel) throws DataException {
  if (this.getEndingGroupLevel() <= groupLevel)   return;
 else {
    while (this.cacheProvider.next()) {
      if (this.getEndingGroupLevel() <= groupLevel)       return;
    }
  }
}
Program: 66545
Project: 66545
Buggy source:
@Override public int getStartingGroupLevel() throws DataException {
  return this.getStartingGroupLevel(this.cacheProvider.getCurrentIndex());
}

Fixed version (ground truth):
public int getStartingGroupLevel() throws DataException {
  return this.getStartingGroupLevel(this.cacheProvider.getCurrentIndex());
}
Program: 66546
Project: 66546
Buggy source:
@Override public void setCacheProvider(CacheProvider cacheProvider){
  this.cacheProvider=cacheProvider;
}

Fixed version (ground truth):
public void setCacheProvider(CacheProvider cacheProvider){
  this.cacheProvider=cacheProvider;
}
Program: 66547
Project: 66547
Buggy source:
@Override public int getCurrentGroupIndex(int groupLevel) throws DataException {
  throw new UnsupportedOperationException();
}

Fixed version (ground truth):
public int getCurrentGroupIndex(int groupLevel) throws DataException {
  throw new UnsupportedOperationException();
}
Program: 66548
Project: 66548
Buggy source:
@Override public void close() throws DataException {
  try {
    if (this.inputStream != null) {
      this.inputStream.close();
      this.inputStream=null;
    }
  }
 catch (  IOException e) {
    throw new DataException(e.getLocalizedMessage(),e);
  }
}

Fixed version (ground truth):
public void close() throws DataException {
  try {
    if (this.inputStream != null) {
      this.inputStream.close();
      this.inputStream=null;
    }
  }
 catch (  IOException e) {
    throw new DataException(e.getLocalizedMessage(),e);
  }
}
Program: 66549
Project: 66549
Buggy source:
/** 
 * Save the current list in memory to disk.
 * @throws DataException 
 * @throws FileNotFoundException
 * @throws IOException
 */
private void saveToDisk() throws DataException {
  try {
    File cacheFile=null;
    if (currentCacheNo < fileList.size()) {
      cacheFile=(File)(fileList.get(currentCacheNo));
    }
 else {
      cacheFile=getCacheFile(this.currentCacheNo);
      fileList.add(cacheFile);
    }
    FileOutputStream fos=FileSecurity.createFileOutputStream(cacheFile);
    DataOutputStream oos=new DataOutputStream(new BufferedOutputStream(fos));
    writeList(oos,currentCache);
    oos.close();
  }
 catch (  FileNotFoundException e) {
    logger.severe("String_Node_Str" + e.toString());
  }
catch (  IOException e) {
    logger.severe("String_Node_Str" + e.toString());
  }
}

Fixed version (ground truth):
/** 
 * Save the current list in memory to disk.
 * @throws DataException 
 * @throws FileNotFoundException
 * @throws IOException
 */
private void saveToDisk() throws DataException {
  FileOutputStream fos=null;
  DataOutputStream oos=null;
  try {
    File cacheFile=null;
    if (currentCacheNo < fileList.size()) {
      cacheFile=(File)(fileList.get(currentCacheNo));
    }
 else {
      cacheFile=getCacheFile(this.currentCacheNo);
      fileList.add(cacheFile);
    }
    fos=FileSecurity.createFileOutputStream(cacheFile);
    oos=new DataOutputStream(new BufferedOutputStream(fos));
    writeList(oos,currentCache);
    oos.close();
  }
 catch (  FileNotFoundException e) {
    logger.severe("String_Node_Str" + e.toString());
  }
catch (  IOException e) {
    try {
      if (oos != null)       oos.close();
    }
 catch (    IOException ie) {
    }
    logger.severe("String_Node_Str" + e.toString());
  }
}
Program: 66550
Project: 66550
Buggy source:
/** 
 * Load the data of currect no from disk.
 * @throws DataException 
 */
private void loadFromDisk() throws DataException {
  try {
    FileInputStream fis=FileSecurity.createFileInputStream(getCacheFile(this.currentCacheNo));
    DataInputStream ois=new DataInputStream(new BufferedInputStream(fis));
    this.currentCache=readList(ois);
    ois.close();
  }
 catch (  FileNotFoundException e) {
    logger.severe("String_Node_Str" + e.toString());
  }
catch (  IOException e) {
    logger.severe("String_Node_Str" + e.toString());
  }
}

Fixed version (ground truth):
/** 
 * Load the data of currect no from disk.
 * @throws DataException 
 */
private void loadFromDisk() throws DataException {
  FileInputStream fis=null;
  DataInputStream ois=null;
  try {
    fis=FileSecurity.createFileInputStream(getCacheFile(this.currentCacheNo));
    ois=new DataInputStream(new BufferedInputStream(fis));
    this.currentCache=readList(ois);
    ois.close();
  }
 catch (  FileNotFoundException e) {
    logger.severe("String_Node_Str" + e.toString());
  }
catch (  IOException e) {
    try {
      if (ois != null)       ois.close();
    }
 catch (    IOException ie) {
    }
    logger.severe("String_Node_Str" + e.toString());
  }
}
Program: 66551
Project: 66551
Buggy source:
protected void outputResultObjects(IResultObject[] resultObjects,int indexOfUnit) throws IOException, DataException {
  rowFile.writeRows(resultObjects,resultObjects.length);
}

Fixed version (ground truth):
protected void outputResultObjects(IResultObject[] resultObjects,int indexOfUnit) throws IOException, DataException {
  try {
    rowFile.writeRows(resultObjects,resultObjects.length);
  }
 catch (  IOException ie) {
    rowFile.close();
    throw ie;
  }
}
Program: 66552
Project: 66552
Buggy source:
/** 
 * @throws DataException
 */
private void prepareCurrentRow() throws DataException {
  clear();
  bindingColumnsEvalUtil.getColumnsValue(boundColumnValueMap);
  if (needCache() && !this.isEmpty()) {
    try {
      saveCurrentRow();
    }
 catch (    IOException e) {
      throw new DataException(ResourceConstants.WRITE_CACHE_TEMPFILE_ERROR,e);
    }
catch (    BirtException e) {
      throw DataException.wrap(e);
    }
  }
}

Fixed version (ground truth):
/** 
 * @throws DataException
 */
private void prepareCurrentRow() throws DataException {
  clear();
  bindingColumnsEvalUtil.getColumnsValue(boundColumnValueMap);
  if (needCache() && !this.isEmpty()) {
    try {
      saveCurrentRow();
    }
 catch (    IOException e) {
      try {
        this.metaOutputStream.close();
        this.rowOutputStream.close();
      }
 catch (      IOException ce) {
      }
      throw new DataException(ResourceConstants.WRITE_CACHE_TEMPFILE_ERROR,e);
    }
catch (    BirtException e) {
      throw DataException.wrap(e);
    }
  }
}
Program: 66553
Project: 66553
Buggy source:
private static String getFilePath(URL url){
  String path=url.getFile();
  try {
    return URLDecoder.decode(path,"String_Node_Str");
  }
 catch (  UnsupportedEncodingException ex) {
    return path;
  }
}

Fixed version (ground truth):
private static String getFilePath(URL url){
  String path=url.getFile();
  return decode(path);
}
Program: 66554
Project: 66554
Buggy source:
/** 
 * @param isLeftDataSet
 * @param dataSetName
 * @return
 * @throws DataException
 */
private IQueryResults populatePreparedQuery(IQueryResults outer,boolean isLeftDataSet,String dataSetName) throws DataException {
  List conditions=PreparedJointDataSourceQuery.this.dataSet.getJoinConditions();
  QueryDefinition queryDefinition=new QueryDefinition();
  queryDefinition.setAutoBinding(true);
  queryDefinition.setDataSetName(dataSetName);
  setParameterBindings(dataEngine,dataSetName,isLeftDataSet,queryDefinition);
  for (int i=0; i < conditions.size(); i++) {
    addSortToQuery((IJoinCondition)conditions.get(i),isLeftDataSet,queryDefinition);
  }
  IPreparedQuery preparedQuery=PreparedQueryUtil.newInstance(dataEngine,queryDefinition,appContext);
  try {
    return preparedQuery.execute(outer,null);
  }
 catch (  BirtException e) {
    throw DataException.wrap(e);
  }
}

Fixed version (ground truth):
/** 
 * @param isLeftDataSet
 * @param dataSetName
 * @return
 * @throws DataException
 */
private IQueryResults populatePreparedQuery(IQueryResults outer,boolean isLeftDataSet,String dataSetName) throws DataException {
  List conditions=PreparedJointDataSourceQuery.this.dataSet.getJoinConditions();
  QueryDefinition queryDefinition=new QueryDefinition();
  queryDefinition.setAsTempQuery();
  queryDefinition.setAutoBinding(true);
  queryDefinition.setDataSetName(dataSetName);
  setParameterBindings(dataEngine,dataSetName,isLeftDataSet,queryDefinition);
  for (int i=0; i < conditions.size(); i++) {
    addSortToQuery((IJoinCondition)conditions.get(i),isLeftDataSet,queryDefinition);
  }
  IPreparedQuery preparedQuery=PreparedQueryUtil.newInstance(dataEngine,queryDefinition,appContext);
  try {
    return preparedQuery.execute(outer,null);
  }
 catch (  BirtException e) {
    throw DataException.wrap(e);
  }
}