nus-yam/ex-repair huggingface dataset:
Program: 76313
Project: 76313
Buggy source:
public void testInteger3() throws IOException {
  BlockRandomAccessObject documentObject=new BlockRandomAccessObject(new BufferedRandomAccessFile(new File("String_Node_Str"),"String_Node_Str",1024),"String_Node_Str",0,0,new DocumentObjectAllocatedTable());
  byte[] bytes=new byte[1024];
  bytes[0]=1;
  bytes[1]=2;
  documentObject.seek(0);
  documentObject.write(bytes,0,bytes.length);
  documentObject.write(bytes,0,bytes.length);
  documentObject.write(bytes,0,bytes.length);
  bytes=new byte[932];
  documentObject.write(bytes,0,bytes.length);
  assertEquals(documentObject.read(bytes,0,bytes.length),-1);
  documentObject.close();
}

Fixed version (ground truth):
public void testInteger3() throws IOException {
  BlockRandomAccessObject documentObject=new BlockRandomAccessObject(new BufferedRandomAccessFile(new File(tmpPath + File.separatorChar + "String_Node_Str"),"String_Node_Str",1024),"String_Node_Str",0,0,new DocumentObjectAllocatedTable());
  byte[] bytes=new byte[1024];
  bytes[0]=1;
  bytes[1]=2;
  documentObject.seek(0);
  documentObject.write(bytes,0,bytes.length);
  documentObject.write(bytes,0,bytes.length);
  documentObject.write(bytes,0,bytes.length);
  bytes=new byte[932];
  documentObject.write(bytes,0,bytes.length);
  assertEquals(documentObject.read(bytes,0,bytes.length),-1);
  documentObject.close();
}
Program: 76314
Project: 76314
Buggy source:
public void testInteger1() throws IOException {
  int objectNumber=1001;
  BufferedRandomDataAccessObject documentObject=new BufferedRandomDataAccessObject(new SimpleRandomAccessObject(new File("String_Node_Str"),"String_Node_Str"),1024);
  for (int i=0; i < objectNumber; i++) {
    documentObject.writeInt(i);
  }
  documentObject.seek(0);
  for (int i=0; i < objectNumber; i++) {
    assertEquals(documentObject.readInt(),i);
  }
  documentObject.seek(400);
  assertEquals(documentObject.readInt(),100);
  documentObject.seek(804);
  assertEquals(documentObject.readInt(),201);
  assertEquals(documentObject.readInt(),202);
  documentObject.seek(2804);
  documentObject.writeInt(1000001);
  assertEquals(documentObject.readInt(),702);
  documentObject.seek(2804);
  assertEquals(documentObject.readInt(),1000001);
  documentObject.close();
}

Fixed version (ground truth):
public void testInteger1() throws IOException {
  int objectNumber=1001;
  BufferedRandomDataAccessObject documentObject=new BufferedRandomDataAccessObject(new SimpleRandomAccessObject(new File(tmpPath + File.separatorChar + "String_Node_Str"),"String_Node_Str"),1024);
  for (int i=0; i < objectNumber; i++) {
    documentObject.writeInt(i);
  }
  documentObject.seek(0);
  for (int i=0; i < objectNumber; i++) {
    assertEquals(documentObject.readInt(),i);
  }
  documentObject.seek(400);
  assertEquals(documentObject.readInt(),100);
  documentObject.seek(804);
  assertEquals(documentObject.readInt(),201);
  assertEquals(documentObject.readInt(),202);
  documentObject.seek(2804);
  documentObject.writeInt(1000001);
  assertEquals(documentObject.readInt(),702);
  documentObject.seek(2804);
  assertEquals(documentObject.readInt(),1000001);
  documentObject.close();
}
Program: 76315
Project: 76315
Buggy source:
public void testInteger() throws IOException {
  int objectNumber=1001;
  BufferedRandomAccessFile file=new BufferedRandomAccessFile(new File("String_Node_Str"),"String_Node_Str",1000);
  for (int i=0; i < objectNumber; i++) {
    file.writeInt(i);
  }
  file.seek(0);
  for (int i=0; i < objectNumber; i++) {
    assertEquals(file.readInt(),i);
  }
  file.seek(400);
  assertEquals(file.readInt(),100);
  file.seek(804);
  assertEquals(file.readInt(),201);
  assertEquals(file.readInt(),202);
  file.seek(2804);
  file.writeInt(1000001);
  assertEquals(file.readInt(),702);
  file.seek(2804);
  assertEquals(file.readInt(),1000001);
  file.close();
}

Fixed version (ground truth):
public void testInteger() throws IOException {
  int objectNumber=1001;
  BufferedRandomAccessFile file=new BufferedRandomAccessFile(new File(tmpPath + File.separatorChar + "String_Node_Str"),"String_Node_Str",1000);
  for (int i=0; i < objectNumber; i++) {
    file.writeInt(i);
  }
  file.seek(0);
  for (int i=0; i < objectNumber; i++) {
    assertEquals(file.readInt(),i);
  }
  file.seek(400);
  assertEquals(file.readInt(),100);
  file.seek(804);
  assertEquals(file.readInt(),201);
  assertEquals(file.readInt(),202);
  file.seek(2804);
  file.writeInt(1000001);
  assertEquals(file.readInt(),702);
  file.seek(2804);
  assertEquals(file.readInt(),1000001);
  file.close();
}
Program: 76316
Project: 76316
Buggy source:
public void testString() throws IOException {
  int objectNumber=3000;
  BufferedRandomAccessFile file=new BufferedRandomAccessFile(new File("String_Node_Str"),"String_Node_Str",1000);
  for (int i=0; i < objectNumber; i++) {
    file.writeUTF("String_Node_Str" + i);
  }
  file.seek(0);
  for (int i=0; i < objectNumber; i++) {
    assertEquals(file.readUTF(),"String_Node_Str" + i);
  }
  file.close();
}

Fixed version (ground truth):
public void testString() throws IOException {
  int objectNumber=3000;
  BufferedRandomAccessFile file=new BufferedRandomAccessFile(new File(tmpPath + File.separatorChar + "String_Node_Str"),"String_Node_Str",1000);
  for (int i=0; i < objectNumber; i++) {
    file.writeUTF("String_Node_Str" + i);
  }
  file.seek(0);
  for (int i=0; i < objectNumber; i++) {
    assertEquals(file.readUTF(),"String_Node_Str" + i);
  }
  file.close();
}
Program: 76317
Project: 76317
Buggy source:
public void testBytes() throws IOException {
  BufferedRandomAccessFile file=new BufferedRandomAccessFile(new File("String_Node_Str"),"String_Node_Str",1000);
  byte[] bytes=new byte[1024];
  bytes[0]=1;
  bytes[1]=2;
  file.seek(0);
  file.write(bytes,0,bytes.length);
  file.write(bytes,0,bytes.length);
  file.write(bytes,0,bytes.length);
  bytes=new byte[932];
  file.write(bytes,0,bytes.length);
  bytes=new byte[1024];
  file.seek(0);
  assertEquals(file.read(bytes,0,bytes.length),1024);
  assertEquals(bytes[0],1);
  assertEquals(bytes[1],2);
  file.close();
}

