nus-yam/ex-repair huggingface dataset:
Program: 69682
Project: 69682
Buggy source:
public void startCell(ICellContent cell){
  IStyle style=cell.getComputedStyle();
  engine.addCell(cell.getColumn(),cell.getColSpan(),cell.getRowSpan(),style);
}

Fixed version (ground truth):
public void startCell(ICellContent cell){
  IStyle style=cell.getComputedStyle();
  engine.addCell(cell,cell.getColumn(),cell.getColSpan(),cell.getRowSpan(),style);
}
Program: 69684
Project: 69684
Buggy source:
public static String convertColor(String value){
  if (value == null || "String_Node_Str".equalsIgnoreCase(value)) {
    return StyleConstant.NULL;
  }
  value=ExcelUtil.getValue(value);
  Matcher m=colorp.matcher(value);
  if (m.matches()) {
    StringBuffer buffer=new StringBuffer();
    buffer.append("String_Node_Str");
    for (int i=2; i <= 4; i++) {
      String hex=Integer.toHexString(Integer.parseInt(ExcelUtil.getValue(m.group(i)).trim()));
      if (hex.length() < 2) {
        buffer.append(0);
      }
      buffer.append(hex);
    }
    return buffer.toString();
  }
  return StyleConstant.NULL;
}

Fixed version (ground truth):
public static String convertColor(String value){
  value=EmitterUtil.parseColor(ExcelUtil.getValue(value));
  if (value == null) {
    return StyleConstant.NULL;
  }
 else {
    return "String_Node_Str" + value;
  }
}
Program: 69685
Project: 69685
Buggy source:
public static String convertBorderWeight(String linestyle){
  String w=StyleConstant.NULL;
  if (linestyle != null && !"String_Node_Str".equalsIgnoreCase(linestyle)) {
    linestyle=ExcelUtil.getValue(linestyle);
    int weight=(int)Double.parseDouble(linestyle);
    if (weight >= 749 && weight < 1499) {
      w="String_Node_Str";
    }
 else     if (weight >= 1499 && weight < 2249) {
      w="String_Node_Str";
    }
 else     if (weight >= 2249) {
      w="String_Node_Str";
    }
 else {
      w="String_Node_Str";
    }
  }
  return w;
}

Fixed version (ground truth):
public static String convertBorderWeight(double width){
  String w=StyleConstant.NULL;
  if (width >= 749 && width < 1499) {
    w="String_Node_Str";
  }
 else   if (width >= 1499 && width < 2249) {
    w="String_Node_Str";
  }
 else   if (width >= 2249) {
    w="String_Node_Str";
  }
 else {
    w="String_Node_Str";
  }
  return w;
}
Program: 69686
Project: 69686
Buggy source:
public StyleEntry createEntry(ContainerSizeInfo sizeInfo,IStyle style){
  if (style == null) {
    return StyleBuilder.createEmptyStyleEntry();
  }
  StyleEntry entry=initStyle(style,sizeInfo);
  entry.setStart(true);
  return entry;
}

Fixed version (ground truth):
public StyleEntry createEntry(ContainerSizeInfo sizeInfo,IStyle style){
  if (style == null) {
    return StyleBuilder.createEmptyStyleEntry();
  }
  StyleEntry entry=initStyle(style,sizeInfo);
  return entry;
}
Program: 69687
Project: 69687
Buggy source:
public void addCell(int col,int colSpan,int rowSpan,IStyle style){
  XlsTable table=tables.peek();
  ContainerSizeInfo cellSizeInfo=table.getColumnSizeInfo(col,colSpan);
  XlsCell cell=new XlsCell(engine.createEntry(cellSizeInfo,style),cellSizeInfo,getCurrentContainer(),rowSpan);
  addContainer(cell);
}

Fixed version (ground truth):
public void addCell(ICellContent cellcontent,int col,int colSpan,int rowSpan,IStyle style){
  XlsTable table=tables.peek();
  ContainerSizeInfo cellSizeInfo=table.getColumnSizeInfo(col,colSpan);
  int diagonalNumber=cellcontent.getDiagonalNumber();
  StyleEntry cellStyleEntry=null;
  if (diagonalNumber != 0) {
    String diagonalColor=cellcontent.getDiagonalColor();
    String diagonalStyle=cellcontent.getDiagonalStyle();
    int diagonalWidth=PropertyUtil.getDimensionValue(cellcontent,cellcontent.getDiagonalWidth(),cellSizeInfo.getWidth());
    cellStyleEntry=engine.createCellEntry(cellSizeInfo,style,diagonalColor,diagonalStyle,diagonalWidth);
  }
 else {
    cellStyleEntry=engine.createEntry(cellSizeInfo,style);
  }
  XlsCell cell=new XlsCell(cellStyleEntry,cellSizeInfo,getCurrentContainer(),rowSpan);
  addContainer(cell);
}
Program: 69688
Project: 69688
Buggy source:
public static String parseColor(String color){
  if ("String_Node_Str".equalsIgnoreCase(color) || color == null || color.length() == 0) {
    return null;
  }
  if (color.startsWith("String_Node_Str")) {
    return color.substring(1,Math.min(color.length(),7));
  }
 else   if (color.equalsIgnoreCase("String_Node_Str"))   return "String_Node_Str";
 else   if (color.equalsIgnoreCase("String_Node_Str"))   return "String_Node_Str";
 else   if (color.equalsIgnoreCase("String_Node_Str"))   return "String_Node_Str";
 else   if (color.equalsIgnoreCase("String_Node_Str"))   return "String_Node_Str";
 else   if (color.equalsIgnoreCase("String_Node_Str"))   return "String_Node_Str";
 else   if (color.equalsIgnoreCase("String_Node_Str"))   return "String_Node_Str";
 else   if (color.equalsIgnoreCase("String_Node_Str"))   return "String_Node_Str";
 else   if (color.equalsIgnoreCase("String_Node_Str"))   return "String_Node_Str";
 else   if (color.equalsIgnoreCase("String_Node_Str"))   return "String_Node_Str";
 else   if (color.equalsIgnoreCase("String_Node_Str"))   return "String_Node_Str";
 else   if (color.equalsIgnoreCase("String_Node_Str"))   return "String_Node_Str";
 else   if (color.equalsIgnoreCase("String_Node_Str"))   return "String_Node_Str";
 else   if (color.equalsIgnoreCase("String_Node_Str"))   return "String_Node_Str";
 else   if (color.equalsIgnoreCase("String_Node_Str"))   return "String_Node_Str";
 else   if (color.equalsIgnoreCase("String_Node_Str"))   return "String_Node_Str";
 else   if (color.equalsIgnoreCase("String_Node_Str"))   return "String_Node_Str";
  String[] values=color.substring(color.indexOf("String_Node_Str") + 1,color.length() - 1).split("String_Node_Str");
  String value="String_Node_Str";
  for (int i=0; i < values.length; i++) {
    try {
      String s=Integer.toHexString((Integer.parseInt(values[i].trim())));
      if (s.length() == 1) {
        s="String_Node_Str" + s;
      }
      value+=s;
    }
 catch (    Exception e) {
      logger.log(Level.WARNING,e.getMessage(),e);
      value=null;
    }
  }
  return value;
}

