nus-yam/ex-repair huggingface dataset:
Program: 71824
Project: 71824
Buggy source:
/** 
 * Create evaluator for data cube under sharing crosstab query.
 * @param session
 * @param cube
 * @return
 * @throws ExtendedElementException
 * @throws BirtException
 * @throws DataException
 * @since 2.3
 */
private IDataRowExpressionEvaluator createCubeEvaluatorForSharingQuery(DataRequestSession session,CubeHandle cube) throws ExtendedElementException, BirtException, DataException {
  CrosstabReportItemHandle crosstabItem=null;
  if (isInMultiView()) {
    crosstabItem=(CrosstabReportItemHandle)((ExtendedItemHandle)itemHandle.getContainer().getContainer()).getReportItem();
  }
 else {
    IReportItem reportItem=((ExtendedItemHandle)itemHandle.getDataBindingReference()).getReportItem();
    if (reportItem instanceof CrosstabReportItemHandle) {
      crosstabItem=(CrosstabReportItemHandle)reportItem;
    }
 else {
      return createCubeEvaluator(cube,session);
    }
  }
  ICubeQueryDefinition qd=CrosstabQueryUtil.createCubeQuery(crosstabItem,null,false,true,true,true,true,true);
  session.defineCube(cube);
  IPreparedCubeQuery ipcq=session.prepare(qd);
  return new BIRTCubeResultSetEvaluator(ipcq.execute(null,null));
}

Fixed version (ground truth):
/** 
 * Create evaluator for data cube under sharing crosstab query.
 * @param session
 * @param cube
 * @return
 * @throws ExtendedElementException
 * @throws BirtException
 * @throws DataException
 * @since 2.3
 */
private IDataRowExpressionEvaluator createCubeEvaluatorForSharingQuery(final DataRequestSession session,CubeHandle cube) throws ExtendedElementException, BirtException, DataException {
  CrosstabReportItemHandle crosstabItem=null;
  if (isInMultiView()) {
    crosstabItem=(CrosstabReportItemHandle)((ExtendedItemHandle)itemHandle.getContainer().getContainer()).getReportItem();
  }
 else {
    IReportItem reportItem=((ExtendedItemHandle)itemHandle.getDataBindingReference()).getReportItem();
    if (reportItem instanceof CrosstabReportItemHandle) {
      crosstabItem=(CrosstabReportItemHandle)reportItem;
    }
 else {
      return createCubeEvaluator(cube,session);
    }
  }
  ICubeQueryDefinition qd=CrosstabQueryUtil.createCubeQuery(crosstabItem,null,false,true,true,true,true,true);
  session.defineCube(cube);
  IPreparedCubeQuery ipcq=session.prepare(qd);
  return new BIRTCubeResultSetEvaluator(ipcq.execute(null,null)){
    @Override public void close(){
      super.close();
      session.shutdown();
    }
  }
;
}
Program: 71825
Project: 71825
Buggy source:
/** 
 * Does Live Preview. Need to check all series data binding complete before invoking
 * @param chart chart model
 * @param dataProvider data service provider
 * @throws ChartException
 */
public static void doLivePreview(Chart chart,IDataServiceProvider dataProvider) throws ChartException {
  boolean isSharingQuery=dataProvider.checkState(IDataServiceProvider.SHARE_QUERY);
  final List expressions=Generator.instance().getRowExpressions(chart,null,!isSharingQuery);
  IDataRowExpressionEvaluator evaluator=dataProvider.prepareRowExpressionEvaluator(chart,expressions,-1,false);
  RunTimeContext context=new RunTimeContext();
  context.setULocale(ULocale.getDefault());
  context.setSharingQuery(isSharingQuery);
  Generator.instance().bindData(evaluator,chart,context);
}

Fixed version (ground truth):
/** 
 * Does Live Preview. Need to check all series data binding complete before invoking
 * @param chart chart model
 * @param dataProvider data service provider
 * @throws ChartException
 */
public static void doLivePreview(Chart chart,IDataServiceProvider dataProvider) throws ChartException {
  boolean isSharingQuery=dataProvider.checkState(IDataServiceProvider.SHARE_QUERY);
  final List expressions=Generator.instance().getRowExpressions(chart,null,!isSharingQuery);
  IDataRowExpressionEvaluator evaluator=dataProvider.prepareRowExpressionEvaluator(chart,expressions,-1,false);
  RunTimeContext context=new RunTimeContext();
  context.setULocale(ULocale.getDefault());
  context.setSharingQuery(isSharingQuery);
  Generator.instance().bindData(evaluator,chart,context);
  if (evaluator != null) {
    evaluator.close();
  }
}
Program: 71826
Project: 71826
Buggy source:
public void testSupportsMultipleResultSets() throws Exception {
  assertFalse(dbMeta1.supportsMultipleResultSets());
  assertFalse(dbMeta2.supportsMultipleResultSets());
}

Fixed version (ground truth):
public void testSupportsMultipleResultSets() throws Exception {
  assertTrue(dbMeta1.supportsMultipleResultSets());
  assertTrue(dbMeta2.supportsMultipleResultSets());
}
Program: 71827
Project: 71827
Buggy source:
public void testSupportsNamedResultSets() throws Exception {
  assertFalse(dbMeta1.supportsNamedResultSets());
  assertFalse(dbMeta2.supportsNamedResultSets());
}

Fixed version (ground truth):
public void testSupportsNamedResultSets() throws Exception {
  assertTrue(dbMeta1.supportsNamedResultSets());
  assertTrue(dbMeta2.supportsNamedResultSets());
}
Program: 71828
Project: 71828
Buggy source:
protected void initialize(){
  PageContext pageContext=new PageContext();
  if (context.autoPageBreak) {
    pageContext.pageContent=createPageContent();
  }
 else {
    pageContext.pageContent=pageContent;
  }
  currentContext=pageContext;
  contextList.add(currentContext);
  createRoot();
  PageArea page=(PageArea)currentContext.root;
  context.setMaxHeight(page.getRoot().getHeight());
  context.setMaxWidth(page.getRoot().getWidth());
  layoutHeader(page);
  layoutFooter(page);
  updateBodySize(page);
  context.setMaxHeight(page.getBody().getHeight());
  context.setMaxWidth(page.getBody().getWidth());
  currentContext.maxAvaWidth=context.getMaxWidth();
  if (context.autoPageBreak) {
    currentContext.maxAvaHeight=context.getMaxHeight();
  }
 else {
    currentContext.maxAvaHeight=Integer.MAX_VALUE;
  }
}

