nus-yam/ex-repair huggingface dataset:
Program: 70097
Project: 70097
Buggy source:
public DataGenerationEngine(ExecutionContext context,IDocArchiveWriter writer) throws Exception {
  super(context,writer);
  DataSessionContext dteSessionContext=new DataSessionContext(DataSessionContext.MODE_GENERATION,null,context.getScriptContext(),context.getApplicationClassLoader());
  dteSessionContext.setDocumentWriter(writer);
  DataEngineContext dteEngineContext=dteSessionContext.getDataEngineContext();
  dteEngineContext.setLocale(context.getLocale());
  String tempDir=getTempDir(context);
  if (tempDir != null) {
    dteEngineContext.setTmpdir(tempDir);
  }
  dteSession=DataRequestSession.newSession(dteSessionContext);
  dos=new DataOutputStream(writer.createRandomAccessStream(ReportDocumentConstants.DATA_META_STREAM));
  DteMetaInfoIOUtil.startMetaInfo(dos);
}

Fixed version (ground truth):
public DataGenerationEngine(ExecutionContext context,IDocArchiveWriter writer) throws Exception {
  super(context,writer);
  DataSessionContext dteSessionContext=new DataSessionContext(DataSessionContext.MODE_GENERATION,null,context.getScriptContext(),context.getApplicationClassLoader());
  dteSessionContext.setDocumentWriter(writer);
  DataEngineContext dteEngineContext=dteSessionContext.getDataEngineContext();
  dteEngineContext.setLocale(context.getLocale());
  dteEngineContext.setTimeZone(context.getTimeZone());
  String tempDir=getTempDir(context);
  if (tempDir != null) {
    dteEngineContext.setTmpdir(tempDir);
  }
  dteSession=DataRequestSession.newSession(dteSessionContext);
  dos=new DataOutputStream(writer.createRandomAccessStream(ReportDocumentConstants.DATA_META_STREAM));
  DteMetaInfoIOUtil.startMetaInfo(dos);
}
Program: 70098
Project: 70098
Buggy source:
public DataInteractiveEngine(ExecutionContext context,IDocArchiveReader reader,IDocArchiveWriter writer) throws Exception {
  super(context);
  DataSessionContext dteSessionContext=new DataSessionContext(DataSessionContext.MODE_UPDATE,null,context.getScriptContext(),context.getApplicationClassLoader());
  dteSessionContext.setDocumentReader(reader);
  dteSessionContext.setDocumentWriter(writer);
  DataEngineContext dteEngineContext=dteSessionContext.getDataEngineContext();
  dteEngineContext.setLocale(context.getLocale());
  String tempDir=getTempDir(context);
  if (tempDir != null) {
    dteEngineContext.setTmpdir(tempDir);
  }
  dteSession=DataRequestSession.newSession(dteSessionContext);
  loadDteMetaInfo(reader);
  if (writer != null && dos == null) {
    dos=new DataOutputStream(writer.createRandomAccessStream(ReportDocumentConstants.DATA_SNAP_META_STREAM));
    DteMetaInfoIOUtil.startMetaInfo(dos);
  }
}

Fixed version (ground truth):
public DataInteractiveEngine(ExecutionContext context,IDocArchiveReader reader,IDocArchiveWriter writer) throws Exception {
  super(context);
  DataSessionContext dteSessionContext=new DataSessionContext(DataSessionContext.MODE_UPDATE,null,context.getScriptContext(),context.getApplicationClassLoader());
  dteSessionContext.setDocumentReader(reader);
  dteSessionContext.setDocumentWriter(writer);
  DataEngineContext dteEngineContext=dteSessionContext.getDataEngineContext();
  dteEngineContext.setLocale(context.getLocale());
  dteEngineContext.setTimeZone(context.getTimeZone());
  String tempDir=getTempDir(context);
  if (tempDir != null) {
    dteEngineContext.setTmpdir(tempDir);
  }
  dteSession=DataRequestSession.newSession(dteSessionContext);
  loadDteMetaInfo(reader);
  if (writer != null && dos == null) {
    dos=new DataOutputStream(writer.createRandomAccessStream(ReportDocumentConstants.DATA_SNAP_META_STREAM));
    DteMetaInfoIOUtil.startMetaInfo(dos);
  }
}
Program: 70099
Project: 70099
Buggy source:
public DataPresentationEngine(ExecutionContext context,IDocArchiveReader reader) throws Exception {
  super(context);
  DataSessionContext dteSessionContext=new DataSessionContext(DataSessionContext.MODE_PRESENTATION,null,context.getScriptContext(),context.getApplicationClassLoader());
  dteSessionContext.setDocumentReader(reader);
  DataEngineContext dteEngineContext=dteSessionContext.getDataEngineContext();
  dteEngineContext.setLocale(context.getLocale());
  String tempDir=getTempDir(context);
  if (tempDir != null) {
    dteEngineContext.setTmpdir(tempDir);
  }
  dteSession=DataRequestSession.newSession(dteSessionContext);
  loadDteMetaInfo(reader);
}

Fixed version (ground truth):
public DataPresentationEngine(ExecutionContext context,IDocArchiveReader reader) throws Exception {
  super(context);
  DataSessionContext dteSessionContext=new DataSessionContext(DataSessionContext.MODE_PRESENTATION,null,context.getScriptContext(),context.getApplicationClassLoader());
  dteSessionContext.setDocumentReader(reader);
  DataEngineContext dteEngineContext=dteSessionContext.getDataEngineContext();
  dteEngineContext.setLocale(context.getLocale());
  dteEngineContext.setTimeZone(context.getTimeZone());
  String tempDir=getTempDir(context);
  if (tempDir != null) {
    dteEngineContext.setTmpdir(tempDir);
  }
  dteSession=DataRequestSession.newSession(dteSessionContext);
  loadDteMetaInfo(reader);
}
Program: 70100
Project: 70100
Buggy source:
public IContent execute(){
  ICellContent content=context.getReportContent().createCellContent();
  initializeContent(content,cellHandle);
  content.setRowSpan(rowSpan);
  content.setColSpan(colSpan);
  content.setColumn(colIndex);
  try {
    EdgeCursor columnEdgeCursor=getColumnEdgeCursor();
    if (columnEdgeCursor != null) {
      columnEdgeCursor.setPosition(position);
    }
  }
 catch (  OLAPException e) {
    logger.log(Level.SEVERE,Messages.getString("String_Node_Str"),e);
  }
  processStyle(cellHandle);
  processVisibility(cellHandle);
  processBookmark(cellHandle);
  processScopeAndHeaders(cellHandle);
  processAction(cellHandle);
  currentChild=0;
  ICubeResultSet cubeRset=getCubeResultSet();
  DataID di=cubeRset == null ? null : new DataID(cubeRset.getID(),cubeRset.getCellIndex());
  InstanceID iid=new InstanceID(null,cellHandle == null ? -1 : cellHandle.getModelHandle().getID(),di);
  content.setInstanceID(iid);
  return content;
}

