nus-yam/ex-repair huggingface dataset:
Program: 75534
Project: 75534
Buggy source:
public List getScriptNodes(ReportDesignHandle handle){
  apply(handle);
  return scriptNodes;
}

Fixed version (ground truth):
public List getScriptNodes(ReportDesignHandle handle){
  scriptNodes.clear();
  apply(handle);
  return scriptNodes;
}
Program: 75535
Project: 75535
Buggy source:
public List getScriptNodes(DesignElementHandle elementHandle){
  List scriptMethods=elementHandle.getMethods();
  for (Iterator ite=scriptMethods.iterator(); ite.hasNext(); ) {
    IElementPropertyDefn elementPropDefn=(IElementPropertyDefn)ite.next();
    String methodName=elementPropDefn.getMethodInfo().getName();
    if (elementHandle.getStringProperty(methodName) != null) {
      ScriptObjectNode scriptElementNode=new ScriptObjectNode(elementPropDefn);
      scriptNodes.add(scriptElementNode);
    }
  }
  return scriptNodes;
}

Fixed version (ground truth):
public List getScriptNodes(DesignElementHandle elementHandle){
  List scriptNodes=new ArrayList();
  List scriptMethods=elementHandle.getMethods();
  if (scriptMethods != null) {
    for (Iterator ite=scriptMethods.iterator(); ite.hasNext(); ) {
      IElementPropertyDefn elementPropDefn=(IElementPropertyDefn)ite.next();
      String methodName=elementPropDefn.getMethodInfo().getName();
      if (elementHandle.getStringProperty(methodName) != null) {
        ScriptObjectNode scriptElementNode=new ScriptObjectNode(elementPropDefn);
        scriptNodes.add(scriptElementNode);
      }
    }
  }
  return scriptNodes;
}
Program: 75536
Project: 75536
Buggy source:
private void exportImageHeader(String imageURI) throws IOException {
  pptOutput.write("String_Node_Str".getBytes());
  pptOutput.write("String_Node_Str".getBytes());
  pptOutput.write(("String_Node_Str" + (String)imageNames.get(imageURI) + "String_Node_Str").getBytes());
  pptOutput.write("String_Node_Str".getBytes());
  pptOutput.write(("String_Node_Str" + (String)imageExtensions.get(imageURI) + "String_Node_Str").getBytes());
}

Fixed version (ground truth):
private void exportImageHeader(String imagekey) throws IOException {
  pptOutput.write("String_Node_Str".getBytes());
  pptOutput.write("String_Node_Str".getBytes());
  pptOutput.write(("String_Node_Str" + (String)imageNames.get(imagekey) + "String_Node_Str").getBytes());
  pptOutput.write("String_Node_Str".getBytes());
  pptOutput.write(("String_Node_Str" + (String)imageExtensions.get(imagekey) + "String_Node_Str").getBytes());
}
Program: 75539
Project: 75539
Buggy source:
public void clipSave(){
  contentByte.saveState();
}

Fixed version (ground truth):
public void clipSave(){
  cbUnder.saveState();
  contentByte.saveState();
}
Program: 75540
Project: 75540
Buggy source:
public void clipRestore(){
  contentByte.restoreState();
}

Fixed version (ground truth):
public void clipRestore(){
  cbUnder.restoreState();
  contentByte.restoreState();
}
Program: 75541
Project: 75541
Buggy source:
private void clip(float startX,float startY,float width,float height){
  startY=transformY(startY,height);
  contentByte.clip();
  contentByte.rectangle(startX,startY,width,height);
  contentByte.newPath();
}

Fixed version (ground truth):
private void clip(float startX,float startY,float width,float height){
  startY=transformY(startY,height);
  contentByte.clip();
  contentByte.rectangle(startX,startY,width,height);
  contentByte.newPath();
  cbUnder.clip();
  cbUnder.rectangle(startX,startY,width,height);
  cbUnder.newPath();
}
Program: 75542
Project: 75542
Buggy source:
protected void keepUnresolvedCells(){
  if (rowCount <= 0) {
    return;
  }
  if (rowHint == null) {
    Row row=rows[rowCount - 1];
    Cell[] cells=rows[rowCount - 1].cells;
    IRowContent rowContent=(IRowContent)row.getContent();
    ITableContent table=rowContent.getTable();
    InstanceID tableId=table.getInstanceID();
    InstanceID rowId=rowContent.getInstanceID();
    UnresolvedRowHint hint=new UnresolvedRowHint(tableId,rowId);
    for (int cellId=0; cellId < realColCount; cellId++) {
      if (cells[cellId] != null) {
        ICellContent cc=((CellContent)cells[cellId].getContent()).getContent();
        String style=cc.getStyle().getCssText();
        hint.addUnresolvedCell(style,cells[cellId].getColId(),cells[cellId].getColSpan(),cells[cellId].getRowSpan());
      }
    }
    this.rowHint=hint;
  }
}

Fixed version (ground truth):
protected void keepUnresolvedCells(){
  if (rowCount <= 0) {
    return;
  }
  if (rowHint == null) {
    Row row=rows[rowCount - 1];
    Cell[] cells=rows[rowCount - 1].cells;
    IRowContent rowContent=(IRowContent)row.getContent();
    ITableContent table=rowContent.getTable();
    InstanceID tableId=table.getInstanceID();
    InstanceID rowId=rowContent.getInstanceID();
    UnresolvedRowHint hint=new UnresolvedRowHint(tableId.toUniqueString(),rowId.toUniqueString());
    for (int cellId=0; cellId < realColCount; cellId++) {
      if (cells[cellId] != null) {
        ICellContent cc=((CellContent)cells[cellId].getContent()).getContent();
        String style=cc.getStyle().getCssText();
        hint.addUnresolvedCell(style,cells[cellId].getColId(),cells[cellId].getColSpan(),cells[cellId].getRowSpan());
      }
    }
    this.rowHint=hint;
  }
}
Program: 75543
Project: 75543
Buggy source:
private boolean needClip(IContainerArea container){
  return !(container instanceof RowArea);
}

Fixed version (ground truth):
private boolean needClip(IContainerArea container){
  return (container instanceof CellArea) || (container instanceof InlineContainerArea);
}
Program: 75544
Project: 75544
Buggy source:
public UnresolvedRowHint getUnresolvedRowHint(ITableContent table){
  if (hints.size() > 0) {
    String idStr=table.getInstanceID().toString();
    Iterator iter=hints.iterator();
    while (iter.hasNext()) {
      UnresolvedRowHint rowHint=(UnresolvedRowHint)iter.next();
      if (idStr.equals(rowHint.getTableId().toString())) {
        return rowHint;
      }
    }
  }
  return null;
}