Fixed version (ground truth):
public static String parseColor(String color){
  return EmitterUtil.parseColor(color);
}
Program: 69689
Project: 69689
Buggy source:
public void layout(IFigure container){
  if (!isDistroy()) {
    return;
  }
  if (!isCalculating) {
    helper=new TableBorderHelper(owner);
    helper.updateCellBorderInsets();
  }
  figureInfo.clear();
  data=new WorkingData();
  data.columnWidths=new TableLayoutData.ColumnData[getColumnCount()];
  data.rowHeights=new TableLayoutData.RowData[getRowCount()];
  init(data.columnWidths,data.rowHeights);
  List children=container.getChildren();
  initMinSize(children);
  initMergeMinsize(children);
  caleLayoutData(container);
  if (!isCalculating) {
    layoutTable(container);
  }
  resetRowMinSize(data.rowHeights);
  initRowMinSize(children);
  initRowMergeMinsize(children);
  caleRowData();
  if (!isCalculating) {
    layoutTable(container);
  }
  setConstraint(container,data);
  needlayout=false;
  if (isCalculating) {
  }
  int containerWidth=getOwner().getFigure().getParent().getClientArea().getSize().width;
  if (containerWidth < 0) {
    Display.getCurrent().asyncExec(new Runnable(){
      public void run(){
        if (isNeedRelayout) {
          getOwner().reLayout();
          isNeedRelayout=false;
        }
      }
    }
);
    return;
  }
  reselect();
}

Fixed version (ground truth):
public void layout(IFigure container){
  if (!isDistroy()) {
    return;
  }
{
    helper=new TableBorderHelper(owner);
    helper.updateCellBorderInsets();
  }
  figureInfo.clear();
  data=new WorkingData();
  data.columnWidths=new TableLayoutData.ColumnData[getColumnCount()];
  data.rowHeights=new TableLayoutData.RowData[getRowCount()];
  init(data.columnWidths,data.rowHeights);
  List children=container.getChildren();
  initMinSize(children);
  initMergeMinsize(children);
  caleLayoutData(container);
  if (!isCalculating) {
    layoutTable(container);
  }
  resetRowMinSize(data.rowHeights);
  initRowMinSize(children);
  initRowMergeMinsize(children);
  caleRowData();
  if (!isCalculating) {
    layoutTable(container);
  }
  setConstraint(container,data);
  needlayout=false;
  if (isCalculating) {
  }
  int containerWidth=getOwner().getFigure().getParent().getClientArea().getSize().width;
  if (containerWidth < 0) {
    Display.getCurrent().asyncExec(new Runnable(){
      public void run(){
        if (isNeedRelayout) {
          getOwner().reLayout();
          isNeedRelayout=false;
        }
      }
    }
);
    return;
  }
  reselect();
}
Program: 69690
Project: 69690
Buggy source:
private void preview(String uri){
  try {
    if (imageData != null) {
      ByteArrayInputStream bis=new ByteArrayInputStream(Base64.decodeBase64(imageData.getBytes()));
      previewCanvas.loadImage(bis);
    }
 else {
      previewCanvas.loadImage(new URL(uri));
    }
  }
 catch (  Exception e) {
    logger.log(e);
  }
}

Fixed version (ground truth):
private void preview(String uri){
  try {
    previewCanvas.loadImage(new URL(uri));
  }
 catch (  Exception e) {
    logger.log(e);
  }
}
Program: 69691
Project: 69691
Buggy source:
/** 
 * @throws DataException
 */
protected void createAccumulators() throws DataException {
  AggregationFunctionDefinition[] aggregationFunctions=aggregation.getAggregationFunctions();
  if (aggregationFunctions != null) {
    this.accumulators=new Accumulator[aggregationFunctions.length];
    for (int i=0; i < aggregationFunctions.length; i++) {
      IAggrFunction aggregationFunc=AggregationManager.getInstance().getAggregation(aggregationFunctions[i].getFunctionName());
      if (aggregation == null) {
        throw new DataException(DataResourceHandle.getInstance().getMessage(ResourceConstants.UNSUPPORTED_FUNCTION) + aggregationFunctions[i].getFunctionName());
      }
      this.accumulators[i]=aggregationFunc.newAccumulator();
      this.accumulators[i].start();
    }
  }
}

Fixed version (ground truth):
/** 
 * @throws DataException
 */