Fixed version (ground truth):
public IContent execute(){
  ICellContent content=context.getReportContent().createCellContent();
  initializeContent(content,cellHandle);
  content.setRowSpan(rowSpan);
  content.setColSpan(colSpan);
  content.setColumn(colIndex);
  if (cellHandle != null && cellHandle.getContainer() instanceof LevelViewHandle) {
    content.setRepeatContent(true);
  }
  try {
    EdgeCursor columnEdgeCursor=getColumnEdgeCursor();
    if (columnEdgeCursor != null) {
      columnEdgeCursor.setPosition(position);
    }
  }
 catch (  OLAPException e) {
    logger.log(Level.SEVERE,Messages.getString("String_Node_Str"),e);
  }
  processStyle(cellHandle);
  processVisibility(cellHandle);
  processBookmark(cellHandle);
  processScopeAndHeaders(cellHandle);
  processAction(cellHandle);
  currentChild=0;
  ICubeResultSet cubeRset=getCubeResultSet();
  DataID di=cubeRset == null ? null : new DataID(cubeRset.getID(),cubeRset.getCellIndex());
  InstanceID iid=new InstanceID(null,cellHandle == null ? -1 : cellHandle.getModelHandle().getID(),di);
  content.setInstanceID(iid);
  return content;
}
Program: 70106
Project: 70106
Buggy source:
/** 
 * @param row
 * @param functionNo
 * @return
 * @throws DataException 
 */
private boolean getFilterResult(Row4Aggregation row,int functionNo) throws DataException {
  facttableRow.setMeasure(row.getMeasures());
  IJSFacttableFilterEvalHelper filterEvalHelper=(aggregation.getAggregationFunctions()[functionNo]).getFilterEvalHelper();
  if (filterEvalHelper == null) {
    return true;
  }
 else {
    return filterEvalHelper.evaluateFilter(facttableRow);
  }
}

Fixed version (ground truth):
/** 
 * @param row
 * @param functionNo
 * @return
 * @throws DataException 
 */
private boolean getFilterResult(Row4Aggregation row,int functionNo) throws DataException {
  facttableRow.setDimPos(row.getDimPos());
  facttableRow.setMeasure(row.getMeasures());
  IJSFacttableFilterEvalHelper filterEvalHelper=(aggregation.getAggregationFunctions()[functionNo]).getFilterEvalHelper();
  if (filterEvalHelper == null) {
    return true;
  }
 else {
    return filterEvalHelper.evaluateFilter(facttableRow);
  }
}
Program: 70107
Project: 70107
Buggy source:
/** 
 * @param stopSign
 * @throws IOException
 * @throws BirtException
 */
private void populateSortedFactRows(StopSign stopSign) throws IOException, DataException {
  prepareSortedStacks();
  int measureCount=dataSet4Aggregation.getMetaInfo().getMeasureInfos().length;
  try {
    while (dataSet4Aggregation.next() && !stopSign.isStopped()) {
      for (int i=0; i < allSortedFactRows.size(); i++) {
        DiskSortedStackWrapper diskSortedStackWrapper=((DiskSortedStackWrapper)allSortedFactRows.get(i));
        int[] levelIndex=diskSortedStackWrapper.levelIndex;
        Row4Aggregation aggregationRow=new Row4Aggregation();
        aggregationRow.setLevelMembers(getLevelMembers(levelIndex));
        if (aggregationRow.getLevelMembers() == null) {
          continue;
        }
        aggregationRow.setMeasures(new Object[measureCount]);
        for (int j=0; j < measureCount; j++) {
          aggregationRow.getMeasures()[j]=dataSet4Aggregation.getMeasureValue(j);
        }
        aggregationRow.setParameterValues(getParameterValues());
        diskSortedStackWrapper.diskSortedStack.push(aggregationRow);
      }
    }
  }
 catch (  BirtException e) {
    throw DataException.wrap(e);
  }
}

Fixed version (ground truth):
/** 
 * @param stopSign
 * @throws IOException
 * @throws BirtException
 */
private void populateSortedFactRows(StopSign stopSign) throws IOException, DataException {
  prepareSortedStacks();
  int measureCount=dataSet4Aggregation.getMetaInfo().getMeasureInfos().length;
  try {
    while (dataSet4Aggregation.next() && !stopSign.isStopped()) {
      for (int i=0; i < allSortedFactRows.size(); i++) {
        DiskSortedStackWrapper diskSortedStackWrapper=((DiskSortedStackWrapper)allSortedFactRows.get(i));
        int[] levelIndex=diskSortedStackWrapper.levelIndex;
        Row4Aggregation aggregationRow=new Row4Aggregation();
        aggregationRow.setDimPos(dataSet4Aggregation.getDimensionPosition());
        aggregationRow.setLevelMembers(getLevelMembers(levelIndex));
        if (aggregationRow.getLevelMembers() == null) {
          continue;
        }
        aggregationRow.setMeasures(new Object[measureCount]);
        for (int j=0; j < measureCount; j++) {
          aggregationRow.getMeasures()[j]=dataSet4Aggregation.getMeasureValue(j);
        }
        aggregationRow.setParameterValues(getParameterValues());
        diskSortedStackWrapper.diskSortedStack.push(aggregationRow);
      }
    }
  }
 catch (  BirtException e) {
    throw DataException.wrap(e);
  }
}
Program: 70108
Project: 70108
Buggy source:
/** 
 * @param dimensionResultIterators
 * @param factTableRowIterator
 * @param aggregations
 * @throws BirtOlapException 
 */