Fixed version (ground truth):
public UnresolvedRowHint getUnresolvedRowHint(ITableContent table){
  if (hints.size() > 0) {
    String idStr=table.getInstanceID().toUniqueString();
    Iterator iter=hints.iterator();
    while (iter.hasNext()) {
      UnresolvedRowHint rowHint=(UnresolvedRowHint)iter.next();
      if (idStr.equals(rowHint.getTableId())) {
        return rowHint;
      }
    }
  }
  return null;
}
Program: 75545
Project: 75545
Buggy source:
public UnresolvedRowHint getUnresolvedRowHint(ITableContent table){
  if (hints.size() > 0) {
    String idStr=table.getInstanceID().toString();
    Iterator iter=hints.iterator();
    while (iter.hasNext()) {
      UnresolvedRowHint rowHint=(UnresolvedRowHint)iter.next();
      if (idStr.equals(rowHint.getTableId().toString())) {
        return rowHint;
      }
    }
  }
  return null;
}

Fixed version (ground truth):
public UnresolvedRowHint getUnresolvedRowHint(ITableContent table){
  if (hints.size() > 0) {
    String idStr=table.getInstanceID().toUniqueString();
    Iterator iter=hints.iterator();
    while (iter.hasNext()) {
      UnresolvedRowHint rowHint=(UnresolvedRowHint)iter.next();
      if (idStr.equals(rowHint.getTableId())) {
        return rowHint;
      }
    }
  }
  return null;
}
Program: 75546
Project: 75546
Buggy source:
public void initTableLayout(UnresolvedRowHint hint){
  if (hint != null) {
    IReportContent report=tableContent.getReportContent();
    IRowContent rowContent=report.createRowContent();
    InstanceID rowId=hint.getRowId();
    rowContent.setInstanceID(rowId);
    rowContent.setParent(tableContent);
    RowArea rowArea=AreaFactory.createRowArea(rowContent);
    unresolvedRow=new Row(rowArea,start,end - start,false);
    for (int i=start; i < end; i++) {
      ICellContent cellContent=report.createCellContent();
      hint.initUnresolvedCell(cellContent,rowId,i);
      cellContent.setParent(rowContent);
      CellArea cellArea=AreaFactory.createCellArea(cellContent);
      unresolvedRow.addArea(cellArea);
      i=i + cellArea.getColSpan() - 1;
    }
  }
}

Fixed version (ground truth):
public void initTableLayout(UnresolvedRowHint hint){
  if (hint != null) {
    IReportContent report=tableContent.getReportContent();
    IRowContent rowContent=report.createRowContent();
    InstanceID rowId=InstanceID.parse(hint.getRowId());
    rowContent.setInstanceID(rowId);
    rowContent.setParent(tableContent);
    RowArea rowArea=AreaFactory.createRowArea(rowContent);
    unresolvedRow=new Row(rowArea,start,end - start,false);
    for (int i=start; i < end; i++) {
      ICellContent cellContent=report.createCellContent();
      hint.initUnresolvedCell(cellContent,rowId,i);
      cellContent.setParent(rowContent);
      CellArea cellArea=AreaFactory.createCellArea(cellContent);
      unresolvedRow.addArea(cellArea);
      i=i + cellArea.getColSpan() - 1;
    }
  }
}
Program: 75547
Project: 75547
Buggy source:
protected int getRowSpan(IRowContent row,CellArea cell){
  int rowSpan=cell.getRowSpan();
  IContent rowContent=(IContent)cell.getContent().getParent();
  if (rowSpan > 1 && (!row.getInstanceID().toString().equals(rowContent.getInstanceID().toString()))) {
    return rowSpan - 1;
  }
  return rowSpan;
}

Fixed version (ground truth):
protected int getRowSpan(IRowContent row,CellArea cell){
  int rowSpan=cell.getRowSpan();
  IContent rowContent=(IContent)cell.getContent().getParent();
  if (rowSpan > 1 && (!row.getInstanceID().toUniqueString().equals(rowContent.getInstanceID().toUniqueString()))) {
    return rowSpan - 1;
  }
  return rowSpan;
}
Program: 75548
Project: 75548
Buggy source:
protected boolean equals(InstanceID rowId,InstanceID id){
  if (rowId != null && id != null) {
    return rowId.toString().equals(id.toString());
  }
  return false;
}

Fixed version (ground truth):
protected boolean equals(InstanceID rowId,String id){
  if (rowId != null && id != null) {
    return rowId.toUniqueString().equals(id);
  }
  return false;
}
Program: 75549
Project: 75549
Buggy source:
public InstanceID getRowId(){
  return this.rowId;
}

Fixed version (ground truth):
public String getRowId(){
  return this.rowId;
}
Program: 75550
Project: 75550
Buggy source:
public InstanceID getTableId(){
  return this.tableId;
}

Fixed version (ground truth):
public String getTableId(){
  return this.tableId;
}
Program: 75551
Project: 75551
Buggy source:
public UnresolvedRowHint(InstanceID tableId,InstanceID rowId){
  this.tableId=tableId;
  this.rowId=rowId;
}

Fixed version (ground truth):
public UnresolvedRowHint(String tableId,String rowId){
  this.tableId=tableId;
  this.rowId=rowId;
}
Program: 75552
Project: 75552
Buggy source:
protected void keepUnresolvedCells(){
  if (rowCount <= 0) {
    return;
  }
  if (rowHint == null) {
    Row row=rows[rowCount - 1];
    Cell[] cells=rows[rowCount - 1].cells;
    IRowContent rowContent=(IRowContent)row.getContent();
    ITableContent table=rowContent.getTable();
    InstanceID tableId=table.getInstanceID();
    InstanceID rowId=rowContent.getInstanceID();
    UnresolvedRowHint hint=new UnresolvedRowHint(tableId.toUniqueString(),rowId.toUniqueString());
    for (int cellId=0; cellId < realColCount; cellId++) {
      if (cells[cellId] != null) {
        ICellContent cc=((CellContent)cells[cellId].getContent()).getContent();
        String style=cc.getStyle().getCssText();
        hint.addUnresolvedCell(style,cells[cellId].getColId(),cells[cellId].getColSpan(),cells[cellId].getRowSpan());
      }
    }
    this.rowHint=hint;
  }
}

