nus-yam/ex-repair huggingface dataset:
Program: 77209
Project: 77209
Buggy source:
public Object calculate(Object value){
  if (value == null) {
    return new Double(-1);
  }
  if (intervalStart == null) {
    return new Double(Math.floor(DateTimeUtil.diffSecond(defaultStart,(Date)value) / intervalRange));
  }
 else {
    if (DateTimeUtil.diffSecond((Date)intervalStart,(Date)value) < 0) {
      return new Double(-1);
    }
 else {
      return new Double(Math.floor(DateTimeUtil.diffSecond((Date)intervalStart,(Date)value) / intervalRange));
    }
  }
}

Fixed version (ground truth):
public Object calculate(Object value){
  if (value == null) {
    return new Double(-1);
  }
  if (intervalStart == null) {
    return new Double(Math.floor(DateTimeUtil.diffSecond(defaultStart,(Date)value) / getDateIntervalRange()));
  }
 else {
    if (DateTimeUtil.diffSecond((Date)intervalStart,(Date)value) < 0) {
      return new Double(-1);
    }
 else {
      return new Double(Math.floor(DateTimeUtil.diffSecond((Date)intervalStart,(Date)value) / getDateIntervalRange()));
    }
  }
}
Program: 77210
Project: 77210
Buggy source:
public Object calculate(Object value){
  if (value == null) {
    return new Double(-1);
  }
  if (intervalStart == null) {
    return new Double(Math.floor(DateTimeUtil.diffWeek(defaultStart,(Date)value) / intervalRange));
  }
 else {
    if (DateTimeUtil.diffWeek((Date)intervalStart,(Date)value) < 0) {
      return new Double(-1);
    }
 else {
      return new Double(Math.floor(DateTimeUtil.diffWeek((Date)intervalStart,(Date)value) / intervalRange));
    }
  }
}

Fixed version (ground truth):
public Object calculate(Object value){
  if (value == null) {
    return new Double(-1);
  }
  if (intervalStart == null) {
    return new Double(Math.floor(DateTimeUtil.diffWeek(defaultStart,(Date)value) / getDateIntervalRange()));
  }
 else {
    if (DateTimeUtil.diffWeek((Date)intervalStart,(Date)value) < 0) {
      return new Double(-1);
    }
 else {
      return new Double(Math.floor(DateTimeUtil.diffWeek((Date)intervalStart,(Date)value) / getDateIntervalRange()));
    }
  }
}
Program: 77211
Project: 77211
Buggy source:
public Object calculate(Object value){
  if (value == null) {
    return new Double(-1);
  }
  if (intervalStart == null) {
    return new Double(Math.floor(DateTimeUtil.diffYear(defaultStart,(Date)value) / intervalRange));
  }
 else {
    if (DateTimeUtil.diffYear((Date)intervalStart,(Date)value) < 0) {
      return new Double(-1);
    }
 else {
      return new Double(Math.floor(DateTimeUtil.diffYear((Date)intervalStart,(Date)value) / intervalRange));
    }
  }
}

Fixed version (ground truth):
public Object calculate(Object value){
  if (value == null) {
    return new Double(-1);
  }
  if (intervalStart == null) {
    return new Double(Math.floor(DateTimeUtil.diffYear(defaultStart,(Date)value) / getDateIntervalRange()));
  }
 else {
    if (DateTimeUtil.diffYear((Date)intervalStart,(Date)value) < 0) {
      return new Double(-1);
    }
 else {
      return new Double(Math.floor(DateTimeUtil.diffYear((Date)intervalStart,(Date)value) / getDateIntervalRange()));
    }
  }
}
Program: 77213
Project: 77213
Buggy source:
/** 
 * Test feature of aggregation expression 
 */
public void test_RunningAggregationExpression() throws Exception {
  String testSQL="String_Node_Str" + getTestTableName();
  ((OdaDataSetDesign)this.dataSet).setQueryText(testSQL);
  IBaseExpression[] expressions=new IBaseExpression[]{new ScriptExpression("String_Node_Str",0),new ScriptExpression("String_Node_Str",2),new ScriptExpression("String_Node_Str",2)};
  String names[]={"String_Node_Str","String_Node_Str","String_Node_Str"};
  GroupDefinition[] groupDef=new GroupDefinition[]{new GroupDefinition("String_Node_Str"),new GroupDefinition("String_Node_Str")};
  groupDef[0].setKeyExpression("String_Node_Str");
  groupDef[1].setKeyExpression("String_Node_Str");
  QueryDefinition queryDefn=newReportQuery();
  queryDefn.addGroup(groupDef[0]);
  queryDefn.addGroup(groupDef[1]);
  queryDefn.addResultSetExpression(names[0],expressions[0]);
  queryDefn.addResultSetExpression(names[1],expressions[1]);
  IPreparedQuery preparedQuery=dataEngine.prepare(queryDefn);
  IQueryResults queryResults=preparedQuery.execute(jsScope);
  IResultIterator resultIt=queryResults.getResultIterator();
  assertTrue(resultIt.next());
  resultIt.getValue(names[0]);
  resultIt.getValue(names[1]);
}

Fixed version (ground truth):
/** 
 * Test feature of aggregation expression
 */
public void test_RunningAggregationExpression() throws Exception {
  String testSQL="String_Node_Str" + getTestTableName();
  ((OdaDataSetDesign)this.dataSet).setQueryText(testSQL);
  IBaseExpression[] bindingExprGroup=new IBaseExpression[]{new ScriptExpression("String_Node_Str",0),new ScriptExpression("String_Node_Str",2)};
  String names[]={"String_Node_Str","String_Node_Str"};
  GroupDefinition[] groupDefn=new GroupDefinition[]{new GroupDefinition("String_Node_Str"),new GroupDefinition("String_Node_Str")};
  groupDefn[0].setKeyExpression("String_Node_Str");
  groupDefn[1].setKeyExpression("String_Node_Str");
  String[] bindingNameRow=new String[3];
  bindingNameRow[0]="String_Node_Str";
  bindingNameRow[1]="String_Node_Str";
  bindingNameRow[2]="String_Node_Str";
  IBaseExpression[] bindingExprRow=new IBaseExpression[3];
  bindingExprRow[0]=new ScriptExpression("String_Node_Str");
  bindingExprRow[1]=new ScriptExpression("String_Node_Str");
  bindingExprRow[2]=new ScriptExpression("String_Node_Str");
  createAndRunQuery(names,bindingExprGroup,groupDefn,null,null,null,null,null,null,bindingNameRow,bindingExprRow);
  checkOutputFile();
}
Program: 77214
Project: 77214
Buggy source:
/** 
 * Return an instance of JointResultMeta.
 * @param left
 * @param right
 * @return
 * @throws DataException
 */
