nus-yam/ex-repair huggingface dataset:
Program: 78185
Project: 78185
Buggy source:
private ColumnReferenceExpression getDirectColRefExpr(Node refNode){
  assert(refNode.getType() == Token.GETPROP || refNode.getType() == Token.GETELEM);
  Node rowName=refNode.getFirstChild();
  assert(rowName != null);
  if (rowName.getType() != Token.NAME)   return null;
  String str=rowName.getString();
  assert(str != null);
  if (!str.equals(rowIndicator))   return null;
  Node rowColumn=rowName.getNext();
  assert(rowColumn != null);
  if (refNode.getType() == Token.GETPROP && rowColumn.getType() == Token.STRING) {
    if ("String_Node_Str".equals(rowColumn.getString()) && "String_Node_Str".equals(rowColumn.getString()) && "String_Node_Str".equals(rowColumn.getString()))     return null;
    return new ColumnReferenceExpression(this.isDataSetMode ? STRING_ROW : STRING_DATASETROW,rowColumn.getString());
  }
  if (refNode.getType() == Token.GETELEM) {
    if (rowColumn.getType() == Token.NUMBER) {
      if (0 == rowColumn.getDouble())       return null;
      return new ColumnReferenceExpression(this.isDataSetMode ? STRING_ROW : STRING_DATASETROW,(int)rowColumn.getDouble());
    }
 else     if (rowColumn.getType() == Token.STRING) {
      if ("String_Node_Str".equals(rowColumn.getString()))       return null;
      return new ColumnReferenceExpression(this.isDataSetMode ? STRING_ROW : STRING_DATASETROW,rowColumn.getString());
    }
  }
  return null;
}

Fixed version (ground truth):
private ColumnReferenceExpression getDirectColRefExpr(Node refNode){
  assert(refNode.getType() == Token.GETPROP || refNode.getType() == Token.GETELEM);
  Node rowName=refNode.getFirstChild();
  assert(rowName != null);
  if (rowName.getType() != Token.NAME)   return null;
  String str=rowName.getString();
  assert(str != null);
  if (!str.equals(rowIndicator))   return null;
  Node rowColumn=rowName.getNext();
  assert(rowColumn != null);
  if (refNode.getType() == Token.GETPROP && rowColumn.getType() == Token.STRING) {
    if ("String_Node_Str".equals(rowColumn.getString()) || "String_Node_Str".equals(rowColumn.getString()) || "String_Node_Str".equals(rowColumn.getString()))     return null;
    return new ColumnReferenceExpression(this.isDataSetMode ? STRING_ROW : STRING_DATASETROW,rowColumn.getString());
  }
  if (refNode.getType() == Token.GETELEM) {
    if (rowColumn.getType() == Token.NUMBER) {
      if (0 == rowColumn.getDouble())       return null;
      return new ColumnReferenceExpression(this.isDataSetMode ? STRING_ROW : STRING_DATASETROW,(int)rowColumn.getDouble());
    }
 else     if (rowColumn.getType() == Token.STRING) {
      if ("String_Node_Str".equals(rowColumn.getString()))       return null;
      return new ColumnReferenceExpression(this.isDataSetMode ? STRING_ROW : STRING_DATASETROW,rowColumn.getString());
    }
  }
  return null;
}
Program: 78186
Project: 78186
Buggy source:
protected void setUp() throws Exception {
  super.setUp();
  sessionHandle=DesignEngine.newSession(Locale.getDefault());
  designHandle=sessionHandle.createDesign();
}

Fixed version (ground truth):
protected void setUp() throws Exception {
  super.setUp();
  sessionHandle=DesignEngine.newSession(ULocale.getDefault());
  designHandle=sessionHandle.createDesign();
}
Program: 78187
Project: 78187
Buggy source:
protected void __initParameters(HttpServletRequest request) throws Exception {
  IViewerReportDesignHandle design=getDesignHandle(request);
  InputOptions options=new InputOptions();
  options.setOption(InputOptions.OPT_REQUEST,request);
  options.setOption(InputOptions.OPT_LOCALE,locale);
  Collection parameterList=this.getReportService().getParameterDefinitions(design,options);
  this.parameters=(HashMap)getParsedParameters(design,parameterList,request,options);
  this.missingParameter=validateParameters(parameterList,this.parameters);
}

Fixed version (ground truth):
protected void __initParameters(HttpServletRequest request) throws Exception {
  IViewerReportDesignHandle design=null;
  IReportRunnable reportRunnable=null;
  IReportDocument reportDocumentInstance=ReportEngineService.getInstance().openReportDocument(this.reportDesignName,this.reportDocumentName);
  if (reportDocumentInstance != null) {
    reportRunnable=reportDocumentInstance.getReportRunnable();
    reportDocumentInstance.close();
  }
  if (reportRunnable != null)   design=new BirtViewerReportDesignHandle(null,reportRunnable.getReportName());
 else   design=getDesignHandle(request);
  InputOptions options=new InputOptions();
  options.setOption(InputOptions.OPT_REQUEST,request);
  options.setOption(InputOptions.OPT_LOCALE,locale);
  Collection parameterList=this.getReportService().getParameterDefinitions(design,options);
  this.parameters=(HashMap)getParsedParameters(design,parameterList,request,options);
  this.missingParameter=validateParameters(parameterList,this.parameters);
}
Program: 78188
Project: 78188
Buggy source:
public void extractResultSet(String docName,String resultSetId,Set columns,Set filters,InputOptions options,OutputStream out) throws ReportServiceException {
  IReportDocument doc=ReportEngineService.getInstance().openReportDocument(docName);
  Locale locale=(Locale)options.getOption(InputOptions.OPT_LOCALE);
  try {
    ReportEngineService.getInstance().extractData(doc,resultSetId,columns,locale,out);
    doc.close();
  }
 catch (  RemoteException e) {
    throw new ReportServiceException(e.getLocalizedMessage());
  }
}