Fixed version (ground truth):
protected void keepUnresolvedCells(){
  if (rowCount <= 0) {
    return;
  }
  if (rowHint == null) {
    Row row=rows[rowCount - 1];
    Cell[] cells=rows[rowCount - 1].cells;
    IRowContent rowContent=(IRowContent)row.getContent();
    ITableContent table=rowContent.getTable();
    InstanceID tableId=table.getInstanceID();
    InstanceID rowId=rowContent.getInstanceID();
    UnresolvedRowHint hint=new UnresolvedRowHint(tableId.toUniqueString(),rowId.toUniqueString());
    for (int cellId=0; cellId < realColCount; cellId++) {
      if (cells[cellId] != null) {
        String style=null;
        CellContent cellContent=(CellContent)cells[cellId].getContent();
        if (cellContent != null) {
          ICellContent cc=cellContent.getContent();
          if (cc != null) {
            style=cc.getStyle().getCssText();
          }
        }
        hint.addUnresolvedCell(style,cells[cellId].getColId(),cells[cellId].getColSpan(),cells[cellId].getRowSpan());
      }
    }
    this.rowHint=hint;
  }
}
Program: 75553
Project: 75553
Buggy source:
/** 
 * Gets models of selected elements
 * @return
 */
protected List getElementHandles(){
  boolean isEditPart=false;
  List selList=null;
  IEvaluationContext context=(IEvaluationContext)event.getApplicationContext();
  Object obj=context.getVariable(ICommandParameterNameContants.SELECTION);
  if (obj != null) {
    selList=new ArrayList();
    selList.add(obj);
  }
  if (selList == null || selList.size() < 1) {
    selList=getSelectedObjects();
  }
  for (int i=0; i < selList.size(); i++) {
    if (selList.get(i) instanceof ReportElementEditPart) {
      isEditPart=true;
    }
  }
  if (isEditPart) {
    selList=InsertInLayoutUtil.editPart2Model(TableUtil.filletCellInSelectionEditorpart(getSelection())).toList();
  }
  return selList;
}

Fixed version (ground truth):
/** 
 * Gets models of selected elements
 * @return
 */
protected List getElementHandles(){
  boolean isEditPart=false;
  List selList=null;
  IEvaluationContext context=(IEvaluationContext)event.getApplicationContext();
  Object obj=context.getVariable(ICommandParameterNameContants.SELECTION);
  if (obj != null) {
    selList=new ArrayList();
    selList.add(obj);
  }
  if (selList == null || selList.size() < 1) {
    return Collections.EMPTY_LIST;
  }
  for (int i=0; i < selList.size(); i++) {
    if (selList.get(i) instanceof ReportElementEditPart) {
      isEditPart=true;
    }
  }
  if (isEditPart) {
    selList=InsertInLayoutUtil.editPart2Model(TableUtil.filletCellInSelectionEditorpart(getSelection())).toList();
  }
  return selList;
}
Program: 75554
Project: 75554
Buggy source:
/** 
 * Executes the Command. This method should not be called if the Command is not executable.
 */