protected void createAccumulators() throws DataException {
  AggregationFunctionDefinition[] aggregationFunctions=aggregation.getAggregationFunctions();
  if (aggregationFunctions != null) {
    this.accumulators=new Accumulator[aggregationFunctions.length];
    for (int i=0; i < aggregationFunctions.length; i++) {
      IAggrFunction aggregationFunc=AggregationManager.getInstance().getAggregation(aggregationFunctions[i].getFunctionName());
      if (aggregationFunc == null) {
        throw new DataException(DataResourceHandle.getInstance().getMessage(ResourceConstants.UNSUPPORTED_FUNCTION) + aggregationFunctions[i].getFunctionName());
      }
      this.accumulators[i]=aggregationFunc.newAccumulator();
      this.accumulators[i].start();
    }
  }
}
Program: 69692
Project: 69692
Buggy source:
public boolean preHandleMouseUp(){
  if (getRequest().getNewObjectType() instanceof ScalarParameterHandle) {
    try {
      Object newObj=getRequest().getNewObject();
      if (newObj instanceof Object[]) {
        Object[] newObjs=(Object[])newObj;
        Object[] insertedObjs=new Object[newObjs.length];
        for (int i=0; i < newObjs.length; i++) {
          DesignElementHandle elementHandle=(DesignElementHandle)newObjs[i];
          if (elementHandle.getRoot() instanceof LibraryHandle) {
            ModuleHandle moduleHandle=SessionHandleAdapter.getInstance().getReportDesignHandle();
            LibraryHandle library=(LibraryHandle)elementHandle.getRoot();
            if (moduleHandle != library) {
              try {
                if (UIUtil.includeLibrary(moduleHandle,library)) {
                  elementHandle=moduleHandle.getElementFactory().newElementFrom(elementHandle,elementHandle.getName());
                  moduleHandle.addElement(elementHandle,ModuleHandle.PARAMETER_SLOT);
                  insertedObjs[i]=elementHandle;
                  continue;
                }
              }
 catch (              Exception e) {
                ExceptionHandler.handle(e);
              }
            }
          }
          insertedObjs[i]=newObjs[i];
        }
        newObj=insertedObjs;
      }
      Object newHandle=InsertInLayoutUtil.performInsert(newObj,getTargetEditPart());
      if (newHandle == null)       return false;
      setModel(newHandle);
      return super.preHandleMouseUp();
    }
 catch (    SemanticException e) {
      ExceptionHandler.handle(e);
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean preHandleMouseUp(){
  if (getRequest().getNewObjectType() instanceof ScalarParameterHandle) {
    try {
      Object newObj=getRequest().getNewObject();
      if (newObj instanceof Object[]) {
        Object[] newObjs=(Object[])newObj;
        newObj=UIUtil.getInsertPamaterElements(newObjs);
      }
      Object newHandle=InsertInLayoutUtil.performInsert(newObj,getTargetEditPart());
      if (newHandle == null)       return false;
      setModel(newHandle);
      return super.preHandleMouseUp();
    }
 catch (    SemanticException e) {
      ExceptionHandler.handle(e);
    }
  }
  return false;
}
Program: 69693
Project: 69693
Buggy source:
protected void updateRelatedViews(){
  updatePaletteView(getCurrentPageInstance());
  updateOutLineView(getCurrentPageInstance());
  updateDateView(getCurrentPageInstance());
}

Fixed version (ground truth):
public void updateRelatedViews(){
  updatePaletteView(getCurrentPageInstance());
  updateOutLineView(getCurrentPageInstance());
  updateDateView(getCurrentPageInstance());
}
Program: 69694
Project: 69694
Buggy source:
private void setAllInput(FileEditorInput input){
  if (pages == null) {
    return;
  }
  setInput(input);
  if (getEditorInput() != null) {
    setPartName(getEditorInput().getName());
    firePropertyChange(IWorkbenchPartConstants.PROP_PART_NAME);
    firePropertyChange(IWorkbenchPartConstants.PROP_PART_NAME);
    getProvider().getReportModuleHandle(getEditorInput()).setFileName(getProvider().getInputPath(getEditorInput()).toOSString());
  }
  for (Iterator it=pages.iterator(); it.hasNext(); ) {
    Object page=it.next();
    if (page instanceof IReportEditorPage) {
      ((IReportEditorPage)page).setInput(input);
    }
  }
}

Fixed version (ground truth):
private void setAllInput(FileEditorInput input){
  if (pages == null) {
    return;
  }
  setInput(input);
  if (getEditorInput() != null) {
    setPartName(getEditorInput().getName());
    firePropertyChange(IWorkbenchPartConstants.PROP_PART_NAME);
    firePropertyChange(IWorkbenchPartConstants.PROP_PART_NAME);
    getProvider().getReportModuleHandle(getEditorInput()).setFileName(getProvider().getInputPath(getEditorInput()).toOSString());
  }
  for (Iterator it=pages.iterator(); it.hasNext(); ) {
    Object page=it.next();
    if (page instanceof IReportEditorPage) {
      ((IReportEditorPage)page).setInput(input);
    }
  }
  updateRelatedViews();
}
Program: 69695
Project: 69695
Buggy source:
/** 
 * This method is used for back-forward compatible. For the new DTE api store the original ComputedColumnHandle expression as a parameter value now, we should retrive expression value from ComputedColumnHandle's expression(old) or argument value.
 * @param bindingColumn
 * @return
 */
public static String getAggregationExpression(ComputedColumnHandle bindingColumn){
  if (bindingColumn.getExpression() != null)   return bindingColumn.getExpression();
  String functionName=bindingColumn.getAggregateFunction();
  try {
    IAggrFunction function=getAggregationManager().getAggregation(functionName);
    for (    IParameterDefn param : function.getParameterDefn()) {
      if (param.isDataField()) {
        for (Iterator iterator=bindingColumn.argumentsIterator(); iterator.hasNext(); ) {
          AggregationArgumentHandle arg=(AggregationArgumentHandle)iterator.next();
          if (DataAdapterUtil.adaptArgumentName(arg.getName()).equals(param.getName())) {
            return arg.getValue();
          }
        }
      }
    }
  }
 catch (  BirtException e) {
  }
  return null;
}

Fixed version (ground truth):
/** 
 * This method is used for back-forward compatible. For the new DTE api store the original ComputedColumnHandle expression as a parameter value now, we should retrive expression value from ComputedColumnHandle's expression(old) or argument value.
 * @param bindingColumn
 * @return
 */
public static String getAggregationExpression(ComputedColumnHandle bindingColumn){
  if (bindingColumn.getExpression() != null)   return bindingColumn.getExpression();
  String functionName=bindingColumn.getAggregateFunction();
  try {
    IAggrFunction function=getAggregationManager().getAggregation(DataAdapterUtil.adaptModelAggregationType(functionName));
    for (    IParameterDefn param : function.getParameterDefn()) {
      if (param.isDataField()) {
        for (Iterator iterator=bindingColumn.argumentsIterator(); iterator.hasNext(); ) {
          AggregationArgumentHandle arg=(AggregationArgumentHandle)iterator.next();
          if (DataAdapterUtil.adaptArgumentName(arg.getName()).equals(param.getName())) {
            return arg.getValue();
          }
        }
      }
    }
  }
 catch (  BirtException e) {
  }
  return null;
}
Program: 69696
Project: 69696
Buggy source:
protected static DataItemHandle performInsertParameter(ScalarParameterHandle model) throws SemanticException {
  DataItemHandle dataHandle=DesignElementFactory.getInstance().newDataItem(null);
  ComputedColumn bindingColumn=StructureFactory.newComputedColumn(dataHandle,model.getName());
  bindingColumn.setExpression(DEUtil.getExpression(model));
  String paramType=model.getDataType();
  if (DesignChoiceConstants.PARAM_TYPE_DATETIME.equals(paramType))   paramType=DesignChoiceConstants.COLUMN_DATA_TYPE_DATETIME;
  bindingColumn.setDataType(paramType);
  dataHandle.addColumnBinding(bindingColumn,false);
  dataHandle.setResultSetColumn(bindingColumn.getName());
  return dataHandle;
}

Fixed version (ground truth):
public static DataItemHandle performInsertParameter(ScalarParameterHandle model) throws SemanticException {
  DataItemHandle dataHandle=DesignElementFactory.getInstance().newDataItem(null);
  ComputedColumn bindingColumn=StructureFactory.newComputedColumn(dataHandle,model.getName());
  bindingColumn.setExpression(DEUtil.getExpression(model));
  String paramType=model.getDataType();
  if (DesignChoiceConstants.PARAM_TYPE_DATETIME.equals(paramType))   paramType=DesignChoiceConstants.COLUMN_DATA_TYPE_DATETIME;
  bindingColumn.setDataType(paramType);
  dataHandle.addColumnBinding(bindingColumn,false);
  dataHandle.setResultSetColumn(bindingColumn.getName());
  return dataHandle;
}
Program: 69697
Project: 69697
Buggy source:
public void refreshFigure(){
  refreshBorder((DesignElementHandle)getModel(),new LineBorder());
  Insets pist=getImageAdapter().getPadding(getFigure().getInsets());
  ((LineBorder)(getFigure().getBorder())).setPaddingInsets(pist);
  Image image=null;
  try {
    image=getImageAdapter().getImage();
  }
 catch (  SWTException e) {
  }
  ((ImageFigure)this.getFigure()).setStretched(image != null);
  if (image == null) {
    image=ReportPlatformUIImages.getImage(IReportGraphicConstants.ICON_MISSING_IMG);
  }
  ((ImageFigure)this.getFigure()).setImage(image);
  if (getImageAdapter().getSize() != null) {
    this.getFigure().setSize(getImageAdapter().getSize());
  }
 else   if (image != null) {
    Dimension rawSize=getImageAdapter().getRawSize();
    if (rawSize.height == 0 && rawSize.width == 0) {
      this.getFigure().setSize(new Dimension(image.getBounds().width,image.getBounds().height));
    }
 else     if (rawSize.height == 0) {
      this.getFigure().setSize(new Dimension(rawSize.width,image.getBounds().height));
    }
 else {
      this.getFigure().setSize(new Dimension(image.getBounds().width,rawSize.height));
    }
  }
  refreshBackgroundColor((DesignElementHandle)getModel());
  refreshMargin();
  ((AbstractGraphicalEditPart)getParent()).setLayoutConstraint(this,getFigure(),getConstraint());
}

Fixed version (ground truth):
public void refreshFigure(){
  refreshBorder((DesignElementHandle)getModel(),new LineBorder());
  Insets pist=getImageAdapter().getPadding(getFigure().getInsets());
  ((LineBorder)(getFigure().getBorder())).setPaddingInsets(pist);
  Image image=null;
  try {
    image=getImageAdapter().getImage();
  }
 catch (  SWTException e) {
  }
  ((ImageFigure)this.getFigure()).setStretched(image != null);
  if (image == null) {
    image=ReportPlatformUIImages.getImage(IReportGraphicConstants.ICON_MISSING_IMG);
  }
  ((ImageFigure)this.getFigure()).setImage(image);
  if (getImageAdapter().getSize() != null) {
    this.getFigure().setSize(getImageAdapter().getSize());
  }
 else   if (image != null) {
    Dimension rawSize=getImageAdapter().getRawSize();
    if (rawSize.height == 0 && rawSize.width == 0) {
      this.getFigure().setSize(new Dimension(image.getBounds().width,image.getBounds().height));
    }
 else     if (rawSize.height == 0) {
      this.getFigure().setSize(new Dimension(rawSize.width,(int)(image.getBounds().height * ((double)rawSize.width / image.getBounds().width))));
    }
 else {
      this.getFigure().setSize(new Dimension((int)(image.getBounds().width * ((double)rawSize.height / image.getBounds().height)),rawSize.height));
    }
  }
  refreshBackgroundColor((DesignElementHandle)getModel());
  refreshMargin();
  ((AbstractGraphicalEditPart)getParent()).setLayoutConstraint(this,getFigure(),getConstraint());
}
Program: 69698
Project: 69698
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());
  refreshMarginBorder(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());
  ((ReportElementFigure)getFigure()).setBackGroundImageSize(getModelAdapter().getBackgroundImageWidth((MasterPageHandle)getModel()),getModelAdapter().getBackgroundImageHeight((MasterPageHandle)getModel()));
}
Program: 69699
Project: 69699
Buggy source:
public void refreshFigure(){
  SimpleMasterPageHandle masterPageHandle=getSimpleMasterPageHandle();
  Dimension size=getMasterPageSize(masterPageHandle);
  Rectangle bounds=new Rectangle(0,0,size.width - 1,size.height - 1);
  ReportRootFigure figure=(ReportRootFigure)getFigure();
  figure.setShowMargin(showMargin);
  ((ReportDesignLayout)(figure.getLayoutManager())).setAuto(DesignChoiceConstants.REPORT_LAYOUT_PREFERENCE_AUTO_LAYOUT.equals(((ReportDesignHandle)getModel()).getLayoutPreference()));
  ((ReportDesignLayout)(figure.getLayoutManager())).setAuto(DesignChoiceConstants.BIDI_DIRECTION_LTR.equals(((ReportDesignHandle)getModel()).getBidiOrientation()));
  if (!showMargin) {
    Insets mg=getMasterPageInsets(masterPageHandle);
    bounds.width-=mg.getWidth();
    bounds.height-=mg.getHeight();
  }
  Insets initInsets=getMasterPageInsets(masterPageHandle);
  ((AbstractPageFlowLayout)getFigure().getLayoutManager()).setInitSize(bounds);
  ((AbstractPageFlowLayout)getFigure().getLayoutManager()).setInitInsets(initInsets);
  refreshMarginBorder((ReportDesignMarginBorder)getFigure().getBorder());
  int color=getBackgroundColor(masterPageHandle);
  getFigure().setBackgroundColor(getBackGroundColor(color));
  refreshBackground(masterPageHandle);
}

Fixed version (ground truth):
public void refreshFigure(){
  SimpleMasterPageHandle masterPageHandle=getSimpleMasterPageHandle();
  Dimension size=getMasterPageSize(masterPageHandle);
  Rectangle bounds=new Rectangle(0,0,size.width - 1,size.height - 1);
  ReportRootFigure figure=(ReportRootFigure)getFigure();
  figure.setShowMargin(showMargin);
  ((ReportDesignLayout)(figure.getLayoutManager())).setAuto(DesignChoiceConstants.REPORT_LAYOUT_PREFERENCE_AUTO_LAYOUT.equals(((ReportDesignHandle)getModel()).getLayoutPreference()));
  ((ReportDesignLayout)(figure.getLayoutManager())).setAuto(DesignChoiceConstants.BIDI_DIRECTION_LTR.equals(((ReportDesignHandle)getModel()).getBidiOrientation()));
  if (!showMargin) {
    Insets mg=getMasterPageInsets(masterPageHandle);
    bounds.width-=mg.getWidth();
    bounds.height-=mg.getHeight();
  }
  Insets initInsets=getMasterPageInsets(masterPageHandle);
  ((AbstractPageFlowLayout)getFigure().getLayoutManager()).setInitSize(bounds);
  ((AbstractPageFlowLayout)getFigure().getLayoutManager()).setInitInsets(initInsets);
  refreshMarginBorder((ReportDesignMarginBorder)getFigure().getBorder());
  int color=getBackgroundColor(masterPageHandle);
  getFigure().setBackgroundColor(getBackGroundColor(color));
  refreshBackground(masterPageHandle);
  ((ReportElementFigure)getFigure()).setBackGroundImageSize(getModelAdapter().getBackgroundImageWidth(masterPageHandle),getModelAdapter().getBackgroundImageHeight(masterPageHandle));
}
Program: 69700
Project: 69700
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());
    }
  }
  Image image=getImage();
  if (image == null) {
    return;
  }
  int x, y;
  Rectangle area=getBounds();
  graphics.getClip(PRIVATE_RECT);
  if (position != null && position.x != -1) {
    x=area.x + position.x;
  }
 else {
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;
}
}
if (position != null && position.y != -1) {
y=area.y + position.y;
}
 else {
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;
}
}
ArrayList xyList=createImageList(x,y);
Iterator iter=xyList.iterator();
while (iter.hasNext()) {
Point point=(Point)iter.next();
graphics.drawImage(image,point);
}
xyList.clear();
graphics.setClip(PRIVATE_RECT);
}

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());
    }
  }
  Image image=getImage();
  if (image == null) {
    return;
  }
  int x, y;
  Rectangle area=getBounds();
  graphics.getClip(PRIVATE_RECT);
  if (position != null && position.x != -1) {
    x=area.x + position.x;
  }
 else {
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;
}
}
if (position != null && position.y != -1) {
y=area.y + position.y;
}
 else {
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;
}
}
ArrayList xyList=createImageList(x,y);
Iterator iter=xyList.iterator();
Dimension imageSize=new Rectangle(image.getBounds()).getSize();
while (iter.hasNext()) {
Point point=(Point)iter.next();
graphics.drawImage(image,0,0,imageSize.width,imageSize.height,point.x,point.y,size.width,size.height);
}
xyList.clear();
graphics.setClip(PRIVATE_RECT);
}
Program: 69701
Project: 69701
Buggy source:
/** 
 * Set the sort conditions
 * @param sortKeys
 * @param sortOrderings
 */