Fixed version (ground truth):
public void extractResultSet(String docName,String resultSetId,Set columns,Set filters,InputOptions options,OutputStream out) throws ReportServiceException {
  IReportDocument doc=ReportEngineService.getInstance().openReportDocument(getReportDesignName(options),docName);
  Locale locale=(Locale)options.getOption(InputOptions.OPT_LOCALE);
  try {
    ReportEngineService.getInstance().extractData(doc,resultSetId,columns,locale,out);
    doc.close();
  }
 catch (  RemoteException e) {
    throw new ReportServiceException(e.getLocalizedMessage());
  }
}
Program: 78189
Project: 78189
Buggy source:
public long getPageCount(String docName,InputOptions options) throws ReportServiceException {
  IReportDocument doc=ReportEngineService.getInstance().openReportDocument(docName);
  long count=doc.getPageCount();
  doc.close();
  return count;
}

Fixed version (ground truth):
public long getPageCount(String docName,InputOptions options) throws ReportServiceException {
  IReportDocument doc=ReportEngineService.getInstance().openReportDocument(getReportDesignName(options),docName);
  long count=doc.getPageCount();
  doc.close();
  return count;
}
Program: 78190
Project: 78190
Buggy source:
public IViewerReportDesignHandle getReportDesignHandle(String docName,InputOptions options){
  IReportDocument doc=ReportEngineService.getInstance().openReportDocument(docName);
  String fileName=doc.getReportRunnable().getReportName();
  doc.close();
  IViewerReportDesignHandle design=new BirtViewerReportDesignHandle(null,fileName);
  return design;
}

Fixed version (ground truth):
public IViewerReportDesignHandle getReportDesignHandle(String docName,InputOptions options){
  IReportDocument doc=ReportEngineService.getInstance().openReportDocument(getReportDesignName(options),docName);
  String fileName=doc.getReportRunnable().getReportName();
  doc.close();
  IViewerReportDesignHandle design=new BirtViewerReportDesignHandle(null,fileName);
  return design;
}
Program: 78191
Project: 78191
Buggy source:
public ByteArrayOutputStream getPage(String docName,String pageID,InputOptions renderOptions,List activeIds) throws ReportServiceException {
  IReportDocument doc=ReportEngineService.getInstance().openReportDocument(docName);
  HttpServletRequest request=(HttpServletRequest)renderOptions.getOption(InputOptions.OPT_REQUEST);
  Locale locale=(Locale)renderOptions.getOption(InputOptions.OPT_LOCALE);
  Boolean isMasterPageContent=(Boolean)renderOptions.getOption(InputOptions.OPT_IS_MASTER_PAGE_CONTENT);
  Boolean svgFlag=(Boolean)renderOptions.getOption(InputOptions.OPT_IS_MASTER_PAGE_CONTENT);
  Long pageNum=Long.valueOf(pageID);
  try {
    ByteArrayOutputStream os=ReportEngineService.getInstance().renderReport(request,doc,pageNum.longValue(),isMasterPageContent.booleanValue(),svgFlag.booleanValue(),activeIds,locale);
    doc.close();
    return os;
  }
 catch (  RemoteException e) {
    throw new ReportServiceException(e.getLocalizedMessage());
  }
}

Fixed version (ground truth):
public ByteArrayOutputStream getPage(String docName,String pageID,InputOptions renderOptions,List activeIds) throws ReportServiceException {
  IReportDocument doc=ReportEngineService.getInstance().openReportDocument(getReportDesignName(renderOptions),docName);
  HttpServletRequest request=(HttpServletRequest)renderOptions.getOption(InputOptions.OPT_REQUEST);
  Locale locale=(Locale)renderOptions.getOption(InputOptions.OPT_LOCALE);
  Boolean isMasterPageContent=(Boolean)renderOptions.getOption(InputOptions.OPT_IS_MASTER_PAGE_CONTENT);
  Boolean svgFlag=(Boolean)renderOptions.getOption(InputOptions.OPT_IS_MASTER_PAGE_CONTENT);
  Long pageNum=Long.valueOf(pageID);
  try {
    ByteArrayOutputStream os=ReportEngineService.getInstance().renderReport(request,doc,pageNum.longValue(),isMasterPageContent.booleanValue(),svgFlag.booleanValue(),activeIds,locale);
    doc.close();
    return os;
  }
 catch (  RemoteException e) {
    throw new ReportServiceException(e.getLocalizedMessage());
  }
}
Program: 78193
Project: 78193
Buggy source:
public ToC getTOC(String docName,String tocId,InputOptions options) throws ReportServiceException {
  IReportDocument doc=ReportEngineService.getInstance().openReportDocument(docName);
  TOCNode node=null;
  if (tocId != null) {
    node=doc.findTOC(tocId);
  }
 else {
    node=doc.findTOC(null);
  }
  if (node == null) {
    throw new ReportServiceException("String_Node_Str");
  }
  doc.close();
  return transformTOCNode(node);
}

Fixed version (ground truth):
public ToC getTOC(String docName,String tocId,InputOptions options) throws ReportServiceException {
  IReportDocument doc=ReportEngineService.getInstance().openReportDocument(getReportDesignName(options),docName);
  TOCNode node=null;
  if (tocId != null) {
    node=doc.findTOC(tocId);
  }
 else {
    node=doc.findTOC(null);
  }
  if (node == null) {
    throw new ReportServiceException("String_Node_Str");
  }
  doc.close();
  return transformTOCNode(node);
}
Program: 78194
Project: 78194
Buggy source:
public Map getParameterValues(String docName,InputOptions options){
  IReportDocument doc=ReportEngineService.getInstance().openReportDocument(docName);
  Map paramValues=doc.getParameterValues();
  doc.close();
  return paramValues;
}

Fixed version (ground truth):
public Map getParameterValues(String docName,InputOptions options){
  IReportDocument doc=ReportEngineService.getInstance().openReportDocument(getReportDesignName(options),docName);
  Map paramValues=doc.getParameterValues();
  doc.close();
  return paramValues;
}
Program: 78195
Project: 78195
Buggy source:
public long getPageNumberByBookmark(String docName,String bookmark,InputOptions options) throws ReportServiceException {
  IReportDocument doc=ReportEngineService.getInstance().openReportDocument(docName);
  long pageNumber=doc.getPageNumber(bookmark);
  doc.close();
  return pageNumber;
}

Fixed version (ground truth):
public long getPageNumberByBookmark(String docName,String bookmark,InputOptions options) throws ReportServiceException {
  IReportDocument doc=ReportEngineService.getInstance().openReportDocument(getReportDesignName(options),docName);
  long pageNumber=doc.getPageNumber(bookmark);
  doc.close();
  return pageNumber;
}
Program: 78196
Project: 78196
Buggy source:
/** 
 * Open report document from archive,
 * @param docName -the name of the report document
 * @return
 */