Fixed version (ground truth):
public void testBytes() throws IOException {
  BufferedRandomAccessFile file=new BufferedRandomAccessFile(new File(tmpPath + File.separatorChar + "String_Node_Str"),"String_Node_Str",1000);
  byte[] bytes=new byte[1024];
  bytes[0]=1;
  bytes[1]=2;
  file.seek(0);
  file.write(bytes,0,bytes.length);
  file.write(bytes,0,bytes.length);
  file.write(bytes,0,bytes.length);
  bytes=new byte[932];
  file.write(bytes,0,bytes.length);
  bytes=new byte[1024];
  file.seek(0);
  assertEquals(file.read(bytes,0,bytes.length),1024);
  assertEquals(bytes[0],1);
  assertEquals(bytes[1],2);
  file.close();
}
Program: 76318
Project: 76318
Buggy source:
public void testBigDecimal() throws IOException {
  int objectNumber=3000;
  BufferedRandomAccessFile file=new BufferedRandomAccessFile(new File("String_Node_Str"),"String_Node_Str",1000);
  for (int i=0; i < objectNumber; i++) {
    file.writeBigDecimal(new BigDecimal("String_Node_Str" + i));
  }
  file.seek(0);
  for (int i=0; i < objectNumber; i++) {
    assertEquals(file.readBigDecimal(),new BigDecimal("String_Node_Str" + i));
  }
  file.close();
}

Fixed version (ground truth):
public void testBigDecimal() throws IOException {
  int objectNumber=3000;
  BufferedRandomAccessFile file=new BufferedRandomAccessFile(new File(tmpPath + File.separatorChar + "String_Node_Str"),"String_Node_Str",1000);
  for (int i=0; i < objectNumber; i++) {
    file.writeBigDecimal(new BigDecimal("String_Node_Str" + i));
  }
  file.seek(0);
  for (int i=0; i < objectNumber; i++) {
    assertEquals(file.readBigDecimal(),new BigDecimal("String_Node_Str" + i));
  }
  file.close();
}
Program: 76319
Project: 76319
Buggy source:
public void testDate() throws IOException {
  int objectNumber=4101;
  BufferedRandomAccessFile file=new BufferedRandomAccessFile(new File("String_Node_Str"),"String_Node_Str",1000);
  for (int i=0; i < objectNumber; i++) {
    file.writeDate(new Date(1900100000 + i * 1000));
  }
  file.seek(0);
  for (int i=0; i < objectNumber; i++) {
    assertEquals(file.readDate(),new Date(1900100000 + i * 1000));
  }
  file.close();
}

Fixed version (ground truth):
public void testDate() throws IOException {
  int objectNumber=4101;
  BufferedRandomAccessFile file=new BufferedRandomAccessFile(new File(tmpPath + File.separatorChar + "String_Node_Str"),"String_Node_Str",1000);
  for (int i=0; i < objectNumber; i++) {
    file.writeDate(new Date(1900100000 + i * 1000));
  }
  file.seek(0);
  for (int i=0; i < objectNumber; i++) {
    assertEquals(file.readDate(),new Date(1900100000 + i * 1000));
  }
  file.close();
}
Program: 76320
Project: 76320
Buggy source:
public void testMixed() throws IOException {
  int objectNumber=1001;
  BufferedRandomAccessFile file=new BufferedRandomAccessFile(new File("String_Node_Str"),"String_Node_Str",1000);
  for (int i=0; i < objectNumber; i++) {
    file.writeInt(i);
  }
  file.seek(0);
  for (int i=0; i < objectNumber; i++) {
    assertEquals(file.readInt(),i);
  }
  file.writeBigDecimal(new BigDecimal("String_Node_Str"));
  file.writeDate(new Date(12202000));
  file.writeUTF("String_Node_Str");
  file.writeShort(1300);
  file.writeLong(300000111l);
  file.seek(0);
  file.skipBytes(objectNumber * 4);
  assertEquals(file.readBigDecimal(),new BigDecimal("String_Node_Str"));
  assertEquals(file.readDate(),new Date(12202000));
  assertEquals(file.readUTF(),"String_Node_Str");
  assertEquals(file.readShort(),1300);
  assertEquals(file.readLong(),300000111l);
}

Fixed version (ground truth):
public void testMixed() throws IOException {
  int objectNumber=1001;
  BufferedRandomAccessFile file=new BufferedRandomAccessFile(new File(tmpPath + File.separatorChar + "String_Node_Str"),"String_Node_Str",1000);
  for (int i=0; i < objectNumber; i++) {
    file.writeInt(i);
  }
  file.seek(0);
  for (int i=0; i < objectNumber; i++) {
    assertEquals(file.readInt(),i);
  }
  file.writeBigDecimal(new BigDecimal("String_Node_Str"));
  file.writeDate(new Date(12202000));
  file.writeUTF("String_Node_Str");
  file.writeShort(1300);
  file.writeLong(300000111l);
  file.seek(0);
  file.skipBytes(objectNumber * 4);
  assertEquals(file.readBigDecimal(),new BigDecimal("String_Node_Str"));
  assertEquals(file.readDate(),new Date(12202000));
  assertEquals(file.readUTF(),"String_Node_Str");
  assertEquals(file.readShort(),1300);
  assertEquals(file.readLong(),300000111l);
}
Program: 76321
Project: 76321
Buggy source:
public void ensureGlyphAvailable(char c) throws IOException {
  Character character=new Character(c);
  if (!glyphDefined.contains(character)) {
    glyphDefined.add(character);
    out.print(((int)c) + "String_Node_Str");
    out.print(getGlyphIndex(c));
    outputAsPsString(out,getGlyphData(c));
    out.println("String_Node_Str" + fontName + "String_Node_Str");
  }
}

Fixed version (ground truth):
public void ensureGlyphAvailable(char c) throws IOException {
  List charactersToOutput=getCharactersToOutput(c);
  for (int i=0; i < charactersToOutput.size(); i++) {
    ensureRawDataAvailable(((Character)charactersToOutput.get(i)).charValue());
  }
  ensureRawDataAvailable(c);
}
Program: 76322
Project: 76322
Buggy source:
private byte[] getGlyphData(char c) throws IOException {
  int[] tableLocation=(int[])positionTables.get("String_Node_Str");
  int glyphIndex=getGlyphIndex(c);
  int offset=tableLocation[0] + head.locaBytesPerEntry * glyphIndex;
  rf.seek(offset);
  int dataOffsetRelativeToGlyfTable, dataLength;
  if (head.locaBytesPerEntry == 4) {
    dataOffsetRelativeToGlyfTable=rf.readInt();
    dataLength=rf.readInt() - dataOffsetRelativeToGlyfTable;
  }
 else {
    dataOffsetRelativeToGlyfTable=rf.readUnsignedShort() * 2;
    dataLength=rf.readUnsignedShort() * 2 - dataOffsetRelativeToGlyfTable;
  }
  int[] glyphLocation=(int[])positionTables.get("String_Node_Str");
  int dataOffset=dataOffsetRelativeToGlyfTable + glyphLocation[0];
  byte[] result=new byte[dataLength];
  rf.seek(dataOffset);
  rf.readFully(result);
  return result;
}

