nus-yam/ex-repair huggingface dataset:
Program: 68907
Project: 68907
Buggy source:
public int read(byte[] b) throws IOException {
  return read(b,0,b.length);
}

Fixed version (ground truth):
public int read() throws IOException {
  byte[] b=new byte[1];
  int len=read(b);
  if (len < 0) {
    return -1;
  }
  return b[0] & 0xff;
}
Program: 68908
Project: 68908
Buggy source:
/** 
 * Reads up to <code>b.length</code> bytes of data from this object  into an array of bytes. This method blocks until at least one byte  of input is available. 
 * @param b   the buffer into which the data is read.
 * @return     the total number of bytes read into the buffer, or<code>-1</code> if there is no more data because the end of this object has been reached.
 * @exception IOException  if an I/O error occurs.
 */
public int read(byte b[]) throws IOException ;

Fixed version (ground truth):
public int read() throws IOException ;
Program: 68909
Project: 68909
Buggy source:
public int read(byte[] b) throws IOException {
  return inputStream.read(b);
}

Fixed version (ground truth):
public int read() throws IOException {
  return inputStream.read();
}
Program: 68910
Project: 68910
Buggy source:
public int read(byte[] b) throws IOException {
  throw new UnsupportedOperationException();
}

Fixed version (ground truth):
public int read() throws IOException {
  throw new UnsupportedOperationException();
}
Program: 68911
Project: 68911
Buggy source:
/** 
 */
public Bytes readBytes() throws IOException {
  long start=delegate.getFilePointer();
  if (start == 226) {
    start=delegate.getFilePointer();
  }
  byte[] b=new byte[readInt()];
  read(b,0,b.length);
  return new Bytes(b);
}

Fixed version (ground truth):
/** 
 */
public Bytes readBytes() throws IOException {
  long start=delegate.getFilePointer();
  if (start == 226) {
    start=delegate.getFilePointer();
  }
  int size=readInt();
  byte[] b=new byte[size];
  int totalReadSize=0;
  int readSize=read(b,0,b.length);
  totalReadSize=readSize;
  while (readSize != -1 && totalReadSize < size) {
    readSize=read(b,totalReadSize,size - totalReadSize);
    if (readSize != -1) {
      totalReadSize+=readSize;
    }
  }
  return new Bytes(b);
}
Program: 68912
Project: 68912
Buggy source:
public int read(byte[] b) throws IOException {
  return randomAccessFile.read(b);
}

Fixed version (ground truth):
public int read() throws IOException {
  return randomAccessFile.read();
}
Program: 68913
Project: 68913
Buggy source:
public Object[] getElements(Object inputElement){
  List elements=new ArrayList();
  if (inputElement instanceof ExtendedItemHandle) {
    int selectedIndex=editor.cmbExpList.getSelectionIndex();
    if (selectedIndex >= 0) {
      String scriptName=editor.cmbExpList.getItem(editor.cmbExpList.getSelectionIndex());
      ExtendedItemHandle extHandle=(ExtendedItemHandle)inputElement;
      List methods=extHandle.getMethods(scriptName);
      if (methods != null) {
        elements.add(0,Messages.getString("String_Node_Str"));
        elements.addAll(methods);
      }
    }
  }
  return elements.toArray();
}

Fixed version (ground truth):
public Object[] getElements(Object inputElement){
  List elements=new ArrayList();
  if (inputElement instanceof ExtendedItemHandle) {
    int selectedIndex=editor.cmbExpList.getSelectionIndex();
    if (selectedIndex >= 0) {
      String scriptName=editor.cmbExpList.getItem(editor.cmbExpList.getSelectionIndex());
      ExtendedItemHandle extHandle=(ExtendedItemHandle)inputElement;
      List methods=extHandle.getMethods(scriptName);
      if (methods != null && methods.size() > 0) {
        elements.add(0,Messages.getString("String_Node_Str"));
        elements.addAll(methods);
      }
    }
  }
  return elements.toArray();
}
Program: 68914
Project: 68914
Buggy source:
public static String getValidSheetName(String name){
  name=name.replaceAll("String_Node_Str","String_Node_Str");
  if (name.length() > 31) {
    logger.log(Level.WARNING,"String_Node_Str" + name + "String_Node_Str");
    name=name.substring(0,30);
  }
  return name;
}

Fixed version (ground truth):
public static String getValidSheetName(String name){
  name=name.replaceAll("String_Node_Str","String_Node_Str");
  if (name.length() > 31) {
    logger.log(Level.WARNING,"String_Node_Str" + name + "String_Node_Str");
    name=name.substring(0,31);
  }
  return name;
}
Program: 68915
Project: 68915
Buggy source:
public static ColumnsInfo createTable(ITableContent table,int width){
  int tableWidth=getElementWidth(table,width);
  int columnCount=table.getColumnCount();
  if (columnCount == 0) {
    return null;
  }
  int[] columns=new int[columnCount];
  int unassignedCount=0;
  int totalAssigned=0;
  for (int i=0; i < columnCount; i++) {
    DimensionType value=table.getColumn(i).getWidth();
    if (value == null) {
      columns[i]=-1;
      unassignedCount++;
    }
 else {
      columns[i]=ExcelUtil.covertDimensionType(value,tableWidth);
      totalAssigned+=columns[i];
    }
  }
  int leftWidth=tableWidth - totalAssigned;
  if (leftWidth != 0 && unassignedCount == 0) {
    for (int i=0; i < columnCount; i++) {
      columns[i]=resize(columns[i],totalAssigned,leftWidth);
    }
  }
 else   if (leftWidth < 0 && unassignedCount > 0) {
    for (int i=0; i < columnCount; i++) {
      if (columns[i] == -1)       columns[1]=0;
 else       columns[i]=resize(columns[i],totalAssigned,leftWidth);
    }
  }
 else   if (leftWidth >= 0 && unassignedCount > 0) {
    int per=(int)leftWidth / unassignedCount;
    int index=0;
    for (int i=0; i < columns.length; i++) {
      if (columns[i] == -1) {
        columns[i]=per;
        index=i;
      }
    }
    columns[index]=leftWidth - per * (unassignedCount - 1);
  }
  return new ColumnsInfo(columns);
}