void setSortCondition(Object[] sortKeys,boolean[] sortOrderings,int[] sortStrength){
  this.sortKeys=sortKeys;
  this.sortDirections=sortOrderings;
  this.comparator=new Collator[this.sortKeys.length];
  for (int i=0; i < this.comparator.length; i++) {
    this.comparator[i]=sortStrength[i] == ISortDefinition.ASCII_SORT_STRENGTH ? null : Collator.getInstance();
  }
}

Fixed version (ground truth):
/** 
 * Set the sort conditions
 * @param sortKeys
 * @param sortOrderings
 */
void setSortCondition(Object[] sortKeys,boolean[] sortOrderings,int[] sortStrength,ULocale[] sortLocale){
  this.sortKeys=sortKeys;
  this.sortDirections=sortOrderings;
  this.comparator=new Collator[this.sortKeys.length];
  for (int i=0; i < this.comparator.length; i++) {
    this.comparator[i]=sortStrength[i] == ISortDefinition.ASCII_SORT_STRENGTH ? null : Collator.getInstance(sortLocale[i]);
  }
}
Program: 69702
Project: 69702
Buggy source:
public Object[] getFieldValues(){
  ArrayList fields=new ArrayList();
  fields.add(new Integer(startIndex));
  fields.add(new Integer(endIndex));
  if (sortKeys != null) {
    fields.add(new Integer(sortKeys.length));
    for (int i=0; i < sortKeys.length; i++)     fields.add(sortKeys[i]);
  }
 else {
    fields.add(null);
  }
  if (sortDirections != null) {
    fields.add(new Integer(sortDirections.length));
    for (int i=0; i < sortDirections.length; i++)     fields.add(new Boolean(sortDirections[i]));
  }
 else {
    fields.add(null);
  }
  if (this.comparator != null) {
    fields.add(new Integer(comparator.length));
    for (int i=0; i < comparator.length; i++)     fields.add(comparator[i] == null ? ISortDefinition.ASCII_SORT_STRENGTH : new Integer(comparator[i].getStrength()));
  }
 else {
    fields.add(null);
  }
  fields.add(new Boolean(accept));
  return fields.toArray();
}