Fixed version (ground truth):
protected void initialize(){
  PageContext pageContext=new PageContext();
  if (context.autoPageBreak) {
    pageContext.pageContent=createPageContent(pageContent);
  }
 else {
    pageContext.pageContent=pageContent;
  }
  currentContext=pageContext;
  contextList.add(currentContext);
  createRoot();
  PageArea page=(PageArea)currentContext.root;
  context.setMaxHeight(page.getRoot().getHeight());
  context.setMaxWidth(page.getRoot().getWidth());
  layoutHeader(page);
  layoutFooter(page);
  updateBodySize(page);
  context.setMaxHeight(page.getBody().getHeight());
  context.setMaxWidth(page.getBody().getWidth());
  currentContext.maxAvaWidth=context.getMaxWidth();
  if (context.autoPageBreak) {
    currentContext.maxAvaHeight=context.getMaxHeight();
  }
 else {
    currentContext.maxAvaHeight=Integer.MAX_VALUE;
  }
}
Program: 71829
Project: 71829
Buggy source:
protected IPageContent createPageContent(){
  MasterPageDesign pageDesign=getMasterPage(report);
  return ReportExecutorUtil.executeMasterPage(reportExecutor,context.pageNumber++,pageDesign);
}

Fixed version (ground truth):
protected IPageContent createPageContent(IPageContent pageContent,long pageNumber,long totalPageNumber){
  return (IPageContent)cloneContent(pageContent,pageNumber,totalPageNumber);
}
Program: 71830
Project: 71830
Buggy source:
public void addData(int col,Data data){
  if ((getStartRowId(col) > height) || (col >= getColumnCount())) {
    emitter.outputSheet();
    clearCachedSheetData();
  }
  List<Data> column=columns.get(col);
  column.add(data);
  if (data instanceof Data) {
    BookmarkDef bookmark=((Data)data).getBookmark();
    if (null == bookmark) {
      return;
    }
    int rowNo=columnId2StartRowId.get(new Integer(col)).intValue() + getStartRowId(col);
    bookmark.setColumnNo(col + 1);
    bookmark.setRowNo(rowNo);
    bookmarks.add(bookmark);
  }
}

Fixed version (ground truth):
public void addData(int col,Data data){
  if ((getStartRowId(col) > height) || (col >= getColumnCount())) {
    emitter.outputSheet();
    clearCachedSheetData();
  }
  List<Data> column=columns.get(col);
  int size=column.size();
  if (size > 0) {
    column.get(size - 1).clearContainer();
  }
  column.add(data);
  if (data instanceof Data) {
    BookmarkDef bookmark=((Data)data).getBookmark();
    if (null == bookmark) {
      return;
    }
    int rowNo=columnId2StartRowId.get(new Integer(col)).intValue() + getStartRowId(col);
    bookmark.setColumnNo(col + 1);
    bookmark.setRowNo(rowNo);
    bookmarks.add(bookmark);
  }
}
Program: 71831
Project: 71831
Buggy source:
/** 
 * Build the style of image content.
 */
public void buildImageStyle(IImageContent image,StringBuffer styleBuffer,int display){
  buildSize(styleBuffer,HTMLTags.ATTR_WIDTH,image.getWidth());
  buildSize(styleBuffer,HTMLTags.ATTR_HEIGHT,image.getHeight());
  setDisplayProperty(display,0,styleBuffer);
  IStyle style=getElementStyle(image);
  if (style == null) {
    return;
  }
  AttributeBuilder.buildFont(styleBuffer,style);
  AttributeBuilder.buildBox(styleBuffer,style);
  AttributeBuilder.buildBackground(styleBuffer,style,reportEmitter);
  AttributeBuilder.buildText(styleBuffer,style);
  AttributeBuilder.buildVisual(styleBuffer,style);
  AttributeBuilder.buildTextDecoration(styleBuffer,style);
}

Fixed version (ground truth):
/** 
 * Build the style of image content.
 */
public void buildImageStyle(IImageContent image,StringBuffer styleBuffer,int display){
  buildSize(styleBuffer,HTMLTags.ATTR_WIDTH,image.getWidth());
  buildSize(styleBuffer,HTMLTags.ATTR_HEIGHT,image.getHeight());
  setDisplayProperty(display,0,styleBuffer);
  IStyle style=image.getStyle();
  String verticalAlign=style.getVerticalAlign();
  if (verticalAlign != null) {
    styleBuffer.append("String_Node_Str");
    styleBuffer.append(verticalAlign);
    styleBuffer.append("String_Node_Str");
  }
  style=getElementStyle(image);
  if (style == null) {
    return;
  }
  AttributeBuilder.buildFont(styleBuffer,style);
  AttributeBuilder.buildBox(styleBuffer,style);
  AttributeBuilder.buildBackground(styleBuffer,style,reportEmitter);
  AttributeBuilder.buildText(styleBuffer,style);
  AttributeBuilder.buildVisual(styleBuffer,style);
  AttributeBuilder.buildTextDecoration(styleBuffer,style);
}
Program: 71832
Project: 71832
Buggy source:
/** 
 * Build the style of image content.
 */
public void buildImageStyle(IImageContent image,StringBuffer styleBuffer,int display){
  buildSize(styleBuffer,HTMLTags.ATTR_WIDTH,image.getWidth());
  buildSize(styleBuffer,HTMLTags.ATTR_HEIGHT,image.getHeight());
  setDisplayProperty(display,0,styleBuffer);
  IStyle imageComputedStyle=image.getComputedStyle();
  if (null != imageComputedStyle) {
    AttributeBuilder.buildTextDecoration(styleBuffer,imageComputedStyle);
  }
  IStyle style=getElementStyle(image);
  if (style == null) {
    return;
  }
  AttributeBuilder.buildFont(styleBuffer,style);
  AttributeBuilder.buildBox(styleBuffer,style);
  AttributeBuilder.buildBackground(styleBuffer,style,reportEmitter);
  AttributeBuilder.buildText(styleBuffer,style);
  AttributeBuilder.buildVisual(styleBuffer,style);
}

Fixed version (ground truth):
/** 
 * Build the style of image content.
 */
public void buildImageStyle(IImageContent image,StringBuffer styleBuffer,int display){
  buildSize(styleBuffer,HTMLTags.ATTR_WIDTH,image.getWidth());
  buildSize(styleBuffer,HTMLTags.ATTR_HEIGHT,image.getHeight());
  setDisplayProperty(display,0,styleBuffer);
  IStyle imageComputedStyle=image.getComputedStyle();
  if (null != imageComputedStyle) {
    AttributeBuilder.buildTextDecoration(styleBuffer,imageComputedStyle);
  }
  IStyle style=image.getStyle();
  String verticalAlign=style.getVerticalAlign();
  if (verticalAlign != null) {
    styleBuffer.append("String_Node_Str");
    styleBuffer.append(verticalAlign);
    styleBuffer.append("String_Node_Str");
  }
  style=getElementStyle(image);
  if (style == null) {
    return;
  }
  AttributeBuilder.buildFont(styleBuffer,style);
  AttributeBuilder.buildBox(styleBuffer,style);
  AttributeBuilder.buildBackground(styleBuffer,style,reportEmitter);
  AttributeBuilder.buildText(styleBuffer,style);
  AttributeBuilder.buildVisual(styleBuffer,style);
}
Program: 71833
Project: 71833
Buggy source:
/** 
 * Parses a dimension string in locale-dependent way. The input can be in localized value. The measure part use the decimal separator from the locale. e,g. "123,456.78" for English ; "123.456,78" for German. <p> The string must match the following: <ul> <li>null</li> <li>[1-9][0-9]*[.[0-9]*[ ]*[u]], u is the one of the allowed units</li> </ul> <p>
 * @param value the string to parse
 * @return a dimension object
 * @throws PropertyValueException if the string is not valid
 */