Fixed version (ground truth):
public static ColumnsInfo createTable(ITableContent table,int width){
  int tableWidth=getElementWidth(table,width);
  int columnCount=table.getColumnCount();
  if (columnCount == 0) {
    return null;
  }
  int[] columns=new int[columnCount];
  int unassignedCount=0;
  int totalAssigned=0;
  for (int i=0; i < columnCount; i++) {
    DimensionType value=table.getColumn(i).getWidth();
    if (value == null) {
      columns[i]=-1;
      unassignedCount++;
    }
 else {
      columns[i]=ExcelUtil.covertDimensionType(value,tableWidth);
      totalAssigned+=columns[i];
    }
  }
  int leftWidth=tableWidth - totalAssigned;
  if (leftWidth != 0 && unassignedCount == 0) {
    int totalResized=0;
    for (int i=0; i < columnCount - 1; i++) {
      columns[i]=resize(columns[i],totalAssigned,leftWidth);
      totalResized+=columns[i];
    }
    columns[columnCount - 1]=tableWidth - totalResized;
  }
 else   if (leftWidth < 0 && unassignedCount > 0) {
    int totalResized=0;
    int lastAssignedIndex=0;
    for (int i=0; i < columnCount; i++) {
      if (columns[i] == -1) {
        columns[1]=0;
      }
 else {
        columns[i]=resize(columns[i],totalAssigned,leftWidth);
        lastAssignedIndex=i;
      }
      totalResized+=columns[i];
    }
    columns[lastAssignedIndex]+=tableWidth - totalResized;
  }
 else   if (leftWidth >= 0 && unassignedCount > 0) {
    int per=(int)leftWidth / unassignedCount;
    int index=0;
    for (int i=0; i < columns.length; i++) {
      if (columns[i] == -1) {
        columns[i]=per;
        index=i;
      }
    }
    columns[index]=leftWidth - per * (unassignedCount - 1);
  }
  return new ColumnsInfo(columns);
}
Program: 68916
Project: 68916
Buggy source:
public boolean first(){
  try {
    initCubeCursor();
    mainEdgeCursor.first();
    if (subEdgeCursor != null) {
      subEdgeCursor.first();
    }
 else {
      bWithoutSub=true;
    }
    return true;
  }
 catch (  OLAPException e) {
    logger.log(e);
  }
catch (  BirtException e) {
    logger.log(e);
  }
  return false;
}

Fixed version (ground truth):
public boolean first(){
  try {
    initCubeCursor();
    if (mainEdgeCursor.first()) {
      if (subEdgeCursor != null) {
        subEdgeCursor.first();
      }
 else {
        bWithoutSub=true;
      }
      return true;
    }
  }
 catch (  OLAPException e) {
    logger.log(e);
  }
catch (  BirtException e) {
    logger.log(e);
  }
  return false;
}
Program: 68917
Project: 68917
Buggy source:
public boolean first(){
  try {
    initCubeCursor();
    mainEdgeCursor.first();
    fMainPositionNodes.updatePosition();
    if (subEdgeCursor != null) {
      subEdgeCursor.first();
      fSubPositionNodes.updatePosition();
    }
 else {
      bWithoutSub=true;
    }
    return true;
  }
 catch (  OLAPException e) {
    logger.log(e);
  }
catch (  BirtException e) {
    logger.log(e);
  }
  return false;
}