private JointResultMetadata getJointResultMetadata(IResultMetaData left,IResultMetaData right) throws DataException {
  if (left == null || right == null) {
    throw new DataException(ResourceConstants.UNEXPECTED_ERROR);
  }
  try {
    String leftPrefix=dataSet.getLeftDataSetDesignName();
    String rightPrefix=dataSet.getRightDataSetDesignName();
    if (leftPrefix.equals(rightPrefix)) {
      leftPrefix=leftPrefix + "String_Node_Str";
      rightPrefix=rightPrefix + "String_Node_Str";
    }
    leftPrefix=leftPrefix + COLUMN_NAME_SPLITTER;
    rightPrefix=rightPrefix + COLUMN_NAME_SPLITTER;
    JointResultMetadata meta=populatorJointResultMetadata(left,leftPrefix,right,rightPrefix);
    return meta;
  }
 catch (  BirtException be) {
    throw DataException.wrap(be);
  }
}

Fixed version (ground truth):
/** 
 * Return an instance of JointResultMeta.
 * @param left
 * @param right
 * @return
 * @throws DataException
 */
private JointResultMetadata getJointResultMetadata(IResultMetaData left,IResultMetaData right) throws DataException {
  if (left == null || right == null) {
    throw new DataException(ResourceConstants.UNEXPECTED_ERROR);
  }
  try {
    String leftPrefix=getDataSetName(dataSet.getLeftDataSetDesignName());
    String rightPrefix=getDataSetName(dataSet.getRightDataSetDesignName());
    if (leftPrefix.equals(rightPrefix)) {
      leftPrefix=leftPrefix + "String_Node_Str";
      rightPrefix=rightPrefix + "String_Node_Str";
    }
    leftPrefix=leftPrefix + COLUMN_NAME_SPLITTER;
    rightPrefix=rightPrefix + COLUMN_NAME_SPLITTER;
    JointResultMetadata meta=populatorJointResultMetadata(left,leftPrefix,right,rightPrefix);
    return meta;
  }
 catch (  BirtException be) {
    throw DataException.wrap(be);
  }
}
Program: 77216
Project: 77216
Buggy source:
/** 
 * @throws DataException
 */
private void initSaveRowUtil() throws DataException {
  rowExprsOs=streamManager.getOutStream(DataEngineContext.EXPR_VALUE_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE);
  rowLenOs=streamManager.getOutStream(DataEngineContext.EXPR_ROWLEN_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE);
  this.rowSaveUtil=new RowSaveUtil(rowCount,rowExprsOs,rowLenOs);
}

Fixed version (ground truth):
/** 
 * @throws DataException
 */
private void initSaveRowUtil() throws DataException {
  rowExprsOs=streamManager.getOutStream(DataEngineContext.EXPR_VALUE_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE);
  rowLenOs=streamManager.getOutStream(DataEngineContext.EXPR_ROWLEN_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE);
  this.rowSaveUtil=new RowSaveUtil(rowCount,rowExprsOs,rowLenOs,this.getExprNameSet());
}
Program: 77217
Project: 77217
Buggy source:
/** 
 * init save environment
 */
private void initSave(boolean finish) throws DataException {
  if (inited == true)   return;
  inited=true;
  try {
    int totalRowCount=0;
    if (finish == true)     totalRowCount=rowCount;
 else     totalRowCount=rowCount == 0 ? 1 : rowCount;
    IOUtil.writeInt(this.rowExprsDos,totalRowCount);
  }
 catch (  IOException e) {
    throw new DataException(ResourceConstants.RD_SAVE_ERROR,e);
  }
}

Fixed version (ground truth):
/** 
 * init save environment
 */
private void initSave(boolean finish) throws DataException {
  if (inited == true)   return;
  inited=true;
  try {
    int totalRowCount=0;
    if (finish == true)     totalRowCount=rowCount;
 else     totalRowCount=rowCount == 0 ? 1 : rowCount;
    IOUtil.writeInt(this.rowExprsDos,totalRowCount);
    Map map=new HashMap();
    Iterator it=exprNameSet.iterator();
    while (it.hasNext()) {
      Object value=it.next();
      map.put(value,value);
    }
    int rowBytes=this.saveExprValue(map);
    IOUtil.writeInt(this.rowExprsDos,rowBytes);
  }
 catch (  IOException e) {
    throw new DataException(ResourceConstants.RD_SAVE_ERROR,e);
  }
}
Program: 77218
Project: 77218
Buggy source:
/** 
 * @param rowCount
 * @param rowExprsOs
 * @param rowLenOs
 */
RowSaveUtil(int rowCount,OutputStream rowExprsOs,OutputStream rowLenOs){
  this.rowCount=rowCount;
  this.exprNameSet=new HashSet();
  this.rowExprsDos=new DataOutputStream(rowExprsOs);
  this.rowLenDos=new DataOutputStream(rowLenOs);
  this.lastRowIndex=-1;
}

Fixed version (ground truth):
/** 
 * @param rowCount
 * @param rowExprsOs
 * @param rowLenOs
 */
RowSaveUtil(int rowCount,OutputStream rowExprsOs,OutputStream rowLenOs,Set exprNameSet){
  this.rowCount=rowCount;
  this.exprNameSet=new HashSet();
  this.rowExprsDos=new DataOutputStream(rowExprsOs);
  this.rowLenDos=new DataOutputStream(rowLenOs);
  this.lastRowIndex=-1;
  this.exprNameSet=exprNameSet;
}
Program: 77219
Project: 77219
Buggy source:
/** 
 * @param currIndex
 * @param exprID
 * @param exprValue
 * @throws DataException
 */