public static DimensionValue parseInput(String value,ULocale locale) throws PropertyValueException {
  return DimensionValueUtil.doParse(value,true,ThreadResources.getLocale());
}

Fixed version (ground truth):
/** 
 * Parses a dimension string in locale-dependent way. The input can be in localized value. The measure part use the decimal separator from the locale. e,g. "123,456.78" for English ; "123.456,78" for German. <p> The string must match the following: <ul> <li>null</li> <li>[1-9][0-9]*[.[0-9]*[ ]*[u]], u is the one of the allowed units</li> </ul> <p>
 * @param value the string to parse
 * @param locale the locale where the input string resides
 * @return a dimension object
 * @throws PropertyValueException if the string is not valid
 */
public static DimensionValue parseInput(String value,ULocale locale) throws PropertyValueException {
  return DimensionValueUtil.doParse(value,true,locale);
}
Program: 71834
Project: 71834
Buggy source:
public int[] resolveFixedLayout(int maxWidth){
  int columnNumber=table.getColumnCount();
  DimensionType[] columns=new DimensionType[columnNumber];
  for (int i=0; i < columnNumber; i++) {
    IColumn column=table.getColumn(i);
    DimensionType w=column.getWidth();
    if (startCol < 0) {
      startCol=i;
    }
    endCol=i;
    if (w == null) {
      columns[i]=null;
    }
 else {
      columns[i]=new DimensionType(w.getMeasure(),w.getUnits());
    }
  }
  if (startCol < 0)   startCol=0;
  if (endCol < 0)   endCol=0;
  int specifiedWidth=getDimensionValue(tableContent.getWidth(),maxWidth);
  int tableWidth;
  if (specifiedWidth > 0) {
    tableWidth=specifiedWidth;
  }
 else {
    tableWidth=maxWidth;
  }
  return formalize(columns,tableWidth);
}

Fixed version (ground truth):
public int[] resolveFixedLayout(int maxWidth){
  int columnNumber=table.getColumnCount();
  DimensionType[] columns=new DimensionType[columnNumber];
  for (int i=0; i < columnNumber; i++) {
    IColumn column=table.getColumn(i);
    DimensionType w=column.getWidth();
    if (startCol < 0) {
      startCol=i;
    }
    endCol=i;
    if (w == null) {
      columns[i]=null;
    }
 else {
      columns[i]=new DimensionType(w.getMeasure(),w.getUnits());
    }
  }
  if (startCol < 0)   startCol=0;
  if (endCol < 0)   endCol=0;
  boolean isTableWidthDefined=false;
  int specifiedWidth=getDimensionValue(tableContent.getWidth(),maxWidth);
  int tableWidth;
  if (specifiedWidth > 0) {
    tableWidth=specifiedWidth;
    isTableWidthDefined=true;
  }
 else {
    tableWidth=maxWidth;
    isTableWidthDefined=false;
  }
  return formalize(columns,tableWidth,isTableWidthDefined);
}
Program: 71836
Project: 71836
Buggy source:
protected void repeatHeader(){
  if (bandStatus == IBandContent.BAND_HEADER || !tableContent.isHeaderRepeat()) {
    return;
  }
  ITableBandContent header=context.getWrappedTableHeader(content.getInstanceID());
  if (header == null || header.getChildren().isEmpty()) {
    return;
  }
  TableRegionLayout rLayout=getTableRegionLayout();
  rLayout.initialize(header);
  rLayout.layout();
  TableArea tableRegion=(TableArea)header.getExtension(IContent.LAYOUT_EXTENSION);
  if (tableRegion != null && tableRegion.getAllocatedHeight() < getCurrentMaxContentHeight()) {
    Iterator iter=tableRegion.getChildren();
    TableContext tableContext=(TableContext)contextList.getLast();
    while (iter.hasNext()) {
      ContainerArea area=(ContainerArea)iter.next();
      Iterator rowIter=area.getChildren();
      while (rowIter.hasNext()) {
        AbstractArea row=(AbstractArea)rowIter.next();
        if (row instanceof RowArea) {
          tableContext.layout.addRow((RowArea)row);
        }
      }
    }
    iter=tableRegion.getChildren();
    while (iter.hasNext()) {
      AbstractArea area=(AbstractArea)iter.next();
      addArea(area);
    }
  }
  content.setExtension(IContent.LAYOUT_EXTENSION,null);
}

Fixed version (ground truth):
protected void repeatHeader(){
  if (bandStatus == IBandContent.BAND_HEADER) {
    return;
  }
  ITableBandContent header=(ITableBandContent)tableContent.getHeader();
  if (!tableContent.isHeaderRepeat() || header == null) {
    return;
  }
  if (header.getChildren().isEmpty()) {
    return;
  }
  TableRegionLayout rLayout=getTableRegionLayout();
  rLayout.initialize(header);
  rLayout.layout();
  TableArea tableRegion=(TableArea)header.getExtension(IContent.LAYOUT_EXTENSION);
  if (tableRegion != null && tableRegion.getAllocatedHeight() < getCurrentMaxContentHeight()) {
    Iterator iter=tableRegion.getChildren();
    TableContext tableContext=(TableContext)contextList.getLast();
    while (iter.hasNext()) {
      ContainerArea area=(ContainerArea)iter.next();
      Iterator rowIter=area.getChildren();
      while (rowIter.hasNext()) {
        AbstractArea row=(AbstractArea)rowIter.next();
        if (row instanceof RowArea) {
          tableContext.layout.addRow((RowArea)row);
        }
      }
    }
    iter=tableRegion.getChildren();
    while (iter.hasNext()) {
      AbstractArea area=(AbstractArea)iter.next();
      addArea(area);
    }
  }
  content.setExtension(IContent.LAYOUT_EXTENSION,null);
}
Program: 71838
Project: 71838
Buggy source:
public void layout(){
  IAutoTextContent autoText=(IAutoTextContent)content;
  FontHandler handler=new FontHandler(context.getFontManager(),autoText,false);
  FontInfo fontInfo=handler.getFontInfo();
  ContainerArea templateContainer=(ContainerArea)AreaFactory.createInlineContainer(autoText,true,true);
  IStyle areaStyle=templateContainer.getStyle();
  int maxWidth=parent.getCurrentMaxContentWidth();
  int width=getDimensionValue(autoText.getWidth(),maxWidth);
  templateContainer.setAllocatedWidth(maxWidth - parent.currentContext.currentIP);
  int minContentWidth=getDimensionValue(areaStyle.getFontSize()) * 4;
  int maxContentWidth=templateContainer.getWidth();
  int preWidth=0;
  if (width >= maxContentWidth) {
    preWidth=Math.max(maxContentWidth,minContentWidth);
  }
 else {
    preWidth=Math.max(minContentWidth,width);
  }
  templateContainer.setWidth(preWidth);
  templateContainer.setBaseLine(handler.getFontInfo().getBaseline());
  int height=getDimensionValue(autoText.getHeight(),maxWidth);
  templateContainer.setContentHeight(Math.max((int)(fontInfo.getWordHeight() * PDFConstants.LAYOUT_TO_PDF_RATIO),height));
  Dimension templateDimension=new Dimension();
  templateDimension.setDimension(templateContainer.getContentWidth(),templateContainer.getContentHeight());
  AbstractArea templateArea=createTemplateArea(autoText,templateDimension);
  templateContainer.addChild(templateArea);
  templateArea.setBaseLine(handler.getFontInfo().getBaseline());
  templateArea.setPosition(templateContainer.getContentX(),templateContainer.getContentY());
  parent.addArea(templateContainer);
}