Fixed version (ground truth):
private byte[] getGlyphData(char c) throws IOException {
  int dataOffsetRelativeToGlyfTable, dataLength;
  int[] glyphDataPosition=getGlyphDataPosition(c);
  dataOffsetRelativeToGlyfTable=glyphDataPosition[0];
  dataLength=glyphDataPosition[1];
  int[] glyphLocation=(int[])positionTables.get("String_Node_Str");
  int dataOffset=dataOffsetRelativeToGlyfTable + glyphLocation[0];
  byte[] result=new byte[dataLength];
  rf.seek(dataOffset);
  rf.readFully(result);
  return result;
}
Program: 76325
Project: 76325
Buggy source:
public void before() throws ChartException {
  super.before();
  _bImageExternallySpecified=(_img != null);
  if (!_bImageExternallySpecified) {
    if (_bo == null) {
      throw new ChartException(ChartDeviceExtensionPlugin.ID,ChartException.RENDERING,"String_Node_Str",Messages.getResourceBundle(getULocale()));
    }
    if ((int)_bo.getWidth() < 0 || (int)_bo.getHeight() < 0) {
      throw new ChartException(ChartDeviceExtensionPlugin.ID,ChartException.INVALID_IMAGE_SIZE,"String_Node_Str",Messages.getResourceBundle(getULocale()));
    }
    if ((int)_bo.getWidth() == 0 || (int)_bo.getHeight() == 0) {
      _bo.setWidth(1);
      _bo.setHeight(1);
    }
    _img=new BufferedImage((int)_bo.getWidth(),(int)_bo.getHeight(),getImageType());
  }
  super.setProperty(IDeviceRenderer.GRAPHICS_CONTEXT,_img.getGraphics());
}

Fixed version (ground truth):
public void before() throws ChartException {
  super.before();
  _bImageExternallySpecified=(_img != null);
  if (!_bImageExternallySpecified) {
    if (_bo == null) {
      throw new ChartException(ChartDeviceExtensionPlugin.ID,ChartException.RENDERING,"String_Node_Str",Messages.getResourceBundle(getULocale()));
    }
    if ((int)_bo.getWidth() < 0 || (int)_bo.getHeight() < 0) {
      throw new ChartException(ChartDeviceExtensionPlugin.ID,ChartException.INVALID_IMAGE_SIZE,"String_Node_Str",Messages.getResourceBundle(getULocale()));
    }
    if ((int)_bo.getWidth() == 0 || (int)_bo.getHeight() == 0) {
      _bo.setWidth(1);
      _bo.setHeight(1);
    }
    _img=new BufferedImage((int)_bo.getWidth(),(int)_bo.getHeight(),getImageType());
  }
  super.setProperty(IDeviceRenderer.GRAPHICS_CONTEXT,_img.getGraphics());
  if (!supportsTransparency()) {
    _g2d.setPaint(Color.WHITE);
    _g2d.fillRect(0,0,_img.getWidth(null),_img.getHeight(null));
  }
}
Program: 76328
Project: 76328
Buggy source:
/** 
 * This method is called upon plug-in activation.
 * @param context bundle context
 * @exception Exception
 */
public void start(BundleContext context) throws Exception {
  super.start(context);
  bundleContext=context;
  plugin.getPluginPreferences().setDefault(WebViewer.MASTER_PAGE_CONTENT,true);
  plugin.getPluginPreferences().setDefault(WebViewer.PREVIEW_MAXROW,DEFAULT_MAX_ROWS);
}

Fixed version (ground truth):
/** 
 * This method is called upon plug-in activation.
 * @param context bundle context
 * @exception Exception
 */
