nus-yam/ex-repair huggingface dataset:
Program: 74689
Project: 74689
Buggy source:
public void doSave(StreamWrapper streamWrapper,boolean isSubQuery) throws DataException {
  try {
    if (streamWrapper.getStreamForResultClass() != null) {
      IOUtil.writeInt(streamWrapper.getStreamForResultClass(),0);
      streamWrapper.getStreamForResultClass().close();
      if (streamWrapper.getStreamForDataSet() != null) {
        IOUtil.writeInt(streamWrapper.getStreamForDataSet(),0);
        streamWrapper.getStreamForDataSet().close();
      }
    }
    IOUtil.writeInt(streamWrapper.getStreamForGroupInfo(),0);
  }
 catch (  IOException e) {
    throw new DataException(ResourceConstants.RD_SAVE_ERROR,e,"String_Node_Str");
  }
}

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

Fixed version (ground truth):
public void doSave(StreamWrapper streamsWrapper,boolean isSubQuery) throws DataException {
  try {
    if (streamsWrapper.getStreamForResultClass() != null) {
      IOUtil.writeInt(streamsWrapper.getStreamForResultClass(),0);
      streamsWrapper.getStreamForResultClass().close();
      if (streamsWrapper.getStreamForDataSet() != null) {
        IOUtil.writeInt(streamsWrapper.getStreamForDataSet(),0);
        streamsWrapper.getStreamForDataSet().close();
      }
      if (streamsWrapper.getStreamForDataSetRowLens() != null) {
        IOUtil.writeLong(streamsWrapper.getStreamForDataSetRowLens(),0);
        streamsWrapper.getStreamForDataSetRowLens().close();
      }
    }
    IOUtil.writeInt(streamsWrapper.getStreamForGroupInfo(),0);
  }
 catch (  IOException e) {
    throw new DataException(ResourceConstants.RD_SAVE_ERROR,e,"String_Node_Str");
  }
}
Program: 74691
Project: 74691
Buggy source:
/** 
 * This is used for PRESENTATION, the data in report document as the CachedResultSet.
 * @return
 * @throws DataException
 */
IExprResultSet loadExprResultSet() throws DataException {
  if (streamManager.isSecondRD() == true && streamManager.isSubquery() == true)   return new ExprResultSet2(streamManager,version,streamManager.isSecondRD());
  return new ExprResultSet(streamManager,version,streamManager.isSecondRD());
}

Fixed version (ground truth):
/** 
 * This is used for PRESENTATION, the data in report document as the CachedResultSet.
 * @return
 * @throws DataException
 */
IExprResultSet loadExprResultSet() throws DataException {
  if (streamManager.isSecondRD() == true && streamManager.isSubquery() == true)   return new ExprResultSet2(streamManager,version,streamManager.isSecondRD());
  return new ExprResultSet(streamManager,version,streamManager.isSecondRD(),(streamManager.isSubquery() || this.version < VersionManager.VERSION_2_2_1_3) ? null : this.loadDataSetData());
}
Program: 74692
Project: 74692
Buggy source:
/** 
 * @return
 * @throws DataException
 */
public DataSetResultSet loadDataSetData() throws DataException {
  InputStream stream=streamManager.getInStream(DataEngineContext.DATASET_DATA_STREAM,StreamManager.ROOT_STREAM,StreamManager.BASE_SCOPE);
  BufferedInputStream buffStream=new BufferedInputStream(stream);
  DataSetResultSet populator=new DataSetResultSet(buffStream,this.loadResultClass());
  return populator;
}

Fixed version (ground truth):
/** 
 * @return
 * @throws DataException
 */
public DataSetResultSet loadDataSetData() throws DataException {
  RAInputStream stream=streamManager.getInStream(DataEngineContext.DATASET_DATA_STREAM,StreamManager.ROOT_STREAM,StreamManager.BASE_SCOPE);
  RAInputStream lensStream=null;
  if (version >= VersionManager.VERSION_2_2_1_3)   lensStream=streamManager.getInStream(DataEngineContext.DATASET_DATA_LEN_STREAM,StreamManager.ROOT_STREAM,StreamManager.BASE_SCOPE);
  DataSetResultSet populator=new DataSetResultSet(stream,lensStream,this.loadResultClass());
  return populator;
}
Program: 74693
Project: 74693
Buggy source:
/** 
 * This is used for UPDATE, the data in report document as data source for transformation.
 * @return
 * @throws DataException
 */
public IExprDataResultSet loadExprDataResultSet() throws DataException {
  if (version == VersionManager.VERSION_2_0)   throw new DataException(ResourceConstants.WRONG_VERSION);
  InputStream inputStream=streamManager.getInStream(DataEngineContext.EXPR_META_STREAM,StreamManager.ROOT_STREAM,StreamManager.BASE_SCOPE);
  BufferedInputStream buffStream=new BufferedInputStream(inputStream);
  ExprMetaInfo[] exprMetas=ExprMetaUtil.loadExprMetaInfo(buffStream);
  try {
    buffStream.close();
    inputStream.close();
  }
 catch (  IOException e) {
  }
  IExprDataResultSet exprDataResultSet=null;
  if (streamManager.isBasedOnSecondRD() == false)   exprDataResultSet=new ExprDataResultSet1(streamManager.getInStream(DataEngineContext.EXPR_VALUE_STREAM,StreamManager.ROOT_STREAM,StreamManager.BASE_SCOPE),exprMetas,streamManager.getVersion());
 else   exprDataResultSet=new ExprDataResultSet2(streamManager.getInStream(DataEngineContext.EXPR_VALUE_STREAM,StreamManager.ROOT_STREAM,StreamManager.BASE_SCOPE),streamManager.getInStream(DataEngineContext.EXPR_ROWLEN_STREAM,StreamManager.ROOT_STREAM,StreamManager.BASE_SCOPE),streamManager.getInStream(DataEngineContext.ROW_INDEX_STREAM,StreamManager.ROOT_STREAM,StreamManager.PARENT_SCOPE),exprMetas,version);
  return exprDataResultSet;
}

Fixed version (ground truth):
/** 
 * This is used for UPDATE, the data in report document as data source for transformation.
 * @return
 * @throws DataException
 */