public void execute(){
  DesignElementHandle newObject=getNewObject();
  if (DesignerConstants.TRACING_COMMANDS) {
    System.out.println("String_Node_Str");
  }
  try {
    if (parent instanceof SlotHandle) {
      if (after != null) {
        int pos=DEUtil.findInsertPosition(((SlotHandle)parent).getElementHandle(),(DesignElementHandle)after,((SlotHandle)parent).getSlotID());
        ((SlotHandle)parent).add(newObject,pos);
      }
 else {
        ((SlotHandle)parent).add(newObject);
      }
    }
 else     if (newObject instanceof DataSourceHandle) {
      ((DesignElementHandle)parent).addElement(newObject,ReportDesignHandle.DATA_SOURCE_SLOT);
    }
 else {
      if (after != null) {
        int pos=DEUtil.findInsertPosition((DesignElementHandle)parent,(DesignElementHandle)after);
        int slotID=DEUtil.findSlotID(parent,after);
        ((DesignElementHandle)parent).addElement(newObject,slotID,pos);
      }
 else {
        ((DesignElementHandle)parent).addElement(newObject,DEUtil.getDefaultSlotID(parent));
      }
    }
    if (DesignerConstants.TRACING_COMMANDS) {
      System.out.println("String_Node_Str" + DEUtil.getDisplayLabel(newObject) + "String_Node_Str");
    }
  }
 catch (  SemanticException e) {
    if (DesignerConstants.TRACING_COMMANDS) {
      System.out.println("String_Node_Str");
    }
    e.printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * Executes the Command. This method should not be called if the Command is not executable.
 */
public void execute(){
  DesignElementHandle newObject=getNewObject();
  if (DesignerConstants.TRACING_COMMANDS) {
    System.out.println("String_Node_Str");
  }
  try {
    if (parent instanceof SlotHandle) {
      if (after != null) {
        int pos=DEUtil.findInsertPosition(((SlotHandle)parent).getElementHandle(),(DesignElementHandle)after,((SlotHandle)parent).getSlotID());
        ((SlotHandle)parent).add(newObject,pos);
      }
 else {
        ((SlotHandle)parent).add(newObject);
      }
    }
 else     if (newObject instanceof DataSourceHandle) {
      ((DesignElementHandle)parent).addElement(newObject,ReportDesignHandle.DATA_SOURCE_SLOT);
    }
 else {
      if (after != null) {
        int pos=DEUtil.findInsertPosition((DesignElementHandle)parent,(DesignElementHandle)after);
        int slotID=DEUtil.findSlotID(parent,after);
        ((DesignElementHandle)parent).addElement(newObject,slotID,pos);
      }
 else       if (DEUtil.getDefaultSlotID(parent) != -1) {
        ((DesignElementHandle)parent).addElement(newObject,DEUtil.getDefaultSlotID(parent));
      }
 else {
        ((DesignElementHandle)parent).add(DEUtil.getDefaultContentName(parent),newObject);
      }
    }
    if (DesignerConstants.TRACING_COMMANDS) {
      System.out.println("String_Node_Str" + DEUtil.getDisplayLabel(newObject) + "String_Node_Str");
    }
  }
 catch (  SemanticException e) {
    if (DesignerConstants.TRACING_COMMANDS) {
      System.out.println("String_Node_Str");
    }
    e.printStackTrace();
  }
}
Program: 75555
Project: 75555
Buggy source:
/** 
 * populate all available value in selectValueList
 */
private void populateList(){
  try {
    getOkButton().setEnabled(false);
    selectValueList.removeAll();
    viewerValueList.clear();
    if (modelValueList != null) {
      Iterator iter=modelValueList.iterator();
      while (iter.hasNext()) {
        Object candiateValue=iter.next();
        if (candiateValue != null) {
          String displayCandiateValue;
          if (candiateValue instanceof Date) {
            DateFormatter formatter=new DateFormatter(ULocale.US);
            formatter.applyPattern("String_Node_Str");
            displayCandiateValue=formatter.format((Date)candiateValue);
          }
 else           displayCandiateValue=DataTypeUtil.toString(candiateValue);
          viewerValueList.add(displayCandiateValue);
          selectValueList.add(displayCandiateValue);
        }
      }
    }
 else {
      selectValueList.removeAll();
      modelValueList.clear();
      viewerValueList.clear();
      ExceptionHandler.openErrorMessageBox(Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"));
    }
    if (selectValueList.getItemCount() > 0) {
      selectValueList.select(0);
      getOkButton().setEnabled(true);
    }
  }
 catch (  Exception e) {
    ExceptionHandler.handle(e);
  }
}

Fixed version (ground truth):
/** 
 * populate all available value in selectValueList
 */
private void populateList(){
  try {
    getOkButton().setEnabled(false);
    selectValueList.removeAll();
    viewerValueList.clear();
    if (modelValueList != null) {
      Iterator iter=modelValueList.iterator();
      while (iter.hasNext()) {
        Object candiateValue=iter.next();
        if (candiateValue != null) {
          String displayCandiateValue;
          if (candiateValue instanceof Date && !(candiateValue instanceof java.sql.Date || candiateValue instanceof java.sql.Time)) {
            DateFormatter formatter=new DateFormatter(ULocale.US);
            formatter.applyPattern("String_Node_Str");
            displayCandiateValue=formatter.format((Date)candiateValue);
          }
 else           displayCandiateValue=DataTypeUtil.toString(candiateValue);
          viewerValueList.add(displayCandiateValue);
          selectValueList.add(displayCandiateValue);
        }
      }
    }
 else {
      selectValueList.removeAll();
      modelValueList.clear();
      viewerValueList.clear();
      ExceptionHandler.openErrorMessageBox(Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"));
    }
    if (selectValueList.getItemCount() > 0) {
      selectValueList.select(0);
      getOkButton().setEnabled(true);
    }
  }
 catch (  Exception e) {
    ExceptionHandler.handle(e);
  }
}
Program: 75556
Project: 75556
Buggy source:
/** 
 * Compare two bounds in transposed way.
 * @param bo1
 * @param bo2
 * @return
 */
public static final int compareTransposed(Bounds bo1,Bounds bo2){
  final double dMinY1=bo1.getTop();
  final double dMinY2=bo2.getTop();
  double dDiff=dMinY1 - dMinY2;
  if (dDiff != 0) {
    return (dDiff < 0) ? IConstants.MORE : IConstants.LESS;
  }
 else {
    final double dMaxY1=bo1.getTop() + bo1.getHeight();
    final double dMaxY2=bo2.getTop() + bo2.getHeight();
    dDiff=dMaxY1 - dMaxY2;
    if (dDiff != 0) {
      return (dDiff < 0) ? IConstants.MORE : IConstants.LESS;
    }
 else {
      final double dMinX1=bo1.getLeft();
      final double dMinX2=bo2.getLeft();
      dDiff=dMinX1 - dMinX2;
      if (dDiff != 0) {
        return (dDiff < 0) ? IConstants.LESS : IConstants.MORE;
      }
 else {
        final double dMaxX1=bo1.getLeft() + bo1.getWidth();
        final double dMaxX2=bo2.getLeft() + bo2.getWidth();
        dDiff=dMaxX1 - dMaxX2;
        if (dDiff != 0) {
          return (dDiff < 0) ? IConstants.LESS : IConstants.MORE;
        }
 else {
          return IConstants.EQUAL;
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Compare two bounds in transposed way.
 * @param bo1
 * @param bo2
 * @return
 */
public static final int compareTransposed(Bounds bo1,Bounds bo2){
  final double dMinY1=bo1.getTop() + bo1.getHeight();
  final double dMinY2=bo2.getTop() + bo2.getHeight();
  double dDiff=dMinY1 - dMinY2;
  if (dDiff != 0) {
    return (dDiff < 0) ? IConstants.MORE : IConstants.LESS;
  }
 else {
    final double dMaxY1=bo1.getTop();
    final double dMaxY2=bo2.getTop();
    dDiff=dMaxY1 - dMaxY2;
    if (dDiff != 0) {
      return (dDiff < 0) ? IConstants.MORE : IConstants.LESS;
    }
 else {
      final double dMinX1=bo1.getLeft();
      final double dMinX2=bo2.getLeft();
      dDiff=dMinX1 - dMinX2;
      if (dDiff != 0) {
        return (dDiff < 0) ? IConstants.LESS : IConstants.MORE;
      }
 else {
        final double dMaxX1=bo1.getLeft() + bo1.getWidth();
        final double dMaxX2=bo2.getLeft() + bo2.getWidth();
        dDiff=dMaxX1 - dMaxX2;
        if (dDiff != 0) {
          return (dDiff < 0) ? IConstants.LESS : IConstants.MORE;
        }
 else {
          return IConstants.EQUAL;
        }
      }
    }
  }
}
Program: 75559
Project: 75559
Buggy source:
/** 
 * @param ob1
 * @param ob2
 * @return
 */
public static int compareObjects(Object ob1,Object ob2){
  int result=0;
  if (ob1 == ob2) {
    return result;
  }
  if (ob1 == null || ob2 == null) {
    if (ob1 == null) {
      result=-1;
    }
 else {
      result=1;
    }
    return result;
  }
  if (ob1.equals(ob2)) {
    return result;
  }
 else   if (ob1 instanceof Comparable && ob2 instanceof Comparable) {
    Comparable comp1=(Comparable)ob1;
    Comparable comp2=(Comparable)ob2;
    if (ob1.getClass() != ob2.getClass()) {
      try {
        if (ob1 instanceof Number && ob2 instanceof Number) {
          comp1=DataTypeUtil.toDouble(ob1);
          comp2=DataTypeUtil.toDouble(ob2);
        }
 else         if (ob1 instanceof Date && ob2 instanceof Date) {
          comp1=DataTypeUtil.toDate(ob1);
          comp2=DataTypeUtil.toDate(ob1);
        }
      }
 catch (      BirtException ex) {
      }
    }
    result=comp1.compareTo(comp2);
  }
 else   if (ob1 instanceof Boolean && ob2 instanceof Boolean) {
    Boolean bool=(Boolean)ob1;
    if (bool.equals(Boolean.TRUE))     result=1;
 else     result=-1;
  }
 else {
  }
  return result;
}

Fixed version (ground truth):
/** 
 * @param ob1
 * @param ob2
 * @return
 */
public static int compareObjects(Object ob1,Object ob2){
  try {
    return ScriptEvalUtil.compare(ob1,ob2);
  }
 catch (  DataException e) {
    return -1;
  }
}
Program: 75560
Project: 75560
Buggy source:
public void doSave(StreamWrapper streamsWrapper,boolean isSubQuery) throws DataException {
  if (streamsWrapper.getStreamForGroupInfo() != null) {
    this.resultSetPopulator.getGroupProcessorManager().getGroupCalculationUtil().doSave(streamsWrapper.getStreamForGroupInfo());
  }
  if (isSubQuery == false && streamsWrapper.getStreamForResultClass() != null) {
    ((ResultClass)this.resultSetPopulator.getResultSetMetadata()).doSave(streamsWrapper.getStreamForResultClass(),resultSetPopulator.getEventHandler().getAllColumnBindings());
  }
  if (streamsWrapper.getStreamForDataSet() != null) {
    this.resultSetPopulator.getCache().doSave(streamsWrapper.getStreamForDataSet(),resultSetPopulator.getEventHandler().getAllColumnBindings());
  }
}

Fixed version (ground truth):
public void doSave(StreamWrapper streamsWrapper,boolean isSubQuery) throws DataException {
  if (streamsWrapper.getStreamForGroupInfo() != null) {
    this.resultSetPopulator.getGroupProcessorManager().getGroupCalculationUtil().doSave(streamsWrapper.getStreamForGroupInfo());
  }
  if (isSubQuery == false && streamsWrapper.getStreamForResultClass() != null) {
    ((ResultClass)this.resultSetPopulator.getResultSetMetadata()).doSave(streamsWrapper.getStreamForResultClass(),resultSetPopulator.getEventHandler().getAllColumnBindings());
    try {
      streamsWrapper.getStreamForResultClass().close();
      if (streamsWrapper.getStreamForDataSet() != null) {
        this.resultSetPopulator.getCache().doSave(streamsWrapper.getStreamForDataSet(),resultSetPopulator.getEventHandler().getAllColumnBindings());
      }
      streamsWrapper.getStreamForDataSet().close();
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
  }
}
Program: 75561
Project: 75561
Buggy source:
public void doSave(StreamWrapper streamWrapper,boolean isSubQuery) throws DataException {
  try {
    if (streamWrapper.getStreamForResultClass() != null)     IOUtil.writeInt(streamWrapper.getStreamForResultClass(),0);
    if (streamWrapper.getStreamForDataSet() != null)     IOUtil.writeInt(streamWrapper.getStreamForDataSet(),0);
    IOUtil.writeInt(streamWrapper.getStreamForGroupInfo(),0);
  }
 catch (  IOException e) {
    throw new DataException(ResourceConstants.RD_SAVE_ERROR,e,"String_Node_Str");
  }
}

Fixed version (ground truth):
public void doSave(StreamWrapper streamWrapper,boolean isSubQuery) throws DataException {
  try {
    if (streamWrapper.getStreamForResultClass() != null) {
      IOUtil.writeInt(streamWrapper.getStreamForResultClass(),0);
      streamWrapper.getStreamForResultClass().close();
      if (streamWrapper.getStreamForDataSet() != null) {
        IOUtil.writeInt(streamWrapper.getStreamForDataSet(),0);
        streamWrapper.getStreamForDataSet().close();
      }
    }
    IOUtil.writeInt(streamWrapper.getStreamForGroupInfo(),0);
  }
 catch (  IOException e) {
    throw new DataException(ResourceConstants.RD_SAVE_ERROR,e,"String_Node_Str");
  }
}
Program: 75562
Project: 75562
Buggy source:
public void doSave(StreamWrapper streamsWrapper,boolean isSubQuery) throws DataException {
  try {
    if (streamsWrapper.getStreamForResultClass() != null)     IOUtil.writeInt(streamsWrapper.getStreamForResultClass(),0);
    if (streamsWrapper.getStreamForDataSet() != null)     IOUtil.writeInt(streamsWrapper.getStreamForDataSet(),0);
    IOUtil.writeInt(streamsWrapper.getStreamForGroupInfo(),0);
  }
 catch (  IOException e) {
    throw new DataException(ResourceConstants.RD_SAVE_ERROR,e,"String_Node_Str");
  }
}

Fixed version (ground truth):
public void doSave(StreamWrapper streamsWrapper,boolean isSubQuery) throws DataException {
  try {
    if (streamsWrapper.getStreamForResultClass() != null) {
      IOUtil.writeInt(streamsWrapper.getStreamForResultClass(),0);
      streamsWrapper.getStreamForResultClass().close();
      if (streamsWrapper.getStreamForDataSet() != null) {
        IOUtil.writeInt(streamsWrapper.getStreamForDataSet(),0);
        streamsWrapper.getStreamForDataSet().close();
      }
    }
    IOUtil.writeInt(streamsWrapper.getStreamForGroupInfo(),0);
  }
 catch (  IOException e) {
    throw new DataException(ResourceConstants.RD_SAVE_ERROR,e,"String_Node_Str");
  }
}
Program: 75563
Project: 75563
Buggy source:
/** 
 * @param odiResult
 * @param groupLevel
 * @param subQueryInfo
 * @throws DataException
 */
private void saveForUpdate(IResultIterator odiResult,int groupLevel,int[] subQueryInfo) throws DataException {
  try {
    OutputStream streamForGroupInfo=null;
    OutputStream streamForRowIndexInfo=null;
    OutputStream streamForParentIndexInfo=null;
    boolean isSubQuery=streamManager.isSubquery();
    if (streamManager.isSecondRD() == true) {
      streamForRowIndexInfo=streamManager.getOutStream(DataEngineContext.ROW_INDEX_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE);
      if (isSubQuery == true)       streamForParentIndexInfo=streamManager.getOutStream(DataEngineContext.SUBQUERY_PARENTINDEX_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE);
    }
    streamForGroupInfo=streamManager.getOutStream(DataEngineContext.GROUP_INFO_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE);
    odiResult.doSave(new StreamWrapper(null,null,streamForGroupInfo,streamForRowIndexInfo,streamForParentIndexInfo),isSubQuery);
    streamForGroupInfo.close();
    if (streamForRowIndexInfo != null)     streamForRowIndexInfo.close();
    if (streamForParentIndexInfo != null)     streamForParentIndexInfo.close();
    if (isSubQuery == true) {
      if (mode == DataEngineContext.MODE_UPDATE) {
        saveSubQueryInfo(groupLevel,subQueryInfo);
      }
    }
  }
 catch (  IOException e) {
    throw new DataException(ResourceConstants.RD_SAVE_ERROR,e,"String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * @param odiResult
 * @param groupLevel
 * @param subQueryInfo
 * @throws DataException
 */
private void saveForUpdate(IResultIterator odiResult,int groupLevel,int[] subQueryInfo) throws DataException {
  try {
    OutputStream streamForGroupInfo=null;
    OutputStream streamForRowIndexInfo=null;
    OutputStream streamForParentIndexInfo=null;
    boolean isSubQuery=streamManager.isSubquery();
    if (streamManager.isSecondRD() == true) {
      streamForRowIndexInfo=streamManager.getOutStream(DataEngineContext.ROW_INDEX_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE);
      if (isSubQuery == true)       streamForParentIndexInfo=streamManager.getOutStream(DataEngineContext.SUBQUERY_PARENTINDEX_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE);
    }
    streamForGroupInfo=streamManager.getOutStream(DataEngineContext.GROUP_INFO_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE);
    odiResult.doSave(new StreamWrapper(streamManager,null,streamForGroupInfo,streamForRowIndexInfo,streamForParentIndexInfo),isSubQuery);
    streamForGroupInfo.close();
    if (streamForRowIndexInfo != null)     streamForRowIndexInfo.close();
    if (streamForParentIndexInfo != null)     streamForParentIndexInfo.close();
    if (isSubQuery == true) {
      if (mode == DataEngineContext.MODE_UPDATE) {
        saveSubQueryInfo(groupLevel,subQueryInfo);
      }
    }
  }
 catch (  IOException e) {
    throw new DataException(ResourceConstants.RD_SAVE_ERROR,e,"String_Node_Str");
  }
}
Program: 75564
Project: 75564
Buggy source:
/** 
 * @param odiResult
 * @param groupLevel
 * @param subQueryInfo
 * @throws DataException
 */
private void saveForGeneration(IResultIterator odiResult,int groupLevel,int[] subQueryInfo) throws DataException {
  try {
    OutputStream streamForDataSet=null;
    OutputStream streamForResultClass=null;
    OutputStream streamForGroupInfo=null;
    boolean isSubQuery=streamManager.isSubquery();
    if (isSubQuery == false) {
      streamForDataSet=streamManager.getOutStream(DataEngineContext.DATASET_DATA_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE);
      streamForResultClass=streamManager.getOutStream(DataEngineContext.DATASET_META_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE);
    }
    streamForGroupInfo=streamManager.getOutStream(DataEngineContext.GROUP_INFO_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE);
    odiResult.doSave(new StreamWrapper(streamForDataSet,streamForResultClass,streamForGroupInfo,null,null),isSubQuery);
    if (streamForDataSet != null) {
      streamForDataSet.close();
      streamForResultClass.close();
    }
    streamForGroupInfo.close();
    if (isSubQuery == true) {
      if (streamManager.hasOutStream(DataEngineContext.SUBQUERY_INFO_STREAM,StreamManager.SUB_QUERY_ROOT_STREAM,StreamManager.SELF_SCOPE) == false) {
        saveSubQueryInfo(groupLevel,subQueryInfo);
      }
    }
  }
 catch (  IOException e) {
    throw new DataException(ResourceConstants.RD_SAVE_ERROR,e,"String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * @param odiResult
 * @param groupLevel
 * @param subQueryInfo
 * @throws DataException
 */
private void saveForGeneration(IResultIterator odiResult,int groupLevel,int[] subQueryInfo) throws DataException {
  try {
    OutputStream streamForResultClass=null;
    OutputStream streamForGroupInfo=null;
    boolean isSubQuery=streamManager.isSubquery();
    if (isSubQuery == false) {
      streamForResultClass=streamManager.getOutStream(DataEngineContext.DATASET_META_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE);
    }
    streamForGroupInfo=streamManager.getOutStream(DataEngineContext.GROUP_INFO_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE);
    odiResult.doSave(new StreamWrapper(streamManager,streamForResultClass,streamForGroupInfo,null,null),isSubQuery);
    streamForGroupInfo.close();
    if (isSubQuery == true) {
      if (streamManager.hasOutStream(DataEngineContext.SUBQUERY_INFO_STREAM,StreamManager.SUB_QUERY_ROOT_STREAM,StreamManager.SELF_SCOPE) == false) {
        saveSubQueryInfo(groupLevel,subQueryInfo);
      }
    }
  }
 catch (  IOException e) {
    throw new DataException(ResourceConstants.RD_SAVE_ERROR,e,"String_Node_Str");
  }
}
Program: 75565
Project: 75565
Buggy source:
/** 
 * @return
 */
public OutputStream getStreamForDataSet(){
  return this.streamForDataSet;
}

Fixed version (ground truth):
/** 
 * @return
 * @throws DataException 
 */
public OutputStream getStreamForDataSet() throws DataException {
  if (this.streamForResultClass != null && this.streamForDataSet == null) {
    this.streamForDataSet=manager.getOutStream(DataEngineContext.DATASET_DATA_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE);
  }
  return this.streamForDataSet;
}
Program: 75566
Project: 75566
Buggy source:
/** 
 * @param streamForResultClass
 * @param streamForDataSet
 * @param streamForGroupInfo
 * @param streamForRowIndexInfo
 */
public StreamWrapper(OutputStream streamForDataSet,OutputStream streamForResultClass,OutputStream streamForGroupInfo,OutputStream streamForRowIndexInfo,OutputStream streamForParentIndex){
  this.streamForResultClass=streamForResultClass;
  this.streamForDataSet=streamForDataSet;
  this.streamForGroupInfo=streamForGroupInfo;
  this.streamForRowIndexInfo=streamForRowIndexInfo;
  this.streamForParentIndex=streamForParentIndex;
}

Fixed version (ground truth):
/** 
 * @param streamForResultClass
 * @param streamForDataSet
 * @param streamForGroupInfo
 * @param streamForRowIndexInfo
 */
public StreamWrapper(StreamManager manager,OutputStream streamForResultClass,OutputStream streamForGroupInfo,OutputStream streamForRowIndexInfo,OutputStream streamForParentIndex){
  this.streamForResultClass=streamForResultClass;
  this.streamForGroupInfo=streamForGroupInfo;
  this.streamForRowIndexInfo=streamForRowIndexInfo;
  this.streamForParentIndex=streamForParentIndex;
  this.manager=manager;
}
Program: 75567
Project: 75567
Buggy source:
/** 
 * @param context
 * @param id
 * @throws DataException
 */
public DataStreamReader(DataEngineContext context,StreamID id) throws DataException {
  try {
    this.streamMap=new HashMap();
    this.id=id;
    this.context=context;
    RAInputStream is=context.getInputStream(id.getStartStream(),id.getSubQueryStream(),DataEngineContext.DATASET_DATA_STREAM);
    DataInputStream metaIndexStream=new DataInputStream(is);
    while (is.getOffset() < is.length()) {
      int type=is.readInt();
      int size=is.readInt();
      long offset=is.getOffset();
      this.streamMap.put(new Integer(type),new WrapperedRAInputStream((RAInputStream)context.getInputStream(id.getStartStream(),id.getSubQueryStream(),DataEngineContext.DATASET_DATA_STREAM),offset,size));
      is.skip(size);
    }
    metaIndexStream.close();
  }
 catch (  IOException e) {
    throw new DataException(e.getLocalizedMessage());
  }
}

Fixed version (ground truth):
/** 
 * @param context
 * @param id
 * @throws DataException
 */
public DataStreamReader(DataEngineContext context,StreamID id) throws DataException {
  try {
    this.streamMap=new HashMap();
    this.id=id;
    this.context=context;
    RAInputStream is=context.getInputStream(id.getStartStream(),id.getSubQueryStream(),DataEngineContext.DATASET_DATA_STREAM);
    DataInputStream metaIndexStream=new DataInputStream(is);
    int type=is.readInt();
    int size=is.readInt();
    long offset=is.getOffset();
    this.streamMap.put(new Integer(type),new WrapperedRAInputStream((RAInputStream)context.getInputStream(id.getStartStream(),id.getSubQueryStream(),DataEngineContext.DATASET_DATA_STREAM),offset,size));
    metaIndexStream.close();
  }
 catch (  IOException e) {
    throw new DataException(e.getLocalizedMessage());
  }
}
Program: 75568
Project: 75568
Buggy source:
/** 
 * @param streamType
 * @param streamPos
 * @param streamScope
 * @return
 * @throws DataException
 */
public OutputStream getOutStream(int streamType,int streamPos,int streamScope) throws DataException {
  StreamID streamID=getStreamID(streamType,streamPos,streamScope);
  if (!useTempStream(streamType)) {
    return context.getOutputStream(streamID.getStartStream(),streamID.getSubQueryStream(),streamType);
  }
 else {
    int sType=DataEngineContext.META_STREAM;
    if (streamType == DataEngineContext.DATASET_DATA_STREAM || streamType == DataEngineContext.DATASET_META_STREAM)     sType=DataEngineContext.DATASET_DATA_STREAM;
    return this.getTempStreamManager(getStreamID(sType,streamPos,streamScope)).getOutputStream(streamType);
  }
}

Fixed version (ground truth):
/** 
 * @param streamType
 * @param streamPos
 * @param streamScope
 * @return
 * @throws DataException
 */
public OutputStream getOutStream(int streamType,int streamPos,int streamScope) throws DataException {
  StreamID streamID=getStreamID(streamType,streamPos,streamScope);
  if (!useTempStream(streamType)) {
    RAOutputStream outputStream=context.getOutputStream(streamID.getStartStream(),streamID.getSubQueryStream(),streamType);
    if (streamType == DataEngineContext.DATASET_DATA_STREAM && this.version >= VersionManager.VERSION_2_2_0) {
      try {
        outputStream.seek(outputStream.length());
        outputStream.writeInt(0);
        outputStream.writeInt(0);
      }
 catch (      IOException e) {
        e.printStackTrace();
      }
    }
    return outputStream;
  }
 else {
    int sType=DataEngineContext.META_STREAM;
    if (streamType == DataEngineContext.DATASET_DATA_STREAM || streamType == DataEngineContext.DATASET_META_STREAM)     sType=DataEngineContext.DATASET_DATA_STREAM;
    return this.getTempStreamManager(getStreamID(sType,streamPos,streamScope)).getOutputStream(streamType);
  }
}
Program: 75569
Project: 75569
Buggy source:
/** 
 * @param streamType
 * @return
 */
private boolean useTempStream(int streamType){
  if (this.version < VersionManager.VERSION_2_2)   return false;
switch (streamType) {
case DataEngineContext.DATASET_DATA_STREAM:
    return !(this.version < VersionManager.VERSION_2_2_0);
case DataEngineContext.DATASET_META_STREAM:
  return !(this.version < VersionManager.VERSION_2_2_0);
case DataEngineContext.EXPR_VALUE_STREAM:
return false;
case DataEngineContext.EXPR_ROWLEN_STREAM:
return this.version < VersionManager.VERSION_2_2_0;
case DataEngineContext.EXPR_META_STREAM:
return true;
case DataEngineContext.GROUP_INFO_STREAM:
return true;
case DataEngineContext.SUBQUERY_INFO_STREAM:
return false;
case DataEngineContext.QUERY_DEFN_STREAM:
return true;
case DataEngineContext.ORIGINAL_QUERY_DEFN_STREAM:
return false;
case DataEngineContext.ROW_INDEX_STREAM:
return true;
case DataEngineContext.QUERYID_INFO_STREAM:
return true;
case DataEngineContext.SUBQUERY_PARENTINDEX_STREAM:
return true;
case DataEngineContext.META_STREAM:
return false;
case DataEngineContext.META_INDEX_STREAM:
return false;
default :
return false;
}
}

Fixed version (ground truth):
/** 
 * @param streamType
 * @return
 */
private boolean useTempStream(int streamType){
  if (this.version < VersionManager.VERSION_2_2)   return false;
switch (streamType) {
case DataEngineContext.DATASET_DATA_STREAM:
    return false;
case DataEngineContext.DATASET_META_STREAM:
  return !(this.version < VersionManager.VERSION_2_2_0);
case DataEngineContext.EXPR_VALUE_STREAM:
return false;
case DataEngineContext.EXPR_ROWLEN_STREAM:
return this.version < VersionManager.VERSION_2_2_0;
case DataEngineContext.EXPR_META_STREAM:
return true;
case DataEngineContext.GROUP_INFO_STREAM:
return true;
case DataEngineContext.SUBQUERY_INFO_STREAM:
return false;
case DataEngineContext.QUERY_DEFN_STREAM:
return true;
case DataEngineContext.ORIGINAL_QUERY_DEFN_STREAM:
return false;
case DataEngineContext.ROW_INDEX_STREAM:
return true;
case DataEngineContext.QUERYID_INFO_STREAM:
return true;
case DataEngineContext.SUBQUERY_PARENTINDEX_STREAM:
return true;
case DataEngineContext.META_STREAM:
return false;
case DataEngineContext.META_INDEX_STREAM:
return false;
default :
return false;
}
}
Program: 75570
Project: 75570
Buggy source:
private RAInputStream createInputStream(StreamID streamID,int streamType) throws DataException {
  if (!useTempStream(streamType)) {
    return (RAInputStream)context.getInputStream(streamID.getStartStream(),streamID.getSubQueryStream(),streamType);
  }
 else {
    return this.getMetaManager(streamID,streamType).getRAInputStream(streamType);
  }
}

Fixed version (ground truth):
private RAInputStream createInputStream(StreamID streamID,int streamType) throws DataException {
  if (!useTempStream(streamType)) {
    RAInputStream stream=(RAInputStream)context.getInputStream(streamID.getStartStream(),streamID.getSubQueryStream(),streamType);
    if (streamType == DataEngineContext.DATASET_DATA_STREAM && this.version >= VersionManager.VERSION_2_2_0) {
      try {
        stream.readInt();
        int size=stream.readInt();
        stream.skip(size);
        stream.readInt();
        stream.readInt();
      }
 catch (      IOException e) {
        e.printStackTrace();
      }
    }
    return stream;
  }
 else {
    return this.getMetaManager(streamID,streamType).getRAInputStream(streamType);
  }
}
Program: 75574
Project: 75574
Buggy source:
/** 
 * Returns the container slotHandle.
 */
private SlotHandle getDefaultSlotHandle(String insertType){
  IStructuredSelection models=InsertInLayoutUtil.editPart2Model(getSelection());
  if (models.isEmpty()) {
    return null;
  }
  model=models.getFirstElement();
  if (model instanceof LibRootModel) {
    model=((LibRootModel)model).getModel();
  }
  if (model instanceof SlotHandle) {
    return (SlotHandle)model;
  }
 else   if (model instanceof DesignElementHandle) {
    DesignElementHandle handle=(DesignElementHandle)model;
    if (handle.getDefn().isContainer()) {
      int slotId=DEUtil.getDefaultSlotID(handle);
      if (handle.canContain(slotId,insertType)) {
        return handle.getSlot(slotId);
      }
    }
    return handle.getContainerSlotHandle();
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns the container slotHandle.
 */
private SlotHandle getDefaultSlotHandle(String insertType){
  IStructuredSelection models=InsertInLayoutUtil.editPart2Model(getSelection());
  if (models.isEmpty()) {
    return null;
  }
  model=DNDUtil.unwrapToModel(models.getFirstElement());
  if (model instanceof LibRootModel) {
    model=((LibRootModel)model).getModel();
  }
  if (model instanceof SlotHandle) {
    return (SlotHandle)model;
  }
 else   if (model instanceof DesignElementHandle) {
    DesignElementHandle handle=(DesignElementHandle)model;
    if (handle.getDefn().isContainer()) {
      int slotId=DEUtil.getDefaultSlotID(handle);
      if (handle.canContain(slotId,insertType)) {
        return handle.getSlot(slotId);
      }
    }
    return handle.getContainerSlotHandle();
  }
  return null;
}
Program: 75575
Project: 75575
Buggy source:
protected boolean calculateEnabled(){
  slotHandle=getDefaultSlotHandle(insertType);
  return DNDUtil.handleValidateTargetCanContainType(slotHandle,insertType) && DNDUtil.handleValidateTargetCanContainMore(slotHandle,0);
}

Fixed version (ground truth):
protected boolean calculateEnabled(){
  slotHandle=getDefaultSlotHandle(insertType);
  propertyHandle=getDefaultPropertyHandle(insertType);
  Object obj=slotHandle;
  if (obj == null) {
    obj=model;
  }
  return DNDUtil.handleValidateTargetCanContainType(obj,insertType) && DNDUtil.handleValidateTargetCanContainMore(obj,0);
}
Program: 75576
Project: 75576
Buggy source:
protected Request insertElement() throws Exception {
  Request request=new Request(IRequestConstants.REQUEST_TYPE_INSERT);
  Map extendsData=new HashMap();
  extendsData.put(IRequestConstants.REQUEST_KEY_INSERT_SLOT,slotHandle);
  extendsData.put(IRequestConstants.REQUEST_KEY_INSERT_TYPE,insertType);
  extendsData.put(IRequestConstants.REQUEST_KEY_INSERT_POSITION,InsertAction.BELOW);
  request.setExtendedData(extendsData);
  if (ProviderFactory.createProvider(slotHandle.getElementHandle()).performRequest(model,request)) {
    return request;
  }
  return null;
}

Fixed version (ground truth):
protected Request insertElement() throws Exception {
  Request request=new Request(IRequestConstants.REQUEST_TYPE_INSERT);
  Map extendsData=new HashMap();
  if (slotHandle != null) {
    extendsData.put(IRequestConstants.REQUEST_KEY_INSERT_SLOT,slotHandle);
  }
 else   if (propertyHandle != null) {
    extendsData.put(IRequestConstants.REQUEST_KEY_INSERT_PROPERTY,propertyHandle);
  }
  extendsData.put(IRequestConstants.REQUEST_KEY_INSERT_TYPE,insertType);
  extendsData.put(IRequestConstants.REQUEST_KEY_INSERT_POSITION,InsertAction.BELOW);
  request.setExtendedData(extendsData);
  Object obj=model;
  if (slotHandle != null) {
    obj=slotHandle.getElementHandle();
  }
  if (ProviderFactory.createProvider(obj).performRequest(model,request)) {
    return request;
  }
  return null;
}
Program: 75577
Project: 75577
Buggy source:
public void run(){
  transStar(NAME);
  try {
    LevelViewDialog dialog=new LevelViewDialog(UIUtil.getDefaultShell());
    List showLevels=new ArrayList();
    int viewCount=viewHandle.getLevelCount();
    for (int i=0; i < viewCount; i++) {
      LevelViewHandle levelHandle=viewHandle.getLevel(i);
      showLevels.add(levelHandle.getCubeLevel());
    }
    dialog.setInput(viewHandle.getCubeDimension(),showLevels);
    if (dialog.open() == Window.OK) {
      List result=(List)dialog.getResult();
      processor(showLevels,result);
    }
  }
 catch (  SemanticException e) {
    rollBack();
    ExceptionHandler.handle(e);
    return;
  }
  transEnd();
}

Fixed version (ground truth):
public void run(){
  transStar(NAME);
  try {
    LevelViewDialog dialog=new LevelViewDialog(UIUtil.getDefaultShell());
    List showLevels=new ArrayList();
    List nullLevelHandle=new ArrayList();
    int viewCount=viewHandle.getLevelCount();
    for (int i=0; i < viewCount; i++) {
      LevelViewHandle levelHandle=viewHandle.getLevel(i);
      if (levelHandle.getCubeLevel() == null) {
        nullLevelHandle.add(new Integer(levelHandle.getIndex()));
      }
 else {
        showLevels.add(levelHandle.getCubeLevel());
      }
    }
    dialog.setInput(viewHandle.getCubeDimension(),showLevels);
    if (dialog.open() == Window.OK) {
      List result=(List)dialog.getResult();
      processor(showLevels,result,nullLevelHandle);
    }
  }
 catch (  SemanticException e) {
    rollBack();
    ExceptionHandler.handle(e);
    return;
  }
  transEnd();
}