public void start(BundleContext context) throws Exception {
  super.start(context);
  bundleContext=context;
  plugin.getPluginPreferences().setDefault(WebViewer.MASTER_PAGE_CONTENT,true);
  plugin.getPluginPreferences().setDefault(WebViewer.PREVIEW_MAXROW,DEFAULT_MAX_ROWS);
  plugin.getPluginPreferences().setDefault(WebViewer.USER_LOCALE,ULocale.getDefault().getDisplayName());
}
Program: 76333
Project: 76333
Buggy source:
public boolean handleValidate(Object obj){
  if (obj instanceof DimensionHandle) {
    if (getPositionType().equals(ICrosstabCellAdapterFactory.CELL_LEVEL_HANDLE) || getPositionType().equals(ICrosstabCellAdapterFactory.CELL_FIRST_LEVEL_HANDLE)) {
      return true;
    }
  }
  if (obj instanceof MeasureHandle) {
    if (getPositionType().equals(ICrosstabCellAdapterFactory.CELL_MEASURE)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean handleValidate(Object obj){
  CrosstabReportItemHandle crosstab=getCrosstabCellHandle().getCrosstab();
  if (obj instanceof DimensionHandle) {
    if ((getPositionType().equals(ICrosstabCellAdapterFactory.CELL_LEVEL_HANDLE) || getPositionType().equals(ICrosstabCellAdapterFactory.CELL_FIRST_LEVEL_HANDLE)) && CrosstabUtil.canContain(crosstab,(DimensionHandle)obj)) {
      return true;
    }
  }
  if (obj instanceof MeasureHandle) {
    if (getPositionType().equals(ICrosstabCellAdapterFactory.CELL_MEASURE) && CrosstabUtil.canContain(crosstab,(MeasureHandle)obj)) {
      return true;
    }
  }
  return false;
}
Program: 76334
Project: 76334
Buggy source:
public boolean handleValidate(Object obj){
  if (obj instanceof Object[]) {
    Object[] objects=(Object[])obj;
    int len=objects.length;
    if (len != 1) {
      return false;
    }
    return handleValidate(objects[0]);
  }
  if (getType() == ICrosstabConstants.ROW_AXIS_TYPE || getType() == ICrosstabConstants.COLUMN_AXIS_TYPE) {
    if (obj instanceof DimensionHandle) {
      return true;
    }
  }
  if (getType() == MEASURE_TYPE) {
    if (obj instanceof MeasureHandle) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean handleValidate(Object obj){
  if (obj instanceof Object[]) {
    Object[] objects=(Object[])obj;
    int len=objects.length;
    if (len != 1) {
      return false;
    }
    return handleValidate(objects[0]);
  }
  if (getType() == ICrosstabConstants.ROW_AXIS_TYPE || getType() == ICrosstabConstants.COLUMN_AXIS_TYPE) {
    if (obj instanceof DimensionHandle && CrosstabUtil.canContain(crosstab,(DimensionHandle)obj)) {
      return true;
    }
  }
  if (getType() == MEASURE_TYPE) {
    if (obj instanceof MeasureHandle && CrosstabUtil.canContain(crosstab,(MeasureHandle)obj)) {
      return true;
    }
  }
  return false;
}
Program: 76336
Project: 76336
Buggy source:
/** 
 * Parameter data type convertion from int to string.
 * @param type String
 * @return
 */
public static final String ConvertDataType(int type){
  String dataType=DesignChoiceConstants.PARAM_TYPE_ANY;
switch (type) {
case IScalarParameterDefn.TYPE_BOOLEAN:
    dataType=DesignChoiceConstants.PARAM_TYPE_BOOLEAN;
  break;
case IScalarParameterDefn.TYPE_DATE_TIME:
dataType=DesignChoiceConstants.PARAM_TYPE_DATETIME;
break;
case IScalarParameterDefn.TYPE_DECIMAL:
dataType=DesignChoiceConstants.PARAM_TYPE_DECIMAL;
break;
case IScalarParameterDefn.TYPE_FLOAT:
dataType=DesignChoiceConstants.PARAM_TYPE_FLOAT;
break;
case IScalarParameterDefn.TYPE_STRING:
dataType=DesignChoiceConstants.PARAM_TYPE_STRING;
break;
case IScalarParameterDefn.TYPE_INTEGER:
dataType=DesignChoiceConstants.PARAM_TYPE_INTEGER;
break;
}
return dataType;
}

Fixed version (ground truth):
/** 
 * Parameter data type convertion from int to string.
 * @param type String
 * @return
 */
public static final String ConvertDataType(int type){
  String dataType=DesignChoiceConstants.PARAM_TYPE_ANY;
switch (type) {
case IScalarParameterDefn.TYPE_BOOLEAN:
    dataType=DesignChoiceConstants.PARAM_TYPE_BOOLEAN;
  break;
case IScalarParameterDefn.TYPE_DATE_TIME:
dataType=DesignChoiceConstants.PARAM_TYPE_DATETIME;
break;
case IScalarParameterDefn.TYPE_DECIMAL:
dataType=DesignChoiceConstants.PARAM_TYPE_DECIMAL;
break;
case IScalarParameterDefn.TYPE_FLOAT:
dataType=DesignChoiceConstants.PARAM_TYPE_FLOAT;
break;
case IScalarParameterDefn.TYPE_STRING:
dataType=DesignChoiceConstants.PARAM_TYPE_STRING;
break;
case IScalarParameterDefn.TYPE_INTEGER:
dataType=DesignChoiceConstants.PARAM_TYPE_INTEGER;
break;
case IScalarParameterDefn.TYPE_DATE:
dataType=DesignChoiceConstants.PARAM_TYPE_DATE;
break;
case IScalarParameterDefn.TYPE_TIME:
dataType=DesignChoiceConstants.PARAM_TYPE_TIME;
break;
}
return dataType;
}
Program: 76337
Project: 76337
Buggy source:
/** 
 * Try convert an object to given type Types supported: <p> <ul> <li>IScalarParameterDefn.TYPE_INTEGER</li> <li>IScalarParameterDefn.TYPE_DECIMAL</li> <li>IScalarParameterDefn.TYPE_BOOLEAN</li> <li>IScalarParameterDefn.TYPE_DATE_TIME</li> <li>IScalarParameterDefn.TYPE_FLOAT</li> <li>IScalarParameterDefn.TYPE_STRING</li> <ul> </p>
 * @param source
 * @param toType
 * @return
 * @throws BirtException
 */
public static Object convert(Object source,int toType) throws BirtException {
  if (source == null)   return null;
  if (toType == IScalarParameterDefn.TYPE_ANY)   return source;
switch (toType) {
case IScalarParameterDefn.TYPE_INTEGER:
    return DataTypeUtil.toInteger(source);
case IScalarParameterDefn.TYPE_DECIMAL:
  return DataTypeUtil.toBigDecimal(source);
case IScalarParameterDefn.TYPE_BOOLEAN:
return DataTypeUtil.toBoolean(source);
case IScalarParameterDefn.TYPE_DATE_TIME:
return DataTypeUtil.toDate(source);
case IScalarParameterDefn.TYPE_FLOAT:
return DataTypeUtil.toDouble(source);
case IScalarParameterDefn.TYPE_STRING:
return DataTypeUtil.toString(source);
default :
throw new CoreException("String_Node_Str");
}
}

Fixed version (ground truth):
/** 
 * Try convert an object to given type Types supported: <p> <ul> <li>IScalarParameterDefn.TYPE_INTEGER</li> <li>IScalarParameterDefn.TYPE_DECIMAL</li> <li>IScalarParameterDefn.TYPE_BOOLEAN</li> <li>IScalarParameterDefn.TYPE_DATE_TIME</li> <li>IScalarParameterDefn.TYPE_FLOAT</li> <li>IScalarParameterDefn.TYPE_STRING</li> <li>IScalarParameterDefn.TYPE_DATE</li> <li>IScalarParameterDefn.TYPE_TIME</li> <ul> </p>
 * @param source
 * @param toType
 * @return
 * @throws BirtException
 */
public static Object convert(Object source,int toType) throws BirtException {
  if (source == null)   return null;
  if (toType == IScalarParameterDefn.TYPE_ANY)   return source;
switch (toType) {
case IScalarParameterDefn.TYPE_INTEGER:
    return DataTypeUtil.toInteger(source);
case IScalarParameterDefn.TYPE_DECIMAL:
  return DataTypeUtil.toBigDecimal(source);
case IScalarParameterDefn.TYPE_BOOLEAN:
return DataTypeUtil.toBoolean(source);
case IScalarParameterDefn.TYPE_DATE_TIME:
return DataTypeUtil.toDate(source);
case IScalarParameterDefn.TYPE_FLOAT:
return DataTypeUtil.toDouble(source);
case IScalarParameterDefn.TYPE_STRING:
return DataTypeUtil.toString(source);
case IScalarParameterDefn.TYPE_DATE:
return DataTypeUtil.toSqlDate(source);
case IScalarParameterDefn.TYPE_TIME:
return DataTypeUtil.toSqlTime(source);
default :
throw new CoreException("String_Node_Str");
}
}
Program: 76338
Project: 76338
Buggy source:
public void startCell(ICellContent cell){
  leafCell=cell;
  cellFilled=false;
  push(false);
  if (isHidden()) {
    return;
  }
  logger.log(Level.FINE,"String_Node_Str");
  boolean isInTableHead=isCellInTableHead(cell);
  if (isInTableHead) {
    writer.openTag(HTMLTags.TAG_TH);
  }
 else {
    writer.openTag(HTMLTags.TAG_TD);
  }
  setStyleName(cell.getStyleClass());
  int colSpan=cell.getColSpan();
  if (colSpan > 1) {
    writer.attribute(HTMLTags.ATTR_COLSPAN,colSpan);
  }
  int rowSpan=cell.getRowSpan();
  if (rowSpan > 1) {
    writer.attribute(HTMLTags.ATTR_ROWSPAN,rowSpan);
  }
  StringBuffer styleBuffer=new StringBuffer();
  handleColumnRelatedStyle(cell,styleBuffer);
  handleVerticalAlign(cell,styleBuffer);
  if (isInTableHead) {
    handleCellFont(cell,styleBuffer);
  }
  handleCellStyle(cell,styleBuffer);
  writer.attribute(HTMLTags.ATTR_ALIGN,cell.getComputedStyle().getTextAlign());
  if (!startedGroups.isEmpty()) {
    Iterator iter=startedGroups.iterator();
    while (iter.hasNext()) {
      IGroupContent group=(IGroupContent)iter.next();
      outputBookmark(group);
    }
    startedGroups.clear();
  }
  if (enableMetadata) {
    metadataEmitter.startCell(cell);
  }
}

Fixed version (ground truth):
public void startCell(ICellContent cell){
  leafCell=cell;
  cellFilled=false;
  push(false);
  if (isHidden()) {
    return;
  }
  logger.log(Level.FINE,"String_Node_Str");
  boolean isInTableHead=isCellInTableHead(cell);
  if (isInTableHead) {
    writer.openTag(HTMLTags.TAG_TH);
  }
 else {
    writer.openTag(HTMLTags.TAG_TD);
  }
  setStyleName(cell.getStyleClass());
  int colSpan=cell.getColSpan();
  if (colSpan > 1) {
    writer.attribute(HTMLTags.ATTR_COLSPAN,colSpan);
  }
  int rowSpan=cell.getRowSpan();
  if (rowSpan > 1) {
    writer.attribute(HTMLTags.ATTR_ROWSPAN,rowSpan);
  }
  StringBuffer styleBuffer=new StringBuffer();
  handleColumnRelatedStyle(cell,styleBuffer);
  if (isInTableHead) {
    handleCellFont(cell,styleBuffer);
  }
  handleCellStyle(cell,styleBuffer);
  handleCellAlign(cell);
  if (!startedGroups.isEmpty()) {
    Iterator iter=startedGroups.iterator();
    while (iter.hasNext()) {
      IGroupContent group=(IGroupContent)iter.next();
      outputBookmark(group);
    }
    startedGroups.clear();
  }
  if (enableMetadata) {
    metadataEmitter.startCell(cell);
  }
}
Program: 76339
Project: 76339
Buggy source:
/** 
 * Gets a DataEngineContext for use to initialize data engine
 */
public DataEngineContext getDataEngineContext() throws BirtException {
  DataEngineContext context=DataEngineContext.newInstance(mode,getTopScope(),docReader,docWriter);
  if (cacheSet)   context.setCacheOption(cacheOption,cacheCount);
  return context;
}

Fixed version (ground truth):
/** 
 * Gets a DataEngineContext for use to initialize data engine
 */
public DataEngineContext getDataEngineContext() throws BirtException {
  if (this.context != null)   return this.context;
  this.context=DataEngineContext.newInstance(mode,getTopScope(),docReader,docWriter);
  if (cacheSet)   this.context.setCacheOption(cacheOption,cacheCount);
  return this.context;
}
Program: 76340
Project: 76340
Buggy source:
/** 
 * @param b Description of Parameter
 * @param pos Description of Parameter
 * @param len Description of Parameter
 * @return Description of the Returned Value
 * @exception IOException Description of Exception
 */
public int read(byte[] b,int pos,int len) throws IOException {
  if (currBuf.pos + len <= currBuf.dataLen) {
    System.arraycopy(currBuf.bytes,currBuf.pos,b,pos,len);
    currBuf.pos+=len;
    return len;
  }
 else {
    syncBuffer(currBuf.filePos + currBuf.pos);
    if (currBuf.dataLen < currBuf.bytes.length) {
      int readLen=Math.min(len,currBuf.dataLen);
      System.arraycopy(currBuf.bytes,currBuf.pos,b,pos,readLen);
      currBuf.pos+=readLen;
      return readLen;
    }
 else {
      if (currBuf.dataLen >= len) {
        return read(b,pos,len);
      }
 else {
        delegate.seek(currBuf.filePos);
        int readLen=delegate.read(b,pos,len);
        if (len > currBuf.bytes.length) {
          currBuf.filePos+=len - currBuf.bytes.length;
        }
        currBuf.dataLen=Math.min(readLen,currBuf.bytes.length);
        System.arraycopy(b,pos,currBuf.bytes,0,currBuf.dataLen);
        return readLen;
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * @param b Description of Parameter
 * @param pos Description of Parameter
 * @param len Description of Parameter
 * @return Description of the Returned Value
 * @exception IOException Description of Exception
 */
public int read(byte[] b,int pos,int len) throws IOException {
  if (currBuf.pos + len <= currBuf.dataLen) {
    System.arraycopy(currBuf.bytes,currBuf.pos,b,pos,len);
    currBuf.pos+=len;
    return len;
  }
 else {
    syncBuffer(currBuf.filePos + currBuf.pos);
    if (currBuf.dataLen < currBuf.bytes.length) {
      int readLen=Math.min(len,currBuf.dataLen);
      if (readLen == 0) {
        return -1;
      }
      System.arraycopy(currBuf.bytes,currBuf.pos,b,pos,readLen);
      currBuf.pos+=readLen;
      return readLen;
    }
 else {
      if (currBuf.dataLen >= len) {
        return read(b,pos,len);
      }
 else {
        delegate.seek(currBuf.filePos);
        int readLen=delegate.read(b,pos,len);
        if (len > currBuf.bytes.length) {
          currBuf.filePos+=len - currBuf.bytes.length;
        }
        currBuf.dataLen=Math.min(readLen,currBuf.bytes.length);
        System.arraycopy(b,pos,currBuf.bytes,0,currBuf.dataLen);
        return readLen;
      }
    }
  }
}
Program: 76341
Project: 76341
Buggy source:
/** 
 * Returns the TOC Children from a TOCNode
 * @param node
 * @return
 */
private static List getToCChildren(TOCNode node){
  if (node.getChildren() == null)   return null;
  List children=node.getChildren();
  List ret=new ArrayList();
  Iterator it=children.iterator();
  while (it.hasNext()) {
    TOCNode childNode=(TOCNode)it.next();
    ToC child=new ToC(childNode.getNodeID(),childNode.getDisplayString(),childNode.getBookmark());
    child.setChildren(getToCChildren(childNode));
    ret.add(child);
  }
  return ret;
}

Fixed version (ground truth):
/** 
 * Returns the TOC Children from a TOCNode
 * @param node
 * @return
 */
private static List getToCChildren(TOCNode node){
  if (node.getChildren() == null)   return null;
  List children=node.getChildren();
  List ret=new ArrayList();
  Iterator it=children.iterator();
  while (it.hasNext()) {
    TOCNode childNode=(TOCNode)it.next();
    ToC child=new ToC(childNode.getNodeID(),childNode.getDisplayString(),childNode.getBookmark(),BirtUtility.getTOCStyle(childNode));
    child.setChildren(getToCChildren(childNode));
    ret.add(child);
  }
  return ret;
}
Program: 76342
Project: 76342
Buggy source:
/** 
 * Transform TOC Node
 * @param node
 * @return
 */
private static ToC transformTOCNode(TOCNode node){
  ToC toc=new ToC(node.getNodeID(),node.getDisplayString(),node.getBookmark());
  toc.setChildren(getToCChildren(node));
  return toc;
}

Fixed version (ground truth):
/** 
 * Transform TOC Node
 * @param node
 * @return
 */
private static ToC transformTOCNode(TOCNode node){
  ToC toc=new ToC(node.getNodeID(),node.getDisplayString(),node.getBookmark(),BirtUtility.getTOCStyle(node));
  toc.setChildren(getToCChildren(node));
  return toc;
}
Program: 76343
Project: 76343
Buggy source:
/** 
 * Prepare response
 * @throws ReportServiceException
 * @throws RemoteException
 */
protected void prepareResponse() throws ReportServiceException, RemoteException {
  TOC toc=new TOC();
  List children=__node.getChildren();
  if (children != null && children.size() > 0) {
    TOC[] childTOCNodes=new TOC[children.size()];
    for (int i=0; i < children.size(); i++) {
      ToC child=(ToC)children.get(i);
      childTOCNodes[i]=new TOC();
      childTOCNodes[i].setId(child.getID());
      childTOCNodes[i].setDisplayName(child.getDisplayName());
      childTOCNodes[i].setBookmark(child.getBookmark());
      childTOCNodes[i].setIsLeaf(new Boolean(child.getChildren() == null || child.getChildren().size() <= 0));
    }
    toc.setChild(childTOCNodes);
  }
  Data data=new Data();
  data.setTOC(toc);
  UpdateData updateData=new UpdateData();
  updateData.setTarget("String_Node_Str");
  updateData.setData(data);
  Update update=new Update();
  update.setUpdateData(updateData);
  response.setUpdate(new Update[]{update});
}

Fixed version (ground truth):
/** 
 * Prepare response
 * @throws ReportServiceException
 * @throws RemoteException
 */
protected void prepareResponse() throws ReportServiceException, RemoteException {
  TOC toc=new TOC();
  List children=__node.getChildren();
  if (children != null && children.size() > 0) {
    TOC[] childTOCNodes=new TOC[children.size()];
    for (int i=0; i < children.size(); i++) {
      ToC child=(ToC)children.get(i);
      childTOCNodes[i]=new TOC();
      childTOCNodes[i].setId(child.getID());
      childTOCNodes[i].setDisplayName(child.getDisplayName());
      childTOCNodes[i].setBookmark(child.getBookmark());
      childTOCNodes[i].setStyle(child.getStyle());
      childTOCNodes[i].setIsLeaf(new Boolean(child.getChildren() == null || child.getChildren().size() <= 0));
    }
    toc.setChild(childTOCNodes);
  }
  Data data=new Data();
  data.setTOC(toc);
  UpdateData updateData=new UpdateData();
  updateData.setTarget("String_Node_Str");
  updateData.setData(data);
  Update update=new Update();
  update.setUpdateData(updateData);
  response.setUpdate(new Update[]{update});
}
Program: 76344
Project: 76344
Buggy source:
public List getChildren(){
  return children;
}

Fixed version (ground truth):
/** 
 * @return the children list
 */
public List getChildren(){
  return children;
}
Program: 76345
Project: 76345
Buggy source:
public String getDisplayName(){
  return displayName;
}

Fixed version (ground truth):
/** 
 * @return the display name
 */
public String getDisplayName(){
  return displayName;
}
Program: 76346
Project: 76346
Buggy source:
public ToC(String id,String displayName,String bookmark){
  this.id=id;
  this.displayName=displayName;
  this.bookmark=bookmark;
}

Fixed version (ground truth):
/** 
 * Constructor
 * @param id
 * @param displayName
 * @param bookmark
 * @param style
 */
public ToC(String id,String displayName,String bookmark,String style){
  this.id=id;
  this.displayName=displayName;
  this.bookmark=bookmark;
  this.style=style;
}
Program: 76347
Project: 76347
Buggy source:
public String getID(){
  return id;
}

Fixed version (ground truth):
/** 
 * @return the id
 */
public String getID(){
  return id;
}
Program: 76348
Project: 76348
Buggy source:
public void setChildren(List children){
  this.children=children;
}

Fixed version (ground truth):
/** 
 * Set children list
 * @param children
 */
public void setChildren(List children){
  this.children=children;
}
Program: 76349
Project: 76349
Buggy source:
public String getBookmark(){
  return bookmark;
}

Fixed version (ground truth):
/** 
 * @return the bookmark
 */
public String getBookmark(){
  return bookmark;
}
Program: 76350
Project: 76350
Buggy source:
public TOC(java.lang.String id,java.lang.String displayName,java.lang.String bookmark,java.lang.Boolean isLeaf,org.eclipse.birt.report.soapengine.api.TOC[] child){
  this.id=id;
  this.displayName=displayName;
  this.bookmark=bookmark;
  this.isLeaf=isLeaf;
  this.child=child;
}

Fixed version (ground truth):
public TOC(java.lang.String id,java.lang.String displayName,java.lang.String bookmark,java.lang.String style,java.lang.Boolean isLeaf,org.eclipse.birt.report.soapengine.api.TOC[] child){
  this.id=id;
  this.displayName=displayName;
  this.bookmark=bookmark;
  this.style=style;
  this.isLeaf=isLeaf;
  this.child=child;
}
Program: 76351
Project: 76351
Buggy source:
public synchronized int hashCode(){
  if (__hashCodeCalc) {
    return 0;
  }
  __hashCodeCalc=true;
  int _hashCode=1;
  if (getId() != null) {
    _hashCode+=getId().hashCode();
  }
  if (getDisplayName() != null) {
    _hashCode+=getDisplayName().hashCode();
  }
  if (getBookmark() != null) {
    _hashCode+=getBookmark().hashCode();
  }
  if (getIsLeaf() != null) {
    _hashCode+=getIsLeaf().hashCode();
  }
  if (getChild() != null) {
    for (int i=0; i < java.lang.reflect.Array.getLength(getChild()); i++) {
      java.lang.Object obj=java.lang.reflect.Array.get(getChild(),i);
      if (obj != null && !obj.getClass().isArray()) {
        _hashCode+=obj.hashCode();
      }
    }
  }
  __hashCodeCalc=false;
  return _hashCode;
}

Fixed version (ground truth):
public synchronized int hashCode(){
  if (__hashCodeCalc) {
    return 0;
  }
  __hashCodeCalc=true;
  int _hashCode=1;
  if (getId() != null) {
    _hashCode+=getId().hashCode();
  }
  if (getDisplayName() != null) {
    _hashCode+=getDisplayName().hashCode();
  }
  if (getBookmark() != null) {
    _hashCode+=getBookmark().hashCode();
  }
  if (getStyle() != null) {
    _hashCode+=getStyle().hashCode();
  }
  if (getIsLeaf() != null) {
    _hashCode+=getIsLeaf().hashCode();
  }
  if (getChild() != null) {
    for (int i=0; i < java.lang.reflect.Array.getLength(getChild()); i++) {
      java.lang.Object obj=java.lang.reflect.Array.get(getChild(),i);
      if (obj != null && !obj.getClass().isArray()) {
        _hashCode+=obj.hashCode();
      }
    }
  }
  __hashCodeCalc=false;
  return _hashCode;
}
Program: 76352
Project: 76352
Buggy source:
public synchronized boolean equals(java.lang.Object obj){
  if (!(obj instanceof TOC))   return false;
  TOC other=(TOC)obj;
  if (obj == null)   return false;
  if (this == obj)   return true;
  if (__equalsCalc != null) {
    return (__equalsCalc == obj);
  }
  __equalsCalc=obj;
  boolean _equals;
  _equals=true && ((this.id == null && other.getId() == null) || (this.id != null && this.id.equals(other.getId()))) && ((this.displayName == null && other.getDisplayName() == null) || (this.displayName != null && this.displayName.equals(other.getDisplayName())))&& ((this.bookmark == null && other.getBookmark() == null) || (this.bookmark != null && this.bookmark.equals(other.getBookmark())))&& ((this.isLeaf == null && other.getIsLeaf() == null) || (this.isLeaf != null && this.isLeaf.equals(other.getIsLeaf())))&& ((this.child == null && other.getChild() == null) || (this.child != null && java.util.Arrays.equals(this.child,other.getChild())));
  __equalsCalc=null;
  return _equals;
}

Fixed version (ground truth):
public synchronized boolean equals(java.lang.Object obj){
  if (!(obj instanceof TOC))   return false;
  TOC other=(TOC)obj;
  if (obj == null)   return false;
  if (this == obj)   return true;
  if (__equalsCalc != null) {
    return (__equalsCalc == obj);
  }
  __equalsCalc=obj;
  boolean _equals;
  _equals=true && ((this.id == null && other.getId() == null) || (this.id != null && this.id.equals(other.getId()))) && ((this.displayName == null && other.getDisplayName() == null) || (this.displayName != null && this.displayName.equals(other.getDisplayName())))&& ((this.bookmark == null && other.getBookmark() == null) || (this.bookmark != null && this.bookmark.equals(other.getBookmark())))&& ((this.style == null && other.getStyle() == null) || (this.style != null && this.style.equals(other.getStyle())))&& ((this.isLeaf == null && other.getIsLeaf() == null) || (this.isLeaf != null && this.isLeaf.equals(other.getIsLeaf())))&& ((this.child == null && other.getChild() == null) || (this.child != null && java.util.Arrays.equals(this.child,other.getChild())));
  __equalsCalc=null;
  return _equals;
}
Program: 76354
Project: 76354
Buggy source:
/** 
 * upgrade the archive file to the latest version
 * @throws IOException
 */
private void upgradeArchiveV1() throws IOException {
  ArchiveFileV1 reader=new ArchiveFileV1(archiveName);
  try {
    File tempFile=File.createTempFile("String_Node_Str","String_Node_Str");
    tempFile.deleteOnExit();
    ArchiveFile writer=new ArchiveFile(tempFile.getAbsolutePath(),"String_Node_Str");
    List streams=reader.listEntries("String_Node_Str");
    Iterator iter=streams.iterator();
    while (iter.hasNext()) {
      String name=(String)iter.next();
      ArchiveEntry src=reader.getEntry(name);
      ArchiveEntry tgt=writer.createEntry(name);
      copyEntry(src,tgt);
    }
    reader.close();
    writer.saveAs(archiveName);
    writer.close();
  }
  finally {
    reader.close();
  }
}

Fixed version (ground truth):
/** 
 * upgrade the archive file to the latest version
 * @throws IOException
 */
private void upgradeArchiveV1() throws IOException {
  ArchiveFileV1 reader=new ArchiveFileV1(archiveName);
  try {
    File tempFile=File.createTempFile("String_Node_Str","String_Node_Str");
    tempFile.deleteOnExit();
    ArchiveFile writer=new ArchiveFile(tempFile.getAbsolutePath(),"String_Node_Str");
    List streams=reader.listEntries("String_Node_Str");
    Iterator iter=streams.iterator();
    while (iter.hasNext()) {
      String name=(String)iter.next();
      ArchiveEntry src=reader.getEntry(name);
      ArchiveEntry tgt=writer.createEntry(name);
      copyEntry(src,tgt);
    }
    writer.saveAs(archiveName);
    writer.close();
  }
  finally {
    reader.close();
  }
}
Program: 76355
Project: 76355
Buggy source:
protected void openArchiveForAppending() throws IOException {
  RandomAccessFile rf=new RandomAccessFile(archiveName,"String_Node_Str");
  if (rf.length() == 0) {
    af=new ArchiveFileV2(archiveName,rf,"String_Node_Str");
  }
 else {
    try {
      long magicTag=rf.readLong();
      if (magicTag == ArchiveFileV2.DOCUMENT_TAG) {
        af=new ArchiveFileV2(archiveName,"String_Node_Str");
        return;
      }
      rf.close();
      upgradeArchiveV1();
      af=new ArchiveFileV2(archiveName,rf,"String_Node_Str");
      return;
    }
 catch (    IOException ex) {
      rf.close();
      throw ex;
    }
  }
}

Fixed version (ground truth):
protected void openArchiveForAppending() throws IOException {
  RandomAccessFile rf=new RandomAccessFile(archiveName,"String_Node_Str");
  if (rf.length() == 0) {
    af=new ArchiveFileV2(archiveName,rf,"String_Node_Str");
  }
 else {
    try {
      long magicTag=rf.readLong();
      if (magicTag == ArchiveFileV2.DOCUMENT_TAG) {
        af=new ArchiveFileV2(archiveName,rf,"String_Node_Str");
        return;
      }
      rf.close();
      upgradeArchiveV1();
      af=new ArchiveFileV2(archiveName,"String_Node_Str");
      return;
    }
 catch (    IOException ex) {
      rf.close();
      throw ex;
    }
  }
}
Program: 76356
Project: 76356
Buggy source:
public int getUsedCache(){
  if (af != null) {
    return af.getUsedCache();
  }
  return 0;
}

Fixed version (ground truth):
public int getUsedCache(){
  if (af == null) {
    return 0;
  }
  return af.getUsedCache();
}
Program: 76360
Project: 76360
Buggy source:
protected void setPropValue(String newValue){
  if (UIUtil.needAddQuote(ReportDesignConstants.STYLE_ELEMENT,StyleHandle.FONT_FAMILY_PROP,newValue)) {
    super.setPropValue(DEUtil.AddQuote(newValue));
  }
 else {
    super.setPropValue(newValue);
  }
}

Fixed version (ground truth):
protected void setPropValue(String newValue){
  super.setPropValue(newValue);
}
Program: 76367
Project: 76367
Buggy source:
/** 
 * Constructors.
 * @param item
 */
public MultiRowItem(ExtendedItemHandle item){
  IReportItem iitem=(IReportItem)ScriptElementFactory.getInstance().getElement(item);
  this.item=iitem;
}

Fixed version (ground truth):
/** 
 * Constructors.
 * @param item
 */
public MultiRowItem(ExtendedItemHandle item){
  this.item=SimpleElementFactory.getInstance().wrapExtensionElement(item);
}
Program: 76368
Project: 76368
Buggy source:
/** 
 * Initializes the meta-data system and loads all extensions which implements the extension pointers the model defines. The application must call this method once (and only once) before opening or creating a design. It is the application's responsibility because the application will choose the location to store the definition file, and that location may differ for different applications.
 * @param is stream for reading the "rom.def" file that provides the meta-data for the system
 * @throws MetaDataReaderException if error occurs during read the meta-data file.
 */
private static void initialize(InputStream is) throws MetaDataReaderException {
  try {
    MetaDataReader.read(is);
    ExtensionManager.initialize();
    ScriptElementFactory.setInstance(new org.eclipse.birt.report.model.api.impl.SimpleElementFactory());
  }
 catch (  MetaDataParserException e) {
    throw new MetaDataReaderException(MetaDataReaderException.DESIGN_EXCEPTION_META_DATA_ERROR,e);
  }
}

Fixed version (ground truth):
/** 
 * Initializes the meta-data system and loads all extensions which implements the extension pointers the model defines. The application must call this method once (and only once) before opening or creating a design. It is the application's responsibility because the application will choose the location to store the definition file, and that location may differ for different applications.
 * @param is stream for reading the "rom.def" file that provides the meta-data for the system
 * @throws MetaDataReaderException if error occurs during read the meta-data file.
 */
private static void initialize(InputStream is) throws MetaDataReaderException {
  try {
    MetaDataReader.read(is);
    ExtensionManager.initialize();
    SimpleElementFactory.setInstance(new org.eclipse.birt.report.model.api.impl.SimpleElementFactory());
  }
 catch (  MetaDataParserException e) {
    throw new MetaDataReaderException(MetaDataReaderException.DESIGN_EXCEPTION_META_DATA_ERROR,e);
  }
}
Program: 76369
Project: 76369
Buggy source:
public static IDesignElement getElement(DesignElementHandle element){
  if (element == null)   return null;
  if (element instanceof ReportDesignHandle)   return new ReportDesign((ReportDesignHandle)element);
  if (!(element instanceof ReportElementHandle))   return null;
  if (element instanceof DataItemHandle)   return new DataItem((DataItemHandle)element);
  if (element instanceof GridHandle)   return new Grid((GridHandle)element);
  if (element instanceof ImageHandle)   return new Image((ImageHandle)element);
  if (element instanceof LabelHandle)   return new Label((LabelHandle)element);
  if (element instanceof ListHandle)   return new List((ListHandle)element);
  if (element instanceof TableHandle)   return new Table((TableHandle)element);
  if (element instanceof TextDataHandle)   return new DynamicText((TextDataHandle)element);
  if (element instanceof TextItemHandle)   return new TextItem((TextItemHandle)element);
  return new ReportElement((ReportElementHandle)element);
}

Fixed version (ground truth):
public static IDesignElement getElement(DesignElementHandle element){
  if (element == null)   return null;
  if (element instanceof ReportDesignHandle)   return new ReportDesign((ReportDesignHandle)element);
  if (!(element instanceof ReportElementHandle))   return null;
  if (element instanceof DataItemHandle)   return new DataItem((DataItemHandle)element);
  if (element instanceof GridHandle)   return new Grid((GridHandle)element);
  if (element instanceof ImageHandle)   return new Image((ImageHandle)element);
  if (element instanceof LabelHandle)   return new Label((LabelHandle)element);
  if (element instanceof ListHandle)   return new List((ListHandle)element);
  if (element instanceof TableHandle)   return new Table((TableHandle)element);
  if (element instanceof TextDataHandle)   return new DynamicText((TextDataHandle)element);
  if (element instanceof TextItemHandle)   return new TextItem((TextItemHandle)element);
  if (element instanceof ExtendedItemHandle) {
    org.eclipse.birt.report.model.api.simpleapi.IReportItem item=null;
    try {
      IReportItem extensionItem=((ExtendedItemHandle)element).getReportItem();
      if (extensionItem != null)       item=extensionItem.getSimpleElement();
    }
 catch (    ExtendedElementException e) {
    }
    if (item == null)     item=new ExtendedItem((ExtendedItemHandle)element);
    return item;
  }
  return new ReportElement((ReportElementHandle)element);
}
Program: 76370
Project: 76370
Buggy source:
/** 
 * @see org.eclipse.birt.report.service.api.IViewerReportService#extractResultSet(java.lang.String,java.lang.String,java.util.Collection,java.util.Set,org.eclipse.birt.report.service.api.InputOptions,java.io.OutputStream)
 */
public void extractResultSet(String docName,String resultSetId,Collection columns,Set filters,InputOptions options,OutputStream out) throws ReportServiceException {
  IReportDocument doc=ReportEngineService.getInstance().openReportDocument(getReportDesignName(options),docName,getModuleOptions(options));
  Locale locale=(Locale)options.getOption(InputOptions.OPT_LOCALE);
  HttpServletRequest request=(HttpServletRequest)options.getOption(InputOptions.OPT_REQUEST);
  try {
    ReportEngineService.getInstance().extractData(doc,resultSetId,columns,locale,out,ParameterAccessor.getExportEncoding(request));
  }
 catch (  RemoteException e) {
    throw new ReportServiceException(e.getLocalizedMessage(),e);
  }
 finally {
    if (doc != null)     doc.close();
  }
}

Fixed version (ground truth):
/** 
 * @see org.eclipse.birt.report.service.api.IViewerReportService#extractResultSet(java.lang.String,java.lang.String,java.util.Collection,java.util.Set,org.eclipse.birt.report.service.api.InputOptions,java.io.OutputStream)
 */
public void extractResultSet(String docName,String resultSetId,Collection columns,Set filters,InputOptions options,OutputStream out) throws ReportServiceException {
  IReportDocument doc=ReportEngineService.getInstance().openReportDocument(getReportDesignName(options),docName,getModuleOptions(options));
  Locale locale=(Locale)options.getOption(InputOptions.OPT_LOCALE);
  HttpServletRequest request=(HttpServletRequest)options.getOption(InputOptions.OPT_REQUEST);
  try {
    ReportEngineService.getInstance().extractData(doc,resultSetId,columns,locale,out,ParameterAccessor.getExportEncoding(request));
  }
 catch (  RemoteException e) {
    throw new ReportServiceException(e.getLocalizedMessage(),e.getCause());
  }
 finally {
    if (doc != null)     doc.close();
  }
}