public IExprDataResultSet loadExprDataResultSet() throws DataException {
  if (version == VersionManager.VERSION_2_0)   throw new DataException(ResourceConstants.WRONG_VERSION);
  InputStream inputStream=streamManager.getInStream(DataEngineContext.EXPR_META_STREAM,StreamManager.ROOT_STREAM,StreamManager.BASE_SCOPE);
  BufferedInputStream buffStream=new BufferedInputStream(inputStream);
  ExprMetaInfo[] exprMetas=ExprMetaUtil.loadExprMetaInfo(buffStream);
  try {
    buffStream.close();
    inputStream.close();
  }
 catch (  IOException e) {
  }
  IExprDataResultSet exprDataResultSet=null;
  if (streamManager.isBasedOnSecondRD() == false)   exprDataResultSet=new ExprDataResultSet1(streamManager.getInStream(DataEngineContext.EXPR_VALUE_STREAM,StreamManager.ROOT_STREAM,StreamManager.BASE_SCOPE),exprMetas,version,version < VersionManager.VERSION_2_2_1_3 ? null : this.loadDataSetData());
 else   exprDataResultSet=new ExprDataResultSet2(streamManager.getInStream(DataEngineContext.EXPR_VALUE_STREAM,StreamManager.ROOT_STREAM,StreamManager.BASE_SCOPE),streamManager.getInStream(DataEngineContext.EXPR_ROWLEN_STREAM,StreamManager.ROOT_STREAM,StreamManager.BASE_SCOPE),streamManager.getInStream(DataEngineContext.ROW_INDEX_STREAM,StreamManager.ROOT_STREAM,StreamManager.PARENT_SCOPE),exprMetas,version,version < VersionManager.VERSION_2_2_1_3 ? null : this.loadDataSetData());
  return exprDataResultSet;
}
Program: 74694
Project: 74694
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);
  Map bindingNameColumnName=new HashMap();
  Set bindingNamesToSave=new HashSet();
  Iterator it=this.queryDefn.getBindings().keySet().iterator();
  while (it.hasNext()) {
    String key=it.next().toString();
    IBinding binding=(IBinding)this.queryDefn.getBindings().get(key);
    if (this.queryDefn instanceof QueryDefinition && ((QueryDefinition)this.queryDefn).getQueryResultsID() == null && binding.getAggregatOns().size() == 0 && binding.getAggrFunction() == null) {
      IBaseExpression expr=binding.getExpression();
      if (expr instanceof IScriptExpression) {
        String expression=((IScriptExpression)expr).getText();
        String dataSetColumnName=this.getDataSetColumnName(expression);
        if (dataSetColumnName != null) {
          bindingNameColumnName.put(binding.getBindingName(),dataSetColumnName);
        }
      }
    }
    if (bindingNameColumnName.get(binding.getBindingName()) == null)     bindingNamesToSave.add(binding.getBindingName());
  }
  this.rowSaveUtil=new RowSaveUtil(rowCount,rowExprsOs,rowLenOs,bindingNamesToSave,bindingNameColumnName);
}

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);
  Map bindingNameColumnName=new HashMap();
  Set bindingNamesToSave=new HashSet();
  Iterator it=this.queryDefn.getBindings().keySet().iterator();
  while (it.hasNext()) {
    String key=it.next().toString();
    IBinding binding=(IBinding)this.queryDefn.getBindings().get(key);
    if (this.streamManager.getVersion() >= VersionManager.VERSION_2_2_1_3 && this.queryDefn instanceof QueryDefinition && ((QueryDefinition)this.queryDefn).getQueryResultsID() == null && binding.getAggregatOns().size() == 0 && binding.getAggrFunction() == null) {
      IBaseExpression expr=binding.getExpression();
      if (expr instanceof IScriptExpression) {
        String expression=((IScriptExpression)expr).getText();
        String dataSetColumnName=this.getDataSetColumnName(expression);
        if (dataSetColumnName != null) {
          bindingNameColumnName.put(binding.getBindingName(),dataSetColumnName);
        }
      }
    }
    if (bindingNameColumnName.get(binding.getBindingName()) == null)     bindingNamesToSave.add(binding.getBindingName());
  }
  this.rowSaveUtil=new RowSaveUtil(rowCount,rowExprsOs,rowLenOs,bindingNamesToSave,bindingNameColumnName,this.streamManager.getVersion());
}
Program: 74695
Project: 74695
Buggy source:
/** 
 * init save environment
 */
private void initSave(boolean finish) throws DataException {
  if (inited == true)   return;
  inited=true;
  try {
    IOUtil.writeInt(this.rowExprsDos,rowCount);
    Map map=new HashMap();
    Iterator it=exprNameSet.iterator();
    while (it.hasNext()) {
      Object value=it.next();
      map.put(value,value);
    }
    int rowBytes=this.initSave(map);
    IOUtil.writeInt(this.rowExprsDos,rowBytes);
  }
 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 {
    IOUtil.writeInt(this.rowExprsDos,rowCount);
    Map map=new HashMap();
    Iterator it=exprNameSet.iterator();
    while (it.hasNext()) {
      Object value=it.next();
      map.put(value,value);
    }
    int rowBytes=this.version >= VersionManager.VERSION_2_2_1_3 ? this.initSave(map) : this.saveExprValue(map);
    IOUtil.writeInt(this.rowExprsDos,rowBytes);
  }
 catch (  IOException e) {
    throw new DataException(ResourceConstants.RD_SAVE_ERROR,e);
  }
}
Program: 74696
Project: 74696
Buggy source:
/** 
 * @param rowCount
 * @param rowExprsOs
 * @param rowLenOs
 */
RowSaveUtil(int rowCount,OutputStream rowExprsOs,OutputStream rowLenOs,Set exprNameSet,Map directColumnReferenceExpr){
  this.rowCount=rowCount;
  this.rowExprsDos=new DataOutputStream(rowExprsOs);
  this.rowLenDos=new DataOutputStream(rowLenOs);
  this.lastRowIndex=-1;
  this.exprNameSet=exprNameSet;
  this.directColumnReferenceBinding=directColumnReferenceExpr;
}

Fixed version (ground truth):
/** 
 * @param rowCount
 * @param rowExprsOs
 * @param rowLenOs
 */
RowSaveUtil(int rowCount,OutputStream rowExprsOs,OutputStream rowLenOs,Set exprNameSet,Map directColumnReferenceExpr,int version){
  this.rowCount=rowCount;
  this.rowExprsDos=new DataOutputStream(rowExprsOs);
  this.rowLenDos=new DataOutputStream(rowLenOs);
  this.lastRowIndex=-1;
  this.exprNameSet=exprNameSet;
  this.directColumnReferenceBinding=directColumnReferenceExpr;
  this.version=version;
}
Program: 74697
Project: 74697
Buggy source:
public PDFPageDevice(OutputStream output,String title,IReportContext context,IReportContent report){
  this.context=context;
  this.report=report;
  doc=new Document();
  PDFPage.reset();
  try {
    writer=PdfWriter.getInstance(doc,new BufferedOutputStream(output));
    String creator="String_Node_Str" + BundleVersionUtil.getBundleVersion("String_Node_Str") + "String_Node_Str"+ BundleVersionUtil.getBundleVersion("String_Node_Str");
    doc.addCreator(creator);
    if (null != title)     doc.addTitle(title);
  }
 catch (  DocumentException de) {
    logger.log(Level.SEVERE,de.getMessage(),de);
  }
}