Fixed version (ground truth):
public void layout(){
  boolean isInline=parent instanceof IInlineStackingLayout;
  if (isInline) {
    if (parent instanceof LineLayout) {
      ContainerLayout inlineContainer=new InlineContainerLayout(context,parent,content);
      inlineContainer.initialize();
      addTemplateArea(inlineContainer,true);
      inlineContainer.closeLayout();
    }
 else {
      addTemplateArea(parent,true);
    }
  }
 else {
    assert(parent instanceof BlockStackingLayout);
    if (content != null) {
      IStyle contentStyle=content.getComputedStyle();
      String align=contentStyle.getTextAlign();
      parent.content.getComputedStyle().setTextAlign(align);
    }
    LineLayout line=new LineLayout(context,parent);
    line.initialize();
    addTemplateArea(line,false);
    line.closeLayout();
  }
}
Program: 71839
Project: 71839
Buggy source:
public IPreparedDSQuery prepare() throws DataException {
  if (odaStatement != null)   throw new DataException(ResourceConstants.QUERY_HAS_PREPARED);
  odaStatement=dataSource.prepareStatement(queryText,queryType);
  addProperties();
  addParameterDefns();
  IOdaDataSetDesign design=null;
  if (session.getDataSetCacheManager().getCurrentDataSetDesign() instanceof IOdaDataSetDesign)   design=(IOdaDataSetDesign)session.getDataSetCacheManager().getCurrentDataSetDesign();
  if (design != null) {
    if (design.getPrimaryResultSetName() != null) {
      addCustomFields(design.getPrimaryResultSetName(),odaStatement);
      addColumnHints(design.getPrimaryResultSetName(),odaStatement);
      if (this.projectedFields != null)       odaStatement.setColumnsProjection(design.getPrimaryResultSetName(),this.projectedFields);
    }
 else     if (design.getPrimaryResultSetNumber() > 0) {
      addCustomFields(design.getPrimaryResultSetNumber(),odaStatement);
      addColumnHints(design.getPrimaryResultSetNumber(),odaStatement);
      if (this.projectedFields != null)       odaStatement.setColumnsProjection(design.getPrimaryResultSetNumber(),this.projectedFields);
    }
 else {
      prepareColumns();
    }
  }
 else {
    prepareColumns();
  }
  odaStatement.setMaxRows(this.getRowFetchLimit());
  try {
    resultMetadata=getMetaData((IOdaDataSetDesign)session.getDataSetCacheManager().getCurrentDataSetDesign(),odaStatement);
  }
 catch (  DataException e) {
    resultMetadata=null;
  }
  return this;
}

Fixed version (ground truth):
public IPreparedDSQuery prepare() throws DataException {
  if (odaStatement != null)   throw new DataException(ResourceConstants.QUERY_HAS_PREPARED);
  odaStatement=dataSource.prepareStatement(queryText,queryType);
  addProperties();
  addParameterDefns();
  IOdaDataSetDesign design=null;
  if (session.getDataSetCacheManager().getCurrentDataSetDesign() instanceof IOdaDataSetDesign)   design=(IOdaDataSetDesign)session.getDataSetCacheManager().getCurrentDataSetDesign();
  if (design != null) {
    if (supportNameResults(design)) {
      addCustomFields(design.getPrimaryResultSetName(),odaStatement);
      addColumnHints(design.getPrimaryResultSetName(),odaStatement);
      if (this.projectedFields != null)       odaStatement.setColumnsProjection(design.getPrimaryResultSetName(),this.projectedFields);
    }
 else     if (design.getPrimaryResultSetNumber() > 0) {
      addCustomFields(design.getPrimaryResultSetNumber(),odaStatement);
      addColumnHints(design.getPrimaryResultSetNumber(),odaStatement);
      if (this.projectedFields != null)       odaStatement.setColumnsProjection(design.getPrimaryResultSetNumber(),this.projectedFields);
    }
 else {
      prepareColumns();
    }
  }
 else {
    prepareColumns();
  }
  odaStatement.setMaxRows(this.getRowFetchLimit());
  try {
    resultMetadata=getMetaData((IOdaDataSetDesign)session.getDataSetCacheManager().getCurrentDataSetDesign(),odaStatement);
  }
 catch (  DataException e) {
    resultMetadata=null;
  }
  return this;
}
Program: 71840
Project: 71840
Buggy source:
/** 
 * @param design
 * @param odaStatement
 * @return
 * @throws DataException
 */
private IResultClass getMetaData(IOdaDataSetDesign design,PreparedStatement odaStatement) throws DataException {
  IResultClass result=null;
  if (design != null) {
    if (design.getPrimaryResultSetName() != null) {
      result=odaStatement.getMetaData(design.getPrimaryResultSetName());
    }
 else     if (design.getPrimaryResultSetNumber() > 0) {
      result=odaStatement.getMetaData(design.getPrimaryResultSetNumber());
    }
  }
  if (result == null)   result=odaStatement.getMetaData();
  return result;
}

Fixed version (ground truth):
/** 
 * @param design
 * @param odaStatement
 * @return
 * @throws DataException
 */