Fixed version (ground truth):
public Object[] getFieldValues(){
  ArrayList fields=new ArrayList();
  fields.add(new Integer(startIndex));
  fields.add(new Integer(endIndex));
  if (sortKeys != null) {
    fields.add(new Integer(sortKeys.length));
    for (int i=0; i < sortKeys.length; i++)     fields.add(sortKeys[i]);
  }
 else {
    fields.add(null);
  }
  if (sortDirections != null) {
    fields.add(new Integer(sortDirections.length));
    for (int i=0; i < sortDirections.length; i++)     fields.add(new Boolean(sortDirections[i]));
  }
 else {
    fields.add(null);
  }
  if (this.comparator != null) {
    fields.add(new Integer(comparator.length));
    for (int i=0; i < comparator.length; i++)     fields.add(comparator[i] == null ? ISortDefinition.ASCII_SORT_STRENGTH : new Integer(comparator[i].getStrength()));
    for (int i=0; i < comparator.length; i++)     fields.add(comparator[i] == null ? null : comparator[i].getLocale(ULocale.ACTUAL_LOCALE).getBaseName());
  }
 else {
    fields.add(null);
    fields.add(null);
  }
  fields.add(new Boolean(accept));
  return fields.toArray();
}
Program: 69703
Project: 69703
Buggy source:
public ICachedObject createInstance(Object[] fields){
  GroupBoundaryInfo groupBoundaryInfo=new GroupBoundaryInfo(((Integer)fields[0]).intValue(),((Integer)fields[1]).intValue());
  Object[] sortKeys=null;
  int sortKeysTotalLength=1;
  if (fields[2] != null) {
    sortKeys=new Object[((Integer)fields[2]).intValue()];
    System.arraycopy(fields,3,sortKeys,0,sortKeys.length);
    sortKeysTotalLength=sortKeys.length + 1;
  }
  boolean[] sortDirections=null;
  if (fields[2 + sortKeysTotalLength] != null) {
    sortDirections=new boolean[((Integer)fields[2 + sortKeysTotalLength]).intValue()];
    for (int i=0; i < sortDirections.length; i++) {
      sortDirections[i]=((Boolean)fields[3 + sortKeysTotalLength + i]).booleanValue();
    }
  }
  int[] sortStrength=null;
  if (fields[2 + sortKeysTotalLength * 2] != null) {
    sortStrength=new int[((Integer)fields[2 + sortKeysTotalLength * 2]).intValue()];
    for (int i=0; i < sortStrength.length; i++) {
      sortStrength[i]=((Integer)fields[3 + sortKeysTotalLength * 2 + i]).intValue();
    }
  }
  groupBoundaryInfo.setSortCondition(sortKeys,sortDirections,sortStrength);
  groupBoundaryInfo.setAccepted(((Boolean)fields[fields.length - 1]).booleanValue());
  return groupBoundaryInfo;
}