Fixed version (ground truth):
public PDFPageDevice(OutputStream output,String title,IReportContext context,IReportContent report){
  this.context=context;
  this.report=report;
  doc=new Document();
  try {
    writer=PdfWriter.getInstance(doc,new BufferedOutputStream(output));
    String creator="String_Node_Str" + BundleVersionUtil.getBundleVersion("String_Node_Str") + "String_Node_Str"+ BundleVersionUtil.getBundleVersion("String_Node_Str");
    doc.addCreator(creator);
    if (null != title)     doc.addTitle(title);
  }
 catch (  DocumentException de) {
    logger.log(Level.SEVERE,de.getMessage(),de);
  }
}
Program: 74698
Project: 74698
Buggy source:
/** 
 * @param parentBindings
 * @throws DataException 
 */
private void addParentBindings(Map parentBindings) throws DataException {
  Iterator it=parentBindings.keySet().iterator();
  while (it.hasNext()) {
    Object o=it.next();
    IBaseExpression expr=((IBinding)parentBindings.get(o)).getExpression();
    if (expr instanceof IScriptExpression) {
      if (!ExpressionUtil.hasAggregation(((IScriptExpression)expr).getText())) {
        if (baseQueryDefn.getBindings().get(o) == null) {
          IBinding binding=new Binding(o.toString());
          binding.setExpression(copyScriptExpr(expr));
          baseQueryDefn.addBinding(binding);
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * @param parentBindings
 * @throws DataException 
 */
private void addParentBindings(Map parentBindings) throws DataException {
  Iterator it=parentBindings.keySet().iterator();
  while (it.hasNext()) {
    Object o=it.next();
    IBaseExpression expr=((IBinding)parentBindings.get(o)).getExpression();
    if (expr instanceof IScriptExpression) {
      if (!ExpressionUtil.hasAggregation(((IScriptExpression)expr).getText())) {
        if (baseQueryDefn.getBindings().get(o) == null) {
          IBinding binding=new Binding(o.toString());
          binding.setDataType(expr.getDataType());
          binding.setExpression(copyScriptExpr(expr));
          baseQueryDefn.addBinding(binding);
        }
      }
    }
  }
}
Program: 74699
Project: 74699
Buggy source:
/** 
 * Date -> Time String -> Time
 * @param source
 * @return
 * @throws BirtException
 */
public static java.sql.Date toSqlDate(Object source) throws BirtException {
  if (source == null)   return null;
  if (source instanceof Date) {
    return new java.sql.Date(((Date)source).getTime());
  }
 else   if (source instanceof String) {
    try {
      return new java.sql.Date(toDate((String)source).getTime());
    }
 catch (    Exception e) {
      try {
        return java.sql.Date.valueOf((String)source);
      }
 catch (      Exception e1) {
      }
    }
  }
  throw new CoreException(ResourceConstants.CONVERT_FAILS,new Object[]{source.toString(),"String_Node_Str"});
}

Fixed version (ground truth):
/** 
 * @param date
 * @return
 */
private static java.sql.Date toSqlDate(Date date){
  Calendar calendar=Calendar.getInstance();
  calendar.clear();
  calendar.setTimeInMillis(date.getTime());
  calendar.set(Calendar.HOUR_OF_DAY,0);
  calendar.set(Calendar.MINUTE,0);
  calendar.set(Calendar.SECOND,0);
  return new java.sql.Date(calendar.getTimeInMillis());
}
Program: 74700
Project: 74700
Buggy source:
/** 
 * Date -> Time String -> Time
 * @param source
 * @return
 * @throws BirtException
 */
public static Time toSqlTime(Object source) throws BirtException {
  if (source == null)   return null;
  if (source instanceof Date) {
    return new Time(((Date)source).getTime());
  }
 else   if (source instanceof String) {
    try {
      return new Time(toDate((String)source).getTime());
    }
 catch (    Exception e) {
      try {
        return Time.valueOf((String)source);
      }
 catch (      Exception e1) {
      }
    }
  }
  throw new CoreException(ResourceConstants.CONVERT_FAILS,new Object[]{source.toString(),"String_Node_Str"});
}

Fixed version (ground truth):
/** 
 * @param date
 * @return
 */
private static java.sql.Time toSqlTime(Date date){
  Calendar calendar=Calendar.getInstance();
  calendar.clear();
  calendar.setTimeInMillis(date.getTime());
  calendar.set(Calendar.YEAR,1970);
  calendar.set(Calendar.MONTH,0);
  calendar.set(Calendar.DAY_OF_MONTH,1);
  return new java.sql.Time(calendar.getTimeInMillis());
}
Program: 74701
Project: 74701
Buggy source:
public Iterator getMemberValueIterator(TabularCubeHandle cubeHandle,String targetLevel,ILevelDefinition[] higherLevelDefns,Object[] values,Map appContext) throws AdapterException {
  try {
    if ((higherLevelDefns == null && values != null) || (higherLevelDefns != null && values == null) || cubeHandle == null || targetLevel == null)     return null;
    DimLevel target=OlapExpressionUtil.getTargetDimLevel(targetLevel);
    TabularHierarchyHandle hierHandle=(TabularHierarchyHandle)(cubeHandle.getDimension(target.getDimensionName()).getContent(TabularDimensionHandle.HIERARCHIES_PROP,0));
    defineDataSourceAndDataSet(hierHandle.getDataSet());
    Map levelValueMap=new HashMap();
    if (higherLevelDefns != null) {
      for (int i=0; i < higherLevelDefns.length; i++) {
        if (target.getDimensionName().equals(higherLevelDefns[i].getHierarchy().getDimension().getName())) {
          levelValueMap.put(higherLevelDefns[i].getName(),values[i]);
        }
      }
    }
    DataSetIterator it=new DataSetIterator(this.session,hierHandle,appContext);
    return new MemberValueIterator(it,levelValueMap,target.getLevelName(),target.getAttrName());
  }
 catch (  BirtException e) {
    throw new AdapterException(e.getLocalizedMessage(),e);
  }
}

Fixed version (ground truth):
public Iterator getMemberValueIterator(TabularCubeHandle cubeHandle,String targetLevel,ILevelDefinition[] higherLevelDefns,Object[] values,Map appContext) throws AdapterException {
  try {
    if ((higherLevelDefns == null && values != null) || (higherLevelDefns != null && values == null) || cubeHandle == null || targetLevel == null)     return null;
    DimLevel target=OlapExpressionUtil.getTargetDimLevel(targetLevel);
    TabularHierarchyHandle hierHandle=(TabularHierarchyHandle)(cubeHandle.getDimension(target.getDimensionName()).getContent(TabularDimensionHandle.HIERARCHIES_PROP,0));
    if (hierHandle.getDataSet() != null)     defineDataSourceAndDataSet(hierHandle.getDataSet());
 else     defineDataSourceAndDataSet(cubeHandle.getDataSet());
    Map levelValueMap=new HashMap();
    if (higherLevelDefns != null) {
      for (int i=0; i < higherLevelDefns.length; i++) {
        if (target.getDimensionName().equals(higherLevelDefns[i].getHierarchy().getDimension().getName())) {
          levelValueMap.put(higherLevelDefns[i].getName(),values[i]);
        }
      }
    }
    DataSetIterator it=new DataSetIterator(this.session,hierHandle,appContext);
    return new MemberValueIterator(it,levelValueMap,target.getLevelName(),target.getAttrName());
  }
 catch (  BirtException e) {
    throw new AdapterException(e.getLocalizedMessage(),e);
  }
}
Program: 74702
Project: 74702
Buggy source:
/** 
 * @param expr
 * @return
 */
private String getDataSetColumnName(String expr){
  if (expr == null || expr.trim().length() == 0 || !(expr.matches("String_Node_Str") || expr.matches("String_Node_Str")))   return null;
  if (expr.matches("String_Node_Str"))   return expr.replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str");
 else   return expr.replace("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
/** 
 * @param expr
 * @return
 */
private String getDataSetColumnName(String expr){
  if (expr == null || expr.trim().length() == 0 || !(expr.matches("String_Node_Str") || expr.matches("String_Node_Str")))   return null;
  if (expr.matches("String_Node_Str"))   return expr.replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str");
 else   return expr.replaceAll("String_Node_Str","String_Node_Str");
}
Program: 74705
Project: 74705
Buggy source:
JSLevelObject(DimensionCursor cursor,String levelName) throws OLAPException {
  this.cursor=cursor;
  this.levelName=levelName;
  this.defaultColumnName=this.levelName;
}

Fixed version (ground truth):
JSLevelObject(DimensionCursor cursor,String levelName) throws OLAPException {
  this.cursor=cursor;
  this.levelName=levelName;
  RowDataMetaData meta=this.cursor.getMetaData();
  String defaultName=OlapExpressionUtil.getDisplayColumnName(this.levelName);
  for (int i=0; i < meta.getColumnCount(); i++) {
    if (meta.getColumnName(i).equals(defaultName)) {
      this.displayName=defaultName;
      break;
    }
  }
  if (this.displayName == null)   this.displayName=this.levelName;
}
Program: 74706
Project: 74706
Buggy source:
public Object get(String name,Scriptable start){
  try {
    return this.cursor.getObject(OlapExpressionUtil.getAttributeColumnName(levelName,name));
  }
 catch (  OLAPException e) {
    throw new RuntimeException(new DataException(e.getLocalizedMessage()));
  }
}

Fixed version (ground truth):
public Object get(String name,Scriptable start){
  try {
    if ("String_Node_Str".equals(name))     return this.cursor.getObject(OlapExpressionUtil.getAttributeColumnName(levelName,this.displayName));
    return this.cursor.getObject(OlapExpressionUtil.getAttributeColumnName(levelName,name));
  }
 catch (  OLAPException e) {
    throw new RuntimeException(new DataException(e.getLocalizedMessage()));
  }
}
Program: 74707
Project: 74707
Buggy source:
private Object getKeyValue(){
  try {
    return this.cursor.getObject(this.defaultColumnName);
  }
 catch (  OLAPException e) {
    return null;
  }
}

Fixed version (ground truth):
private Object getKeyValue(){
  try {
    return this.cursor.getObject(this.levelName);
  }
 catch (  OLAPException e) {
    return null;
  }
}
Program: 74708
Project: 74708
Buggy source:
/** 
 * The constructor
 * @param textContent the textContent whose font need to be handled
 * @param fontSubstitution 		If it set to false, we needn��t check if the character exists in the selected font.
 * @param format the output format type
 */
public FontHandler(ITextContent textContent,boolean fontSubstitution,String format){
  IStyle style=textContent.getComputedStyle();
  this.fontFamilies=(CSSValueList)style.getProperty(StyleConstants.STYLE_FONT_FAMILY);
  if (CSSConstants.CSS_OBLIQUE_VALUE.equals(style.getFontStyle()) || CSSConstants.CSS_ITALIC_VALUE.equals(style.getFontStyle())) {
    this.fontStyle|=Font.ITALIC;
  }
  if (PropertyUtil.isBoldFont(style.getProperty(StyleConstants.STYLE_FONT_WEIGHT))) {
    this.fontStyle|=Font.BOLD;
  }
  this.fontSize=PropertyUtil.getDimensionValue(style.getProperty(StyleConstants.STYLE_FONT_SIZE)) / PDFConstants.LAYOUT_TO_PDF_RATIO;
  setFormat(format);
  if (!fontSubstitution) {
    if (fontFamilies.getLength() == 0) {
      bf=fontManager.createFont(FontMappingManager.DEFAULT_FONT,fontStyle);
    }
 else {
      String fontName=fontManager.getLogicalFont(fontFamilies.item(0).getCssText());
      bf=fontManager.createFont(fontName,fontStyle);
    }
  }
}

Fixed version (ground truth):
/** 
 * The constructor
 * @param textContent the textContent whose font need to be handled
 * @param fontSubstitution 		If it set to false, we needn��t check if the character exists in the selected font.
 * @param format the output format type
 */
public FontHandler(ITextContent textContent,boolean fontSubstitution,String format){
  IStyle style=textContent.getComputedStyle();
  this.fontFamilies=(CSSValueList)style.getProperty(StyleConstants.STYLE_FONT_FAMILY);
  if (CSSConstants.CSS_OBLIQUE_VALUE.equals(style.getFontStyle()) || CSSConstants.CSS_ITALIC_VALUE.equals(style.getFontStyle())) {
    this.fontStyle|=Font.ITALIC;
  }
  if (PropertyUtil.isBoldFont(style.getProperty(StyleConstants.STYLE_FONT_WEIGHT))) {
    this.fontStyle|=Font.BOLD;
  }
  this.fontSize=PropertyUtil.getDimensionValue(style.getProperty(StyleConstants.STYLE_FONT_SIZE)) / PDFConstants.LAYOUT_TO_PDF_RATIO;
  setFormat(format);
  if (!fontSubstitution) {
    for (int i=0; i < fontFamilies.getLength(); i++) {
      String fontName=fontManager.getLogicalFont(fontFamilies.item(i).getCssText());
      bf=fontManager.createFont(fontName,fontStyle);
      if (bf != null)       return;
    }
    bf=fontManager.createFont(FontMappingManager.DEFAULT_FONT,fontStyle);
  }
}
Program: 74709
Project: 74709
Buggy source:
/** 
 */
public void testAnyOf(){
  String script2="String_Node_Str";
  String script3="String_Node_Str";
  String script4="String_Node_Str";
  String script5="String_Node_Str";
  String script6="String_Node_Str";
  String script7="String_Node_Str";
  assertTrue(((Boolean)cx.evaluateString(scope,script2,"String_Node_Str",1,null)).booleanValue());
  assertTrue(((Boolean)cx.evaluateString(scope,script3,"String_Node_Str",1,null)).booleanValue());
  assertTrue(((Boolean)cx.evaluateString(scope,script4,"String_Node_Str",1,null)).booleanValue());
  assertTrue(((Boolean)cx.evaluateString(scope,script5,"String_Node_Str",1,null)).booleanValue());
  assertTrue(((Boolean)cx.evaluateString(scope,script6,"String_Node_Str",1,null)).booleanValue());
  assertFalse(((Boolean)cx.evaluateString(scope,script7,"String_Node_Str",1,null)).booleanValue());
}

Fixed version (ground truth):
/** 
 */
public void testAnyOf(){
  String script2="String_Node_Str";
  String script3="String_Node_Str";
  String script4="String_Node_Str";
  String script5="String_Node_Str";
  String script6="String_Node_Str";
  String script7="String_Node_Str";
  String script8="String_Node_Str";
  String script9="String_Node_Str";
  assertTrue(((Boolean)cx.evaluateString(scope,script2,"String_Node_Str",1,null)).booleanValue());
  assertTrue(((Boolean)cx.evaluateString(scope,script3,"String_Node_Str",1,null)).booleanValue());
  assertTrue(((Boolean)cx.evaluateString(scope,script4,"String_Node_Str",1,null)).booleanValue());
  assertTrue(((Boolean)cx.evaluateString(scope,script5,"String_Node_Str",1,null)).booleanValue());
  assertTrue(((Boolean)cx.evaluateString(scope,script6,"String_Node_Str",1,null)).booleanValue());
  assertFalse(((Boolean)cx.evaluateString(scope,script7,"String_Node_Str",1,null)).booleanValue());
  assertTrue(((Boolean)cx.evaluateString(scope,script8,"String_Node_Str",1,null)).booleanValue());
  assertFalse(((Boolean)cx.evaluateString(scope,script9,"String_Node_Str",1,null)).booleanValue());
}
Program: 74710
Project: 74710
Buggy source:
/** 
 * @param aggrValueArray
 * @param filterHelper
 * @return
 * @throws IOException
 */
private IDiskArray fetchLevelKeys(IDiskArray aggrValueArray,IJSTopBottomFilterHelper filterHelper) throws IOException {
  IDiskArray levelKeyArray=new BufferedPrimitiveDiskArray(Constants.LIST_BUFFER_SIZE);
  int start=0;
  int end=aggrValueArray.size();
  if (filterHelper.isPercent()) {
    int size=aggrValueArray.size();
    int n=FilterUtil.getTargetN(size,filterHelper.getN());
    if (filterHelper.isTop())     start=size - n;
 else     end=n;
  }
  for (int i=start; i < end; i++) {
    ValueObject aggrValue=(ValueObject)aggrValueArray.get(i);
    levelKeyArray.add(aggrValue.index);
  }
  return levelKeyArray;
}

Fixed version (ground truth):
/** 
 * @param aggrValueArray
 * @param filterHelper
 * @return
 * @throws IOException
 */
private IDiskArray fetchLevelKeys(IDiskArray aggrValueArray,IJSTopBottomFilterHelper filterHelper) throws IOException {
  int start=0;
  int end=aggrValueArray.size();
  if (filterHelper.isPercent()) {
    int size=aggrValueArray.size();
    int n=FilterUtil.getTargetN(size,filterHelper.getN());
    if (filterHelper.isTop())     start=size - n;
 else     end=n;
  }
  IDiskArray levelKeyArray=new BufferedPrimitiveDiskArray(Math.min((end - start + 1),Constants.LIST_BUFFER_SIZE));
  for (int i=start; i < end; i++) {
    ValueObject aggrValue=(ValueObject)aggrValueArray.get(i);
    levelKeyArray.add(aggrValue.index);
  }
  return levelKeyArray;
}
Program: 74711
Project: 74711
Buggy source:
/** 
 * @param dimFilterList
 * @return
 * @throws IOException
 * @throws DataException
 */
private IDiskArray getDimFilterPositions(List dimFilterList) throws IOException, DataException {
  IDiskArray result=new BufferedPrimitiveDiskArray(Constants.LIST_BUFFER_SIZE);
  for (int i=0; i < dimPosition.size(); i++) {
    Integer pos=(Integer)dimPosition.get(i);
    if (isDimPositionSelected(pos.intValue(),dimFilterList))     result.add(pos);
  }
  return result;
}

Fixed version (ground truth):
/** 
 * @param dimFilterList
 * @return
 * @throws IOException
 * @throws DataException
 */
private IDiskArray getDimFilterPositions(List dimFilterList) throws IOException, DataException {
  IDiskArray result=new BufferedPrimitiveDiskArray(Math.min(dimPosition.size(),Constants.LIST_BUFFER_SIZE));
  for (int i=0; i < dimPosition.size(); i++) {
    Integer pos=(Integer)dimPosition.get(i);
    if (isDimPositionSelected(pos.intValue(),dimFilterList))     result.add(pos);
  }
  return result;
}
Program: 74712
Project: 74712
Buggy source:
/** 
 * get the intersection from two disk arrays which have been sorted.
 * @param array1
 * @param array2
 * @return
 * @throws IOException
 */
public static IDiskArray getIntersection(IDiskArray array1,IDiskArray array2) throws IOException {
  IDiskArray result=new BufferedPrimitiveDiskArray(Constants.LIST_BUFFER_SIZE);
  int i=0, j=0;
  while (i < array1.size() && j < array2.size()) {
    Comparable key1=(Comparable)array1.get(i);
    Comparable key2=(Comparable)array2.get(j);
    int ret=key1.compareTo(key2);
    if (ret == 0) {
      result.add(key1);
      i++;
      j++;
    }
 else     if (ret < 0) {
      i++;
    }
 else     j++;
  }
  array1.close();
  array2.close();
  return result;
}

Fixed version (ground truth):
/** 
 * get the intersection from two disk arrays which have been sorted.
 * @param array1
 * @param array2
 * @return
 * @throws IOException
 */
public static IDiskArray getIntersection(IDiskArray array1,IDiskArray array2) throws IOException {
  IDiskArray result=new BufferedPrimitiveDiskArray(min(array1.size(),array2.size(),Constants.LIST_BUFFER_SIZE));
  int i=0, j=0;
  while (i < array1.size() && j < array2.size()) {
    Comparable key1=(Comparable)array1.get(i);
    Comparable key2=(Comparable)array2.get(j);
    int ret=key1.compareTo(key2);
    if (ret == 0) {
      result.add(key1);
      i++;
      j++;
    }
 else     if (ret < 0) {
      i++;
    }
 else     j++;
  }
  array1.close();
  array2.close();
  return result;
}
Program: 74714
Project: 74714
Buggy source:
public void run(){
  IWorkbench workbench=PlatformUI.getWorkbench();
  IWorkbenchWindow window=workbench.getActiveWorkbenchWindow();
  IWorkbenchPage page=window.getActivePage();
  try {
    IDE.openEditor(page,file,true);
    BasicNewProjectResourceWizard.updatePerspective(configElement);
    if (showCheat && !cheatId.equals("String_Node_Str")) {
      new OpenCheatSheetAction(cheatId).run();
    }
  }
 catch (  Exception e) {
    ExceptionHandler.handle(e);
  }
}

Fixed version (ground truth):
public void run(){
  IWorkbench workbench=PlatformUI.getWorkbench();
  IWorkbenchWindow window=workbench.getActiveWorkbenchWindow();
  IWorkbenchPage page=window.getActivePage();
  try {
    IDE.openEditor(page,file,true);
    BasicNewProjectResourceWizard.updatePerspective(configElement);
    if (showCheat && !cheatId.equals("String_Node_Str")) {
      Object oldData=Display.getCurrent().getActiveShell().getData();
      if (oldData instanceof TrayDialog) {
        Display.getCurrent().getActiveShell().setData(null);
      }
      new OpenCheatSheetAction(cheatId).run();
    }
  }
 catch (  Exception e) {
    ExceptionHandler.handle(e);
  }
}
Program: 74715
Project: 74715
Buggy source:
/** 
 * Reset the testButton and manageButton to "enabled" status
 */
protected void resetTestAndMngButton(){
  if (!isURLBlank()) {
    setMessage(EMPTY_URL,IMessageProvider.ERROR);
    testButton.setEnabled(false);
  }
 else {
    setMessage(DEFAULT_MESSAGE);
    if (!testButton.isEnabled())     testButton.setEnabled(true);
  }
  manageButton.setEnabled(true);
  enableParent(manageButton);
}

Fixed version (ground truth):
/** 
 * Reset the testButton and manageButton to "enabled" status
 */
protected void resetTestAndMngButton(){
  if (isURLBlank() && isJNDIBlank()) {
    setMessage(EMPTY_URL,IMessageProvider.ERROR);
    testButton.setEnabled(false);
  }
 else {
    setMessage(DEFAULT_MESSAGE);
    if (!testButton.isEnabled())     testButton.setEnabled(true);
  }
  manageButton.setEnabled(true);
  enableParent(manageButton);
}
Program: 74716
Project: 74716
Buggy source:
/** 
 * This method should be called in the following occations: 1. The value of selected driver is changed 2. The value of inputed URL is changed 3. When the control is created 4.
 */
private void updateTestButton(){
  if (!isURLBlank()) {
    setMessage(EMPTY_URL,IMessageProvider.ERROR);
    testButton.setEnabled(false);
  }
 else {
    setMessage(DEFAULT_MESSAGE);
    if (!testButton.isEnabled())     testButton.setEnabled(true);
  }
}

Fixed version (ground truth):
/** 
 * This method should be called in the following occations: 1. The value of selected driver is changed 2. The value of inputed URL is changed 3. When the control is created 4.
 */
private void updateTestButton(){
  if (isDriverClassBlank() || (isURLBlank() && isJNDIBlank())) {
    setMessage(EMPTY_URL,IMessageProvider.ERROR);
    testButton.setEnabled(false);
  }
 else {
    setMessage(DEFAULT_MESSAGE);
    if (!testButton.isEnabled())     testButton.setEnabled(true);
  }
}
Program: 74717
Project: 74717
Buggy source:
/** 
 * Test if the input URL is blank 
 * @return true url is blank
 */
private boolean isURLBlank(){
  String value=jdbcUrl.getText();
  if (value == null)   return false;
  value=value.trim();
  if (value.length() == 0)   return false;
  return true;
}

Fixed version (ground truth):
/** 
 * Test if the input URL is blank 
 * @return true url is blank
 */
private boolean isURLBlank(){
  return jdbcUrl == null || jdbcUrl.getText().trim().length() == 0;
}
Program: 74719
Project: 74719
Buggy source:
/** 
 * Validates the data source and updates the window message accordingly
 * @return
 */
private boolean isValidDataSource(){
  return isURLBlank();
}

Fixed version (ground truth):
/** 
 * Validates the data source and updates the window message accordingly
 * @return
 */
private boolean isValidDataSource(){
  return !isURLBlank() || !isJNDIBlank();
}
Program: 74720
Project: 74720
Buggy source:
public void modifyText(ModifyEvent e){
  if (!jdbcUrl.isFocusControl() && jdbcUrl.getText().trim().length() == 0) {
    return;
  }
  verifyJDBCProperties();
  updateTestButton();
}

Fixed version (ground truth):
public void modifyText(ModifyEvent e){
  if (!jndiName.isFocusControl() && jndiName.getText().trim().length() == 0) {
    return;
  }
  verifyJDBCProperties();
  updateTestButton();
}
Program: 74721
Project: 74721
Buggy source:
private void verifyJDBCProperties(){
  if (driverChooserCombo != null && jdbcUrl != null) {
    if (getSelectedDriverClassName() != null && getSelectedDriverClassName().trim().length() > 0 && jdbcUrl.getText() != null && jdbcUrl.getText().trim().length() > 0)     setPageComplete(true);
 else     setPageComplete(false);
  }
}

Fixed version (ground truth):
private void verifyJDBCProperties(){
  if (!isDriverClassBlank()) {
    if (!isJNDIBlank()) {
      setPageComplete(true);
    }
 else     if (!isURLBlank()) {
      setPageComplete(true);
    }
 else     setPageComplete(false);
  }
 else   setPageComplete(false);
}
Program: 74722
Project: 74722
Buggy source:
public void writeText(Data d){
  writer.openTag("String_Node_Str");
  if (d.getDatatype().equals(Data.NUMBER)) {
    writer.attribute("String_Node_Str","String_Node_Str");
  }
 else   if (d.getDatatype().equals(Data.DATE)) {
    writer.attribute("String_Node_Str","String_Node_Str");
  }
 else {
    writer.attribute("String_Node_Str","String_Node_Str");
  }
  writer.text(d.getText());
  writer.closeTag("String_Node_Str");
}

Fixed version (ground truth):
public void writeText(Data d){
  writer.openTag("String_Node_Str");
  if (d.getDatatype().equals(Data.NUMBER) && ExcelUtil.isNumber(d.getText())) {
    writer.attribute("String_Node_Str","String_Node_Str");
  }
 else   if (d.getDatatype().equals(Data.DATE)) {
    writer.attribute("String_Node_Str","String_Node_Str");
  }
 else {
    writer.attribute("String_Node_Str","String_Node_Str");
  }
  writer.text(d.getText());
  writer.closeTag("String_Node_Str");
}
Program: 74723
Project: 74723
Buggy source:
public Object get(String name,Scriptable start){
  try {
    if ("String_Node_Str".equals(name))     return this.cursor.getObject(OlapExpressionUtil.getAttributeColumnName(levelName,this.displayName));
    return this.cursor.getObject(OlapExpressionUtil.getAttributeColumnName(levelName,name));
  }
 catch (  OLAPException e) {
    throw new RuntimeException(new DataException(e.getLocalizedMessage()));
  }
}

Fixed version (ground truth):
public Object get(String name,Scriptable start){
  try {
    if (this.displayName.equals(name))     return this.cursor.getObject(OlapExpressionUtil.getAttributeColumnName(levelName,this.displayName));
    return this.cursor.getObject(OlapExpressionUtil.getAttributeColumnName(levelName,name));
  }
 catch (  OLAPException e) {
    throw new RuntimeException(new DataException(e.getLocalizedMessage()));
  }
}
Program: 74724
Project: 74724
Buggy source:
JSLevelObject(DimensionCursor cursor,String levelName) throws OLAPException {
  this.cursor=cursor;
  this.levelName=levelName;
  RowDataMetaData meta=this.cursor.getMetaData();
  String defaultName=OlapExpressionUtil.getDisplayColumnName(this.levelName);
  for (int i=0; i < meta.getColumnCount(); i++) {
    if (meta.getColumnName(i).equals(defaultName)) {
      this.defaultColumnName=defaultName;
      break;
    }
  }
  if (this.defaultColumnName == null)   this.defaultColumnName=this.levelName;
}

Fixed version (ground truth):
JSLevelObject(DimensionCursor cursor,String levelName) throws OLAPException {
  this.cursor=cursor;
  this.levelName=levelName;
  this.defaultColumnName=this.levelName;
}
Program: 74725
Project: 74725
Buggy source:
public IDiskArray findAll() throws IOException {
  IDiskArray result=new BufferedPrimitiveDiskArray(Constants.LIST_BUFFER_SIZE);
  int lastPos=length() - 1;
  for (int i=0; i <= lastPos; i++) {
    result.add(new Integer(i));
  }
  return result;
}

Fixed version (ground truth):
public IDiskArray findAll() throws IOException {
  IDiskArray result=new BufferedPrimitiveDiskArray(Math.min(Constants.MAX_LIST_BUFFER_SIZE,length));
  int lastPos=length() - 1;
  for (int i=0; i <= lastPos; i++) {
    result.add(new Integer(i));
  }
  return result;
}
Program: 74726
Project: 74726
Buggy source:
public IDiskArray getDimensionRowByPositions(IDiskArray positionArray) throws IOException {
  BufferedStructureArray resultArray=new BufferedStructureArray(DimensionRow.getCreator(),Constants.LIST_BUFFER_SIZE);
  for (int i=0; i < positionArray.size(); i++) {
    int pos=((Integer)positionArray.get(i)).intValue();
    resultArray.add(hierarchy.readRowByPosition(pos));
  }
  return resultArray;
}

Fixed version (ground truth):
public IDiskArray getDimensionRowByPositions(IDiskArray positionArray) throws IOException {
  BufferedStructureArray resultArray=new BufferedStructureArray(DimensionRow.getCreator(),Math.min(Constants.MAX_LIST_BUFFER_SIZE,positionArray.size()));
  for (int i=0; i < positionArray.size(); i++) {
    int pos=((Integer)positionArray.get(i)).intValue();
    resultArray.add(hierarchy.readRowByPosition(pos));
  }
  return resultArray;
}
Program: 74727
Project: 74727
Buggy source:
/** 
 * @param level
 * @param filter
 * @return
 * @throws IOException
 * @throws DataException
 */
private static BaseDiskSortedStack find(Level level,ISelection[] filter) throws IOException, DataException {
  IDiskArray indexKeyArray=level.getDiskIndex().find(filter);
  PrimitiveDiskSortedStack resultStack=new PrimitiveDiskSortedStack(Constants.LIST_BUFFER_SIZE,true,true);
  if (indexKeyArray != null) {
    for (int i=0; i < indexKeyArray.size(); i++) {
      IndexKey key=(IndexKey)indexKeyArray.get(i);
      resultStack.push(new Integer(key.getDimensionPos()));
    }
  }
  return resultStack;
}

Fixed version (ground truth):
/** 
 * @param level
 * @param filter
 * @return
 * @throws IOException
 * @throws DataException
 */
private static BaseDiskSortedStack find(Level level,ISelection[] filter) throws IOException, DataException {
  IDiskArray indexKeyArray=level.getDiskIndex().find(filter);
  if (indexKeyArray != null) {
    PrimitiveDiskSortedStack resultStack=new PrimitiveDiskSortedStack(Math.min(indexKeyArray.size(),Constants.MAX_LIST_BUFFER_SIZE),true,true);
    for (int i=0; i < indexKeyArray.size(); i++) {
      IndexKey key=(IndexKey)indexKeyArray.get(i);
      resultStack.push(new Integer(key.getDimensionPos()));
    }
    return resultStack;
  }
 else {
    return new PrimitiveDiskSortedStack(1,true,true);
  }
}
Program: 74728
Project: 74728
Buggy source:
/** 
 * @return
 * @throws IOException
 */
public IDiskArray readAllRows() throws IOException {
  BufferedStructureArray resultArray=new BufferedStructureArray(DimensionRow.getCreator(),Constants.LIST_BUFFER_SIZE);
  documentObj.seek(0);
  int size=documentObj.readInt();
  if (size == 0)   return resultArray;
  offsetDocObj.seek(0);
  documentObj.seek(offsetDocObj.readInt());
  for (int i=0; i < size; i++) {
    resultArray.add(readDimensionRow());
  }
  return resultArray;
}

Fixed version (ground truth):
/** 
 * @return
 * @throws IOException
 */
public IDiskArray readAllRows() throws IOException {
  documentObj.seek(0);
  int size=documentObj.readInt();
  BufferedStructureArray resultArray=new BufferedStructureArray(DimensionRow.getCreator(),size + 1);
  if (size == 0)   return resultArray;
  offsetDocObj.seek(0);
  documentObj.seek(offsetDocObj.readInt());
  for (int i=0; i < size; i++) {
    resultArray.add(readDimensionRow());
  }
  return resultArray;
}
Program: 74730
Project: 74730
Buggy source:
private IDiskArray getSortedDimensionKeys(IDiskArray members) throws IOException {
  DiskSortedStack sortedStack=new DiskSortedStack(Constants.FACT_TABLE_BUFFER_SIZE,true,false,DimensionKey.getCreator());
  for (int i=0; i < members.size(); i++) {
    sortedStack.push(members.get(i));
  }
  IDiskArray resultArray=new BufferedStructureArray(DimensionKey.getCreator(),Constants.LIST_BUFFER_SIZE);
  Object key=sortedStack.pop();
  while (key != null) {
    resultArray.add(key);
    key=sortedStack.pop();
  }
  return resultArray;
}

Fixed version (ground truth):
private IDiskArray getSortedDimensionKeys(IDiskArray members) throws IOException {
  DiskSortedStack sortedStack=new DiskSortedStack(Constants.FACT_TABLE_BUFFER_SIZE,true,false,DimensionKey.getCreator());
  for (int i=0; i < members.size(); i++) {
    sortedStack.push(members.get(i));
  }
  IDiskArray resultArray=new BufferedStructureArray(DimensionKey.getCreator(),Math.min(Constants.MAX_LIST_BUFFER_SIZE,sortedStack.size()));
  Object key=sortedStack.pop();
  while (key != null) {
    resultArray.add(key);
    key=sortedStack.pop();
  }
  return resultArray;
}
Program: 74731
Project: 74731
Buggy source:
/** 
 * @param dimRowArray
 * @return
 * @throws IOException
 */
private static IDiskArray getDimCombinatedKey(int[][] columnIndex,IDiskArray dimRowArray) throws IOException {
  BufferedStructureArray resultArray=new BufferedStructureArray(DimensionKey.getCreator(),Constants.LIST_BUFFER_SIZE);
  for (int i=0; i < dimRowArray.size(); i++) {
    DimensionRow dimRow=(DimensionRow)dimRowArray.get(i);
    DimensionKey key=new DimensionKey(columnIndex.length);
    Object[] values=new Object[columnIndex.length];
    for (int j=0; j < columnIndex.length; j++) {
      if (columnIndex[j][0] == 0) {
        values[j]=dimRow.getMembers()[columnIndex[j][1]].getKeyValues()[columnIndex[j][2]];
      }
 else {
        values[j]=dimRow.getMembers()[columnIndex[j][1]].getAttributes()[columnIndex[j][2]];
      }
    }
    key.setKeyValues(values);
    key.setDimensionPos(i);
    resultArray.add(key);
  }
  return resultArray;
}

Fixed version (ground truth):
/** 
 * @param dimRowArray
 * @return
 * @throws IOException
 */
private static IDiskArray getDimCombinatedKey(int[][] columnIndex,IDiskArray dimRowArray) throws IOException {
  BufferedStructureArray resultArray=new BufferedStructureArray(DimensionKey.getCreator(),Math.min(dimRowArray.size(),Constants.MAX_LIST_BUFFER_SIZE));
  for (int i=0; i < dimRowArray.size(); i++) {
    DimensionRow dimRow=(DimensionRow)dimRowArray.get(i);
    DimensionKey key=new DimensionKey(columnIndex.length);
    Object[] values=new Object[columnIndex.length];
    for (int j=0; j < columnIndex.length; j++) {
      if (columnIndex[j][0] == 0) {
        values[j]=dimRow.getMembers()[columnIndex[j][1]].getKeyValues()[columnIndex[j][2]];
      }
 else {
        values[j]=dimRow.getMembers()[columnIndex[j][1]].getAttributes()[columnIndex[j][2]];
      }
    }
    key.setKeyValues(values);
    key.setDimensionPos(i);
    resultArray.add(key);
  }
  return resultArray;
}
Program: 74732
Project: 74732
Buggy source:
/** 
 * @param members
 * @throws IOException
 */
DimensionPositionSeeker(IDiskArray member) throws IOException {
  IDiskArray members=getSortedDimensionKeys(member);
  this.memberArray=new DimensionKey[Math.min(Constants.LIST_BUFFER_SIZE,members.size())];
  for (int i=0; i < memberArray.length; i++) {
    memberArray[i]=(DimensionKey)members.get(i);
  }
  if (members.size() > Constants.LIST_BUFFER_SIZE) {
    this.diskMemberArray=members;
    this.diskPostion=memberArray.length;
    this.position=this.diskPostion;
  }
}

Fixed version (ground truth):
/** 
 * @param members
 * @throws IOException
 */
DimensionPositionSeeker(IDiskArray member) throws IOException {
  IDiskArray members=getSortedDimensionKeys(member);
  this.memberArray=new DimensionKey[Math.min(Constants.MAX_LIST_BUFFER_SIZE,members.size())];
  for (int i=0; i < memberArray.length; i++) {
    memberArray[i]=(DimensionKey)members.get(i);
  }
  if (members.size() > Constants.MAX_LIST_BUFFER_SIZE) {
    this.diskMemberArray=members;
    this.diskPostion=memberArray.length;
    this.position=this.diskPostion;
  }
}