private IResultClass getMetaData(IOdaDataSetDesign design,PreparedStatement odaStatement) throws DataException {
  IResultClass result=null;
  if (design != null) {
    if (odaStatement.supportsNamedResults() && design.getPrimaryResultSetName() != null) {
      result=odaStatement.getMetaData(design.getPrimaryResultSetName());
    }
 else     if (design.getPrimaryResultSetNumber() > 0) {
      result=odaStatement.getMetaData(design.getPrimaryResultSetNumber());
    }
  }
  if (result == null)   result=odaStatement.getMetaData();
  return result;
}
Program: 71841
Project: 71841
Buggy source:
public int needPageBreak(ICellContent cell){
  int current=currentIndex;
  int end=cell.getColumn() + cell.getColSpan();
  if (end > pageBreakIndexs[current]) {
    while (pageBreakIndexs[current] < end) {
      current++;
      if (current == pageBreakIndexs.length) {
        current=0;
        break;
      }
    }
    return current;
  }
  return -1;
}

Fixed version (ground truth):
public int needPageBreak(ICellContent cell){
  int current=currentIndex;
  int end=cell.getColumn() + cell.getColSpan();
  if (end > pageBreakIndexs[current]) {
    while (pageBreakIndexs[current] < end) {
      current++;
      if (current == pageBreakIndexs.length) {
        current=pageBreakIndexs.length;
        break;
      }
    }
    return current;
  }
  return -1;
}
Program: 71843
Project: 71843
Buggy source:
void setReportItemReference(String referenceName){
  try {
    itemHandle.setDataSet(null);
    itemHandle.setCube(null);
    if (referenceName == null) {
      itemHandle.setDataBindingReference(null);
    }
 else {
      if (!referenceName.equals(getReportItemReference())) {
        itemHandle.setDataBindingReference((ReportItemHandle)getReportDesignHandle().findElement(referenceName));
      }
    }
  }
 catch (  SemanticException e) {
    WizardBase.showException(e.getLocalizedMessage());
  }
}

Fixed version (ground truth):
void setReportItemReference(String referenceName){
  try {
    if (referenceName == null) {
      itemHandle.setDataBindingReference(null);
    }
 else {
      itemHandle.setDataSet(null);
      itemHandle.setCube(null);
      if (!referenceName.equals(getReportItemReference())) {
        itemHandle.setDataBindingReference((ReportItemHandle)getReportDesignHandle().findElement(referenceName));
      }
    }
  }
 catch (  SemanticException e) {
    WizardBase.showException(e.getLocalizedMessage());
  }
}
Program: 71844
Project: 71844
Buggy source:
void setDataSet(String datasetName){
  try {
    boolean isPreviousDataBindingReference=false;
    if (itemHandle.getDataBindingType() == ReportItemHandle.DATABINDING_TYPE_REPORT_ITEM_REF) {
      isPreviousDataBindingReference=true;
      itemHandle.setDataBindingReference(null);
    }
    itemHandle.setCube(null);
    if (datasetName == null) {
      clearBindings();
      itemHandle.setDataSet(null);
    }
 else {
      DataSetHandle dataset=getReportDesignHandle().findDataSet(datasetName);
      if (isPreviousDataBindingReference || itemHandle.getDataSet() != dataset) {
        itemHandle.setDataSet(dataset);
        clearBindings();
        generateBindings(generateComputedColumns(dataset));
      }
    }
  }
 catch (  SemanticException e) {
    WizardBase.showException(e.getLocalizedMessage());
  }
}

Fixed version (ground truth):
void setDataSet(String datasetName){
  try {
    boolean isPreviousDataBindingReference=false;
    if (itemHandle.getDataBindingType() == ReportItemHandle.DATABINDING_TYPE_REPORT_ITEM_REF) {
      isPreviousDataBindingReference=true;
      itemHandle.setDataBindingReference(null);
    }
    itemHandle.setCube(null);
    if (datasetName == null) {
      if (getBoundDataSet() != null) {
        clearBindings();
      }
      itemHandle.setDataSet(null);
    }
 else {
      DataSetHandle dataset=getReportDesignHandle().findDataSet(datasetName);
      if (isPreviousDataBindingReference || itemHandle.getDataSet() != dataset) {
        itemHandle.setDataSet(dataset);
        clearBindings();
        generateBindings(generateComputedColumns(dataset));
      }
    }
  }
 catch (  SemanticException e) {
    WizardBase.showException(e.getLocalizedMessage());
  }
}
Program: 71846
Project: 71846
Buggy source:
@Override protected void setModel(ModuleHandle model){
  super.setModel(model);
  rulerComp.resetReportDesignHandle(model);
}

Fixed version (ground truth):
@Override protected void setModel(ModuleHandle model){
  super.setModel(model);
  if (model != null) {
    rulerComp.resetReportDesignHandle(model);
  }
}
Program: 71847
Project: 71847
Buggy source:
/** 
 */
public void resetText(){
  if (editObject instanceof DesignElementHandle) {
    DesignElementHandle desHdl=(DesignElementHandle)editObject;
    String name=cmbItemLastSelected.getName();
    setEditorText(desHdl.getStringProperty(name));
  }
}

Fixed version (ground truth):
/** 
 */