Fixed version (ground truth):
public boolean first(){
  try {
    initCubeCursor();
    if (mainEdgeCursor.first()) {
      fMainPositionNodes.updatePosition();
      if (subEdgeCursor != null) {
        subEdgeCursor.first();
        fSubPositionNodes.updatePosition();
      }
 else {
        bWithoutSub=true;
      }
      return true;
    }
  }
 catch (  OLAPException e) {
    logger.log(e);
  }
catch (  BirtException e) {
    logger.log(e);
  }
  return false;
}
Program: 68918
Project: 68918
Buggy source:
private void outputImageSource(ArrayImageSource imageSource){
  int originalWidth=imageSource.getWidth();
  int originalHeight=imageSource.getHeight();
  try {
    ByteArrayOutputStream originalSource=new ByteArrayOutputStream();
    for (int i=0; i < originalHeight; i++) {
      for (int j=0; j < originalWidth; j++) {
        int pixel=imageSource.getRGB(j,i);
        int alpha=(pixel >> 24) & 0xff;
        int red=(pixel >> 16) & 0xff;
        int green=(pixel >> 8) & 0xff;
        int blue=pixel & 0xff;
        originalSource.write(transferColor(alpha,red));
        originalSource.write(transferColor(alpha,green));
        originalSource.write(transferColor(alpha,blue));
      }
    }
    byte[] byteArray=deflate(originalSource.toByteArray());
    out.print(Util.toHexString(byteArray) + "String_Node_Str");
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
private void outputImageSource(ArrayImageSource imageSource){
  int originalWidth=imageSource.getWidth();
  int originalHeight=imageSource.getHeight();
  byte[] buffer=new byte[3 * originalHeight * originalWidth];
  int index=0;
  for (int i=0; i < originalHeight; i++) {
    for (int j=0; j < originalWidth; j++) {
      int pixel=imageSource.getRGB(j,i);
      int alpha=(pixel >> 24) & 0xff;
      int red=(pixel >> 16) & 0xff;
      int green=(pixel >> 8) & 0xff;
      int blue=pixel & 0xff;
      buffer[index++]=(byte)transferColor(alpha,red);
      buffer[index++]=(byte)transferColor(alpha,green);
      buffer[index++]=(byte)transferColor(alpha,blue);
    }
  }
  try {
    buffer=deflate(buffer);
    out.print(Util.toHexString(buffer) + "String_Node_Str");
  }
 catch (  IOException e) {
    log.log(Level.WARNING,e.getLocalizedMessage(),e);
  }
}
Program: 68920
Project: 68920
Buggy source:
public static List getSelectValueFromBinding(String expression,DataSetHandle dataSetHandle,Iterator binding,boolean inclFilter) throws BirtException {
}

Fixed version (ground truth):
/** 
 * Used in filter select value dialog in layout.
 * @param expression
 * @param dataSetHandle
 * @param binding
 * @param inclFilter
 * @return
 * @throws BirtException
 */
public static List getSelectValueFromBinding(Expression expression,DataSetHandle dataSetHandle,Iterator binding,boolean inclFilter) throws BirtException {
}
Program: 68921
Project: 68921
Buggy source:
/** 
 * @param selectValueExpression
 * @param dataSetHandle
 * @return
 * @throws BirtException
 */
public static List getSelectValueList(String expression,DataSetHandle dataSetHandle) throws BirtException {
  return getSelectValueList(expression,dataSetHandle,true);
}

Fixed version (ground truth):
/** 
 * @param selectValueExpression
 * @param dataSetHandle
 * @return
 * @throws BirtException
 */
public static List getSelectValueList(Expression expression,DataSetHandle dataSetHandle) throws BirtException {
  return getSelectValueList(expression,dataSetHandle,true);
}
Program: 68922
Project: 68922
Buggy source:
private JavascriptContext createJsContext(ScriptContext context){
  ScriptContext parent=context.getParent();
  Scriptable parentJsScope=global;
  if (parent != null) {
    JavascriptContext parentJsContext=(JavascriptContext)parent.getScriptContext(JavascriptEngineFactory.SCRIPT_JAVASCRIPT);
    if (parentJsContext == null) {
      parentJsContext=createJsContext(parent);
    }
    parentJsScope=parentJsContext.getScope();
  }
  Object scope=context.getScopeObject();
  Scriptable jsScope=createJsScope(parentJsScope,scope);
  JavascriptContext jsContext=new JavascriptContext(context,jsScope);
  Map<String,Object> attrs=context.getAttributes();
  for (  Entry<String,Object> entry : attrs.entrySet()) {
    jsContext.setAttribute(entry.getKey(),entry.getValue());
  }
  context.setScriptContext(JavascriptEngineFactory.SCRIPT_JAVASCRIPT,jsContext);
  return jsContext;
}

Fixed version (ground truth):
private JavascriptContext createJsContext(ScriptContext context){
  ScriptContext parent=context.getParent();
  Scriptable parentJsScope=global;
  if (parent != null) {
    JavascriptContext parentJsContext=(JavascriptContext)parent.getScriptContext(JavascriptEngineFactory.SCRIPT_JAVASCRIPT);
    if (parentJsContext == null) {
      parentJsContext=createJsContext(parent);
    }
    parentJsScope=parentJsContext.getScope();
  }
  Object scope=context.getScopeObject();
  Scriptable jsScope=createJsScope(parentJsScope,scope);
  JavascriptContext jsContext=new JavascriptContext(context,jsScope);
  if (parent == null) {
    this.context.evaluateString(jsScope,"String_Node_Str","String_Node_Str",-1,null);
  }
  Map<String,Object> attrs=context.getAttributes();
  for (  Entry<String,Object> entry : attrs.entrySet()) {
    jsContext.setAttribute(entry.getKey(),entry.getValue());
  }
  context.setScriptContext(JavascriptEngineFactory.SCRIPT_JAVASCRIPT,jsContext);
  return jsContext;
}
Program: 68923
Project: 68923
Buggy source:
/** 
 * @param dimFilterList
 * @return
 * @throws IOException
 * @throws DataException
 */
private IDiskArray getDimFilterPositions(List dimFilterList) throws IOException, DataException {
  IDiskArray result=new BufferedPrimitiveDiskArray(Math.min(dimPosition.size(),Constants.LIST_BUFFER_SIZE));
  for (int i=0; i < dimPosition.size(); i++) {
    Integer pos=(Integer)dimPosition.get(i);
    if (isDimPositionSelected(pos.intValue(),dimFilterList))     result.add(pos);
  }
  return result;
}

Fixed version (ground truth):
/** 
 * @param dimFilterList
 * @return
 * @throws IOException
 * @throws DataException
 */
private IDiskArray getDimFilterPositions(List dimFilterList) throws IOException, DataException {
  IDiskArray result=new BufferedPrimitiveDiskArray(Math.min(dimPosition.size(),Constants.LIST_BUFFER_SIZE));
  for (int i=0; i < dimPosition.size(); i++) {
    Integer pos=(Integer)dimPosition.get(i);
    if (dimFilterList.size() == 0) {
      result.add(pos);
    }
 else     if (isDimPositionSelected(pos.intValue(),dimFilterList)) {
      result.add(pos);
    }
  }
  return result;
}
Program: 68924
Project: 68924
Buggy source:
public Object getAdapter(Class adapter){
  if (adapter == ActionRegistry.class) {
    return scriptEditor.getActionRegistry();
  }
 else   if (adapter == PalettePage.class) {
    if (cmbExprListViewer != null) {
      cmbExprListViewer.addSelectionChangedListener(palettePage.getSupport());
    }
    return palettePage;
  }
  if (adapter == IContentOutlinePage.class) {
    DesignerOutlinePage outlinePage=new DesignerOutlinePage(SessionHandleAdapter.getInstance().getReportDesignHandle());
    return outlinePage;
  }
  if (adapter == IPropertySheetPage.class) {
    ReportPropertySheetPage sheetPage=new ReportPropertySheetPage(SessionHandleAdapter.getInstance().getReportDesignHandle());
    return sheetPage;
  }
  if (adapter == DataViewPage.class) {
    DataViewTreeViewerPage page=new DataViewTreeViewerPage(SessionHandleAdapter.getInstance().getReportDesignHandle());
    return page;
  }
  if (adapter == AttributeViewPage.class) {
    AttributeViewPage page=new AttributeViewPage();
    return page;
  }
  if (adapter == ITextEditor.class) {
    return scriptEditor;
  }
  return super.getAdapter(adapter);
}

Fixed version (ground truth):
public Object getAdapter(Class adapter){
  if (adapter == ActionRegistry.class) {
    return scriptEditor.getActionRegistry();
  }
 else   if (adapter == PalettePage.class) {
    if (cmbExprListViewer != null) {
      cmbExprListViewer.addSelectionChangedListener(palettePage.getSupport());
    }
    palettePage.setViewer(getViewer());
    return palettePage;
  }
  if (adapter == IContentOutlinePage.class) {
    DesignerOutlinePage outlinePage=new DesignerOutlinePage(SessionHandleAdapter.getInstance().getReportDesignHandle());
    return outlinePage;
  }
  if (adapter == IPropertySheetPage.class) {
    ReportPropertySheetPage sheetPage=new ReportPropertySheetPage(SessionHandleAdapter.getInstance().getReportDesignHandle());
    return sheetPage;
  }
  if (adapter == DataViewPage.class) {
    DataViewTreeViewerPage page=new DataViewTreeViewerPage(SessionHandleAdapter.getInstance().getReportDesignHandle());
    return page;
  }
  if (adapter == AttributeViewPage.class) {
    AttributeViewPage page=new AttributeViewPage();
    return page;
  }
  if (adapter == ITextEditor.class) {
    return scriptEditor;
  }
  return super.getAdapter(adapter);
}
Program: 68925
Project: 68925
Buggy source:
/** 
 * Creates the palette viewer and its control.
 * @see Page#createControl(org.eclipse.swt.widgets.Composite)
 */
public void createControl(Composite parent){
  if (getViewer() == null) {
    return;
  }
  tree=new Tree(parent,SWT.NONE);
  treeCommon.setTree(tree);
  treeCommon.setExpressionViewer(getViewer());
  treeCommon.createDefaultExpressionTree();
  treeCommon.addMouseTrackListener();
  treeCommon.addMouseListener();
  treeCommon.addDragSupportToTree();
  treeCommon.addDropSupportToViewer();
  tree.setToolTipText("String_Node_Str");
  tree.addDisposeListener(new DisposeListener(){
    public void widgetDisposed(    DisposeEvent e){
      treeCommon.removeDropSupportToViewer();
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Creates the palette viewer and its control.
 * @see Page#createControl(org.eclipse.swt.widgets.Composite)
 */
public void createControl(Composite parent){
  tree=new Tree(parent,SWT.NONE);
  treeCommon.setTree(tree);
  treeCommon.setExpressionViewer(targetViewer);
  treeCommon.createDefaultExpressionTree();
  treeCommon.addMouseTrackListener();
  treeCommon.addMouseListener();
  treeCommon.addDragSupportToTree();
  treeCommon.addDropSupportToViewer();
  tree.setToolTipText("String_Node_Str");
  tree.addDisposeListener(new DisposeListener(){
    public void widgetDisposed(    DisposeEvent e){
      treeCommon.removeDropSupportToViewer();
    }
  }
);
}
Program: 68926
Project: 68926
Buggy source:
public Object getAdapter(Class adapter){
  if (adapter == ActionRegistry.class) {
    return jsEditor.getAdapter(ActionRegistry.class);
  }
  if (adapter == PalettePage.class) {
    return jsEditor.getAdapter(PalettePage.class);
  }
  if (adapter == IContentOutlinePage.class) {
    DesignerOutlinePage outlinePage=new DesignerOutlinePage(getModel());
    getModelEventManager().addModelEventProcessor(outlinePage.getModelProcessor());
    return outlinePage;
  }
  if (adapter == DataViewPage.class) {
    DataViewTreeViewerPage page=new DataViewTreeViewerPage(getModel());
    getModelEventManager().addModelEventProcessor(page.getModelProcessor());
    return page;
  }
  return jsEditor.getAdapter(adapter);
}

Fixed version (ground truth):
public Object getAdapter(Class adapter){
  if (adapter == ActionRegistry.class) {
    return jsEditor.getAdapter(ActionRegistry.class);
  }
  if (adapter == PalettePage.class) {
    return jsEditor.getAdapter(PalettePage.class);
  }
  if (adapter == IContentOutlinePage.class) {
    DesignerOutlinePage outlinePage=new DesignerOutlinePage(getModel());
    getModelEventManager().addModelEventProcessor(outlinePage.getModelProcessor());
    return outlinePage;
  }
  if (adapter == DataViewPage.class) {
    DataViewTreeViewerPage page=new DataViewTreeViewerPage(getModel());
    getModelEventManager().addModelEventProcessor(page.getModelProcessor());
    return page;
  }
  if (adapter == IPropertySheetPage.class) {
    ReportPropertySheetPage sheetPage=new ReportPropertySheetPage(getModel());
    return sheetPage;
  }
  return jsEditor.getAdapter(adapter);
}
Program: 68927
Project: 68927
Buggy source:
private void buildParameterTree(){
  for (Iterator iterator=SessionHandleAdapter.getInstance().getReportDesignHandle().getParameters().iterator(); iterator.hasNext(); ) {
    ReportElementHandle handle=(ReportElementHandle)iterator.next();
    if (handle instanceof ParameterHandle) {
      createSubTreeItem(parametersItem,DEUtil.getDisplayLabel(handle,false),ReportPlatformUIImages.getImage(handle),DEUtil.getExpression(handle),((ParameterHandle)handle).getHelpText(),true);
    }
 else     if (handle instanceof ParameterGroupHandle) {
      TreeItem groupItem=createSubTreeItem(parametersItem,DEUtil.getDisplayLabel(handle,false),ReportPlatformUIImages.getImage(handle),true);
      for (Iterator itor=((ParameterGroupHandle)handle).getParameters().iterator(); itor.hasNext(); ) {
        ParameterHandle parameter=(ParameterHandle)itor.next();
        createSubTreeItem(groupItem,parameter.getDisplayLabel(),ReportPlatformUIImages.getImage(handle),DEUtil.getExpression(parameter),parameter.getDisplayLabel(),true);
      }
    }
  }
}

Fixed version (ground truth):
private void buildParameterTree(){
  ModuleHandle module=SessionHandleAdapter.getInstance().getReportDesignHandle();
  if (module == null) {
    return;
  }
  for (Iterator iterator=module.getParameters().iterator(); iterator.hasNext(); ) {
    ReportElementHandle handle=(ReportElementHandle)iterator.next();
    if (handle instanceof ParameterHandle) {
      createSubTreeItem(parametersItem,DEUtil.getDisplayLabel(handle,false),ReportPlatformUIImages.getImage(handle),DEUtil.getExpression(handle),((ParameterHandle)handle).getHelpText(),true);
    }
 else     if (handle instanceof ParameterGroupHandle) {
      TreeItem groupItem=createSubTreeItem(parametersItem,DEUtil.getDisplayLabel(handle,false),ReportPlatformUIImages.getImage(handle),true);
      for (Iterator itor=((ParameterGroupHandle)handle).getParameters().iterator(); itor.hasNext(); ) {
        ParameterHandle parameter=(ParameterHandle)itor.next();
        createSubTreeItem(groupItem,parameter.getDisplayLabel(),ReportPlatformUIImages.getImage(handle),DEUtil.getExpression(parameter),parameter.getDisplayLabel(),true);
      }
    }
  }
}
Program: 68928
Project: 68928
Buggy source:
/** 
 * Update query by specified expression. <p> Under shared binding case, update grouping/aggregate attributes of chart model if the selected item is group/aggregate expression.
 */
public void updateQuery(String expression){
  if (getInputControl() instanceof CCombo) {
    String oldQuery=query.getDefinition() == null ? "String_Node_Str" : query.getDefinition();
    Object checkResult=context.getDataServiceProvider().checkData(queryType,expression);
    if (checkResult != null && checkResult instanceof Boolean) {
      if (!((Boolean)checkResult).booleanValue()) {
        setUIText(getInputControl(),oldQuery);
        return;
      }
    }
  }
  if (!isTableSharedBinding()) {
    setQueryExpression(expression);
    return;
  }
  updateQueryForSharedBinding(expression);
  String regex="String_Node_Str";
  if (expression.matches(regex)) {
    DataDefinitionTextManager.getInstance().updateControlBackground(getInputControl(),expression);
    final Event e=new Event();
    e.data=BaseDataDefinitionComponent.this;
    e.widget=getInputControl();
    e.type=IChartDataSheet.EVENT_QUERY;
    e.detail=IChartDataSheet.DETAIL_UPDATE_COLOR;
    Display.getCurrent().asyncExec(new Runnable(){
      public void run(){
        context.getDataSheet().notifyListeners(e);
      }
    }
);
  }
 else {
    getInputControl().setBackground(null);
  }
}

Fixed version (ground truth):
/** 
 * Update query by specified expression. <p> Under shared binding case, update grouping/aggregate attributes of chart model if the selected item is group/aggregate expression.
 */
public void updateQuery(String expression){
  if (getInputControl() instanceof CCombo) {
    String oldQuery=query.getDefinition() == null ? "String_Node_Str" : query.getDefinition();
    Object checkResult=context.getDataServiceProvider().checkData(queryType,expression);
    if (checkResult != null && checkResult instanceof Boolean) {
      if (!((Boolean)checkResult).booleanValue()) {
        setUIText(getInputControl(),oldQuery);
        return;
      }
    }
  }
  if (!isTableSharedBinding()) {
    setQueryExpression(expression);
    return;
  }
  updateQueryForSharedBinding(expression);
  String regex="String_Node_Str";
  if (expression.matches(regex)) {
    DataDefinitionTextManager.getInstance().updateText(query);
    final Event e=new Event();
    e.data=BaseDataDefinitionComponent.this;
    e.widget=getInputControl();
    e.type=IChartDataSheet.EVENT_QUERY;
    e.detail=IChartDataSheet.DETAIL_UPDATE_COLOR;
    Display.getCurrent().asyncExec(new Runnable(){
      public void run(){
        context.getDataSheet().notifyListeners(e);
      }
    }
);
  }
 else {
    getInputControl().setBackground(null);
  }
}
Program: 68929
Project: 68929
Buggy source:
/** 
 * Binding color to specified control.
 * @param control
 * @param expression
 * @since 2.5
 */
public void updateControlBackground(Control control,String expression){
  ColorPalette.getInstance().putColor(expression);
  control.setBackground(ColorPalette.getInstance().getColor(expression));
}

Fixed version (ground truth):
/** 
 * Binding color to specified control.
 * @param control
 * @param expression
 * @since 2.5
 */
private void updateControlBackground(Control control,String expression){
  ColorPalette.getInstance().putColor(expression);
  control.setBackground(ColorPalette.getInstance().getColor(expression));
}
Program: 68930
Project: 68930
Buggy source:
public void addDataDefinitionText(Control text,IQueryExpressionManager queryManager){
  textCollection.put(text,queryManager);
}

Fixed version (ground truth):
public void addDataDefinitionText(Control text,IQueryExpressionManager queryManager){
  textCollection.put(text,queryManager);
  text.addDisposeListener(new DisposeListener(){
    public void widgetDisposed(    DisposeEvent e){
      if (e.widget instanceof Control) {
        removeDataDefinitionText((Control)e.widget);
      }
    }
  }
);
}
Program: 68931
Project: 68931
Buggy source:
public void updateQuery(Control control){
  if (textCollection.containsKey(control)) {
    IQueryExpressionManager queryManager=textCollection.get(control);
    queryManager.updateQuery(ChartUIUtil.getText(control));
    adjustScaleData(queryManager.getQuery());
    updateControlBackground(control,ChartUIUtil.getText(control));
  }
}

Fixed version (ground truth):
public void updateQuery(Control control){
  if (textCollection.containsKey(control)) {
    IQueryExpressionManager queryManager=textCollection.get(control);
    queryManager.updateQuery(ChartUIUtil.getText(control));
    adjustScaleData(queryManager.getQuery());
    if (control.isDisposed()) {
      control=findText(queryManager.getQuery());
    }
    if (control != null) {
      updateControlBackground(control,ChartUIUtil.getText(control));
    }
  }
}
Program: 68932
Project: 68932
Buggy source:
private JavascriptContext createJsContext(ScriptContext context){
  ScriptContext parent=context.getParent();
  Scriptable parentJsScope=global;
  if (parent != null) {
    JavascriptContext parentJsContext=(JavascriptContext)parent.getScriptContext(JavascriptEngineFactory.SCRIPT_JAVASCRIPT);
    if (parentJsContext == null) {
      parentJsContext=createJsContext(parent);
    }
    parentJsScope=parentJsContext.getScope();
  }
  Object scope=context.getScopeObject();
  Scriptable jsScope=createJsScope(parentJsScope,scope);
  JavascriptContext jsContext=new JavascriptContext(context,jsScope);
  if (parent == null) {
    this.context.evaluateString(jsScope,"String_Node_Str","String_Node_Str",-1,null);
  }
  Map<String,Object> attrs=context.getAttributes();
  for (  Entry<String,Object> entry : attrs.entrySet()) {
    jsContext.setAttribute(entry.getKey(),entry.getValue());
  }
  context.setScriptContext(JavascriptEngineFactory.SCRIPT_JAVASCRIPT,jsContext);
  return jsContext;
}

Fixed version (ground truth):
private JavascriptContext createJsContext(ScriptContext context){
  ScriptContext parent=context.getParent();
  Scriptable parentJsScope=global;
  if (parent != null) {
    JavascriptContext parentJsContext=(JavascriptContext)parent.getScriptContext(JavascriptEngineFactory.SCRIPT_JAVASCRIPT);
    if (parentJsContext == null) {
      parentJsContext=createJsContext(parent);
    }
    parentJsScope=parentJsContext.getScope();
  }
  Object scope=context.getScopeObject();
  Scriptable jsScope=createJsScope(parentJsScope,scope);
  JavascriptContext jsContext=new JavascriptContext(context,jsScope);
  if (parent == null) {
    this.context.evaluateString(jsScope,"String_Node_Str","String_Node_Str",1,null);
  }
  Map<String,Object> attrs=context.getAttributes();
  for (  Entry<String,Object> entry : attrs.entrySet()) {
    jsContext.setAttribute(entry.getKey(),entry.getValue());
  }
  context.setScriptContext(JavascriptEngineFactory.SCRIPT_JAVASCRIPT,jsContext);
  return jsContext;
}
Program: 68934
Project: 68934
Buggy source:
/** 
 * Returns if the current region contains given x,y.
 * @param x
 * @param y
 * @param gc
 * @return if the current region contains given x,y
 */
public boolean contains(double x,double y,GC gc){
  if (_bb != null) {
    return _bb.contains((int)x,(int)y);
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Returns if the current region contains given x,y.
 * @param x
 * @param y
 * @param gc
 * @return if the current region contains given x,y
 */
public boolean contains(double x,double y,GC gc){
  if (region != null) {
    return region.contains((int)x,(int)y);
  }
  return false;
}
Program: 68935
Project: 68935
Buggy source:
/** 
 * Returns if current region is empty.
 * @return if current region is empty
 */
public boolean isEmpty(){
  if (_bb != null) {
    return _bb.isEmpty();
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Returns if current region is empty.
 * @return if current region is empty
 */
public boolean isEmpty(){
  if (region != null) {
    return region.isEmpty();
  }
  return true;
}
Program: 68936
Project: 68936
Buggy source:
/** 
 * This constructor supports shape definition via an elliptical arc
 * @param oSource
 * @param boEllipse
 * @param dStart
 * @param dExtent
 * @param iArcType
 * @param ac
 */
RegionAction(StructureSource oSource,Bounds boEllipse,double dStart,double dExtent,boolean bSector,Action ac,double dTranslateX,double dTranslateY,double dScale,Region clipping){
  _oSource=oSource;
  boEllipse=goFactory.copyOf(boEllipse);
  boEllipse.translate(dTranslateX,dTranslateY);
  boEllipse.scale(dScale);
  double x=boEllipse.getLeft();
  double y=boEllipse.getTop();
  double width=boEllipse.getWidth();
  double height=boEllipse.getHeight();
  Path ph=new Path(Display.getDefault());
  ph.addArc((float)x,(float)y,(float)width,(float)height,(float)dStart,(float)dExtent);
  if (bSector) {
    ph.lineTo((float)(x + width / 2),(float)(y + height / 2));
  }
  ph.close();
  if (clipping != null) {
  }
  _ac=ac;
  float[] b=new float[4];
  ph.getBounds(b);
  _bb=new Rectangle((int)b[0],(int)b[1],(int)b[2],(int)b[3]);
  ph.dispose();
}

Fixed version (ground truth):
/** 
 * This constructor supports shape definition via an elliptical arc
 * @param oSource
 * @param boEllipse
 * @param dStart
 * @param dExtent
 * @param iArcType
 * @param ac
 */
RegionAction(StructureSource oSource,Bounds boEllipse,double dStart,double dExtent,int iArcType,Action ac,double dTranslateX,double dTranslateY,double dScale,Region clipping){
  _oSource=oSource;
  boEllipse=goFactory.copyOf(boEllipse);
  boEllipse.translate(dTranslateX,dTranslateY);
  boEllipse.scale(dScale);
  Shape shape=new Arc2D.Double(boEllipse.getLeft(),boEllipse.getTop(),boEllipse.getWidth(),boEllipse.getHeight(),dStart,dExtent,toSwingArcType(iArcType));
  int[] i2a=shape2polyCoords(shape);
  Region sh=new Region();
  sh.add(i2a);
  if (clipping != null) {
    sh.intersect(clipping);
  }
  _ac=ac;
  this.region=sh;
}
Program: 68937
Project: 68937
Buggy source:
/** 
 * Dispose the resources.
 */
public void dispose(){
}

Fixed version (ground truth):
/** 
 * Dispose the resources.
 */
public void dispose(){
  if (region != null) {
    region.dispose();
  }
}
Program: 68938
Project: 68938
Buggy source:
/** 
 * Note the Region object is value copied, others are just reference copy. <b>The invoker must call <code>dispose()</code> explicitly when this is not used anymore</b>.
 * @return A copy of current RegionAction
 */
public RegionAction copy(){
  Rectangle nbb=null;
  if (_bb != null) {
    nbb=new Rectangle(_bb.x,_bb.y,_bb.width,_bb.height);
  }
  return new RegionAction(_oSource,nbb,_ac);
}

Fixed version (ground truth):
/** 
 * Note the Region object is value copied, others are just reference copy. <b>The invoker must call <code>dispose()</code> explicitly when this is not used anymore</b>.
 * @return A copy of current RegionAction
 */
public RegionAction copy(){
  return new RegionAction(_oSource,region,_ac);
}
Program: 68940
Project: 68940
Buggy source:
public void testExecute() throws Exception {
  Document doc=getDomTree();
  HashMap styles=new HashMap();
  new HTMLProcessor((ReportDesignHandle)null,null).execute((Element)doc.getFirstChild(),styles);
  Element iEle=(Element)doc.getFirstChild().getFirstChild();
  assertEquals(iEle.getTagName(),"String_Node_Str");
  assertEquals("String_Node_Str",getStyle(styles,iEle,"String_Node_Str"));
  Element fontEle=(Element)iEle.getNextSibling();
  assertEquals(fontEle.getTagName(),"String_Node_Str");
  assertEquals("String_Node_Str",getStyle(styles,fontEle,"String_Node_Str"));
  assertEquals("String_Node_Str",getStyle(styles,fontEle,"String_Node_Str"));
  assertEquals("String_Node_Str",getStyle(styles,fontEle,"String_Node_Str"));
  Element uEle=(Element)fontEle.getNextSibling();
  assertEquals(uEle.getTagName(),"String_Node_Str");
  assertEquals("String_Node_Str",getStyle(styles,uEle,"String_Node_Str"));
}

Fixed version (ground truth):
public void testExecute() throws Exception {
  Document doc=getDomTree();
  HashMap styles=new HashMap();
  new HTMLProcessor((ReportDesignHandle)null,null).execute((Element)doc.getFirstChild(),styles);
  Element iEle=(Element)doc.getFirstChild().getFirstChild();
  assertEquals(iEle.getTagName(),"String_Node_Str");
  assertEquals("String_Node_Str",getStyle(styles,iEle,"String_Node_Str"));
  Element fontEle=(Element)iEle.getNextSibling();
  assertEquals(fontEle.getTagName(),"String_Node_Str");
  assertEquals("String_Node_Str",getStyleAttribute(fontEle,"String_Node_Str"));
  assertEquals("String_Node_Str",getStyleAttribute(fontEle,"String_Node_Str"));
  assertEquals("String_Node_Str",getStyleAttribute(fontEle,"String_Node_Str"));
  Element uEle=(Element)fontEle.getNextSibling();
  assertEquals(uEle.getTagName(),"String_Node_Str");
  assertEquals("String_Node_Str",getStyle(styles,uEle,"String_Node_Str"));
}
Program: 68942
Project: 68942
Buggy source:
private void setFont(String psName,float size){
  out.println("String_Node_Str" + psName + "String_Node_Str"+ size+ "String_Node_Str");
}

Fixed version (ground truth):
private void setFont(String font,float size){
  if (needSetFont(font,size)) {
    setCurrentGraphic(font,size);
    out.println("String_Node_Str" + font + "String_Node_Str"+ size+ "String_Node_Str");
  }
}
Program: 68943
Project: 68943
Buggy source:
private String applyFont(String fontName,int fontStyle,float fontSize,String text){
  if (isIntrinsicFont(fontName)) {
    return applyIntrinsicFont(fontName,fontStyle,fontSize,text);
  }
 else {
    try {
      String fontPath=getFontPath(fontName);
      if (fontPath == null) {
        return applyIntrinsicFont(fontName,fontStyle,fontSize,text);
      }
      ITrueTypeWriter trueTypeWriter=getTrueTypeFontWriter(fontPath);
      String displayName=fontName.replace(' ','_');
      trueTypeWriter.useDisplayName(displayName);
      trueTypeWriter.ensureGlyphsAvailable(text);
      setFont(displayName,fontSize);
      return trueTypeWriter.toHexString(text);
    }
 catch (    Exception e) {
      log.log(Level.WARNING,"String_Node_Str" + fontName);
    }
    return null;
  }
}

Fixed version (ground truth):
private String applyFont(String fontName,int fontStyle,float fontSize,String text){
  if (isIntrinsicFont(fontName)) {
    return applyIntrinsicFont(fontName,fontStyle,fontSize,text);
  }
 else {
    try {
      String fontPath=getFontPath(fontName);
      if (fontPath == null) {
        return applyIntrinsicFont(fontName,fontStyle,fontSize,text);
      }
      ITrueTypeWriter trueTypeWriter=getTrueTypeFontWriter(fontPath,fontName);
      trueTypeWriter.ensureGlyphsAvailable(text);
      String displayName=trueTypeWriter.getDisplayName();
      setFont(displayName,fontSize);
      return trueTypeWriter.toHexString(text);
    }
 catch (    Exception e) {
      log.log(Level.WARNING,"String_Node_Str" + fontName);
    }
    return null;
  }
}
Program: 68944
Project: 68944
Buggy source:
private void outputColor(Color c){
  if (c == null) {
    return;
  }
  out.print(c.getRed() / 255.0);
  out.print("String_Node_Str");
  out.print(c.getGreen() / 255.0);
  out.print("String_Node_Str");
  out.print(c.getBlue() / 255.0);
  out.print("String_Node_Str");
}

Fixed version (ground truth):
private void outputColor(Color c){
  if (c == null) {
    c=Color.black;
  }
  Graphic currentGraphic=getCurrentGraphic();
  if (c.equals(currentGraphic.color)) {
    return;
  }
  currentGraphic.color=c;
  out.print(c.getRed() / 255.0);
  out.print("String_Node_Str");
  out.print(c.getGreen() / 255.0);
  out.print("String_Node_Str");
  out.print(c.getBlue() / 255.0);
  out.print("String_Node_Str");
  out.println("String_Node_Str");
}
Program: 68945
Project: 68945
Buggy source:
public void clipRestore(){
  out.println("String_Node_Str");
}

Fixed version (ground truth):
public void clipRestore(){
  out.println("String_Node_Str");
  graphics.pop();
}
Program: 68946
Project: 68946
Buggy source:
public void drawString(String str,float x,float y,FontInfo fontInfo,float letterSpacing,float wordSpacing,Color color,boolean linethrough,boolean overline,boolean underline,CSSValue align){
  y=transformY(y);
  String text=str;
  String drawCommand="String_Node_Str";
  boolean needSimulateItalic=false;
  if (fontInfo != null) {
    float fontSize=fontInfo.getFontSize();
    int fontStyle=fontInfo.getFontStyle();
    if (fontInfo.getSimulation()) {
      if (fontStyle == Font.BOLD || fontStyle == Font.BOLDITALIC) {
        float offset=(float)(fontSize * Math.log10(fontSize) / 100);
        drawCommand=offset + "String_Node_Str";
      }
      if (fontStyle == Font.ITALIC || fontStyle == Font.BOLDITALIC) {
        needSimulateItalic=true;
      }
    }
    BaseFont baseFont=fontInfo.getBaseFont();
    String fontName=baseFont.getPostscriptFontName();
    text=applyFont(fontName,fontStyle,fontSize,text);
  }
  color=color == null ? Color.black : color;
  outputColor(color);
  out.print(x + "String_Node_Str" + y+ "String_Node_Str");
  out.print(wordSpacing + "String_Node_Str" + letterSpacing+ "String_Node_Str");
  out.println(text + "String_Node_Str" + needSimulateItalic+ "String_Node_Str"+ drawCommand);
}

Fixed version (ground truth):
public void drawString(String str,float x,float y,FontInfo fontInfo,float letterSpacing,float wordSpacing,Color color,boolean linethrough,boolean overline,boolean underline,CSSValue align){
  y=transformY(y);
  String text=str;
  boolean needSimulateItalic=false;
  boolean needSimulateBold=false;
  boolean hasSpace=wordSpacing != 0 || letterSpacing != 0;
  float offset=0;
  if (fontInfo != null) {
    float fontSize=fontInfo.getFontSize();
    int fontStyle=fontInfo.getFontStyle();
    if (fontInfo.getSimulation()) {
      if (fontStyle == Font.BOLD || fontStyle == Font.BOLDITALIC) {
        offset=(float)(fontSize * Math.log10(fontSize) / 100);
        needSimulateBold=true;
      }
      if (fontStyle == Font.ITALIC || fontStyle == Font.BOLDITALIC) {
        needSimulateItalic=true;
      }
    }
    BaseFont baseFont=fontInfo.getBaseFont();
    String fontName=baseFont.getPostscriptFontName();
    text=applyFont(fontName,fontStyle,fontSize,text);
  }
  outputColor(color);
  out.print(x + "String_Node_Str" + y+ "String_Node_Str");
  if (hasSpace)   out.print(wordSpacing + "String_Node_Str" + letterSpacing+ "String_Node_Str");
  out.print(text + "String_Node_Str");
  if (needSimulateBold)   out.print(offset + "String_Node_Str");
  String command=getCommand(hasSpace,needSimulateBold,needSimulateItalic);
  out.println(command);
}
Program: 68947
Project: 68947
Buggy source:
public void clipSave(){
  out.println("String_Node_Str");
}

Fixed version (ground truth):
public void clipSave(){
  out.println("String_Node_Str");
  graphics.push(new Graphic());
}
Program: 68948
Project: 68948
Buggy source:
private ITrueTypeWriter getTrueTypeFontWriter(String fontPath) throws DocumentException, IOException {
  File file=new File(fontPath);
  ITrueTypeWriter trueTypeWriter=(ITrueTypeWriter)trueTypeFontWriters.get(file);
  if (trueTypeWriter != null) {
    return trueTypeWriter;
  }
 else {
    TrueTypeFont ttFont=TrueTypeFont.getInstance(fontPath);
    trueTypeWriter=ttFont.getTrueTypeWriter(out);
    trueTypeWriter.initialize();
    trueTypeFontWriters.put(file,trueTypeWriter);
    return trueTypeWriter;
  }
}

Fixed version (ground truth):
private ITrueTypeWriter getTrueTypeFontWriter(String fontPath,String fontName) throws DocumentException, IOException {
  File file=new File(fontPath);
  ITrueTypeWriter trueTypeWriter=(ITrueTypeWriter)trueTypeFontWriters.get(file);
  if (trueTypeWriter != null) {
    return trueTypeWriter;
  }
 else {
    TrueTypeFont ttFont=TrueTypeFont.getInstance(fontPath);
    trueTypeWriter=ttFont.getTrueTypeWriter(out);
    trueTypeWriter.initialize(fontName);
    trueTypeFontWriters.put(file,trueTypeWriter);
    return trueTypeWriter;
  }
}
Program: 68949
Project: 68949
Buggy source:
public void setColor(Color c){
  outputColor(c);
  out.println("String_Node_Str");
}

Fixed version (ground truth):
public void setColor(Color c){
  outputColor(c);
}
Program: 68950
Project: 68950
Buggy source:
/** 
 * Gets the name of this element. The returned element name will be the same as <CODE>getName()</CODE>, plus the namespace of the module that the element is contained, if the element name resides in the whole design tree scope; otherwise we will append the name of the holder where the element name resides. If the element is existed in the current module,this method and <CODE>getName()</CODE> will return identical results.
 * @return the qualified name of the element.
 */
public String getQualifiedName(){
  String name=getElement().getFullName();
  if (name == null)   return null;
  Module rootElement=getElement().getRoot();
  if (rootElement instanceof Library) {
    String namespace=((Library)rootElement).getNamespace();
    return StringUtil.buildQualifiedReference(namespace,name);
  }
  return name;
}

Fixed version (ground truth):
/** 
 * Gets the name of this element. The returned element name will be the same as <CODE>getName()</CODE>, plus the namespace of the module that the element is contained, if the element name resides in the whole design tree scope; otherwise we will append the name of the holder where the element name resides. If the element is existed in the current module,this method and <CODE>getName()</CODE> will return identical results.
 * @return the qualified name of the element.
 */
public String getQualifiedName(){
  String name=getElement().getFullName();
  if (name == null)   return null;
  Module rootElement=getElement().getRoot();
  String namespace=rootElement.getNamespace();
  return StringUtil.buildQualifiedReference(namespace,name);
}
Program: 68951
Project: 68951
Buggy source:
private double getContentHeight(IContent content){
  return content.getHeight() == null ? 0 : ExcelUtil.covertDimensionType(content.getHeight(),0);
}

Fixed version (ground truth):
private double getContentHeight(IContent content){
  return content.getHeight() == null ? 0 : ExcelUtil.covertDimensionType(content.getHeight(),0) / 1000;
}
Program: 68952
Project: 68952
Buggy source:
public void endRow(IRowContent row){
  DimensionType height=row.getHeight();
  double rowHeight=height != null ? ExcelUtil.covertDimensionType(height,0) : 0;
  engine.endRow(rowHeight);
}

Fixed version (ground truth):
public void endRow(IRowContent row){
  DimensionType height=row.getHeight();
  double rowHeight=height != null ? ExcelUtil.covertDimensionType(height,0) / 1000 : 0;
  engine.endRow(rowHeight);
}
Program: 68953
Project: 68953
Buggy source:
public static int covertDimensionType(DimensionType value,int parent){
  if (DimensionType.UNITS_PERCENTAGE.equals(value.getUnits())) {
    return (int)(value.getMeasure() / 100 * parent);
  }
  if (DimensionType.UNITS_PX.equalsIgnoreCase(value.getUnits())) {
    return (int)(value.getMeasure() * PX_PT);
  }
  if (DimensionType.UNITS_EM.equalsIgnoreCase(value.getUnits()) || DimensionType.UNITS_EX.equalsIgnoreCase(value.getUnits())) {
    return (int)value.getMeasure() * 12;
  }
 else {
    return (int)(value.convertTo(DimensionType.UNITS_PT));
  }
}

Fixed version (ground truth):
public static int covertDimensionType(DimensionType value,int parent){
  if (DimensionType.UNITS_PERCENTAGE.equals(value.getUnits())) {
    return (int)(value.getMeasure() / 100 * parent * 1000);
  }
  if (DimensionType.UNITS_PX.equalsIgnoreCase(value.getUnits())) {
    return (int)(value.getMeasure() * PX_PT * 1000);
  }
  if (DimensionType.UNITS_EM.equalsIgnoreCase(value.getUnits()) || DimensionType.UNITS_EX.equalsIgnoreCase(value.getUnits())) {
    return (int)(value.getMeasure() * 12 * 1000);
  }
 else {
    return (int)(value.convertTo(DimensionType.UNITS_PT) * 1000);
  }
}
Program: 68954
Project: 68954
Buggy source:
public void outputColumns(int[] width){
  writer.openTag("String_Node_Str");
  if (width == null) {
    return;
  }
  for (int i=0; i < width.length; i++) {
    writer.openTag("String_Node_Str");
    writer.attribute("String_Node_Str",width[i]);
    writer.closeTag("String_Node_Str");
  }
}

Fixed version (ground truth):
public void outputColumns(int[] width){
  writer.openTag("String_Node_Str");
  if (width == null) {
    return;
  }
  for (int i=0; i < width.length; i++) {
    writer.openTag("String_Node_Str");
    writer.attribute("String_Node_Str",width[i] / 1000);
    writer.closeTag("String_Node_Str");
  }
}
Program: 68955
Project: 68955
Buggy source:
private static int resize(int width,int total,int left){
  return (int)(width + (float)width / (float)total * left);
}

Fixed version (ground truth):
private static int resize(int width,int total,int left){
  return Math.round(width + (float)width / (float)total * left);
}