public AggregationExecutor(IDataSet4Aggregation dataSet4Aggregation,AggregationDefinition[] aggregations) throws IOException, DataException {
  Object[] params={dataSet4Aggregation,aggregations};
  logger.entering(AggregationExecutor.class.getName(),"String_Node_Str",params);
  this.dataSet4Aggregation=dataSet4Aggregation;
  getParameterColIndex(aggregations);
  this.aggregationCalculators=new AggregationCalculator[aggregations.length];
  for (int i=0; i < this.aggregationCalculators.length; i++) {
    this.aggregationCalculators[i]=new AggregationCalculator(aggregations[i],paraColumns,dataSet4Aggregation.getMetaInfo());
  }
  sortedFactRows=new DiskSortedStackWrapper[aggregations.length];
  getAggregationLevelIndex();
  logger.exiting(AggregationExecutor.class.getName(),"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * @param dimensionResultIterators
 * @param factTableRowIterator
 * @param aggregations
 * @throws BirtOlapException 
 */
public AggregationExecutor(ICubeDimensionReader cubeDimensionReader,IDataSet4Aggregation dataSet4Aggregation,AggregationDefinition[] aggregations) throws IOException, DataException {
  Object[] params={dataSet4Aggregation,aggregations};
  logger.entering(AggregationExecutor.class.getName(),"String_Node_Str",params);
  this.dataSet4Aggregation=dataSet4Aggregation;
  getParameterColIndex(aggregations);
  this.aggregationCalculators=new AggregationCalculator[aggregations.length];
  for (int i=0; i < this.aggregationCalculators.length; i++) {
    this.aggregationCalculators[i]=new AggregationCalculator(aggregations[i],paraColumns,dataSet4Aggregation.getMetaInfo(),cubeDimensionReader);
  }
  sortedFactRows=new DiskSortedStackWrapper[aggregations.length];
  getAggregationLevelIndex();
  logger.exiting(AggregationExecutor.class.getName(),"String_Node_Str");
}
Program: 70109
Project: 70109
Buggy source:
public boolean hasNextChild(){
  if (children == null) {
    return false;
  }
  if (currentChild < children.size()) {
    return true;
  }
  if (needRowGroups) {
    if (endOfGroups) {
      return false;
    }
    try {
      while (!endOfGroups) {
        int endingGroupIndex=GroupUtil.getEndingGroupLevel(rowCursor,groupCursors);
        if (endingGroupIndex <= 0) {
          currentChild=0;
          children=new ArrayList();
          if (crosstabItem.getGrandTotal(ROW_AXIS_TYPE) != null && (measureCount > 0 || !IColumnWalker.IGNORE_TOTAL_COLUMN_WITHOUT_MEASURE)) {
            CrosstabFooterExecutor totalExecutor=new CrosstabFooterExecutor(this);
            children.add(totalExecutor);
          }
          endOfGroups=true;
          return currentChild < children.size();
        }
        if (rowCursor.next()) {
          collectExecutable();
          return currentChild < children.size();
        }
      }
    }
 catch (    OLAPException e) {
      logger.log(Level.SEVERE,Messages.getString("String_Node_Str"),e);
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean hasNextChild(){
  if (children == null) {
    return false;
  }
  if (currentChild < children.size()) {
    return true;
  }
  if (needRowGroups) {
    if (endOfGroups) {
      return false;
    }
    try {
      while (!endOfGroups) {
        int endingGroupIndex=GroupUtil.getEndingGroupLevel(rowCursor,groupCursors);
        if (endingGroupIndex <= 0) {
          currentChild=0;
          children=new ArrayList();
          if (needRowGrandTotal(GRAND_TOTAL_LOCATION_AFTER)) {
            CrosstabFooterExecutor totalExecutor=new CrosstabFooterExecutor(this);
            children.add(totalExecutor);
          }
          endOfGroups=true;
          return currentChild < children.size();
        }
        if (rowCursor.next()) {
          collectExecutable();
          return currentChild < children.size();
        }
      }
    }
 catch (    OLAPException e) {
      logger.log(Level.SEVERE,Messages.getString("String_Node_Str"),e);
    }
  }
  return false;
}
Program: 70111
Project: 70111
Buggy source:
public CellArea deepClone(){
  CellArea cell=(CellArea)super.deepClone();
  cell.setBoxStyle(new BoxStyle(cell.getBoxStyle()));
  return cell;
}

Fixed version (ground truth):
public CellArea deepClone(){
  CellArea cell=(CellArea)super.deepClone();
  cell.setBoxStyle(new BoxStyle(cell.getBoxStyle()));
  if (getRowSpan() > 1) {
    cell.setHeight(currentBP + getOffsetY() + localProperties.getPaddingBottom());
  }
  return cell;
}
Program: 70112
Project: 70112
Buggy source:
public void replace(CellArea origin,CellArea dest){
  children.remove(origin);
  children.add(dest);
  dest.setParent(this);
}

Fixed version (ground truth):
public void replace(CellArea origin,CellArea dest){
  int index=children.indexOf(origin);
  if (index >= 0) {
    children.remove(origin);
    children.add(index,dest);
    dest.setParent(this);
  }
}
Program: 70113
Project: 70113
Buggy source:
protected void _splitSpanCell(int height,boolean force) throws BirtException {
  if (cells.length != children.size()) {
    for (int i=0; i < cells.length; i++) {
      if (cells[i] instanceof DummyCell) {
        SplitResult splitCell=cells[i].split(0,force);
        CellArea cell=(CellArea)splitCell.getResult();
        if (cell != null) {
          cell.setHeight(((DummyCell)cells[i]).getDelta());
          CellArea org=((DummyCell)cells[i]).getCell();
          RowArea row=(RowArea)org.getParent();
          row.replace(org,cell);
          cell.setParent(row);
        }
        i=i + cells[i].getColSpan() - 1;
      }
    }
  }
}

Fixed version (ground truth):
protected void _splitSpanCell(int height,boolean force) throws BirtException {
  if (cells.length != children.size()) {
    for (int i=0; i < cells.length; i++) {
      if (cells[i] instanceof DummyCell) {
        int oh=((DummyCell)cells[i]).getCell().getHeight();
        int ch=((DummyCell)cells[i]).getDelta();
        int rowSpan=((DummyCell)cells[i]).getRowSpan();
        if (ch >= oh) {
          CellArea cell=cells[i].cloneArea();
          cell.setHeight(0);
          cell.setRowSpan(rowSpan);
          cell.setParent(this);
          addChildByColumnId(cell);
        }
 else {
          CellArea cell=cells[i].cloneArea();
          cell.setHeight(0);
          cell.setRowSpan(rowSpan);
          cell.setParent(this);
          addChildByColumnId(cell);
        }
        i=i + cells[i].getColSpan() - 1;
      }
    }
  }
}
Program: 70114
Project: 70114
Buggy source:
/** 
 * Transfer background for current page to Doc format. Now, the exported file will apply the first background properties, and followed background will ignore. In addition, Since the Word only support fill-in background, the background attach, pos, posX, posY and repeat are not mapped to Word easyly. At present, ignore those properties.
 * @throws IOException
 * @TODO support background properties. attach, pos, posx, posy and repeat.
 */
protected void drawDocumentBackground() throws IOException {
  IStyle style=previousPage.getComputedStyle();
  String backgroundColor=style.getBackgroundColor();
  String backgroundImageUrl=EmitterUtil.getBackgroundImageUrl(style,reportContent.getDesign().getReportDesign());
  wordWriter.drawDocumentBackground(backgroundColor,backgroundImageUrl);
}

Fixed version (ground truth):
/** 
 * Transfer background for current page to Doc format. Now, the exported file will apply the first background properties, and followed background will ignore. In addition, Since the Word only support fill-in background, the background attach, pos, posX, posY and repeat are not mapped to Word easyly. At present, ignore those properties.
 * @throws IOException
 * @TODO support background properties. attach, pos, posx, posy and repeat.
 */
protected void drawDocumentBackground() throws IOException {
  IStyle style=previousPage.getComputedStyle();
  String backgroundColor=style.getBackgroundColor();
  String backgroundImageUrl=EmitterUtil.getBackgroundImageUrl(style,reportContent.getDesign().getReportDesign());
  String height=style.getBackgroundHeight();
  String width=style.getBackgroundWidth();
  wordWriter.drawDocumentBackground(backgroundColor,backgroundImageUrl,height,width);
}
Program: 70115
Project: 70115
Buggy source:
private void writeHeaderFooter() throws IOException, BirtException {
  if (previousPage.getPageHeader() != null) {
    SimpleMasterPageDesign master=(SimpleMasterPageDesign)previousPage.getGenerateBy();
    wordWriter.startHeader(!master.isShowHeaderOnFirst(),headerHeight,contentWidth);
    contentVisitor.visitChildren(previousPage.getPageHeader(),null);
    wordWriter.endHeader();
  }
  if (previousPage.getPageFooter() != null) {
    wordWriter.startFooter(footerHeight,contentWidth);
    contentVisitor.visitChildren(previousPage.getPageFooter(),null);
    wordWriter.endFooter();
  }
}

Fixed version (ground truth):
private void writeHeaderFooter() throws IOException, BirtException {
  IStyle style=previousPage.getComputedStyle();
  String backgroundHeight=style.getBackgroundHeight();
  String backgroundWidth=style.getBackgroundWidth();
  if (previousPage.getPageHeader() != null || backgroundHeight != null || backgroundWidth != null) {
    SimpleMasterPageDesign master=(SimpleMasterPageDesign)previousPage.getGenerateBy();
    wordWriter.startHeader(!master.isShowHeaderOnFirst(),headerHeight,contentWidth);
    if (backgroundHeight != null || backgroundWidth != null) {
      String backgroundImageUrl=EmitterUtil.getBackgroundImageUrl(style,reportContent.getDesign().getReportDesign());
      wordWriter.drawDocumentBackgroundImage(backgroundImageUrl,backgroundHeight,backgroundWidth,WordUtil.twipToPt(topMargin),WordUtil.twipToPt(leftMargin),WordUtil.twipToPt(pageHeight),WordUtil.twipToPt(pageWidth));
    }
    contentVisitor.visitChildren(previousPage.getPageHeader(),null);
    wordWriter.endHeader();
  }
  if (previousPage.getPageFooter() != null) {
    wordWriter.startFooter(footerHeight,contentWidth);
    contentVisitor.visitChildren(previousPage.getPageFooter(),null);
    wordWriter.endFooter();
  }
}
Program: 70116
Project: 70116
Buggy source:
void drawDocumentBackground(String backgroundColor,String backgroundImageUrl) throws IOException ;

Fixed version (ground truth):
void drawDocumentBackground(String backgroundColor,String backgroundImageUrl,String backgrounHeight,String backgroundWidth) throws IOException ;
Program: 70117
Project: 70117
Buggy source:
private void writeHiddenProperty(){
  writer.openTag("String_Node_Str");
  writeAttrTag("String_Node_Str","String_Node_Str");
  writer.closeTag("String_Node_Str");
}

Fixed version (ground truth):
public void writeHiddenProperty(){
  writer.openTag("String_Node_Str");
  writeAttrTag("String_Node_Str","String_Node_Str");
  writer.closeTag("String_Node_Str");
}
Program: 70118
Project: 70118
Buggy source:
public void drawDocumentBackground(String bgcolor,String backgroundImageUrl){
  writer.openTag("String_Node_Str");
  if (backgroundImageUrl != null) {
    byte[] backgroundImageData=EmitterUtil.getImageData(backgroundImageUrl);
    drawDocumentBackgroundImage(backgroundImageData);
  }
 else   drawDocumentBackgroundColor(bgcolor);
  writer.closeTag("String_Node_Str");
}

Fixed version (ground truth):
public void drawDocumentBackground(String bgcolor,String backgroundImageUrl,String backgroundHeight,String backgroundWidth){
  writer.openTag("String_Node_Str");
  if (backgroundImageUrl != null && backgroundHeight == null && backgroundWidth == null) {
    byte[] backgroundImageData=EmitterUtil.getImageData(backgroundImageUrl);
    drawDocumentBackgroundImage(backgroundImageData);
  }
 else   drawDocumentBackgroundColor(bgcolor);
  writer.closeTag("String_Node_Str");
}
Program: 70119
Project: 70119
Buggy source:
/** 
 * Get the padding of the current element.
 * @param retValue The padding value of the current element.
 * @return The padding's new value of the current element.
 */
public Insets getPadding(Insets retValue){
  if (retValue == null) {
    retValue=new Insets();
  }
 else {
    retValue=new Insets(retValue);
  }
  int fontSize=DEUtil.getFontSizeIntValue(getHandle());
  DimensionValue dimensionValue=(DimensionValue)getHandle().getProperty(StyleHandle.PADDING_TOP_PROP);
  double px=DEUtil.convertToPixel(dimensionValue,fontSize);
  dimensionValue=(DimensionValue)getHandle().getProperty(StyleHandle.PADDING_BOTTOM_PROP);
  double py=DEUtil.convertToPixel(dimensionValue,fontSize);
  retValue.top=(int)px;
  retValue.bottom=(int)py;
  dimensionValue=(DimensionValue)getHandle().getProperty(StyleHandle.PADDING_LEFT_PROP);
  px=DEUtil.convertToPixel(dimensionValue,fontSize);
  dimensionValue=(DimensionValue)getHandle().getProperty(StyleHandle.PADDING_RIGHT_PROP);
  py=DEUtil.convertToPixel(dimensionValue,fontSize);
  retValue.left=(int)px;
  retValue.right=(int)py;
  return retValue;
}

Fixed version (ground truth):
/** 
 * Get the padding of the current element.
 * @param retValue The padding value of the current element.
 * @return The padding's new value of the current element.
 */
public Insets getPadding(Insets retValue){
  return DEUtil.getPadding(getHandle(),retValue);
}
Program: 70120
Project: 70120
Buggy source:
protected IFigure createFigure(){
  ReportRootFigure figure=new ReportRootFigure();
  figure.setOpaque(true);
  figure.setShowMargin(showMargin);
  ReportDesignLayout layout=new ReportDesignLayout(this);
  Dimension size=DEFAULTSIZE;
  Rectangle bounds=new Rectangle(0,0,size.width - 1,size.height - 1);
  layout.setInitSize(bounds);
  figure.setLayoutManager(layout);
  figure.setBorder(new ReportDesignMarginBorder(INSETS));
  figure.setBounds(bounds.getCopy());
  return figure;
}

Fixed version (ground truth):
protected IFigure createFigure(){
  ReportRootFigure figure=new ReportRootFigure();
  figure.setOpaque(true);
  figure.setShowMargin(showMargin);
  ReportDesignLayout layout=new ReportDesignLayout(this);
  Dimension size=DEFAULTSIZE;
  Rectangle bounds=new Rectangle(0,0,size.width - 1,size.height - 1);
  layout.setInitSize(bounds);
  figure.setLayoutManager(layout);
  ReportDesignMarginBorder border=new ReportDesignMarginBorder(INSETS);
  border.reInitStyle();
  figure.setBorder(border);
  figure.setBounds(bounds.getCopy());
  return figure;
}
Program: 70121
Project: 70121
Buggy source:
/** 
 * Constructor
 * @param insets
 */
public ReportDesignMarginBorder(Insets insets){
  super(insets);
}

Fixed version (ground truth):
/** 
 * Constructor
 * @param insets
 */
public ReportDesignMarginBorder(Insets insets){
  setMarginInsets(insets);
}
Program: 70122
Project: 70122
Buggy source:
public void refreshFigure(){
  int color=getBackgroundColor((MasterPageHandle)getModel());
  getFigure().setBackgroundColor(getBackGroundColor(color));
  Dimension size=getMasterPageSize((MasterPageHandle)getModel());
  Rectangle bounds=new Rectangle(0,0,size.width - 1,size.height - 1);
  ((AbstractPageFlowLayout)getFigure().getLayoutManager()).setInitSize(bounds);
  ReportDesignMarginBorder reportDesignMarginBorder=new ReportDesignMarginBorder(getMasterPageInsets((MasterPageHandle)getModel()));
  reportDesignMarginBorder.setBackgroundColor(((MasterPageHandle)getModel()).getPropertyHandle(StyleHandle.BACKGROUND_COLOR_PROP).getIntValue());
  getFigure().setBorder(reportDesignMarginBorder);
  refreshBackground((MasterPageHandle)getModel());
}

Fixed version (ground truth):
public void refreshFigure(){
  int color=getBackgroundColor((MasterPageHandle)getModel());
  getFigure().setBackgroundColor(getBackGroundColor(color));
  Dimension size=getMasterPageSize((MasterPageHandle)getModel());
  Rectangle bounds=new Rectangle(0,0,size.width - 1,size.height - 1);
  ((AbstractPageFlowLayout)getFigure().getLayoutManager()).setInitSize(bounds);
  ReportDesignMarginBorder reportDesignMarginBorder=new ReportDesignMarginBorder(getMasterPageInsets((MasterPageHandle)getModel()));
  reportDesignMarginBorder.setBackgroundColor(((MasterPageHandle)getModel()).getPropertyHandle(StyleHandle.BACKGROUND_COLOR_PROP).getIntValue());
  refreshMarginBorder(reportDesignMarginBorder);
  refreshBackground((MasterPageHandle)getModel());
}
Program: 70123
Project: 70123
Buggy source:
protected void paintFigure(Graphics graphics){
  super.paintFigure(graphics);
  graphics.setForegroundColor(ReportColorConstants.MarginBorderColor);
  graphics.drawRectangle(getBounds().getCopy().crop(getBorder().getInsets(this)).crop(DEFAULT_CROP));
  graphics.setForegroundColor(ReportColorConstants.ReportForeground);
  graphics.drawRectangle(getBounds().getCopy().crop(new Insets(0,0,1,1)));
}

Fixed version (ground truth):
protected void paintFigure(Graphics graphics){
  graphics.fillRectangle(getBounds());
  super.paintFigure(graphics);
  graphics.setForegroundColor(ReportColorConstants.ReportForeground);
  graphics.drawRectangle(getBounds().getCopy().crop(new Insets(0,0,1,1)));
}
Program: 70125
Project: 70125
Buggy source:
/** 
 * @return The constraint
 */
protected Object getConstraint(){
  ExtendedItemHandle handle=getExtendedItemHandle();
  ReportItemConstraint constraint=new ReportItemConstraint();
  String type=handle.getPrivateStyle().getDisplay();
  if (type == null || DesignChoiceConstants.DISPLAY_NONE.equals(type)) {
    type=DesignChoiceConstants.DISPLAY_BLOCK;
  }
  constraint.setDisplay(type);
  constraint.setMargin(getModelAdapter().getMargin(null));
  return constraint;
}

Fixed version (ground truth):
/** 
 * @return The constraint
 */
protected Object getConstraint(){
  ExtendedItemHandle handle=getExtendedItemHandle();
  ReportItemConstraint constraint=new ReportItemConstraint();
  String type=handle.getPrivateStyle().getDisplay();
  if (type == null || DesignChoiceConstants.DISPLAY_NONE.equals(type)) {
    type=DesignChoiceConstants.DISPLAY_BLOCK;
  }
  constraint.setDisplay(type);
  constraint.setMargin(getModelAdapter().getMargin(null));
  DimensionHandle value=handle.getWidth();
  constraint.setMeasure(value.getMeasure());
  constraint.setUnits(value.getUnits());
  return constraint;
}
Program: 70127
Project: 70127
Buggy source:
/** 
 * @param function
 * @param row
 * @param funcIndex
 * @return
 */
protected Object[] getAccumulatorParameter(AggregationFunctionDefinition function,IAggregationResultRow row,int funcIndex){
  Object[] parameters=null;
  if (paraInfo[funcIndex] == null || paraInfo[funcIndex].getLevelIndex() == -1) {
    if (function.getParaValue() == null) {
      parameters=new Object[1];
      if (measureIndexes[funcIndex] < 0) {
        return null;
      }
 else {
        parameters[0]=row.getAggregationValues()[measureIndexes[funcIndex]];
      }
    }
 else {
      parameters=new Object[2];
      parameters[1]=function.getParaValue();
      if (measureIndexes[funcIndex] >= 0) {
        parameters[0]=row.getAggregationValues()[measureIndexes[funcIndex]];
      }
    }
  }
 else {
    parameters=new Object[2];
    if (measureIndexes[funcIndex] < 0) {
      parameters[0]=null;
    }
 else {
      parameters[0]=row.getAggregationValues()[measureIndexes[funcIndex]];
    }
    Member member=row.getLevelMembers()[paraInfo[funcIndex].getLevelIndex()];
    if (paraInfo[funcIndex].isKey()) {
      parameters[1]=member.getKeyValues()[paraInfo[funcIndex].getColumnIndex()];
    }
 else {
      parameters[1]=member.getAttributes()[paraInfo[funcIndex].getColumnIndex()];
    }
  }
  return parameters;
}

Fixed version (ground truth):
/** 
 * @param function
 * @param row
 * @param funcIndex
 * @return
 * @throws DataException 
 */
protected Object[] getAccumulatorParameter(AggregationFunctionDefinition function,IAggregationResultRow row,int funcIndex) throws DataException {
  Object[] parameters=null;
  if (paraInfo[funcIndex] == null || paraInfo[funcIndex].getLevelIndex() == -1) {
    if (getParaNum(funcIndex) <= 1) {
      parameters=new Object[1];
      if (measureIndexes[funcIndex] < 0) {
        return null;
      }
 else {
        parameters[0]=row.getAggregationValues()[measureIndexes[funcIndex]];
      }
    }
 else {
      parameters=new Object[2];
      parameters[1]=function.getParaValue();
      if (measureIndexes[funcIndex] >= 0) {
        parameters[0]=row.getAggregationValues()[measureIndexes[funcIndex]];
      }
    }
  }
 else {
    parameters=new Object[2];
    if (measureIndexes[funcIndex] < 0) {
      parameters[0]=null;
    }
 else {
      parameters[0]=row.getAggregationValues()[measureIndexes[funcIndex]];
    }
    Member member=row.getLevelMembers()[paraInfo[funcIndex].getLevelIndex()];
    if (paraInfo[funcIndex].isKey()) {
      parameters[1]=member.getKeyValues()[paraInfo[funcIndex].getColumnIndex()];
    }
 else {
      parameters[1]=member.getAttributes()[paraInfo[funcIndex].getColumnIndex()];
    }
  }
  return parameters;
}
Program: 70128
Project: 70128
Buggy source:
protected Dimension getChildSize(IFigure child,int wHint,int hHint){
  ReportItemConstraint constraint=(ReportItemConstraint)getConstraint(child);
  Dimension preferredDimension;
  if (DesignChoiceConstants.REPORT_LAYOUT_PREFERENCE_FIXED_LAYOUT.equals(layoutPreference) && child instanceof IFixLayoutHelper) {
    preferredDimension=((IFixLayoutHelper)child).getFixPreferredSize(wHint,hHint);
    if (constraint != null) {
      Dimension dimension=constraint.getSize();
      if (dimension.width <= 0) {
        if (constraint.getMeasure() != 0 && DesignChoiceConstants.UNITS_PERCENTAGE.equals(constraint.getUnits())) {
          preferredDimension.width=(int)constraint.getMeasure() * wHint / 100;
        }
      }
    }
    constraint=null;
  }
 else {
    preferredDimension=child.getPreferredSize(wHint,hHint);
  }
  if (constraint != null && !constraint.isFitContiner()) {
    if (constraint.isNone()) {
      return new Dimension(0,0);
    }
    Dimension dimension=constraint.getSize();
    if (dimension.height <= 0) {
      dimension.height=preferredDimension.height;
    }
    if (dimension.width <= 0) {
      if (constraint.getMeasure() != 0 && DesignChoiceConstants.UNITS_PERCENTAGE.equals(constraint.getUnits())) {
        dimension.width=(int)constraint.getMeasure() * wHint / 100;
      }
 else {
        dimension.width=preferredDimension.width;
      }
    }
    return dimension;
  }
 else {
    return preferredDimension;
  }
}

Fixed version (ground truth):
protected Dimension getChildSize(IFigure child,int wHint,int hHint){
  updateChild(child,wHint);
  ReportItemConstraint constraint=(ReportItemConstraint)getConstraint(child);
  Dimension preferredDimension;
  if (DesignChoiceConstants.REPORT_LAYOUT_PREFERENCE_FIXED_LAYOUT.equals(layoutPreference) && child instanceof IFixLayoutHelper) {
    preferredDimension=((IFixLayoutHelper)child).getFixPreferredSize(wHint,hHint);
    if (constraint != null) {
      Dimension dimension=constraint.getSize();
      if (dimension.width <= 0) {
        if (constraint.getMeasure() != 0 && DesignChoiceConstants.UNITS_PERCENTAGE.equals(constraint.getUnits())) {
          preferredDimension.width=(int)constraint.getMeasure() * wHint / 100;
        }
      }
    }
    constraint=null;
  }
 else {
    preferredDimension=child.getPreferredSize(wHint,hHint);
  }
  if (constraint != null && !constraint.isFitContiner()) {
    if (constraint.isNone()) {
      return new Dimension(0,0);
    }
    Dimension dimension=constraint.getSize();
    if (dimension.height <= 0) {
      dimension.height=preferredDimension.height;
    }
    if (dimension.width <= 0) {
      if (constraint.getMeasure() != 0 && DesignChoiceConstants.UNITS_PERCENTAGE.equals(constraint.getUnits())) {
        dimension.width=(int)constraint.getMeasure() * wHint / 100;
      }
 else {
        dimension.width=preferredDimension.width;
      }
    }
    return dimension;
  }
 else {
    return preferredDimension;
  }
}
Program: 70130
Project: 70130
Buggy source:
protected void configGraphicalViewer(){
  viewer=new DeferredGraphicalViewer(){
    protected void fireSelectionChanged(){
    }
  }
;
  DeferredGraphicalViewer reportViewer=(DeferredGraphicalViewer)viewer;
  hostShell=new Shell();
  reportViewer.createControl(hostShell);
  reportViewer.setEditDomain(new DefaultEditDomain(null));
  reportViewer.setRootEditPart(new ReportRootEditPart());
  reportViewer.setEditPartFactory(new GraphicalPartFactory());
  reportViewer.setContents(model);
  reportViewer.flush();
}

Fixed version (ground truth):
protected void configGraphicalViewer(){
  viewer=new DeferredGraphicalViewer(){
    protected void fireSelectionChanged(){
    }
  }
;
  DeferredGraphicalViewer reportViewer=(DeferredGraphicalViewer)viewer;
  if (model instanceof ReportDesignHandle) {
    String orientation=((ReportDesignHandle)model).getBidiOrientation();
    if (DesignChoiceConstants.BIDI_DIRECTION_RTL.equals(orientation)) {
      hostShell=new Shell(SWT.RIGHT_TO_LEFT);
    }
 else {
      hostShell=new Shell(SWT.LEFT_TO_RIGHT);
    }
  }
 else {
    hostShell=new Shell();
  }
  reportViewer.createControl(hostShell);
  reportViewer.setEditDomain(new DefaultEditDomain(null));
  reportViewer.setRootEditPart(new ReportRootEditPart());
  reportViewer.setEditPartFactory(new GraphicalPartFactory());
  reportViewer.setContents(model);
  reportViewer.flush();
}
Program: 70131
Project: 70131
Buggy source:
public void paint(Drawable drawable,Device device,Rectangle region){
  ReportPrintGraphicalViewerOperation op=new ReportPrintGraphicalViewerOperation(viewer,drawable,device,new org.eclipse.draw2d.geometry.Rectangle(region));
  op.run("String_Node_Str");
}

Fixed version (ground truth):
public void paint(Drawable drawable,Device device,Rectangle region){
  ReportPrintGraphicalViewerOperation op=new ReportPrintGraphicalViewerOperation(viewer,drawable,device,new org.eclipse.draw2d.geometry.Rectangle(region));
  if (model instanceof ReportDesignHandle) {
    op.setOrientation(((ReportDesignHandle)model).getBidiOrientation());
  }
  op.run("String_Node_Str");
}
Program: 70132
Project: 70132
Buggy source:
/** 
 * @param jobName
 */
public void run(String jobName){
  preparePrintSource();
  printerGC=new GC(getDrawable(),SWT.LEFT_TO_RIGHT);
  printPages();
  restorePrintSource();
  cleanup();
}

Fixed version (ground truth):
/** 
 * @param jobName
 */
public void run(String jobName){
  preparePrintSource();
  if (DesignChoiceConstants.BIDI_DIRECTION_RTL.equals(getOrientation())) {
    printerGC=new GC(getDrawable(),SWT.RIGHT_TO_LEFT);
  }
 else {
    printerGC=new GC(getDrawable(),SWT.LEFT_TO_RIGHT);
  }
  printPages();
  restorePrintSource();
  cleanup();
}
Program: 70135
Project: 70135
Buggy source:
public void refreshFigure(){
  StyleHandle style=((DesignElementHandle)getModel()).getPrivateStyle();
  ((LabelFigure)getFigure()).setDirection(getTextDirection());
  ((LabelFigure)getFigure()).setText(getText());
  ((LabelFigure)getFigure()).setFont(getFont());
  ((LabelFigure)getFigure()).setTextUnderline(style.getTextUnderline());
  ((LabelFigure)getFigure()).setTextLineThrough(style.getTextLineThrough());
  ((LabelFigure)getFigure()).setTextOverline(style.getTextOverline());
  ((LabelFigure)getFigure()).setTextAlign(style.getTextAlign());
  ((LabelFigure)getFigure()).setVerticalAlign(style.getVerticalAlign());
  ((LabelFigure)getFigure()).setDisplay(style.getDisplay());
  ((LabelFigure)getFigure()).setRecommendSize(getLabelAdapter().getSize());
  ((AbstractGraphicalEditPart)getParent()).setLayoutConstraint(this,getFigure(),getConstraint());
  ((LabelFigure)getFigure()).setForegroundColor(ColorManager.getColor(getForegroundColor((ReportItemHandle)getModel())));
  refreshBorder((DesignElementHandle)getModel(),new LineBorder());
  Insets pist=getLabelAdapter().getPadding(getFigure().getInsets());
  ((LineBorder)(getFigure().getBorder())).setPaddingInsets(pist);
  if (!hasText())   ((LabelFigure)getFigure()).setForegroundColor(ReportColorConstants.ShadowLineColor);
 else   ((LabelFigure)getFigure()).setForegroundColor(ColorManager.getColor(getForegroundColor((ReportItemHandle)getModel())));
  refreshBackground((DesignElementHandle)getModel());
  refreshMargin();
}

Fixed version (ground truth):
public void refreshFigure(){
  StyleHandle style=((DesignElementHandle)getModel()).getPrivateStyle();
  ((LabelFigure)getFigure()).setDirection(getTextDirection());
  ((LabelFigure)getFigure()).setText(getText());
  ((LabelFigure)getFigure()).setFont(getFont());
  ((LabelFigure)getFigure()).setTextUnderline(style.getTextUnderline());
  ((LabelFigure)getFigure()).setTextLineThrough(style.getTextLineThrough());
  ((LabelFigure)getFigure()).setTextOverline(style.getTextOverline());
  ((LabelFigure)getFigure()).setTextAlign(style.getTextAlign());
  ((LabelFigure)getFigure()).setVerticalAlign(style.getVerticalAlign());
  ((LabelFigure)getFigure()).setDisplay(style.getDisplay());
  ((LabelFigure)getFigure()).setRecommendSize(getLabelAdapter().getSize());
  ((LabelFigure)getFigure()).setFixLayout(isFixLayout());
  ((AbstractGraphicalEditPart)getParent()).setLayoutConstraint(this,getFigure(),getConstraint());
  ((LabelFigure)getFigure()).setForegroundColor(ColorManager.getColor(getForegroundColor((ReportItemHandle)getModel())));
  refreshBorder((DesignElementHandle)getModel(),new LineBorder());
  Insets pist=getLabelAdapter().getPadding(getFigure().getInsets());
  ((LineBorder)(getFigure().getBorder())).setPaddingInsets(pist);
  if (!hasText())   ((LabelFigure)getFigure()).setForegroundColor(ReportColorConstants.ShadowLineColor);
 else   ((LabelFigure)getFigure()).setForegroundColor(ColorManager.getColor(getForegroundColor((ReportItemHandle)getModel())));
  refreshBackground((DesignElementHandle)getModel());
  refreshMargin();
}
Program: 70136
Project: 70136
Buggy source:
public void postValidate(){
  if (DesignChoiceConstants.DISPLAY_BLOCK.equals(display) || DesignChoiceConstants.DISPLAY_INLINE.equals(display)) {
    List list=getFragments();
    FlowBox box;
    int left=Integer.MAX_VALUE, top=left;
    int bottom=Integer.MIN_VALUE;
    for (int i=0; i < list.size(); i++) {
      box=(FlowBox)list.get(i);
      left=Math.min(left,box.getX());
      top=Math.min(top,box.getBaseline() - box.getAscent());
      bottom=Math.max(bottom,box.getBaseline() + box.getDescent());
    }
    setBounds(new Rectangle(left,top,LabelFigure.this.getClientArea().width,Math.max(LabelFigure.this.getClientArea().height,bottom - top)));
    list=getChildren();
    for (int i=0; i < list.size(); i++) {
      ((FlowFigure)list.get(i)).postValidate();
    }
  }
 else {
    super.postValidate();
  }
}

Fixed version (ground truth):
public void postValidate(){
  if (DesignChoiceConstants.DISPLAY_BLOCK.equals(display) || DesignChoiceConstants.DISPLAY_INLINE.equals(display)) {
    List list=getFragments();
    FlowBox box;
    int left=Integer.MAX_VALUE, top=left;
    int bottom=Integer.MIN_VALUE;
    for (int i=0; i < list.size(); i++) {
      box=(FlowBox)list.get(i);
      left=Math.min(left,box.getX());
      top=Math.min(top,box.getBaseline() - box.getAscent());
      bottom=Math.max(bottom,box.getBaseline() + box.getDescent());
    }
    int width=LabelFigure.this.getClientArea().width;
    if (isFixLayout) {
      int maxWidth=calcMaxSegment() - getInsets().getWidth();
      width=Math.max(width,maxWidth);
    }
    setBounds(new Rectangle(left,top,width,Math.max(LabelFigure.this.getClientArea().height,bottom - top)));
    if (isFixLayout()) {
      Figure child=(Figure)getParent();
      Rectangle rect=child.getBounds();
      child.setBounds(new Rectangle(rect.x,rect.y,width,rect.height));
    }
    list=getChildren();
    for (int i=0; i < list.size(); i++) {
      ((FlowFigure)list.get(i)).postValidate();
    }
  }
 else {
    super.postValidate();
  }
}
Program: 70138
Project: 70138
Buggy source:
@Override public Dimension getFixMinimumSize(int w,int h){
  int width=0;
  int height=0;
  if (recommendSize.width > 0) {
    width=recommendSize.width;
  }
 else {
    if (recommendSize.height > 0) {
      width=getMinimumSize(w,recommendSize.height,true,false,true).width;
    }
 else {
      width=getMinimumSize(w,h,true,false,false).width;
    }
  }
  if (recommendSize.height > 0) {
    height=recommendSize.height;
  }
 else {
    if (recommendSize.width > 0) {
      height=getMinimumSize(width,h,true,true,false).height;
    }
 else {
      height=getMinimumSize(w,h,true,false,false).height;
    }
  }
  return new Dimension(width,height);
}

Fixed version (ground truth):
@Override public Dimension getFixMinimumSize(int w,int h){
  int width=0;
  int height=0;
  if (recommendSize.width > 0) {
    width=recommendSize.width;
  }
 else {
    if (recommendSize.height > 0) {
      width=getMinimumSize(w,recommendSize.height,true,false,true).width;
    }
 else {
      width=getMinimumSize(w,h,true,false,false).width;
    }
  }
  if (recommendSize.height > 0) {
    height=recommendSize.height;
  }
 else {
    if (recommendSize.width > 0) {
      int maxWidth=calcMaxSegment();
      height=getMinimumSize(Math.max(maxWidth,recommendSize.width),h,true,true,false).height;
    }
 else {
      height=getMinimumSize(w,h,true,false,false).height;
    }
  }
  return new Dimension(width,height);
}
Program: 70139
Project: 70139
Buggy source:
public URL findResource(ModuleHandle moduleHandle,String filename,int type){
  if (path == null || path.equals("String_Node_Str"))   return null;
  try {
    URL url=new URL(path + filename);
    return url;
  }
 catch (  MalformedURLException mue) {
    mue.printStackTrace();
  }
  return null;
}

Fixed version (ground truth):
public URL findResource(ModuleHandle moduleHandle,String fileName,int type,Map appContext){
  return null;
}
Program: 70140
Project: 70140
Buggy source:
@Override public Dimension getFixPreferredSize(int w,int h){
  int width=0;
  int height=0;
  if (recommendSize.width > 0) {
    width=recommendSize.width;
  }
 else {
    if (recommendSize.height > 0) {
      width=getPreferredSize(w,recommendSize.height,true,false,true).width;
    }
 else {
      width=getPreferredSize(w,h,true,false,false).width;
    }
  }
  if (recommendSize.height > 0) {
    height=recommendSize.height;
  }
 else {
    if (recommendSize.width > 0) {
      height=getPreferredSize(width,h,true,true,false).height;
    }
 else {
      height=getPreferredSize(w,h,true,false,false).height;
    }
  }
  return new Dimension(width,height);
}

Fixed version (ground truth):
@Override public Dimension getFixPreferredSize(int w,int h){
  int width=0;
  int height=0;
  if (recommendSize.width > 0) {
    width=recommendSize.width;
  }
 else {
    if (recommendSize.height > 0) {
      width=getPreferredSize(w,recommendSize.height,true,false,true).width;
    }
 else {
      width=getPreferredSize(w,h,true,false,false).width;
    }
  }
  if (recommendSize.height > 0) {
    height=recommendSize.height;
  }
 else {
    if (recommendSize.width > 0) {
      int maxWidth=calcMaxSegment();
      height=getPreferredSize(Math.max(maxWidth,recommendSize.width),h,true,true,false).height;
    }
 else {
      height=getPreferredSize(w,h,true,false,false).height;
    }
  }
  return new Dimension(width,height);
}
Program: 70141
Project: 70141
Buggy source:
protected IContentEmitter createContentEmitter() throws EngineException {
  ExtensionManager extManager=ExtensionManager.getInstance();
  pagination=extManager.getPagination(emitterID);
  IRenderOption executionRenderOptions=executionContext.getRenderOption();
  if (!executionRenderOptions.hasOption(IRenderOption.OUTPUT_DISPLAY_NONE)) {
    Boolean outputDisplayNone=extManager.getOutputDisplayNone(emitterID);
    executionRenderOptions.setOption(IRenderOption.OUTPUT_DISPLAY_NONE,outputDisplayNone);
  }
  if (!executionRenderOptions.hasOption(IRenderOption.SUPPORTED_IMAGE_FORMATS)) {
    String supportedImageFormats=extManager.getSupportedImageFormats(emitterID);
    executionRenderOptions.setOption(IRenderOption.SUPPORTED_IMAGE_FORMATS,supportedImageFormats);
  }
  IContentEmitter emitter=null;
  try {
    emitter=extManager.createEmitter(format,emitterID);
  }
 catch (  Throwable t) {
    log.log(Level.SEVERE,"String_Node_Str",format);
    throw new EngineException(MessageConstants.CANNOT_CREATE_EMITTER_EXCEPTION,format,t);
  }
  if (emitter == null) {
    log.log(Level.SEVERE,"String_Node_Str",format);
    throw new EngineException(MessageConstants.CANNOT_CREATE_EMITTER_EXCEPTION,format);
  }
  return emitter;
}

Fixed version (ground truth):
protected IContentEmitter createContentEmitter() throws EngineException {
  ExtensionManager extManager=ExtensionManager.getInstance();
  pagination=extManager.getPagination(emitterID);
  IRenderOption executionRenderOptions=executionContext.getRenderOption();
  if (!renderOptions.hasOption(IRenderOption.OUTPUT_DISPLAY_NONE)) {
    Boolean outputDisplayNone=extManager.getOutputDisplayNone(emitterID);
    renderOptions.setOption(IRenderOption.OUTPUT_DISPLAY_NONE,outputDisplayNone);
    executionRenderOptions.setOption(IRenderOption.OUTPUT_DISPLAY_NONE,outputDisplayNone);
  }
  if (!renderOptions.hasOption(IRenderOption.SUPPORTED_IMAGE_FORMATS)) {
    String supportedImageFormats=extManager.getSupportedImageFormats(emitterID);
    renderOptions.setOption(IRenderOption.SUPPORTED_IMAGE_FORMATS,supportedImageFormats);
    executionRenderOptions.setOption(IRenderOption.SUPPORTED_IMAGE_FORMATS,supportedImageFormats);
  }
  IContentEmitter emitter=null;
  try {
    emitter=extManager.createEmitter(format,emitterID);
  }
 catch (  Throwable t) {
    log.log(Level.SEVERE,"String_Node_Str",format);
    throw new EngineException(MessageConstants.CANNOT_CREATE_EMITTER_EXCEPTION,format,t);
  }
  if (emitter == null) {
    log.log(Level.SEVERE,"String_Node_Str",format);
    throw new EngineException(MessageConstants.CANNOT_CREATE_EMITTER_EXCEPTION,format);
  }
  return emitter;
}