Fixed version (ground truth):
public ICachedObject createInstance(Object[] fields){
  GroupBoundaryInfo groupBoundaryInfo=new GroupBoundaryInfo(((Integer)fields[0]).intValue(),((Integer)fields[1]).intValue());
  Object[] sortKeys=null;
  int sortKeysTotalLength=1;
  if (fields[2] != null) {
    sortKeys=new Object[((Integer)fields[2]).intValue()];
    System.arraycopy(fields,3,sortKeys,0,sortKeys.length);
    sortKeysTotalLength=sortKeys.length + 1;
  }
  boolean[] sortDirections=null;
  if (fields[2 + sortKeysTotalLength] != null) {
    sortDirections=new boolean[((Integer)fields[2 + sortKeysTotalLength]).intValue()];
    for (int i=0; i < sortDirections.length; i++) {
      sortDirections[i]=((Boolean)fields[3 + sortKeysTotalLength + i]).booleanValue();
    }
  }
  int[] sortStrength=null;
  if (fields[2 + sortKeysTotalLength * 2] != null) {
    sortStrength=new int[((Integer)fields[2 + sortKeysTotalLength * 2]).intValue()];
    for (int i=0; i < sortStrength.length; i++) {
      sortStrength[i]=((Integer)fields[3 + sortKeysTotalLength * 2 + i]).intValue();
    }
  }
  ULocale[] locales=null;
  if (fields[2 + sortKeysTotalLength * 3] != null) {
    locales=new ULocale[((Integer)fields[2 + sortKeysTotalLength * 3]).intValue()];
    for (int i=0; i < sortStrength.length; i++) {
      Object locale=fields[3 + sortKeysTotalLength * 3 + i];
      if (locale != null)       locales[i]=new ULocale((String)locale);
    }
  }
  groupBoundaryInfo.setSortCondition(sortKeys,sortDirections,sortStrength,locales);
  groupBoundaryInfo.setAccepted(((Boolean)fields[fields.length - 1]).booleanValue());
  return groupBoundaryInfo;
}
Program: 69704
Project: 69704
Buggy source:
/** 
 * Add sort infos to GroupBoundaryInfo in groupArray.
 * @param cx
 * @param groupArray
 * @param groupPosition groupPosition = groupLevel - 1; it is 0-based;
 * @param groupIndex
 * @throws DataException
 */
private void populateGroupBoundaryInfoSortings(ScriptContext cx,List[] groupArray,int groupPosition,int groupIndex) throws DataException {
  Object[] sortKeys=new Object[this.populator.getQuery().getGrouping()[groupPosition].getSorts().size()];
  boolean[] sortDirections=new boolean[sortKeys.length];
  int[] sortStrength=new int[sortKeys.length];
  this.populator.getResultIterator().last(groupPosition + 1);
  for (int l=0; l < sortKeys.length; l++) {
    sortKeys[l]=ScriptEvalUtil.evalExpr(((ISortDefinition)this.populator.getQuery().getGrouping()[groupPosition].getSorts().get(l)).getExpression(),cx,this.groupProcessor.getExpressionProcessor().getScope(),ScriptExpression.defaultID,0);
    sortDirections[l]=((ISortDefinition)this.populator.getQuery().getGrouping()[groupPosition].getSorts().get(l)).getSortDirection() == ISortDefinition.SORT_ASC ? true : false;
    sortStrength[l]=((ISortDefinition)this.populator.getQuery().getGrouping()[groupPosition].getSorts().get(l)).getSortStrength();
  }
  ((GroupBoundaryInfo)groupArray[groupPosition].get(groupIndex)).setSortCondition(sortKeys,sortDirections,sortStrength);
  this.populator.getResultIterator().next();
}

Fixed version (ground truth):
/** 
 * Add sort infos to GroupBoundaryInfo in groupArray.
 * @param cx
 * @param groupArray
 * @param groupPosition groupPosition = groupLevel - 1; it is 0-based;
 * @param groupIndex
 * @throws DataException
 */