private int saveExprValue(Map valueMap) throws DataException {
  ByteArrayOutputStream tempBaos=new ByteArrayOutputStream();
  BufferedOutputStream tempBos=new BufferedOutputStream(tempBaos);
  DataOutputStream tempDos=new DataOutputStream(tempBos);
  try {
    IOUtil.writeInt(tempDos,valueMap.size());
    Iterator it=valueMap.entrySet().iterator();
    while (it.hasNext()) {
      Map.Entry entry=(Entry)it.next();
      String exprID=(String)entry.getKey();
      Object value=entry.getValue();
      IOUtil.writeString(tempDos,exprID);
      IOUtil.writeObject(tempDos,value);
      exprNameSet.add(exprID);
    }
    tempDos.flush();
    tempBos.flush();
    tempBaos.flush();
    byte[] bytes=tempBaos.toByteArray();
    int rowBytes=bytes.length;
    IOUtil.writeRawBytes(this.rowExprsDos,bytes);
    tempBaos=null;
    tempBos=null;
    tempDos=null;
    return rowBytes;
  }
 catch (  IOException e) {
    throw new DataException(ResourceConstants.RD_SAVE_ERROR,e,"String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * @param currIndex
 * @param exprID
 * @param exprValue
 * @throws DataException
 */
private int saveExprValue(Map valueMap) throws DataException {
  ByteArrayOutputStream tempBaos=new ByteArrayOutputStream();
  BufferedOutputStream tempBos=new BufferedOutputStream(tempBaos);
  DataOutputStream tempDos=new DataOutputStream(tempBos);
  try {
    IOUtil.writeInt(tempDos,valueMap.size());
    Iterator it=valueMap.keySet().iterator();
    while (it.hasNext()) {
      Object key=it.next();
      Object value=valueMap.get(key);
      IOUtil.writeObject(tempDos,value);
    }
    tempDos.flush();
    tempBos.flush();
    tempBaos.flush();
    byte[] bytes=tempBaos.toByteArray();
    int rowBytes=bytes.length;
    IOUtil.writeRawBytes(this.rowExprsDos,bytes);
    tempBaos=null;
    tempBos=null;
    tempDos=null;
    return rowBytes;
  }
 catch (  IOException e) {
    throw new DataException(ResourceConstants.RD_SAVE_ERROR,e,"String_Node_Str");
  }
}
Program: 77220
Project: 77220
Buggy source:
/** 
 * @param rowExprsRAIs
 * @param rowLenRAIs
 * @param version
 */
ExprDataReader1(RAInputStream rowExprsRAIs,RAInputStream rowLenRAIs,int version) throws DataException {
  try {
    rowCount=IOUtil.readInt(rowExprsRAIs);
  }
 catch (  IOException e) {
    throw new DataException(ResourceConstants.RD_LOAD_ERROR,e,"String_Node_Str");
  }
  this.rowExprsDis=new DataInputStream(rowExprsRAIs);
  this.rowExprsRAIs=rowExprsRAIs;
  this.rowLenRAIs=rowLenRAIs;
  this.version=version;
  this.currReadIndex=0;
  this.currRowIndex=-1;
  this.INT_LENGTH=IOUtil.INT_LENGTH;
}

Fixed version (ground truth):
/** 
 * @param rowExprsRAIs
 * @param rowLenRAIs
 * @param version
 */
ExprDataReader1(RAInputStream rowExprsRAIs,RAInputStream rowLenRAIs,int version) throws DataException {
  this.INT_LENGTH=IOUtil.INT_LENGTH;
  try {
    this.rowCount=IOUtil.readInt(rowExprsRAIs);
    int exprCount=IOUtil.readInt(rowExprsRAIs);
    this.exprKeys=new ArrayList();
    this.rowExprsDis=new DataInputStream(rowExprsRAIs);
    for (int i=0; i < exprCount; i++) {
      this.exprKeys.add(IOUtil.readString(this.rowExprsDis));
    }
    this.metaOffset=INT_LENGTH + IOUtil.readInt(this.rowExprsDis) + INT_LENGTH;
  }
 catch (  IOException e) {
    throw new DataException(ResourceConstants.RD_LOAD_ERROR,e,"String_Node_Str");
  }
  this.rowExprsRAIs=rowExprsRAIs;
  this.rowLenRAIs=rowLenRAIs;
  this.version=version;
  this.currReadIndex=0;
  this.currRowIndex=-1;
}
Program: 77221
Project: 77221
Buggy source:
/** 
 * @param absoluteRowIndex
 * @throws IOException
 * @throws DataException
 */
private void skipTo(int absoluteRowIndex) throws IOException, DataException {
  if (currReadIndex == absoluteRowIndex)   return;
  if (version == VersionManager.VERSION_2_0) {
    int exprCount;
    int gapRows=absoluteRowIndex - currReadIndex;
    for (int j=0; j < gapRows; j++) {
      exprCount=IOUtil.readInt(rowExprsDis);
      for (int i=0; i < exprCount; i++) {
        IOUtil.readString(rowExprsDis);
        IOUtil.readObject(rowExprsDis);
      }
    }
  }
 else {
    rowLenRAIs.seek(absoluteRowIndex * INT_LENGTH);
    int rowOffsetAbsolute=IOUtil.readInt(rowLenRAIs);
    rowExprsRAIs.seek(rowOffsetAbsolute + 4);
    rowExprsDis=new DataInputStream(rowExprsRAIs);
  }
}

Fixed version (ground truth):
/** 
 * @param absoluteRowIndex
 * @throws IOException
 * @throws DataException
 */
private void skipTo(int absoluteRowIndex) throws IOException, DataException {
  if (currReadIndex == absoluteRowIndex)   return;
  if (version == VersionManager.VERSION_2_0) {
    int exprCount;
    int gapRows=absoluteRowIndex - currReadIndex;
    for (int j=0; j < gapRows; j++) {
      exprCount=IOUtil.readInt(rowExprsDis);
      for (int i=0; i < exprCount; i++) {
        IOUtil.readObject(rowExprsDis);
      }
    }
  }
 else {
    rowLenRAIs.seek(absoluteRowIndex * INT_LENGTH);
    int rowOffsetAbsolute=IOUtil.readInt(rowLenRAIs);
    rowExprsRAIs.seek(rowOffsetAbsolute + this.metaOffset);
    rowExprsDis=new DataInputStream(rowExprsRAIs);
  }
}
Program: 77222
Project: 77222
Buggy source:
/** 
 * @throws IOException
 */
private Map getValueMap() throws IOException {
  Map valueMap=new HashMap();
  int exprCount=IOUtil.readInt(rowExprsDis);
  for (int i=0; i < exprCount; i++) {
    String exprID=IOUtil.readString(rowExprsDis);
    Object exprValue=IOUtil.readObject(rowExprsDis);
    valueMap.put(exprID,exprValue);
  }
  return valueMap;
}

Fixed version (ground truth):
/** 
 * @throws IOException
 */
private Map getValueMap() throws IOException {
  Map valueMap=new HashMap();
  int exprCount=IOUtil.readInt(rowExprsDis);
  for (int i=0; i < exprCount; i++) {
    String exprID=this.exprKeys.get(i).toString();
    Object exprValue=IOUtil.readObject(rowExprsDis);
    valueMap.put(exprID,exprValue);
  }
  return valueMap;
}
Program: 77223
Project: 77223
Buggy source:
/** 
 * @param absoluteIndex
 * @throws IOException
 * @throws DataException
 */
private void skipTo(int absoluteIndex) throws IOException, DataException {
  if (currRowLenReadIndex == absoluteIndex)   return;
  currRowLenReadIndex=absoluteIndex + 1;
  rowLenIs.seek(absoluteIndex * 4);
  rowExprsIs.seek(IOUtil.readInt(rowLenIs) + 4);
  rowExprsDis=new DataInputStream(rowExprsIs);
}

Fixed version (ground truth):
/** 
 * @param absoluteIndex
 * @throws IOException
 * @throws DataException
 */
private void skipTo(int absoluteIndex) throws IOException, DataException {
  if (currRowLenReadIndex == absoluteIndex)   return;
  currRowLenReadIndex=absoluteIndex + 1;
  rowLenIs.seek(absoluteIndex * 4);
  rowExprsIs.seek(IOUtil.readInt(rowLenIs) + this.metaOffset);
  rowExprsDis=new DataInputStream(rowExprsIs);
}
Program: 77224
Project: 77224
Buggy source:
/** 
 * @throws IOException
 */
private Map getValueMap() throws IOException {
  Map valueMap=new HashMap();
  int exprCount=IOUtil.readInt(rowExprsDis);
  for (int i=0; i < exprCount; i++) {
    String exprID=IOUtil.readString(rowExprsDis);
    Object exprValue=IOUtil.readObject(rowExprsDis);
    valueMap.put(exprID,exprValue);
  }
  return valueMap;
}

Fixed version (ground truth):
/** 
 * @throws IOException
 */
private Map getValueMap() throws IOException {
  Map valueMap=new HashMap();
  int exprCount=IOUtil.readInt(rowExprsDis);
  for (int i=0; i < exprCount; i++) {
    String exprID=this.exprKeys.get(i).toString();
    Object exprValue=IOUtil.readObject(rowExprsDis);
    valueMap.put(exprID,exprValue);
  }
  return valueMap;
}
Program: 77225
Project: 77225
Buggy source:
public static String relativize(URL url){
  if (url.getProtocol().equals("String_Node_Str")) {
    try {
      return new File(ReportPlugin.getDefault().getResourceFolder()).toURI().relativize(new URI(url.toString())).getPath();
    }
 catch (    URISyntaxException e) {
    }
  }
  return url.getPath();
}

Fixed version (ground truth):
public static String relativize(URL url){
  if (url.getProtocol().equals("String_Node_Str")) {
    return URIUtil.getRelativePath(ReportPlugin.getDefault().getResourceFolder(),url.getPath());
  }
  return url.getPath();
}
Program: 77226
Project: 77226
Buggy source:
/** 
 * @return
 * @throws DataException save error
 */
Map getColumnsValue() throws DataException {
  Map exprValueMap=new HashMap();
  Map realValueMap=new HashMap();
  for (int i=0; i < allManualBindingExprs.size(); i++) {
    List list=(List)allManualBindingExprs.get(i);
    Iterator it=list.iterator();
    while (it.hasNext()) {
      BindingColumn bindingColumn=(BindingColumn)it.next();
      Object exprValue=evaluateValue(bindingColumn,MANUAL_BINDING);
      exprValueMap.put(bindingColumn.columnName,exprValue);
      if (exprValue instanceof BirtException == false)       realValueMap.put(bindingColumn.columnName,exprValue);
    }
  }
  Iterator itr=this.allAutoBindingExprs.iterator();
  while (itr.hasNext()) {
    BindingColumn bindingColumn=(BindingColumn)itr.next();
    Object exprValue=evaluateValue(bindingColumn,AUTO_BINDING);
    exprValueMap.put(bindingColumn.columnName,exprValue);
    if (exprValue instanceof BirtException == false)     realValueMap.put(bindingColumn.columnName,exprValue);
  }
  saveHelper.doSaveExpr(realValueMap);
  return exprValueMap;
}

Fixed version (ground truth):
/** 
 * @return
 * @throws DataException save error
 */
Map getColumnsValue() throws DataException {
  Map exprValueMap=new HashMap();
  for (int i=0; i < allManualBindingExprs.size(); i++) {
    List list=(List)allManualBindingExprs.get(i);
    Iterator it=list.iterator();
    while (it.hasNext()) {
      BindingColumn bindingColumn=(BindingColumn)it.next();
      Object exprValue=evaluateValue(bindingColumn,MANUAL_BINDING);
      exprValueMap.put(bindingColumn.columnName,exprValue);
    }
  }
  Iterator itr=this.allAutoBindingExprs.iterator();
  while (itr.hasNext()) {
    BindingColumn bindingColumn=(BindingColumn)itr.next();
    Object exprValue=evaluateValue(bindingColumn,AUTO_BINDING);
    exprValueMap.put(bindingColumn.columnName,exprValue);
  }
  saveHelper.doSaveExpr(exprValueMap);
  return exprValueMap;
}
Program: 77227
Project: 77227
Buggy source:
/** 
 * @param rowCount
 * @param rowExprsOs
 * @param rowLenOs
 */
RowSaveUtil(int rowCount,OutputStream rowExprsOs,OutputStream rowLenOs,Set exprNameSet){
  this.rowCount=rowCount;
  this.exprNameSet=new HashSet();
  this.rowExprsDos=new DataOutputStream(rowExprsOs);
  this.rowLenDos=new DataOutputStream(rowLenOs);
  this.lastRowIndex=-1;
  this.exprNameSet=exprNameSet;
}

Fixed version (ground truth):
/** 
 * @param rowCount
 * @param rowExprsOs
 * @param rowLenOs
 */
RowSaveUtil(int rowCount,OutputStream rowExprsOs,OutputStream rowLenOs,Set exprNameSet){
  this.rowCount=rowCount;
  this.rowExprsDos=new DataOutputStream(rowExprsOs);
  this.rowLenDos=new DataOutputStream(rowLenOs);
  this.lastRowIndex=-1;
  this.exprNameSet=exprNameSet;
}
Program: 77228
Project: 77228
Buggy source:
/** 
 * @param currIndex
 * @param exprID
 * @param exprValue
 * @throws DataException
 */
private int saveExprValue(Map valueMap) throws DataException {
  ByteArrayOutputStream tempBaos=new ByteArrayOutputStream();
  BufferedOutputStream tempBos=new BufferedOutputStream(tempBaos);
  DataOutputStream tempDos=new DataOutputStream(tempBos);
  try {
    IOUtil.writeInt(tempDos,valueMap.size());
    Iterator it=valueMap.keySet().iterator();
    while (it.hasNext()) {
      Object key=it.next();
      Object value=valueMap.get(key);
      IOUtil.writeObject(tempDos,value);
    }
    tempDos.flush();
    tempBos.flush();
    tempBaos.flush();
    byte[] bytes=tempBaos.toByteArray();
    int rowBytes=bytes.length;
    IOUtil.writeRawBytes(this.rowExprsDos,bytes);
    tempBaos=null;
    tempBos=null;
    tempDos=null;
    return rowBytes;
  }
 catch (  IOException e) {
    throw new DataException(ResourceConstants.RD_SAVE_ERROR,e,"String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * @param currIndex
 * @param exprID
 * @param exprValue
 * @throws DataException
 */
private int saveExprValue(Map valueMap) throws DataException {
  ByteArrayOutputStream tempBaos=new ByteArrayOutputStream();
  BufferedOutputStream tempBos=new BufferedOutputStream(tempBaos);
  DataOutputStream tempDos=new DataOutputStream(tempBos);
  try {
    IOUtil.writeInt(tempDos,valueMap.size());
    Iterator it=exprNameSet.iterator();
    while (it.hasNext()) {
      Object key=it.next();
      Object value=valueMap.get(key);
      if (value instanceof DataException)       value=EXCEPTION_INDICATOR;
      IOUtil.writeObject(tempDos,value);
    }
    tempDos.flush();
    tempBos.flush();
    tempBaos.flush();
    byte[] bytes=tempBaos.toByteArray();
    int rowBytes=bytes.length;
    IOUtil.writeRawBytes(this.rowExprsDos,bytes);
    tempBaos=null;
    tempBos=null;
    tempDos=null;
    return rowBytes;
  }
 catch (  IOException e) {
    throw new DataException(ResourceConstants.RD_SAVE_ERROR,e,"String_Node_Str");
  }
}
Program: 77229
Project: 77229
Buggy source:
/** 
 * @throws IOException
 */
private Map getValueMap() throws IOException {
  Map valueMap=new HashMap();
  int exprCount=IOUtil.readInt(rowExprsDis);
  for (int i=0; i < exprCount; i++) {
    String exprID=this.exprKeys.get(i).toString();
    Object exprValue=IOUtil.readObject(rowExprsDis);
    valueMap.put(exprID,exprValue);
  }
  return valueMap;
}

Fixed version (ground truth):
/** 
 * @throws IOException
 */
private Map getValueMap() throws IOException {
  Map valueMap=new HashMap();
  int exprCount=IOUtil.readInt(rowExprsDis);
  for (int i=0; i < exprCount; i++) {
    String exprID=this.exprKeys.get(i).toString();
    Object exprValue=IOUtil.readObject(rowExprsDis);
    if (RowSaveUtil.EXCEPTION_INDICATOR.equals(exprValue))     continue;
    valueMap.put(exprID,exprValue);
  }
  return valueMap;
}
Program: 77230
Project: 77230
Buggy source:
/** 
 * @throws IOException
 */
private Map getValueMap() throws IOException {
  Map valueMap=new HashMap();
  int exprCount=IOUtil.readInt(rowExprsDis);
  for (int i=0; i < exprCount; i++) {
    String exprID=this.exprKeys.get(i).toString();
    Object exprValue=IOUtil.readObject(rowExprsDis);
    valueMap.put(exprID,exprValue);
  }
  return valueMap;
}

Fixed version (ground truth):
/** 
 * @throws IOException
 */
private Map getValueMap() throws IOException {
  Map valueMap=new HashMap();
  int exprCount=IOUtil.readInt(rowExprsDis);
  for (int i=0; i < exprCount; i++) {
    String exprID=this.exprKeys.get(i).toString();
    Object exprValue=IOUtil.readObject(rowExprsDis);
    if (RowSaveUtil.EXCEPTION_INDICATOR.equals(exprValue))     continue;
    valueMap.put(exprID,exprValue);
  }
  return valueMap;
}
Program: 77232
Project: 77232
Buggy source:
/** 
 */
public void test_122600(){
  MetaDataDictionary instance=MetaDataDictionary.getInstance();
  IChoiceSet choiceset=instance.getChoiceSet("String_Node_Str");
  IChoice[] naturedSortedChoices=choiceset.getChoices(null);
  assertEquals("String_Node_Str",naturedSortedChoices[17].getName());
  assertEquals("String_Node_Str",naturedSortedChoices[1].getName());
  assertEquals("String_Node_Str",naturedSortedChoices[10].getName());
  assertEquals("String_Node_Str",naturedSortedChoices[12].getName());
}

Fixed version (ground truth):
/** 
 */
public void test_122600(){
  MetaDataDictionary instance=MetaDataDictionary.getInstance();
  IChoiceSet choiceset=instance.getChoiceSet("String_Node_Str");
  IChoice[] naturedSortedChoices=choiceset.getChoices(null);
  boolean topN=false;
  boolean bottomN=false;
  boolean like=false;
  boolean match=false;
  for (int i=0; i < naturedSortedChoices.length; i++) {
    IChoice choice=(IChoice)naturedSortedChoices[i];
    if ("String_Node_Str".equals(choice.getName()))     topN=true;
 else     if ("String_Node_Str".equals(choice.getName()))     bottomN=true;
 else     if ("String_Node_Str".equals(choice.getName()))     like=true;
 else     if ("String_Node_Str".equals(choice.getName()))     match=true;
  }
  assertTrue(topN);
  assertTrue(bottomN);
  assertTrue(like);
  assertTrue(match);
}
Program: 77233
Project: 77233
Buggy source:
/** 
 * Reset for test case
 */
synchronized void resetForTest(){
  cacheMap=new HashMap();
  folderUtil=new FolderUtil();
}

Fixed version (ground truth):
/** 
 * Reset for test case
 */
void resetForTest(){
synchronized (this) {
    cacheMap=new HashMap();
    folderUtil=new FolderUtil();
  }
}
Program: 77234
Project: 77234
Buggy source:
/** 
 * @param dsAndDs
 * @return
 */
synchronized boolean doesLoadFromCache(DataSourceAndDataSet dsAndDs){
  String cacheDirStr=(String)this.cacheMap.get(dsAndDs);
  if (cacheDirStr != null && new File(cacheDirStr).exists() == true)   return true;
 else   return false;
}

Fixed version (ground truth):
/** 
 * @param dsAndDs
 * @return
 */
boolean doesLoadFromCache(DataSourceAndDataSet dsAndDs){
  String cacheDirStr=null;
synchronized (this.cacheMap) {
    cacheDirStr=(String)this.cacheMap.get(dsAndDs);
  }
  if (cacheDirStr != null && new File(cacheDirStr).exists() == true)   return true;
 else   return false;
}
Program: 77235
Project: 77235
Buggy source:
/** 
 * @param dataSourceDesign2
 * @param dataSetDesign2
 */
synchronized void clearCache(DataSourceAndDataSet dsAndDs){
  Object cacheDir=cacheMap.get(dsAndDs);
  if (cacheDir != null) {
    cacheMap.remove(dsAndDs);
    folderUtil.deleteDir((String)cacheDir);
  }
}

Fixed version (ground truth):
/** 
 * @param dataSourceDesign2
 * @param dataSetDesign2
 */
void clearCache(DataSourceAndDataSet dsAndDs){
  Object cacheDir=null;
synchronized (this.cacheMap) {
    cacheDir=cacheMap.remove(dsAndDs);
  }
  if (cacheDir != null) {
    folderUtil.deleteDir((String)cacheDir);
  }
}
Program: 77236
Project: 77236
Buggy source:
/** 
 * @return
 */
synchronized boolean doesSaveToCache(DataSourceAndDataSet dsAndDs){
  String cacheDirStr=(String)this.cacheMap.get(dsAndDs);
  if (cacheDirStr != null && new File(cacheDirStr).exists() == true) {
    return false;
  }
 else {
    this.cacheMap.put(dsAndDs,folderUtil.createSessionTempDir());
    return true;
  }
}

Fixed version (ground truth):
/** 
 * @return
 */
boolean doesSaveToCache(DataSourceAndDataSet dsAndDs){
  String cacheDirStr=null;
synchronized (this.cacheMap) {
    cacheDirStr=(String)this.cacheMap.get(dsAndDs);
  }
  if (cacheDirStr != null && new File(cacheDirStr).exists() == true) {
    return false;
  }
 else {
synchronized (this.cacheMap) {
      cacheDirStr=(String)this.cacheMap.get(dsAndDs);
      if (cacheDirStr != null && new File(cacheDirStr).exists() == true) {
        return false;
      }
 else {
        this.cacheMap.put(dsAndDs,folderUtil.createSessionTempDir());
        return true;
      }
    }
  }
}
Program: 77237
Project: 77237
Buggy source:
/** 
 * Returns the matched ODA data set parameter by the given ROM data set parameter and data set design.
 * @param param the ROM data set parameter
 * @param dataSetDesign the oda data set design
 * @return the matched ODA parameter defintion
 */
private static ParameterDefinition getValidParameterDefinition(OdaDataSetParameterHandle param,DataSetParameters odaParams){
  if (param == null || odaParams == null)   return null;
  if (odaParams.getParameterDefinitions().isEmpty())   return null;
  ParameterDefinition matchedParam=DataSetParameterAdapter.findParameterDefinition(odaParams,param.getName(),param.getPosition());
  return matchedParam;
}

Fixed version (ground truth):
/** 
 * Returns the matched ODA data set parameter by the given ROM data set parameter and data set design.
 * @param param the ROM data set parameter
 * @param dataSetDesign the oda data set design
 * @return the matched ODA parameter defintion
 */
private static ParameterDefinition getValidParameterDefinition(OdaDataSetParameterHandle param,DataSetParameters odaParams){
  if (param == null || odaParams == null)   return null;
  if (odaParams.getParameterDefinitions().isEmpty())   return null;
  ParameterDefinition matchedParam=DataSetParameterAdapter.findParameterDefinition(odaParams,param.getNativeName(),param.getPosition());
  return matchedParam;
}
Program: 77239
Project: 77239
Buggy source:
/** 
 * @throws DataException
 */
void saveQueryDefn() throws DataException {
  OutputStream outputStream;
  if (queryDefn instanceof QueryDefinition && ((QueryDefinition)queryDefn).getQueryResultsID() == null) {
    outputStream=streamManager.getOutStream(DataEngineContext.ORIGINAL_QUERY_DEFN_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE);
    QueryDefnUtil.saveBaseQueryDefn(outputStream,queryDefn);
  }
  outputStream=streamManager.getOutStream(DataEngineContext.QUERY_DEFN_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE);
  QueryDefnUtil.saveBaseQueryDefn(outputStream,queryDefn);
  try {
    outputStream.close();
  }
 catch (  IOException e) {
    throw new DataException(ResourceConstants.RD_SAVE_ERROR,e);
  }
}

Fixed version (ground truth):
/** 
 * @throws DataException
 */
void saveQueryDefn() throws DataException {
  OutputStream outputStream;
  if (queryDefn instanceof QueryDefinition && ((QueryDefinition)queryDefn).getQueryResultsID() == null) {
    outputStream=streamManager.getOutStream(DataEngineContext.ORIGINAL_QUERY_DEFN_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE);
    QueryDefnUtil.saveBaseQueryDefn(outputStream,queryDefn);
    try {
      outputStream.close();
    }
 catch (    IOException e) {
      throw new DataException(ResourceConstants.RD_SAVE_ERROR,e);
    }
  }
  outputStream=streamManager.getOutStream(DataEngineContext.QUERY_DEFN_STREAM,StreamManager.ROOT_STREAM,StreamManager.SELF_SCOPE);
  QueryDefnUtil.saveBaseQueryDefn(outputStream,queryDefn);
  try {
    outputStream.close();
  }
 catch (  IOException e) {
    throw new DataException(ResourceConstants.RD_SAVE_ERROR,e);
  }
}
Program: 77241
Project: 77241
Buggy source:
/** 
 * Parse report object and get the parameter default values
 * @param design IViewerReportDesignHandle
 * @param paramName String
 * @param options InputOptionsF
 * @return String
 */
protected String getParameterDefaultValues(IViewerReportDesignHandle design,String paramName,InputOptions options) throws ReportServiceException {
  if (design == null)   return null;
  String defalutValue=null;
  Object defaultValueObj=null;
  try {
    defaultValueObj=this.getReportService().getParameterDefaultValue(design,paramName,options);
  }
 catch (  ReportServiceException e) {
    e.printStackTrace();
  }
  ScalarParameterHandle parameter=(ScalarParameterHandle)findParameter(paramName);
  if (defaultValueObj != null && parameter != null) {
    defalutValue=ParameterValidationUtil.getDisplayValue(null,parameter.getPattern(),defaultValueObj,locale);
  }
  if (defalutValue == null && parameter != null) {
    defalutValue=parameter.getDefaultValue();
  }
  return defalutValue;
}

Fixed version (ground truth):
/** 
 * Parse report object and get the parameter default values
 * @param design IViewerReportDesignHandle
 * @param paramName String
 * @param options InputOptionsF
 * @return String
 */
protected String getParameterDefaultValues(IViewerReportDesignHandle design,String paramName,InputOptions options) throws ReportServiceException {
  if (design == null)   return null;
  String defalutValue=null;
  Object defaultValueObj=null;
  try {
    defaultValueObj=this.getReportService().getParameterDefaultValue(design,paramName,options);
  }
 catch (  ReportServiceException e) {
    e.printStackTrace();
  }
  ScalarParameterHandle parameter=(ScalarParameterHandle)findParameter(paramName);
  if (defaultValueObj != null && parameter != null) {
    String dataType=parameter.getDataType();
    String pattern=parameter.getPattern();
    if (DesignChoiceConstants.PARAM_TYPE_DATETIME.equalsIgnoreCase(dataType)) {
      defalutValue=ParameterValidationUtil.getDisplayValue(defaultValueObj);
    }
 else {
      if (DesignChoiceConstants.PARAM_TYPE_STRING.equalsIgnoreCase(dataType)) {
        pattern=null;
      }
      defalutValue=ParameterValidationUtil.getDisplayValue(null,pattern,defaultValueObj,locale);
    }
  }
  if (defalutValue == null && parameter != null) {
    defalutValue=parameter.getDefaultValue();
  }
  return defalutValue;
}
Program: 77243
Project: 77243
Buggy source:
/** 
 * @throws DataException
 */
void doSaveFinish() throws DataException {
  if (needsSaveToDoc() == false)   return;
  if (isBasicSaved == false) {
    isBasicSaved=true;
    this.getRdSave().saveResultIterator(new DummyCachedResult(),-1,null);
  }
  this.getRdSave().saveFinish(0);
}

Fixed version (ground truth):
/** 
 * @throws DataException
 */
void doSaveFinish() throws DataException {
  if (needsSaveToDoc() == false)   return;
  if (isBasicSaved == false) {
    isBasicSaved=true;
    this.getRdSave().saveResultIterator(new DummyCachedResult(),-1,new int[]{0,1});
  }
  this.getRdSave().saveFinish(0);
}
Program: 77244
Project: 77244
Buggy source:
/** 
 * @param dataSetName
 * @return
 * @throws BirtException
 */
private IResultMetaData getRealMetaData(DataSetHandle dataSetHandle) throws BirtException {
  QueryDefinition query=new QueryDefinition();
  query.setDataSetName(dataSetHandle.getQualifiedName());
  query.setMaxRows(1);
  IResultMetaData metaData=MetaDataPopulator.retrieveResultMetaData(dataSetHandle);
  if (metaData == null) {
    metaData=new QueryExecutionHelper(dataEngine,modelAdaptor,sessionContext,false).executeQuery(query).getResultMetaData();
    addResultSetColumn(dataSetHandle,metaData);
  }
  if (needsUseResultHint(dataSetHandle,metaData)) {
    metaData=new QueryExecutionHelper(dataEngine,modelAdaptor,sessionContext,true).executeQuery(query).getResultMetaData();
  }
  if (!(dataSetHandle instanceof ScriptDataSetHandle))   clearUnusedData(dataSetHandle,metaData);
  return metaData;
}

Fixed version (ground truth):
/** 
 * @param dataSetName
 * @return
 * @throws BirtException
 */
private IResultMetaData getRealMetaData(DataSetHandle dataSetHandle) throws BirtException {
  QueryDefinition query=new QueryDefinition();
  query.setDataSetName(dataSetHandle.getQualifiedName());
  query.setMaxRows(1);
  IResultMetaData metaData=MetaDataPopulator.retrieveResultMetaData(dataSetHandle);
  if (metaData == null) {
    metaData=new QueryExecutionHelper(dataEngine,modelAdaptor,sessionContext,false).executeQuery(query).getResultMetaData();
    if (dataSetHandle.canEdit())     addResultSetColumn(dataSetHandle,metaData);
  }
  if (needsUseResultHint(dataSetHandle,metaData)) {
    metaData=new QueryExecutionHelper(dataEngine,modelAdaptor,sessionContext,true).executeQuery(query).getResultMetaData();
  }
  if (!(dataSetHandle instanceof ScriptDataSetHandle))   clearUnusedData(dataSetHandle,metaData);
  return metaData;
}
Program: 77247
Project: 77247
Buggy source:
/** 
 * Create a row expression base on a binding column name.
 * @param columnName the column name
 * @return the expression, or null if the column name is blank.
 */
public static String getColumnExpression(String columnName){
  Assert.isNotNull(columnName);
  if (StringUtil.isBlank(columnName)) {
    return null;
  }
  return BINDING_COLUMN_PREFIX + "String_Node_Str" + escape(columnName)+ "String_Node_Str";
}

Fixed version (ground truth):
/** 
 * Create a row expression base on a binding column name.
 * @param columnName the column name
 * @return the expression, or null if the column name is blank.
 */
public static String getColumnExpression(String columnName){
  Assert.isNotNull(columnName);
  if (StringUtil.isBlank(columnName)) {
    return null;
  }
  return ExpressionUtil.createJSRowExpression(columnName);
}
Program: 77249
Project: 77249
Buggy source:
/** 
 * compile row position expression
 * @param refNode
 * @param tree
 * @param columnExprList
 * @throws BirtException
 */
private void compileRowPositionRef(Node refNode,ScriptOrFnNode tree,List columnExprList) throws BirtException {
  Node rowFirstNode=refNode.getFirstChild();
  if (rowFirstNode.getType() == Token.GETELEM || rowFirstNode.getType() == Token.SETELEM) {
    Node rowNode=rowFirstNode.getFirstChild();
    if (rowNode != null && rowNode.getType() == Token.NAME && rowNode.getString().equals(ROWS_0_INDICATOR)) {
      Node rowColumn=rowNode.getNext();
      if (rowColumn.getDouble() == 0.0) {
        rowColumn=rowFirstNode.getNext();
        if (rowColumn.getType() == Token.STRING && (refNode.getType() == Token.GETELEM || refNode.getType() == Token.SETELEM)) {
          ColumnBinding binding=new ColumnBinding(rowColumn.getString(),DATASETROW_INDICATOR + "String_Node_Str" + rowColumn.getString()+ "String_Node_Str",1);
          columnExprList.add(binding);
          ;
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * compile row position expression
 * @param refNode
 * @param tree
 * @param columnExprList
 * @throws BirtException
 */
private void compileRowPositionRef(Node refNode,ScriptOrFnNode tree,List columnExprList) throws BirtException {
  Node rowFirstNode=refNode.getFirstChild();
  if (rowFirstNode.getType() == Token.GETELEM || rowFirstNode.getType() == Token.SETELEM) {
    Node rowNode=rowFirstNode.getFirstChild();
    if (rowNode != null && rowNode.getType() == Token.NAME && rowNode.getString().equals(ROWS_0_INDICATOR)) {
      Node rowColumn=rowNode.getNext();
      if (rowColumn.getDouble() == 0.0) {
        rowColumn=rowFirstNode.getNext();
        if (rowColumn.getType() == Token.STRING && (refNode.getType() == Token.GETELEM || refNode.getType() == Token.SETELEM)) {
          ColumnBinding binding=new ColumnBinding(rowColumn.getString(),ExpressionUtil.createJSDataSetRowExpression(rowColumn.getString()),1);
          columnExprList.add(binding);
          ;
        }
      }
    }
  }
}
Program: 77250
Project: 77250
Buggy source:
/** 
 * The method which extracts column name from group definition.
 * @param group
 * @return
 */
private String getGroupKeyExpression(GroupDefinition group){
  String columnName;
  if (group.getKeyColumn() != null) {
    columnName="String_Node_Str" + group.getKeyColumn() + "String_Node_Str";
  }
 else {
    columnName=group.getKeyExpression();
  }
  return columnName;
}

Fixed version (ground truth):
/** 
 * The method which extracts column name from group definition.
 * @param group
 * @return
 */
private String getGroupKeyExpression(GroupDefinition group){
  String columnName;
  if (group.getKeyColumn() != null) {
    columnName=ExpressionUtil.createJSRowExpression(group.getKeyColumn());
  }
 else {
    columnName=group.getKeyExpression();
  }
  return columnName;
}
Program: 77251
Project: 77251
Buggy source:
public void initAutoBinding() throws DataException {
  if (needAutoBinding() == false)   return;
  Context cx=Context.enter();
  IResultMetaData metaData=getResultMetaData();
  int columnCount=metaData.getColumnCount();
  for (int i=0; i < columnCount; i++) {
    int colIndex=i + 1;
    try {
      String colName=metaData.getColumnAlias(colIndex);
      if (colName == null)       colName=metaData.getColumnName(colIndex);
      ScriptExpression baseExpr=new ScriptExpression("String_Node_Str" + JavascriptEvalUtil.transformToJsConstants(colName) + "String_Node_Str",metaData.getColumnType(colIndex));
      CompiledExpression compiledExpr=ExpressionCompilerUtil.compile(baseExpr.getText(),cx);
      baseExpr.setHandle(compiledExpr);
      this.exprManager.addAutoBindingExpr(colName,baseExpr);
    }
 catch (    BirtException e) {
    }
  }
  Context.exit();
}

Fixed version (ground truth):
public void initAutoBinding() throws DataException {
  if (needAutoBinding() == false)   return;
  Context cx=Context.enter();
  IResultMetaData metaData=getResultMetaData();
  int columnCount=metaData.getColumnCount();
  for (int i=0; i < columnCount; i++) {
    int colIndex=i + 1;
    try {
      String colName=metaData.getColumnAlias(colIndex);
      if (colName == null)       colName=metaData.getColumnName(colIndex);
      ScriptExpression baseExpr=new ScriptExpression(ExpressionUtil.createJSDataSetRowExpression(colName),metaData.getColumnType(colIndex));
      CompiledExpression compiledExpr=ExpressionCompilerUtil.compile(baseExpr.getText(),cx);
      baseExpr.setHandle(compiledExpr);
      this.exprManager.addAutoBindingExpr(colName,baseExpr);
    }
 catch (    BirtException e) {
    }
  }
  Context.exit();
}
Program: 77253
Project: 77253
Buggy source:
public ParameterAdapter(DataSetParameterHandle modelParam){
  setName(modelParam.getName());
  if (modelParam.getPosition() != null)   setPosition(modelParam.getPosition().intValue());
  if (modelParam.getNativeDataType() != null)   setNativeType(modelParam.getNativeDataType().intValue());
  setType(ModelAdapter.adaptModelDataType(modelParam.getDataType()));
  setInputMode(modelParam.isInput());
  setOutputMode(modelParam.isOutput());
  setNullable(modelParam.allowNull());
  setInputOptional(modelParam.isOptional());
  if (modelParam instanceof OdaDataSetParameterHandle && ((OdaDataSetParameterHandle)modelParam).getParamName() != null) {
    setDefaultInputValue(ExpressionUtil.createParameterExpression(((OdaDataSetParameterHandle)modelParam).getParamName()));
  }
 else   setDefaultInputValue(modelParam.getDefaultValue());
}

Fixed version (ground truth):
public ParameterAdapter(DataSetParameterHandle modelParam){
  setName(modelParam.getName());
  if (modelParam.getPosition() != null)   setPosition(modelParam.getPosition().intValue());
  if (modelParam.getNativeDataType() != null)   setNativeType(modelParam.getNativeDataType().intValue());
  setType(ModelAdapter.adaptModelDataType(modelParam.getDataType()));
  setInputMode(modelParam.isInput());
  setOutputMode(modelParam.isOutput());
  setNullable(modelParam.allowNull());
  setInputOptional(modelParam.isOptional());
  if (modelParam instanceof OdaDataSetParameterHandle && ((OdaDataSetParameterHandle)modelParam).getParamName() != null) {
    setDefaultInputValue(ExpressionUtil.createJSParameterExpression(((OdaDataSetParameterHandle)modelParam).getParamName()));
  }
 else   setDefaultInputValue(modelParam.getDefaultValue());
}
Program: 77254
Project: 77254
Buggy source:
/** 
 * @param result
 * @param key
 */
private void addConditionalExprBindings(TotalExprBinding result,IConditionalExpression key,List bindings,String groupName){
  IConditionalExpression ce=key;
  if (groupName != null)   ce.setGroupName(groupName);
  String bindingName=TOTAL_PREFIX + totalColumnSuffix;
  totalColumnSuffix++;
  ColumnBinding columnBinding=new ColumnBinding(bindingName,ce);
  List allColumnBindings=new ArrayList();
  allColumnBindings.add(columnBinding);
  result.addColumnBindings(allColumnBindings);
  result.addNewExpression("String_Node_Str" + JavascriptEvalUtil.transformToJsConstants(bindingName) + "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * @param result
 * @param key
 */
private void addConditionalExprBindings(TotalExprBinding result,IConditionalExpression key,List bindings,String groupName){
  IConditionalExpression ce=key;
  if (groupName != null)   ce.setGroupName(groupName);
  String bindingName=TOTAL_PREFIX + totalColumnSuffix;
  totalColumnSuffix++;
  ColumnBinding columnBinding=new ColumnBinding(bindingName,ce);
  List allColumnBindings=new ArrayList();
  allColumnBindings.add(columnBinding);
  result.addColumnBindings(allColumnBindings);
  result.addNewExpression(org.eclipse.birt.core.data.ExpressionUtil.createJSRowExpression(bindingName));
}
Program: 77257
Project: 77257
Buggy source:
public void visitDataItem(DataItemHandle handle){
  DataItemDesign data=new DataItemDesign();
  setupReportItem(data,handle);
  data.setName(handle.getName());
  String expr=handle.getResultSetColumn();
  if (expr != null && expr.trim().length() > 0) {
    expr="String_Node_Str" + JavascriptEvalUtil.transformToJsConstants(expr) + "String_Node_Str";
    data.setValue(expr);
  }
  ActionHandle action=handle.getActionHandle();
  if (action != null) {
    data.setAction(createAction(action));
  }
  data.setHelpText(handle.getHelpTextKey(),handle.getHelpText());
  setHighlight(data,expr);
  setMap(data,expr);
  currentElement=data;
}

Fixed version (ground truth):
public void visitDataItem(DataItemHandle handle){
  DataItemDesign data=new DataItemDesign();
  setupReportItem(data,handle);
  data.setName(handle.getName());
  String expr=handle.getResultSetColumn();
  if (expr != null && expr.trim().length() > 0) {
    expr=ExpressionUtil.createJSRowExpression(expr);
    data.setValue(expr);
  }
  ActionHandle action=handle.getActionHandle();
  if (action != null) {
    data.setAction(createAction(action));
  }
  data.setHelpText(handle.getHelpTextKey(),handle.getHelpText());
  setHighlight(data,expr);
  setMap(data,expr);
  currentElement=data;
}