public IReportDocument openReportDocument(String docName){
  IReportDocument document=null;
  try {
synchronized (this.getClass()) {
      document=engine.openReportDocument(docName);
    }
  }
 catch (  Exception e) {
  }
  return document;
}

Fixed version (ground truth):
/** 
 * Open report document from archive,
 * @param docName -the name of the report document
 * @return
 */
public IReportDocument openReportDocument(String systemId,String docName){
  IReportDocument document=null;
  try {
synchronized (this.getClass()) {
      document=engine.openReportDocument(docName);
    }
  }
 catch (  Exception e) {
  }
  return document;
}
Program: 78198
Project: 78198
Buggy source:
/** 
 * Create HTML render context.
 * @param svgFlag
 * @return
 */
private HTMLRenderContext createHTMLrenderContext(boolean svgFlag){
  HTMLRenderContext renderContext=new HTMLRenderContext();
  renderContext.setImageDirectory(imageDirectory);
  renderContext.setBaseImageURL(contextPath + imageBaseUrl);
  renderContext.setBaseURL(this.contextPath + "String_Node_Str");
  renderContext.setSupportedImageFormats(svgFlag ? "String_Node_Str" : "String_Node_Str");
  return renderContext;
}

Fixed version (ground truth):
/** 
 * Create HTML render context.
 * @param svgFlag
 * @param servletPath
 * @return
 */
private HTMLRenderContext createHTMLrenderContext(boolean svgFlag,String servletPath){
  HTMLRenderContext renderContext=new HTMLRenderContext();
  renderContext.setImageDirectory(imageDirectory);
  renderContext.setBaseImageURL(contextPath + imageBaseUrl);
  if (servletPath != null && servletPath.length() > 0 && !servletPath.equalsIgnoreCase(IBirtConstants.SERVLET_PATH_PREVIEW)) {
    renderContext.setBaseURL(this.contextPath + servletPath);
  }
 else {
    renderContext.setBaseURL(this.contextPath + IBirtConstants.SERVLET_PATH_FRAMESET);
  }
  renderContext.setSupportedImageFormats(svgFlag ? "String_Node_Str" : "String_Node_Str");
  return renderContext;
}
Program: 78199
Project: 78199
Buggy source:
/** 
 * Create PDF render context.
 * @return
 */
private PDFRenderContext createPDFrenderContext(){
  PDFRenderContext renderContext=new PDFRenderContext();
  renderContext.setBaseURL(this.contextPath + "String_Node_Str");
  renderContext.setSupportedImageFormats("String_Node_Str");
  return renderContext;
}

Fixed version (ground truth):
/** 
 * Create PDF render context.
 * @return
 */
private PDFRenderContext createPDFrenderContext(){
  PDFRenderContext renderContext=new PDFRenderContext();
  renderContext.setBaseURL(this.contextPath + IBirtConstants.SERVLET_PATH_RUN);
  renderContext.setSupportedImageFormats("String_Node_Str");
  return renderContext;
}
Program: 78201
Project: 78201
Buggy source:
/** 
 * UnGroups the svg drawing instructions that represents this primitive events.
 * @param pre primitive render event
 * @param drawText TODO
 */