private void populateGroupBoundaryInfoSortings(ScriptContext cx,List[] groupArray,int groupPosition,int groupIndex) throws DataException {
  Object[] sortKeys=new Object[this.populator.getQuery().getGrouping()[groupPosition].getSorts().size()];
  boolean[] sortDirections=new boolean[sortKeys.length];
  int[] sortStrength=new int[sortKeys.length];
  ULocale[] sortLocale=new ULocale[sortKeys.length];
  this.populator.getResultIterator().last(groupPosition + 1);
  for (int l=0; l < sortKeys.length; l++) {
    sortKeys[l]=ScriptEvalUtil.evalExpr(((ISortDefinition)this.populator.getQuery().getGrouping()[groupPosition].getSorts().get(l)).getExpression(),cx,this.groupProcessor.getExpressionProcessor().getScope(),ScriptExpression.defaultID,0);
    sortDirections[l]=((ISortDefinition)this.populator.getQuery().getGrouping()[groupPosition].getSorts().get(l)).getSortDirection() == ISortDefinition.SORT_ASC ? true : false;
    sortStrength[l]=((ISortDefinition)this.populator.getQuery().getGrouping()[groupPosition].getSorts().get(l)).getSortStrength();
    ULocale locale=((ISortDefinition)this.populator.getQuery().getGrouping()[groupPosition].getSorts().get(l)).getSortLocale();
    if (locale == null)     locale=populator.getSession().getEngineContext().getLocale();
    sortLocale[l]=locale;
  }
  ((GroupBoundaryInfo)groupArray[groupPosition].get(groupIndex)).setSortCondition(sortKeys,sortDirections,sortStrength,sortLocale);
  this.populator.getResultIterator().next();
}
Program: 69705
Project: 69705
Buggy source:
private static String toString_SortDefinition(Object source){
  SortDefinition sort=(SortDefinition)source;
  StringBuffer stringBuffer=new StringBuffer("String_Node_Str");
  if (!isEmpty(sort.getColumn()))   stringBuffer.append("String_Node_Str" + sort.getColumn() + "String_Node_Str");
  if (!isEmpty(sort.getExpression()))   stringBuffer.append("String_Node_Str" + sort.getExpression() + "String_Node_Str");
  stringBuffer.append("String_Node_Str" + sort.getSortDirection() + "String_Node_Str");
  stringBuffer.append("String_Node_Str" + sort.getSortStrength() + "String_Node_Str");
  return stringBuffer.toString();
}

Fixed version (ground truth):
private static String toString_SortDefinition(Object source){
  SortDefinition sort=(SortDefinition)source;
  StringBuffer stringBuffer=new StringBuffer("String_Node_Str");
  if (!isEmpty(sort.getColumn()))   stringBuffer.append("String_Node_Str" + sort.getColumn() + "String_Node_Str");
  if (!isEmpty(sort.getExpression()))   stringBuffer.append("String_Node_Str" + sort.getExpression() + "String_Node_Str");
  stringBuffer.append("String_Node_Str" + sort.getSortDirection() + "String_Node_Str");
  stringBuffer.append("String_Node_Str" + sort.getSortStrength() + "String_Node_Str");
  stringBuffer.append("String_Node_Str" + sort.getSortLocale() + "String_Node_Str");
  return stringBuffer.toString();
}
Program: 69706
Project: 69706
Buggy source:
/** 
 * Populate the sortings in a query.
 * @throws DataException
 */
private void populateSorting() throws DataException {
  List sorts=this.baseQueryDefn.getSorts();
  if (sorts != null && !sorts.isEmpty()) {
    IQuery.SortSpec[] sortSpecs=new IQuery.SortSpec[sorts.size()];
    Iterator it=sorts.iterator();
    for (int i=0; it.hasNext(); i++) {
      ISortDefinition src=(ISortDefinition)it.next();
      int sortIndex=-1;
      String sortKey=src.getColumn();
      if (sortKey == null)       sortKey=src.getExpression().getText();
 else {
        sortKey=getColumnRefExpression(sortKey);
      }
      temporaryComputedColumns.add(new ComputedColumn("String_Node_Str" + i + "String_Node_Str",sortKey,getExpressionDataType(sortKey)));
      sortIndex=-1;
      sortKey=String.valueOf("String_Node_Str" + i + "String_Node_Str");
      IQuery.SortSpec dest=new IQuery.SortSpec(sortIndex,sortKey,src.getSortDirection() == ISortDefinition.SORT_ASC,src.getSortStrength() == -1 ? null : Collator.getInstance());
      sortSpecs[i]=dest;
    }
    odiQuery.setOrdering(Arrays.asList(sortSpecs));
  }
}

Fixed version (ground truth):
/** 
 * Populate the sortings in a query.
 * @throws DataException
 */
private void populateSorting() throws DataException {
  List sorts=this.baseQueryDefn.getSorts();
  if (sorts != null && !sorts.isEmpty()) {
    IQuery.SortSpec[] sortSpecs=new IQuery.SortSpec[sorts.size()];
    Iterator it=sorts.iterator();
    for (int i=0; it.hasNext(); i++) {
      ISortDefinition src=(ISortDefinition)it.next();
      int sortIndex=-1;
      String sortKey=src.getColumn();
      if (sortKey == null)       sortKey=src.getExpression().getText();
 else {
        sortKey=getColumnRefExpression(sortKey);
      }
      temporaryComputedColumns.add(new ComputedColumn("String_Node_Str" + i + "String_Node_Str",sortKey,getExpressionDataType(sortKey)));
      sortIndex=-1;
      sortKey=String.valueOf("String_Node_Str" + i + "String_Node_Str");
      IQuery.SortSpec dest=new IQuery.SortSpec(sortIndex,sortKey,src.getSortDirection() == ISortDefinition.SORT_ASC,src.getSortStrength() == -1 ? null : Collator.getInstance(src.getSortLocale() == null ? session.getEngineContext().getLocale() : src.getSortLocale()));
      sortSpecs[i]=dest;
    }
    odiQuery.setOrdering(Arrays.asList(sortSpecs));
  }
}
Program: 69707
Project: 69707
Buggy source:
/** 
 * @param outputStream
 * @param sorts
 * @throws IOException 
 */
public static void saveSorts(OutputStream outputStream,List sorts,int version) throws IOException {
  DataOutputStream dos=new DataOutputStream(outputStream);
  if (sorts == null) {
    IOUtil.writeInt(dos,0);
  }
 else {
    IOUtil.writeInt(dos,sorts.size());
    Iterator it=sorts.iterator();
    while (it.hasNext()) {
      ISortDefinition sortDefn=(ISortDefinition)it.next();
      IOUtil.writeString(dos,sortDefn.getColumn());
      ExprUtil.saveBaseExpr(dos,sortDefn.getExpression());
      IOUtil.writeInt(dos,sortDefn.getSortDirection());
      if (version >= VersionManager.VERSION_2_3_1)       IOUtil.writeInt(dos,sortDefn.getSortStrength());
    }
  }
  dos.flush();
}

Fixed version (ground truth):
/** 
 * @param outputStream
 * @param sorts
 * @throws IOException 
 */
public static void saveSorts(OutputStream outputStream,List sorts,int version) throws IOException {
  DataOutputStream dos=new DataOutputStream(outputStream);
  if (sorts == null) {
    IOUtil.writeInt(dos,0);
  }
 else {
    IOUtil.writeInt(dos,sorts.size());
    Iterator it=sorts.iterator();
    while (it.hasNext()) {
      ISortDefinition sortDefn=(ISortDefinition)it.next();
      IOUtil.writeString(dos,sortDefn.getColumn());
      ExprUtil.saveBaseExpr(dos,sortDefn.getExpression());
      IOUtil.writeInt(dos,sortDefn.getSortDirection());
      if (version >= VersionManager.VERSION_2_3_1)       IOUtil.writeInt(dos,sortDefn.getSortStrength());
      if (version >= VersionManager.VERSION_2_5_0_1)       IOUtil.writeString(dos,sortDefn.getSortLocale() == null ? null : sortDefn.getSortLocale().getBaseName());
    }
  }
  dos.flush();
}
Program: 69708
Project: 69708
Buggy source:
/** 
 * @param outputStream
 * @param sorts
 * @throws IOException
 */