public void resetText(){
  if (editObject instanceof DesignElementHandle && cmbItemLastSelected != null) {
    DesignElementHandle desHdl=(DesignElementHandle)editObject;
    String name=cmbItemLastSelected.getName();
    setEditorText(desHdl.getStringProperty(name));
  }
}
Program: 71849
Project: 71849
Buggy source:
public boolean onBroughtToTop(IReportEditorPage page){
  if (!hasWarning && ReportPlugin.getDefault().getPreferenceStore().getString(ReportPlugin.LIBRARY_WARNING_PREFERENCE).equals(MessageDialogWithToggle.PROMPT)) {
    MessageDialogWithToggle.openInformation(UIUtil.getDefaultShell(),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"),false,ReportPlugin.getDefault().getPreferenceStore(),ReportPlugin.LIBRARY_WARNING_PREFERENCE);
    hasWarning=true;
  }
  ModuleHandle model=getProvider().getReportModuleHandle(getEditorInput());
  if (getStaleType() == IPageStaleType.MODEL_RELOAD) {
    doSave(null);
  }
  if (model != null && getModel() != model) {
    Object oldModel=getModel();
    setModel(model);
    rebuildReportDesign(oldModel);
    if (getModel() != null) {
      this.getGraphicalViewer().setContents(getModel());
      hookModelEventManager(getModel());
      markPageStale(IPageStaleType.NONE);
    }
    updateStackActions();
  }
  GraphicalViewer view=getGraphicalViewer();
  if (view != null) {
    UIUtil.resetViewSelection(view,true);
  }
  return true;
}

Fixed version (ground truth):
public boolean onBroughtToTop(IReportEditorPage page){
  if (!hasWarning && ReportPlugin.getDefault().getPreferenceStore().getString(ReportPlugin.LIBRARY_WARNING_PREFERENCE).equals(MessageDialogWithToggle.PROMPT)) {
    MessageDialogWithToggle.openInformation(UIUtil.getDefaultShell(),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"),false,ReportPlugin.getDefault().getPreferenceStore(),ReportPlugin.LIBRARY_WARNING_PREFERENCE);
    hasWarning=true;
  }
  ModuleHandle model=getProvider().getReportModuleHandle(getEditorInput());
  boolean reload=false;
  if (getStaleType() == IPageStaleType.MODEL_RELOAD) {
    setModel(null);
    doSave(null);
    reload=true;
  }
  if ((model != null && getModel() != model) || reload) {
    Object oldModel=getModel();
    setModel(model);
    rebuildReportDesign(oldModel);
    if (getModel() != null) {
      this.getGraphicalViewer().setContents(getModel());
      hookModelEventManager(getModel());
      markPageStale(IPageStaleType.NONE);
    }
    updateStackActions();
  }
  GraphicalViewer view=getGraphicalViewer();
  if (view != null) {
    UIUtil.resetViewSelection(view,true);
  }
  return true;
}
Program: 71850
Project: 71850
Buggy source:
/** 
 * Handles the selection request
 * @param request
 */
protected void handleSelectionChange(ReportRequest request){
  if (request.getSource() == this) {
    return;
  }
  final List list=request.getSelectionModelList();
  if (canSetSelection(list)) {
    setSelection(new StructuredSelection(list));
  }
}

Fixed version (ground truth):
/** 
 * Handles the selection request
 * @param request
 */
protected void handleSelectionChange(ReportRequest request){
  if (request.getSource() == this) {
    return;
  }
  if (getTreeViewer() == null) {
    return;
  }
  final List list=request.getSelectionModelList();
  if (canSetSelection(list)) {
    setSelection(new StructuredSelection(list));
  }
}
Program: 71852
Project: 71852
Buggy source:
/** 
 * @see org.eclipse.draw2d.Figure#paintFigure(Graphics)
 */
protected void paintFigure(Graphics graphics){
  if (isOpaque()) {
    if (getBorder() instanceof BaseBorder) {
      graphics.fillRectangle(getBounds().getCopy().crop(((BaseBorder)getBorder()).getBorderInsets()));
    }
 else {
      graphics.fillRectangle(getBounds());
    }
  }
  if (getImage() == null) {
    return;
  }
  if (stretch) {
    paintStretched(graphics);
    return;
  }
  int x, y;
  Rectangle area=getClientArea();
switch (alignment & PositionConstants.NORTH_SOUTH) {
case PositionConstants.NORTH:
    y=area.y;
  break;
case PositionConstants.SOUTH:
y=area.y + area.height - size.height;
break;
default :
y=(area.height - size.height) / 2 + area.y;
break;
}
switch (alignment & PositionConstants.EAST_WEST) {
case PositionConstants.EAST:
x=area.x + area.width - size.width;
break;
case PositionConstants.WEST:
x=area.x;
break;
default :
x=(area.width - size.width) / 2 + area.x;
break;
}
graphics.drawImage(getImage(),x,y);
}

Fixed version (ground truth):
/** 
 * @see org.eclipse.draw2d.Figure#paintFigure(Graphics)
 */
protected void paintFigure(Graphics graphics){
  if (isOpaque()) {
    if (getBorder() instanceof BaseBorder) {
      graphics.fillRectangle(getBounds().getCopy().crop(((BaseBorder)getBorder()).getBorderInsets()));
    }
 else {
      graphics.fillRectangle(getBounds());
    }
  }
  if (getImage() == null || getImage().isDisposed()) {
    return;
  }
  if (stretch) {
    paintStretched(graphics);
    return;
  }
  int x, y;
  Rectangle area=getClientArea();
switch (alignment & PositionConstants.NORTH_SOUTH) {
case PositionConstants.NORTH:
    y=area.y;
  break;
case PositionConstants.SOUTH:
y=area.y + area.height - size.height;
break;
default :
y=(area.height - size.height) / 2 + area.y;
break;
}
switch (alignment & PositionConstants.EAST_WEST) {
case PositionConstants.EAST:
x=area.x + area.width - size.width;
break;
case PositionConstants.WEST:
x=area.x;
break;
default :
x=(area.width - size.width) / 2 + area.x;
break;
}
graphics.drawImage(getImage(),x,y);
}
Program: 71853
Project: 71853
Buggy source:
/** 
 * Creates provider's array for font style controls.
 * @return the provider's array(elements are instances of<code>IDescriptorProvider</code>).
 */
private IDescriptorProvider[] createFontStyleProviders(){
  return new IDescriptorProvider[]{new FontStylePropertyDescriptorProvider(StyleHandle.FONT_WEIGHT_PROP,ReportDesignConstants.STYLE_ELEMENT),new FontStylePropertyDescriptorProvider(StyleHandle.FONT_STYLE_PROP,ReportDesignConstants.STYLE_ELEMENT),new FontStylePropertyDescriptorProvider(StyleHandle.TEXT_UNDERLINE_PROP,ReportDesignConstants.STYLE_ELEMENT),new FontStylePropertyDescriptorProvider(StyleHandle.TEXT_LINE_THROUGH_PROP,ReportDesignConstants.STYLE_ELEMENT),new PropertyDescriptorProvider(StyleHandle.TEXT_DIRECTION_PROP,ReportDesignConstants.STYLE_ELEMENT)};
}

Fixed version (ground truth):
/** 
 * Creates provider's array for font style controls.
 * @return the provider's array(elements are instances of<code>IDescriptorProvider</code>).
 */
private IDescriptorProvider[] createFontStyleProviders(){
  return new IDescriptorProvider[]{new FontStylePropertyDescriptorProvider(StyleHandle.FONT_WEIGHT_PROP,ReportDesignConstants.STYLE_ELEMENT),new FontStylePropertyDescriptorProvider(StyleHandle.FONT_STYLE_PROP,ReportDesignConstants.STYLE_ELEMENT),new FontStylePropertyDescriptorProvider(StyleHandle.TEXT_UNDERLINE_PROP,ReportDesignConstants.STYLE_ELEMENT),new FontStylePropertyDescriptorProvider(StyleHandle.TEXT_LINE_THROUGH_PROP,ReportDesignConstants.STYLE_ELEMENT),new PropertyDescriptorProvider(StyleHandle.TEXT_ALIGN_PROP,ReportDesignConstants.STYLE_ELEMENT)};
}
Program: 71854
Project: 71854
Buggy source:
public void testSafeDivide(){
  String[] scripts=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  double values[]=new double[]{0,-1.05,10.05,-1};
  for (int i=0; i < values.length; i++) {
    assertEquals(((Number)cx.evaluateString(scope,scripts[i],"String_Node_Str",1,null)).doubleValue(),values[i],0);
  }
}

Fixed version (ground truth):
public void testSafeDivide(){
  String[] scripts=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  double values[]=new double[]{0,-1.05,10.05,-1,-2};
  for (int i=0; i < values.length; i++) {
    assertEquals(((Number)cx.evaluateString(scope,scripts[i],"String_Node_Str",1,null)).doubleValue(),values[i],0);
  }
}
Program: 71855
Project: 71855
Buggy source:
/** 
 * @param dividend
 * @param divisor
 * @param ifZero
 * @return
 * @throws BirtException
 */
public static final Object safeDivide(Object dividend,Object divisor,Object ifZero) throws BirtException {
  try {
    Object ret=divide(dividend,divisor);
    if (ret instanceof Double) {
      Double d=(Double)ret;
      return Double.isInfinite(d) ? ifZero : ret;
    }
    return ret;
  }
 catch (  ArithmeticException e) {
    return ifZero;
  }
}

Fixed version (ground truth):
/** 
 * @param dividend
 * @param divisor
 * @param ifZero
 * @return
 * @throws BirtException
 */
public static final Object safeDivide(Object dividend,Object divisor,Object ifZero) throws BirtException {
  try {
    Object ret=divide(dividend,divisor);
    if (ret instanceof Double) {
      Double d=(Double)ret;
      return Double.isNaN(d) || Double.isInfinite(d) ? ifZero : ret;
    }
    return ret;
  }
 catch (  ArithmeticException e) {
    return ifZero;
  }
}
Program: 71857
Project: 71857
Buggy source:
public void writeDataFormat(StyleEntry style){
  if (style.getProperty(StyleConstant.DATA_TYPE_PROP) == Data.DATE && style.getProperty(StyleConstant.DATE_FORMAT_PROP) != null) {
    writer.openTag("String_Node_Str");
    writer.attribute("String_Node_Str",style.getProperty(StyleConstant.DATE_FORMAT_PROP));
    writer.closeTag("String_Node_Str");
  }
  if (style.getProperty(StyleConstant.DATA_TYPE_PROP) == Data.NUMBER && style.getProperty(StyleConstant.NUMBER_FORMAT_PROP) != null) {
    writer.openTag("String_Node_Str");
    String numberStyle=style.getProperty(StyleConstant.NUMBER_FORMAT_PROP);
    numberStyle=ExcelUtil.formatNumberPattern(numberStyle);
    writer.attribute("String_Node_Str",numberStyle);
    writer.closeTag("String_Node_Str");
  }
}

Fixed version (ground truth):
public void writeDataFormat(StyleEntry style){
  if (style.getProperty(StyleConstant.DATA_TYPE_PROP) == Data.DATE && style.getProperty(StyleConstant.DATE_FORMAT_PROP) != null) {
    writer.openTag("String_Node_Str");
    writer.attribute("String_Node_Str",style.getProperty(StyleConstant.DATE_FORMAT_PROP));
    writer.closeTag("String_Node_Str");
  }
  if (style.getProperty(StyleConstant.DATA_TYPE_PROP) == Data.NUMBER && style.getProperty(StyleConstant.NUMBER_FORMAT_PROP) != null) {
    writer.openTag("String_Node_Str");
    String numberStyle=style.getProperty(StyleConstant.NUMBER_FORMAT_PROP);
    writer.attribute("String_Node_Str",numberStyle);
    writer.closeTag("String_Node_Str");
  }
}
Program: 71858
Project: 71858
Buggy source:
public Data createData(Object txt,StyleEntry entry){
  String type=Data.STRING;
  if (Data.NUMBER.equals(ExcelUtil.getType(txt))) {
    String format=ExcelUtil.getPattern(txt,entry.getProperty(StyleConstant.NUMBER_FORMAT_PROP));
    entry.setProperty(StyleConstant.NUMBER_FORMAT_PROP,format);
    type=Data.NUMBER;
  }
 else   if (Data.DATE.equals(ExcelUtil.getType(txt))) {
    String format=ExcelUtil.getPattern(txt,entry.getProperty(StyleConstant.DATE_FORMAT_PROP));
    entry.setProperty(StyleConstant.DATE_FORMAT_PROP,format);
    type=Data.DATE;
  }
  entry.setProperty(StyleConstant.DATA_TYPE_PROP,type);
  return new Data(txt,entry,type,getCurrentContainer());
}

Fixed version (ground truth):
public Data createData(Object txt,StyleEntry entry){
  String type=Data.STRING;
  Locale locale=emitter.getLocale();
  if (Data.NUMBER.equals(ExcelUtil.getType(txt))) {
    String format=ExcelUtil.getPattern(txt,entry.getProperty(StyleConstant.NUMBER_FORMAT_PROP));
    format=ExcelUtil.formatNumberPattern(format,locale);
    entry.setProperty(StyleConstant.NUMBER_FORMAT_PROP,format);
    type=Data.NUMBER;
  }
 else   if (Data.DATE.equals(ExcelUtil.getType(txt))) {
    String format=ExcelUtil.getPattern(txt,entry.getProperty(StyleConstant.DATE_FORMAT_PROP));
    entry.setProperty(StyleConstant.DATE_FORMAT_PROP,format);
    type=Data.DATE;
  }
  entry.setProperty(StyleConstant.DATA_TYPE_PROP,type);
  return new Data(txt,entry,type,getCurrentContainer());
}
Program: 71859
Project: 71859
Buggy source:
/** 
 * @param queryResults
 * @param queryScope
 * @throws DataException 
 */
private ResultIterator(QueryResults queryResults,ExprManager exprManager,Scriptable queryScope,Scriptable parentScope) throws DataException {
  this.queryResults=queryResults;
  this.exprManager=exprManager;
  this.queryScope=queryScope;
  this.jsDummyRowObject=new JSDummyRowObject(exprManager,queryScope,parentScope);
  queryScope.put("String_Node_Str",queryScope,jsDummyRowObject);
  this.getRdSaveUtil().doSaveStart();
}

Fixed version (ground truth):
/** 
 * @param queryResults
 * @param queryScope
 * @throws BirtException 
 */
private ResultIterator(QueryResults queryResults,ExprManager exprManager,Scriptable queryScope,Scriptable parentScope) throws BirtException {
  this.queryResults=queryResults;
  this.exprManager=exprManager;
  this.queryScope=queryScope;
  this.jsDummyRowObject=new JSDummyRowObject(exprManager,queryScope,parentScope);
  queryScope.put("String_Node_Str",queryScope,jsDummyRowObject);
  this.getRdSaveUtil().doSaveStart();
  exprValueMap=new HashMap();
  Map exprMap=getBindingMap(exprManager.getBindingExprs());
  Iterator it=exprMap.entrySet().iterator();
  while (it.hasNext()) {
    Map.Entry entry=(Entry)it.next();
    String exprName=(String)entry.getKey();
    IBaseExpression baseExpr=(IBaseExpression)entry.getValue();
    Object exprValue=ExprEvaluateUtil.evaluateRawExpression(baseExpr,queryScope);
    exprValueMap.put(exprName,exprValue);
  }
  this.getRdSaveUtil().doSaveExpr(exprValueMap);
}
Program: 71860
Project: 71860
Buggy source:
public Object getValue(String name) throws BirtException {
  checkOpened();
  if (exprManager.getExpr(name) == null)   throw new DataException(ResourceConstants.INVALID_BOUND_COLUMN_NAME,name);
  if (exprValueMap == null) {
    exprValueMap=new HashMap();
    Map realValueMap=new HashMap();
    Map exprMap=getBindingMap(exprManager.getBindingExprs());
    Iterator it=exprMap.entrySet().iterator();
    while (it.hasNext()) {
      Map.Entry entry=(Entry)it.next();
      String exprName=(String)entry.getKey();
      IBaseExpression baseExpr=(IBaseExpression)entry.getValue();
      Object exprValue=ExprEvaluateUtil.evaluateRawExpression(baseExpr,queryScope);
      exprValueMap.put(exprName,exprValue);
      if (exprValue instanceof BirtException == false)       realValueMap.put(exprName,exprValue);
    }
    this.getRdSaveUtil().doSaveExpr(exprValueMap);
  }
  return exprValueMap.get(name);
}

Fixed version (ground truth):
public Object getValue(String name) throws BirtException {
  checkOpened();
  if (exprManager.getExpr(name) == null)   throw new DataException(ResourceConstants.INVALID_BOUND_COLUMN_NAME,name);
  return exprValueMap.get(name);
}
Program: 71861
Project: 71861
Buggy source:
/** 
 * This method is invoked when the find button is clicked It populates the Available Data Base obecets ( in the Tree control )
 */
protected void populateAvailableDbObjects(){
  DataSetDesign dataSetDesign=getDataSetDesign();
  DataSourceDesign curDataSourceDesign=dataSetDesign.getDataSourceDesign();
  if (curDataSourceDesign == prevDataSourceDesign) {
    if ((cachedSearchTxt == searchTxt.getText() || (cachedSearchTxt != null && cachedSearchTxt.equals(searchTxt.getText()))) && (cachedDbType == getSelectedDbType() || (cachedDbType != null && cachedDbType.equals(getSelectedDbType())))) {
      if (schemaList != null && schemaList.size() > 0) {
        if (cachedSchemaComboIndex == schemaCombo.getSelectionIndex()) {
          return;
        }
      }
 else       return;
    }
  }
  removeAllAvailableDbObjects();
  setRootElement();
  setRefreshInfo();
  if (isSchemaSupported) {
    populateSchemaList();
  }
 else {
    populateTableList();
  }
  addFetchDbObjectListener();
  if (rootNode != null) {
    selectNode(rootNode);
  }
}

Fixed version (ground truth):
/** 
 * This method is invoked when the find button is clicked It populates the Available Data Base obecets ( in the Tree control )
 */
protected void populateAvailableDbObjects(boolean applyFilter){
  DataSetDesign dataSetDesign=getDataSetDesign();
  DataSourceDesign curDataSourceDesign=dataSetDesign.getDataSourceDesign();
  if (curDataSourceDesign == prevDataSourceDesign) {
    if ((cachedSearchTxt == searchTxt.getText() || (cachedSearchTxt != null && cachedSearchTxt.equals(searchTxt.getText()))) && (cachedDbType == getSelectedDbType() || (cachedDbType != null && cachedDbType.equals(getSelectedDbType()))) && cachedShowSystemTable == (showSystemTableCheckBox.getEnabled() && showSystemTableCheckBox.getSelection()) && cachedUseQuoteString == (identifierQuoteStringCheckBox.getEnabled() && identifierQuoteStringCheckBox.getSelection())) {
      if (schemaList != null && schemaList.size() > 0) {
        if (cachedSchemaComboIndex == schemaCombo.getSelectionIndex()) {
          return;
        }
      }
 else       return;
    }
  }
  removeAllAvailableDbObjects();
  cachedDbType=this.getSelectedDbType();
  cachedShowSystemTable=showSystemTableCheckBox.getEnabled() && showSystemTableCheckBox.getSelection();
  cachedUseQuoteString=identifierQuoteStringCheckBox.getEnabled() && identifierQuoteStringCheckBox.getSelection();
  setRootElement();
  setRefreshInfo();
  if (isSchemaSupported) {
    populateSchemaList(applyFilter);
  }
 else {
    populateTableList();
  }
  addFetchDbObjectListener();
  if (rootNode != null) {
    selectNode(rootNode);
  }
}
Program: 71863
Project: 71863
Buggy source:
/** 
 * @param schemaName
 */
private void getSpecificSchema(String schemaName){
  if (!isPageInitialization) {
    if (schemaName.equals(JdbcPlugin.getResourceString("String_Node_Str")) || schemaName.trim().length() == 0) {
      getAvailableSchema();
      setMessage(DEFAULT_MESSAGE);
      return;
    }
    if (containsTableInSchema(schemaName,false)) {
      schemaList=new ArrayList();
      schemaList.add(schemaName);
      setMessage(DEFAULT_MESSAGE);
    }
 else {
      schemaList=null;
      setMessage(JdbcPlugin.getResourceString("String_Node_Str"),WARNING);
    }
  }
 else {
    isPageInitialization=!isPageInitialization;
  }
}

Fixed version (ground truth):
/** 
 * @param schemaName
 */
private void getSpecificSchema(String schemaName,boolean checkEmptySchema){
  if (!isPageInitialization) {
    if (schemaName.equals(JdbcPlugin.getResourceString("String_Node_Str")) || schemaName.trim().length() == 0) {
      getAvailableSchema();
      setMessage(DEFAULT_MESSAGE);
      return;
    }
    boolean showSystemTable=showSystemTableCheckBox.isEnabled() && showSystemTableCheckBox.getSelection();
    if (!checkEmptySchema || containsTableInSchema(schemaName,showSystemTable)) {
      schemaList=new ArrayList();
      schemaList.add(schemaName);
      setMessage(DEFAULT_MESSAGE);
    }
 else {
      schemaList=null;
      setMessage(JdbcPlugin.getResourceString("String_Node_Str"),WARNING);
    }
  }
 else {
    isPageInitialization=!isPageInitialization;
  }
}
Program: 71866
Project: 71866
Buggy source:
/** 
 * Sets up the thread context class loader to make sure that Derby works with our class loader
 */
private void initClassLoaders(){
  if (derbyClassLoader == null) {
    derbyClassLoader=new DerbyClassLoader();
  }
  if (derbyClassLoader.isGood()) {
    ClassLoader contextLoader=Thread.currentThread().getContextClassLoader();
    if (contextLoader != null && !(contextLoader instanceof ContextClassLoaderDelegator)) {
      Thread.currentThread().setContextClassLoader(new ContextClassLoaderDelegator(contextLoader,derbyClassLoader));
    }
  }
}

Fixed version (ground truth):
/** 
 * Sets up the thread context class loader to make sure that Derby works with our class loader
 */
private void initClassLoaders(){
  if (derbyClassLoader == null) {
    derbyClassLoader=new DerbyClassLoader();
  }
}