protected void ungroupPrimitive(PrimitiveRenderEvent pre,boolean drawText){
  if (_iun == null) {
    logger.log(ILogger.WARNING,Messages.getString("String_Node_Str",getULocale()));
    return;
  }
  if (pre.getSource() instanceof StructureSource) {
    final Series series=(Series)getElementFromSource((StructureSource)pre.getSource(),StructureType.SERIES);
    if (series != null) {
      if (drawText) {
        svg_g2d.popParent();
        svg_g2d.popParent();
      }
 else {
        svg_g2d.setDeferStrokColor(null);
        svg_g2d.popParent();
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * UnGroups the svg drawing instructions that represents this primitive events.
 * @param pre primitive render event
 * @param drawText TODO
 */
protected void ungroupPrimitive(PrimitiveRenderEvent pre,boolean drawText){
  if (_iun == null) {
    logger.log(ILogger.WARNING,Messages.getString("String_Node_Str",getULocale()));
    return;
  }
  if (pre.getSource() instanceof StructureSource) {
    StructureSource sourceObject=(StructureSource)pre.getSource();
    final Series series=(Series)getElementFromSource(sourceObject,StructureType.SERIES);
    if (series != null) {
      if (drawText) {
        svg_g2d.popParent();
        svg_g2d.popParent();
      }
 else {
        svg_g2d.setDeferStrokColor(null);
        svg_g2d.popParent();
      }
    }
 else {
      if ((getElementFromSource(sourceObject,StructureType.TITLE) != null) || (getElementFromSource(sourceObject,StructureType.CHART_BLOCK) != null)) {
        svg_g2d.setDeferStrokColor(null);
        svg_g2d.popParent();
      }
    }
  }
}
Program: 78204
Project: 78204
Buggy source:
/** 
 * @see org.eclipse.birt.report.designer.ui.dialogs.properties.IPropertyPage#createPageControl(org.eclipse.swt.widgets.Composite)
 */
public Control createPageControl(Composite parent){
  Composite content=new Composite(parent,SWT.NONE);
  FillLayout layout=new FillLayout();
  content.setLayout(layout);
  Label txt=new Label(content,SWT.LEFT);
  txt.setText(Messages.formatMessage("String_Node_Str",new Object[]{dataSourceDesign.getName()}));
  return content;
}

Fixed version (ground truth):
public Control createPageControl(Composite parent){
  Composite content=new Composite(parent,SWT.NONE);
  FillLayout layout=new FillLayout();
  content.setLayout(layout);
  Label txt=new Label(content,SWT.LEFT);
  txt.setText(Messages.formatMessage("String_Node_Str",new Object[]{dataSourceDesign.getName()}));
  return content;
}
Program: 78205
Project: 78205
Buggy source:
protected DataSetDesign collectDataSetDesign(DataSetDesign design){
  this.datasetDesign.getDataSourceDesign().setOdaExtensionId(OdaJdbcDriver.Constants.DATA_SOURCE_ID);
  this.datasetDesign.setQueryText("String_Node_Str");
  return this.datasetDesign;
}

Fixed version (ground truth):
protected DataSetDesign collectDataSetDesign(DataSetDesign design){
  if (props == null)   props=new Properties();
  props.setProperty(Constants.ODADriverClass,SampleDBConstants.DRIVER_CLASS);
  props.setProperty(Constants.ODAURL,SampleDBConstants.DRIVER_URL);
  props.setProperty(Constants.ODAUser,SAMPLE_DB_SCHEMA);
  props.setProperty(Constants.ODAPassword,"String_Node_Str");
  design.getDataSourceDesign().setOdaExtensionId(OdaJdbcDriver.Constants.DATA_SOURCE_ID);
  try {
    design.getDataSourceDesign().setPublicProperties(DesignSessionUtil.createDataSourcePublicProperties(OdaJdbcDriver.Constants.DATA_SOURCE_ID,props));
  }
 catch (  OdaException e) {
    e.printStackTrace();
  }
  return design;
}
Program: 78206
Project: 78206
Buggy source:
/** 
 * Create a report engine instance.
 */
public IReportEngine createReportEngine(EngineConfig config){
  if (config == null) {
    config=new EngineConfig();
  }
  Platform.initialize(new PlatformFileContext());
  Object factory=Platform.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
  if (factory instanceof IReportEngineFactory) {
    return ((IReportEngineFactory)factory).createReportEngine(config);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Create a report engine instance.
 * @throws BirtException 
 */
public IReportEngine createReportEngine(EngineConfig config) throws BirtException {
  if (config == null) {
    config=new EngineConfig();
  }
  Platform.startup(new PlatformConfig());
  Object factory=Platform.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
  if (factory instanceof IReportEngineFactory) {
    return ((IReportEngineFactory)factory).createReportEngine(config);
  }
  return null;
}
Program: 78207
Project: 78207
Buggy source:
/** 
 * UnGroups the svg drawing instructions that represents this primitive events.
 * @param pre primitive render event
 * @param drawText TODO
 */
protected void ungroupPrimitive(PrimitiveRenderEvent pre,boolean drawText){
  if (_iun == null) {
    logger.log(ILogger.WARNING,Messages.getString("String_Node_Str",getULocale()));
    return;
  }
  if (pre.getSource() instanceof StructureSource) {
    StructureSource sourceObject=(StructureSource)pre.getSource();
    final Series series=(Series)getElementFromSource(sourceObject,StructureType.SERIES);
    if (series != null) {
      if (drawText) {
        svg_g2d.popParent();
        svg_g2d.popParent();
      }
 else {
        svg_g2d.setDeferStrokColor(null);
        svg_g2d.popParent();
      }
    }
 else {
      if ((getElementFromSource(sourceObject,StructureType.TITLE) != null) || (getElementFromSource(sourceObject,StructureType.CHART_BLOCK) != null)) {
        svg_g2d.setDeferStrokColor(null);
        svg_g2d.popParent();
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * UnGroups the svg drawing instructions that represents this primitive events.
 * @param pre primitive render event
 * @param drawText TODO
 */
protected void ungroupPrimitive(PrimitiveRenderEvent pre,boolean drawText){
  if (_iun == null) {
    logger.log(ILogger.WARNING,Messages.getString("String_Node_Str",getULocale()));
    return;
  }
  if (pre.getSource() instanceof StructureSource) {
    StructureSource sourceObject=(StructureSource)pre.getSource();
    final Series series=(Series)getElementFromSource(sourceObject,StructureType.SERIES);
    if (series != null) {
      if (drawText) {
        svg_g2d.popParent();
        svg_g2d.popParent();
      }
 else {
        svg_g2d.setDeferStrokColor(null);
        svg_g2d.popParent();
      }
    }
 else {
      if ((getElementFromSource(sourceObject,StructureType.TITLE) != null) || (getElementFromSource(sourceObject,StructureType.AXIS) != null) || (getElementFromSource(sourceObject,StructureType.CHART_BLOCK) != null)|| (getElementFromSource(sourceObject,StructureType.PLOT) != null)) {
        svg_g2d.setDeferStrokColor(null);
        svg_g2d.popParent();
      }
    }
  }
}
Program: 78211
Project: 78211
Buggy source:
/** 
 * Insert a text string into the text area
 * @param text
 */
private void insertText(String text){
  StyledText textWidget=viewer.getTextWidget();
  int selectionStart=textWidget.getSelection().x;
  textWidget.insert(text);
  textWidget.setSelection(selectionStart + text.length());
  textWidget.setFocus();
}

Fixed version (ground truth):
/** 
 * Insert a text string into the text area
 * @param text
 */
private void insertText(String text){
  if (text == null)   return;
  StyledText textWidget=viewer.getTextWidget();
  int selectionStart=textWidget.getSelection().x;
  textWidget.insert(text);
  textWidget.setSelection(selectionStart + text.length());
  textWidget.setFocus();
}
Program: 78213
Project: 78213
Buggy source:
/** 
 * Init the bean.
 * @param request
 * @throws Exception
 */
protected void __init(HttpServletRequest request) throws Exception {
  if (ParameterAccessor.isGetImageOperator(request)) {
    return;
  }
  this.category="String_Node_Str";
  this.masterPageContent=ParameterAccessor.isMasterPageContent(request);
  this.isDesigner=ParameterAccessor.isDesigner(request);
  this.bookmark=ParameterAccessor.getBookmark(request);
  this.reportPage=String.valueOf(ParameterAccessor.getPage(request));
  this.reportDocumentName=ParameterAccessor.getReportDocument(request);
  this.reportDesignName=ParameterAccessor.getReport(request);
  processReport(request);
  String title=null;
  if (title == null || title.trim().length() <= 0) {
    title=BirtResources.getString("String_Node_Str");
  }
  this.reportTitle=ParameterAccessor.htmlEncode(title);
}

Fixed version (ground truth):
/** 
 * Init the bean.
 * @param request
 * @throws Exception
 */
protected void __init(HttpServletRequest request) throws Exception {
  if (ParameterAccessor.isGetImageOperator(request)) {
    return;
  }
  this.category="String_Node_Str";
  this.masterPageContent=ParameterAccessor.isMasterPageContent(request);
  this.isDesigner=ParameterAccessor.isDesigner(request);
  this.bookmark=ParameterAccessor.getBookmark(request);
  this.reportPage=String.valueOf(ParameterAccessor.getPage(request));
  this.reportDocumentName=ParameterAccessor.getReportDocument(request);
  this.reportDesignName=ParameterAccessor.getReport(request);
  processReport(request);
  String title=null;
  if (title == null || title.trim().length() <= 0) {
    title=BirtResources.getString("String_Node_Str");
  }
  this.reportTitle=ParameterAccessor.htmlEncode(title);
  this.__initParameters(request);
}
Program: 78214
Project: 78214
Buggy source:
/** 
 * @param source
 * @return
 */
private static Node[] populateNodeList(Node[] source){
}

Fixed version (ground truth):
/** 
 * @param source
 * @return
 */
private static Node[] populateNodeList(Node[] source){
  Node[] result=new Node[source.length];
  for (int i=0; i < result.length; i++) {
    result[i]=new Node(source[i].getValue());
  }
  for (int i=0; i < result.length; i++) {
    List l=source[i].getChildren();
    for (int j=0; j < l.size(); j++) {
      Node n=getMatchedNode((Node)l.get(j),result);
      if (n != null)       result[i].addChild(n);
    }
  }
  return result;
}
Program: 78216
Project: 78216
Buggy source:
/** 
 * Set Engine context.
 * @param servletContext
 * @param request
 */
synchronized public void setEngineContext(ServletContext servletContext,HttpServletRequest request){
  if (engine == null) {
    IPlatformContext platformContext=new PlatformServletContext(servletContext);
    config.setPlatformContext(platformContext);
    try {
      Platform.startup(null);
    }
 catch (    BirtException e) {
      e.printStackTrace();
    }
    IReportEngineFactory factory=(IReportEngineFactory)Platform.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
    engine=factory.createReportEngine(config);
    contextPath=request.getContextPath();
  }
}

Fixed version (ground truth):
/** 
 * Set Engine context.
 * @param servletContext
 * @param request
 */
synchronized public void setEngineContext(ServletContext servletContext,HttpServletRequest request){
  if (engine == null) {
    IPlatformContext platformContext=new PlatformServletContext(servletContext);
    config.setPlatformContext(platformContext);
    try {
      Platform.startup(config);
    }
 catch (    BirtException e) {
      e.printStackTrace();
    }
    IReportEngineFactory factory=(IReportEngineFactory)Platform.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
    engine=factory.createReportEngine(config);
    contextPath=request.getContextPath();
  }
}
Program: 78217
Project: 78217
Buggy source:
/** 
 * Get report document name.
 * @param request http request
 * @return report file name
 * @throws AxisFault
 */
public static String getReportDocument(HttpServletRequest request){
  String filePath=getParameter(request,PARAM_REPORT_DOCUMENT);
  filePath=preProcess(filePath);
  if ("String_Node_Str".equals(filePath)) {
    filePath=generateDocumentFromReport(request);
    filePath=createDocumentPath(filePath,request);
  }
  return filePath;
}

Fixed version (ground truth):
/** 
 * Get report document name.
 * @param request http request
 * @return report file name
 * @throws AxisFault
 */
public static String getReportDocument(HttpServletRequest request){
  String filePath=getParameter(request,PARAM_REPORT_DOCUMENT);
  filePath=preProcess(filePath);
  if ("String_Node_Str".equals(filePath)) {
    filePath=generateDocumentFromReport(request);
    filePath=createDocumentPath(filePath,request);
  }
 else {
    filePath=createAbsolutePath(filePath);
  }
  return filePath;
}
Program: 78218
Project: 78218
Buggy source:
private void refreshColumnList(){
  keyChooser.removeAll();
  columnList=DEUtil.getVisiableColumnBindingsList(inputGroup);
  Iterator itor=columnList.iterator();
  while (itor.hasNext()) {
    keyChooser.add(((ComputedColumnHandle)itor.next()).getName());
  }
}

Fixed version (ground truth):
private void refreshColumnList(){
  String selected=keyChooser.getText();
  keyChooser.removeAll();
  columnList=DEUtil.getVisiableColumnBindingsList(inputGroup);
  Iterator itor=columnList.iterator();
  while (itor.hasNext()) {
    keyChooser.add(((ComputedColumnHandle)itor.next()).getName());
  }
  int newIndex=keyChooser.indexOf(selected);
  if (newIndex != -1) {
    keyChooser.select(newIndex);
  }
 else {
    keyChooser.setText(selected);
  }
}
Program: 78219
Project: 78219
Buggy source:
/** 
 * Test whether there are dependency cycles in exprManager.
 * @param exprManager
 * @return
 * @throws DataException
 */
private static void testDependencyCycle(ExprManager exprManager) throws DataException {
  List result=new ArrayList();
  Iterator it=exprManager.getColumnNames().iterator();
  while (it.hasNext()) {
    String name=it.next().toString();
    Node n=new Node(name);
    IBaseExpression expr=exprManager.getExpr(name);
    if (expr instanceof IScriptExpression) {
      String exprText=((IScriptExpression)expr).getText();
      try {
        List l=ExpressionUtil.extractColumnExpressions(exprText);
        for (int j=0; j < l.size(); j++) {
          n.addChild(new Node(((IColumnBinding)l.get(j)).getResultSetColumnName()));
        }
      }
 catch (      BirtException e) {
        throw new DataException(e.getLocalizedMessage());
      }
    }
    result.add(n);
  }
  Node[] source=new Node[result.size()];
  for (int i=0; i < source.length; i++) {
    source[i]=(Node)result.get(i);
  }
  validateNodes(source);
}

Fixed version (ground truth):
/** 
 * Test whether there are dependency cycles in exprManager.
 * @param exprManager
 * @return
 * @throws DataException
 */
private static void testDependencyCycle(ExprManager exprManager) throws DataException {
  List result=new ArrayList();
  Iterator it=exprManager.getColumnNames().iterator();
  while (it.hasNext()) {
    String name=it.next().toString();
    Node n=new Node(name);
    IBaseExpression expr=exprManager.getExpr(name);
    if (expr != null) {
      try {
        List l=null;
        if (expr instanceof IScriptExpression)         l=ExpressionParserUtil.extractColumnExpression((IScriptExpression)expr);
 else         if (expr instanceof IConditionalExpression)         l=ExpressionParserUtil.extractColumnExpression((IConditionalExpression)expr);
 else         throw new DataException(ResourceConstants.BAD_DATA_EXPRESSION);
        for (int j=0; j < l.size(); j++) {
          n.addChild(new Node(l.get(j) == null ? null : l.get(j).toString()));
        }
      }
 catch (      BirtException e) {
        throw new DataException(e.getLocalizedMessage());
      }
    }
    result.add(n);
  }
  Node[] source=new Node[result.size()];
  for (int i=0; i < source.length; i++) {
    source[i]=(Node)result.get(i);
  }
  validateNodes(source);
}
Program: 78220
Project: 78220
Buggy source:
public boolean onBroughtToTop(IReportEditorPage prePage){
  if (getEditorInput() != prePage.getEditorInput()) {
    setInput(prePage.getEditorInput());
  }
  ModuleHandle model=getProvider().getReportModuleHandle(getEditorInput());
  if (model != null && getModel() != model) {
    Object oldModel=getModel();
    getProvider().connect(model);
    rebuildReportDesign(oldModel);
    if (getModel() != null) {
      setViewContentsAsMasterPage();
      markPageStale(IPageStaleType.NONE);
    }
    updateStackActions();
  }
  return true;
}

Fixed version (ground truth):
public boolean onBroughtToTop(IReportEditorPage prePage){
  if (getEditorInput() != prePage.getEditorInput()) {
    setInput(prePage.getEditorInput());
  }
  ModuleHandle model=getProvider().getReportModuleHandle(getEditorInput());
  if (model != null && getModel() != model) {
    Object oldModel=getModel();
    getProvider().connect(model);
    setModel(model);
    rebuildReportDesign(oldModel);
    if (getModel() != null) {
      setViewContentsAsMasterPage();
      markPageStale(IPageStaleType.NONE);
    }
    updateStackActions();
  }
  return true;
}
Program: 78221
Project: 78221
Buggy source:
protected DataSetDesign collectDataSetDesign(DataSetDesign design){
  if (design != null)   design.setQueryText(doc.get());
  return design;
}

Fixed version (ground truth):
protected DataSetDesign collectDataSetDesign(DataSetDesign design){
  if (design != null && doc != null)   design.setQueryText(doc.get());
  return design;
}
Program: 78222
Project: 78222
Buggy source:
private void RemoveAllAvailableDbObjects(){
  availableDbObjectsTree.removeAll();
}

Fixed version (ground truth):
private void RemoveAllAvailableDbObjects(){
  if (availableDbObjectsTree != null)   availableDbObjectsTree.removeAll();
}
Program: 78223
Project: 78223
Buggy source:
public Control createPageControl(Composite parent){
  SashForm SashForm=new SashForm(parent,SWT.HORIZONTAL);
  SashForm.setLayoutData(new GridData(GridData.FILL_BOTH));
  initialize();
  initJdbcInfo();
  createTableSelectionComposite(SashForm);
  populateAvailableDbObjects();
  createTextualQueryComposite(SashForm);
  setSashFormWeights(SashForm);
  return SashForm;
}

Fixed version (ground truth):
/** 
 * @param parent
 * @return
 */
public Control createPageControl(Composite parent){
  SashForm SashForm=new SashForm(parent,SWT.HORIZONTAL);
  SashForm.setLayoutData(new GridData(GridData.FILL_BOTH));
  initialize();
  initJdbcInfo();
  createTableSelectionComposite(SashForm);
  populateAvailableDbObjects();
  createTextualQueryComposite(SashForm);
  setSashFormWeights(SashForm);
  return SashForm;
}
Program: 78224
Project: 78224
Buggy source:
/** 
 * Test whether high level group keys are depended on low level group keys.
 * @param exprManager
 * @return
 * @throws DataException 
 */
private static void testGroupNameValidation(ExprManager exprManager) throws DataException {
  HashMap map=exprManager.getGroupKeys();
  Iterator it=map.keySet().iterator();
  while (it.hasNext()) {
    Integer level=(Integer)it.next();
    exprManager.setEntryGroupLevel(level.intValue());
    if (!ExpressionCompilerUtil.hasColumnRow(map.get(level).toString(),exprManager)) {
      exprManager.setEntryGroupLevel(ExprManager.OVERALL_GROUP);
      throw new DataException(ResourceConstants.INVALID_GROUP_KEY,new Object[]{map.get(level).toString(),level});
    }
  }
}

Fixed version (ground truth):
/** 
 * Test whether high level group keys are depended on low level group keys.
 * @param exprManager
 * @return
 * @throws DataException 
 */
private static void testGroupNameValidation(ExprManager exprManager) throws DataException {
  HashMap map=exprManager.getGroupKeys();
  Iterator it=map.keySet().iterator();
  while (it.hasNext()) {
    Integer level=(Integer)it.next();
    exprManager.setEntryGroupLevel(level.intValue());
    if (!ExpressionCompilerUtil.hasColumnRow(map.get(level).toString(),exprManager)) {
      exprManager.setEntryGroupLevel(ExprManager.OVERALL_GROUP);
      throw new DataException(ResourceConstants.INVALID_GROUP_KEY,new Object[]{map.get(level).toString(),level});
    }
  }
  exprManager.setEntryGroupLevel(ExprManager.OVERALL_GROUP);
}
Program: 78225
Project: 78225
Buggy source:
/** 
 * Returns the image source type. This is one of the following options defined in <code>DesignChoiceConstants</code>: <p> <ul> <li><code>IMAGE_REF_TYPE_NONE</code> <li><code>IMAGE_REF_TYPE_URL</code> <li><code>IMAGE_REF_TYPE_FILE</code> <li><code>IMAGE_REF_TYPE_EXPR</code> <li><code>IMAGE_REF_TYPE_EMBED</code> </ul>
 * @param source the image source type.
 * @throws SemanticException if the <code>source</code> is not one of the above.
 */
public void setSource(String source) throws SemanticException {
  setProperty(ImageItem.SOURCE_PROP,source);
}

Fixed version (ground truth):
/** 
 * Sets the image source type. This is one of the following options defined in <code>DesignChoiceConstants</code>: <p> <ul> <li><code>IMAGE_REF_TYPE_NONE</code> <li><code>IMAGE_REF_TYPE_URL</code> <li><code>IMAGE_REF_TYPE_FILE</code> <li><code>IMAGE_REF_TYPE_EXPR</code> <li><code>IMAGE_REF_TYPE_EMBED</code> </ul>
 * @param source the image source type.
 * @throws SemanticException if the <code>source</code> is not one of the above.
 */
public void setSource(String source) throws SemanticException {
  setProperty(ImageItem.SOURCE_PROP,source);
}
Program: 78226
Project: 78226
Buggy source:
/** 
 * Sets the image uri property. The source type is automatically set in this method. Whether <code>IMAGE_REF_TYPE_FILE</code> or <code>IMAGE_REF_TYPE_URL</code> depends on the uri to set.
 * @param uri the uri to be set.
 * @throws SemanticException if the property is locked.
 */
public void setURI(String uri) throws SemanticException {
  String source=DesignChoiceConstants.IMAGE_REF_TYPE_URL;
  try {
    module.getActivityStack().startTrans();
    setProperty(ImageItem.SOURCE_PROP,source);
    setProperty(ImageItem.URI_PROP,uri);
  }
 catch (  SemanticException e) {
    module.getActivityStack().rollback();
    throw e;
  }
  module.getActivityStack().commit();
}

Fixed version (ground truth):
/** 
 * Sets the image uri property. The source type is <code>IMAGE_REF_TYPE_URL</code>, and will automatically set in this method.
 * @param uri the uri to be set.
 * @throws SemanticException if the property is locked.
 */
public void setURI(String uri) throws SemanticException {
  String source=DesignChoiceConstants.IMAGE_REF_TYPE_URL;
  setURIProperty(uri,source);
}
Program: 78227
Project: 78227
Buggy source:
public void doSaveAs(){
  getActivePageInstance().doSaveAs();
  setInput(getActivePageInstance().getEditorInput());
  IReportProvider provider=getProvider();
  if (provider != null) {
    setPartName(provider.getInputPath(getEditorInput()).lastSegment());
    firePropertyChange(IWorkbenchPartConstants.PROP_PART_NAME);
    getProvider().getReportModuleHandle(getEditorInput()).setFileName(getProvider().getInputPath(getEditorInput()).toOSString());
  }
}

Fixed version (ground truth):
public void doSaveAs(){
  getActivePageInstance().doSaveAs();
  setInput(getActivePageInstance().getEditorInput());
  IReportProvider provider=getProvider();
  if (provider != null) {
    setPartName(provider.getInputPath(getEditorInput()).lastSegment());
    firePropertyChange(IWorkbenchPartConstants.PROP_PART_NAME);
    getProvider().getReportModuleHandle(getEditorInput()).setFileName(getProvider().getInputPath(getEditorInput()).toOSString());
  }
  updateRelatedViews();
}
Program: 78228
Project: 78228
Buggy source:
private String[] getDataSetColumns(ScalarParameterHandle handle){
  if (dataSet == null) {
    return new String[0];
  }
  DataSetItemModel[] models=DataSetManager.getCurrentInstance().getColumns(dataSet,false);
  if (models == null) {
    return new String[0];
  }
  ArrayList valueList=new ArrayList(models.length);
  for (int i=0; i < models.length; i++) {
    if (handle == null || matchDataType(handle,models[i])) {
      valueList.add(models[i].getName());
    }
  }
  return (String[])valueList.toArray(new String[0]);
}

Fixed version (ground truth):
private String[] getDataSetColumns(ScalarParameterHandle handle){
  if (dataSet == null) {
    return new String[0];
  }
  DataSetItemModel[] models=DataSetManager.getCurrentInstance().getColumns(dataSet,false);
  if (models == null) {
    return new String[0];
  }
  ArrayList valueList=new ArrayList(models.length);
  for (int i=0; i < models.length; i++) {
    if (handle == null || matchDataType(handle,models[i])) {
      valueList.add(models[i].getAlias() == null ? models[i].getName() : models[i].getAlias());
    }
  }
  return (String[])valueList.toArray(new String[0]);
}
Program: 78229
Project: 78229
Buggy source:
/** 
 * compile column reference expression
 * @param refNode
 * @throws BirtException
 */
private void compileDirectColRefExpr(Node refNode,ScriptOrFnNode tree,List columnExprList) throws BirtException {
  assert(refNode.getType() == Token.GETPROP || refNode.getType() == Token.GETELEM);
  Node rowName=refNode.getFirstChild();
  assert(rowName != null);
  if (rowName.getType() != Token.NAME) {
    compileComplexExpr(refNode,tree,columnExprList);
  }
  String str=rowName.getString();
  assert(str != null);
  if (!str.equals(ROW_INDICATOR))   return;
  Node rowColumn=rowName.getNext();
  assert(rowColumn != null);
  if (refNode.getType() == Token.GETPROP && rowColumn.getType() == Token.STRING) {
    ColumnBinding binding=new ColumnBinding(rowColumn.getString(),DATASETROW_INDICATOR + "String_Node_Str" + rowColumn.getString()+ "String_Node_Str");
    columnExprList.add(binding);
  }
  if (refNode.getType() == Token.GETELEM) {
    if (rowColumn.getType() == Token.NUMBER) {
    }
 else     if (rowColumn.getType() == Token.STRING) {
      ColumnBinding binding=new ColumnBinding(rowColumn.getString(),DATASETROW_INDICATOR + "String_Node_Str" + rowColumn.getString()+ "String_Node_Str");
      columnExprList.add(binding);
    }
  }
}

Fixed version (ground truth):
/** 
 * compile column reference expression
 * @param refNode
 * @throws BirtException
 */
private void compileDirectColRefExpr(Node refNode,ScriptOrFnNode tree,List columnExprList) throws BirtException {
  assert(refNode.getType() == Token.GETPROP || refNode.getType() == Token.GETELEM);
  Node rowName=refNode.getFirstChild();
  assert(rowName != null);
  if (rowName.getType() != Token.NAME) {
    compileComplexExpr(refNode,tree,columnExprList);
    return;
  }
  String str=rowName.getString();
  assert(str != null);
  if (!str.equals(ROW_INDICATOR))   return;
  Node rowColumn=rowName.getNext();
  assert(rowColumn != null);
  if (refNode.getType() == Token.GETPROP && rowColumn.getType() == Token.STRING) {
    ColumnBinding binding=new ColumnBinding(rowColumn.getString(),DATASETROW_INDICATOR + "String_Node_Str" + rowColumn.getString()+ "String_Node_Str");
    columnExprList.add(binding);
  }
  if (refNode.getType() == Token.GETELEM) {
    if (rowColumn.getType() == Token.NUMBER) {
    }
 else     if (rowColumn.getType() == Token.STRING) {
      ColumnBinding binding=new ColumnBinding(rowColumn.getString(),DATASETROW_INDICATOR + "String_Node_Str" + rowColumn.getString()+ "String_Node_Str");
      columnExprList.add(binding);
    }
  }
}
Program: 78230
Project: 78230
Buggy source:
/** 
 * Returns the level between the holder and the given handle
 * @param holder the handle of the holder
 * @param baseElement the handle of the base element
 * @return the level between the holder and the base element, or -1 if theelement is not a children of the holder
 */
public static int getBindingLevel(DesignElementHandle holder,DesignElementHandle baseElement){
  int level=0;
  for (DesignElementHandle elementHandle=baseElement; elementHandle.getContainer() != null; elementHandle=getBindingHolder(elementHandle).getContainer(), level++) {
    if (getBindingHolder(elementHandle) == holder) {
      return level;
    }
  }
  return -1;
}

Fixed version (ground truth):
/** 
 * Returns the level between the holder and the given handle
 * @param holder the handle of the holder
 * @param baseElement the handle of the base element
 * @return the level between the holder and the base element, or -1 if theelement is not a children of the holder
 */
public static int getBindingLevel(DesignElementHandle holder,DesignElementHandle baseElement){
  int level=0;
  for (DesignElementHandle elementHandle=baseElement; elementHandle.getContainer() != null; elementHandle=getBindingHolder(elementHandle).getContainer(), level++) {
    DesignElementHandle bindingHolder=getBindingHolder(elementHandle);
    if (bindingHolder == holder) {
      return level;
    }
    if (holder instanceof GroupHandle && bindingHolder == holder.getContainer()) {
      return level;
    }
  }
  return -1;
}
Program: 78231
Project: 78231
Buggy source:
/** 
 * Returns all visible column bindings for the given element
 * @param handle the handle of the element
 * @return the list of all visible column bindings.The list order is fromthe top to the given element
 */
public static List getVisiableColumnBindingsList(DesignElementHandle handle,boolean includeSelf){
  List bindingList=new ArrayList();
  if (includeSelf) {
    Iterator iterator=getBindingColumnIterator(handle);
    while (iterator.hasNext()) {
      bindingList.add(iterator.next());
    }
  }
  ReportItemHandle holder=getBindingHolder(handle);
  if (holder != null) {
    for (DesignElementHandle elementHandle=handle.getContainer(); elementHandle != holder.getContainer(); elementHandle=elementHandle.getContainer()) {
      List subBindingList=new ArrayList();
      Iterator iterator=getBindingColumnIterator(elementHandle);
      while (iterator.hasNext()) {
        subBindingList.add(iterator.next());
      }
      bindingList.addAll(0,subBindingList);
    }
  }
  return bindingList;
}

Fixed version (ground truth):
/** 
 * Returns all visible column bindings for the given element
 * @param handle the handle of the element
 * @return the list of all visible column bindings.The list order is fromthe top to the given element
 */
public static List getVisiableColumnBindingsList(DesignElementHandle handle,boolean includeSelf){
  List bindingList=new ArrayList();
  if (includeSelf) {
    Iterator iterator=getBindingColumnIterator(handle);
    while (iterator.hasNext()) {
      bindingList.add(iterator.next());
    }
  }
  ReportItemHandle holder=getBindingHolder(handle);
  if (holder != null) {
    if (holder instanceof ListingHandle && ((ListingHandle)holder).getDetail() == handle.getContainerSlotHandle()) {
      SlotHandle groupSlotHandle=((ListingHandle)holder).getGroups();
      for (Iterator iter=groupSlotHandle.iterator(); iter.hasNext(); ) {
        GroupHandle group=(GroupHandle)iter.next();
        for (Iterator columnIter=group.columnBindingsIterator(); columnIter.hasNext(); ) {
          bindingList.add(columnIter.next());
        }
      }
    }
    for (DesignElementHandle elementHandle=handle.getContainer(); elementHandle != holder.getContainer(); elementHandle=elementHandle.getContainer()) {
      List subBindingList=new ArrayList();
      Iterator iterator=getBindingColumnIterator(elementHandle);
      while (iterator.hasNext()) {
        subBindingList.add(iterator.next());
      }
      bindingList.addAll(0,subBindingList);
    }
  }
  return bindingList;
}
Program: 78232
Project: 78232
Buggy source:
/** 
 * Returns the element handle which can save binding columns the given element
 * @param handle the handle of the element which needs binding columns
 * @return the holder for the element,or itself if no holder available
 */
public static ReportItemHandle getBindingHolder(DesignElementHandle handle){
  if (handle instanceof ReportElementHandle) {
    if (handle instanceof ListingHandle || handle instanceof GridHandle) {
      return (ReportItemHandle)handle;
    }
    ReportItemHandle result=getBindingHolder(handle.getContainer());
    if (result == null && handle instanceof ReportItemHandle) {
      result=(ReportItemHandle)handle;
    }
    return result;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns the element handle which can save binding columns the given element
 * @param handle the handle of the element which needs binding columns
 * @return the holder for the element,or itself if no holder available
 */
public static ReportItemHandle getBindingHolder(DesignElementHandle handle){
  if (handle instanceof ReportElementHandle) {
    if (handle instanceof ListingHandle) {
      return (ReportItemHandle)handle;
    }
    if (handle instanceof ReportItemHandle) {
      if (((ReportItemHandle)handle).getDataSet() != null && ((ReportItemHandle)handle).columnBindingsIterator().hasNext()) {
        return (ReportItemHandle)handle;
      }
    }
    ReportItemHandle result=getBindingHolder(handle.getContainer());
    if (result == null && handle instanceof ReportItemHandle) {
      result=(ReportItemHandle)handle;
    }
    return result;
  }
  return null;
}