public static List loadSorts(InputStream inputStream,int version) throws IOException {
  DataInputStream dis=new DataInputStream(inputStream);
  List sortList=new ArrayList();
  int size=IOUtil.readInt(dis);
  for (int i=0; i < size; i++) {
    String sortKeyColumn=IOUtil.readString(dis);
    IScriptExpression sortKeyExpr=(IScriptExpression)ExprUtil.loadBaseExpr(dis);
    int direction=IOUtil.readInt(dis);
    SortDefinition sortDefn=new SortDefinition();
    if (sortKeyColumn != null)     sortDefn.setColumn(sortKeyColumn);
 else     sortDefn.setExpression(sortKeyExpr.getText());
    sortDefn.setSortDirection(direction);
    if (version >= VersionManager.VERSION_2_3_1)     sortDefn.setSortStrength(IOUtil.readInt(dis));
    sortList.add(sortDefn);
  }
  return sortList;
}

Fixed version (ground truth):
/** 
 * @param outputStream
 * @param sorts
 * @throws IOException
 */
public static List loadSorts(InputStream inputStream,int version) throws IOException {
  DataInputStream dis=new DataInputStream(inputStream);
  List sortList=new ArrayList();
  int size=IOUtil.readInt(dis);
  for (int i=0; i < size; i++) {
    String sortKeyColumn=IOUtil.readString(dis);
    IScriptExpression sortKeyExpr=(IScriptExpression)ExprUtil.loadBaseExpr(dis);
    int direction=IOUtil.readInt(dis);
    SortDefinition sortDefn=new SortDefinition();
    if (sortKeyColumn != null)     sortDefn.setColumn(sortKeyColumn);
 else     sortDefn.setExpression(sortKeyExpr.getText());
    sortDefn.setSortDirection(direction);
    if (version >= VersionManager.VERSION_2_3_1)     sortDefn.setSortStrength(IOUtil.readInt(dis));
    if (version >= VersionManager.VERSION_2_5_0_1) {
      String locale=IOUtil.readString(dis);
      if (locale != null)       sortDefn.setSortLocale(new ULocale(locale));
    }
    sortList.add(sortDefn);
  }
  return sortList;
}
Program: 69709
Project: 69709
Buggy source:
/** 
 * @return
 */
public static int getLatestVersion(){
  return VERSION_2_3_2_1;
}

Fixed version (ground truth):
/** 
 * @return
 */
public static int getLatestVersion(){
  return VERSION_2_5_0_1;
}
Program: 69710
Project: 69710
Buggy source:
/** 
 * Creates a new sort based on model sort key definition
 */
public SortAdapter(SortKeyHandle keyHandle){
  this(keyHandle.getKey(),keyHandle.getDirection());
}

Fixed version (ground truth):
/** 
 * Creates a new sort based on model sort key definition
 */
public SortAdapter(SortKeyHandle keyHandle){
  this(keyHandle.getKey(),keyHandle.getDirection());
  this.setSortStrength(keyHandle.getStrength());
  if (keyHandle.getLocale() != null)   this.setSortLocale(keyHandle.getLocale());
}
Program: 69713
Project: 69713
Buggy source:
protected void buildLogicContainerProperties(IContent content,LayoutContext context){
  IStyle style=content.getStyle();
  if (style != null && !style.isEmpty()) {
    boxStyle=new BoxStyle();
    IStyle cs=content.getComputedStyle();
    Color color=PropertyUtil.getColor(cs.getProperty(IStyle.STYLE_BACKGROUND_COLOR));
    if (color != null) {
      boxStyle.setBackgroundColor(color);
    }
    String url=style.getBackgroundImage();
    if (url != null) {
      boxStyle.setBackgroundImage(new BackgroundImageInfo(getImageUrl(url),cs.getProperty(IStyle.STYLE_BACKGROUND_REPEAT),getDimensionValue(cs.getProperty(IStyle.STYLE_BACKGROUND_POSITION_X),100),getDimensionValue(cs.getProperty(IStyle.STYLE_BACKGROUND_POSITION_Y),100),0,0));
    }
    if (!isInInlineStacking) {
      pageBreakAfter=cs.getProperty(IStyle.STYLE_PAGE_BREAK_AFTER);
      pageBreakInside=cs.getProperty(IStyle.STYLE_PAGE_BREAK_INSIDE);
      pageBreakBefore=cs.getProperty(IStyle.STYLE_PAGE_BREAK_BEFORE);
    }
  }
 else {
    hasStyle=false;
    boxStyle=BoxStyle.DEFAULT;
    localProperties=LocalProperties.DEFAULT;
  }
  bookmark=content.getBookmark();
  action=content.getHyperlinkAction();
}

Fixed version (ground truth):
protected void buildLogicContainerProperties(IContent content,LayoutContext context){
  IStyle style=content.getStyle();
  if (style != null && !style.isEmpty()) {
    boxStyle=new BoxStyle();
    IStyle cs=content.getComputedStyle();
    Color color=PropertyUtil.getColor(cs.getProperty(IStyle.STYLE_BACKGROUND_COLOR));
    if (color != null) {
      boxStyle.setBackgroundColor(color);
    }
    String url=style.getBackgroundImage();
    if (url != null) {
      boxStyle.setBackgroundImage(new BackgroundImageInfo(getImageUrl(url),cs.getProperty(IStyle.STYLE_BACKGROUND_REPEAT),0,0,0,0));
    }
    if (!isInInlineStacking) {
      pageBreakAfter=cs.getProperty(IStyle.STYLE_PAGE_BREAK_AFTER);
      pageBreakInside=cs.getProperty(IStyle.STYLE_PAGE_BREAK_INSIDE);
      pageBreakBefore=cs.getProperty(IStyle.STYLE_PAGE_BREAK_BEFORE);
    }
  }
 else {
    hasStyle=false;
    boxStyle=BoxStyle.DEFAULT;
    localProperties=LocalProperties.DEFAULT;
  }
  bookmark=content.getBookmark();
  action=content.getHyperlinkAction();
}