nus-yam/ex-repair huggingface dataset:
Program: 73554
Project: 73554
Buggy source:
/** 
 * @param dataSourceDesign2
 * @param dataSetDesign2
 */
void clearCache(DataSourceAndDataSet dsAndDs){
  List cacheDir=new ArrayList();
synchronized (cacheMap) {
    while (getKey(dsAndDs) != null)     cacheDir.add(cacheMap.remove(getKey(dsAndDs)));
  }
  for (int i=0; i < cacheDir.size(); i++) {
    Object cacheObject=cacheDir.get(i);
    if (cacheObject instanceof DiskDataSetCacheObject) {
      DiskDataSetCacheObject diskObject=(DiskDataSetCacheObject)cacheObject;
      deleteDir(diskObject.getTempDir());
    }
 else     if (cacheObject instanceof IncreDataSetCacheObject) {
      IncreDataSetCacheObject psObject=(IncreDataSetCacheObject)cacheObject;
      deleteDir(psObject.getCacheDir());
    }
  }
}

Fixed version (ground truth):
/** 
 * @param dataSourceDesign2
 * @param dataSetDesign2
 */
void clearCache(DataSourceAndDataSet dsAndDs){
  List cacheObjects=new ArrayList();
synchronized (cacheMap) {
    Object key=getKey(dsAndDs);
    while (key != null) {
      cacheObjects.add(cacheMap.remove(key));
      key=getKey(dsAndDs);
    }
  }
  for (int i=0; i < cacheObjects.size(); i++) {
    IDataSetCacheObject cacheObject=(IDataSetCacheObject)cacheObjects.get(i);
    cacheObject.release();
  }
}
Program: 73555
Project: 73555
Buggy source:
/** 
 * @param appContext 
 * @param collection 
 * @param baseDataSetDesign 
 * @param baseDataSourceDesign 
 * @return
 * @throws DataException 
 */
boolean doesSaveToCache(DataSourceAndDataSet dsAndDs,int mode,IBaseDataSourceDesign baseDataSourceDesign,IBaseDataSetDesign baseDataSetDesign,Collection parameterHints,Map appContext) throws DataException {
  Object cacheObject=null;
synchronized (cacheMap) {
    cacheObject=cacheMap.get(dsAndDs);
  }
  if (cacheObject != null) {
    return needSaveToCache(cacheObject);
  }
 else {
synchronized (cacheMap) {
      cacheObject=(String)cacheMap.get(dsAndDs);
      if (cacheObject != null) {
        return needSaveToCache(cacheObject);
      }
      IDataSetCacheObject dsCacheObject=null;
      String cacheDir=(String)cacheDirMap.get(baseDataSetDesign);
      if (baseDataSetDesign instanceof IIncreCacheDataSetDesign) {
        dsCacheObject=(IDataSetCacheObject)new IncreDataSetCacheObject(cacheDir);
      }
 else {
switch (mode) {
case DataEngineContext.CACHE_MODE_IN_MEMORY:
          dsCacheObject=(IDataSetCacheObject)new MemoryDataSetCacheObject();
        break;
case DataEngineContext.CACHE_MODE_IN_DISK:
      String tempRootDir=CacheUtil.createTempRootDir(tempDir);
    String sessionTempDir=CacheUtil.createSessionTempDir(tempRootDir);
  dsCacheObject=(IDataSetCacheObject)new DiskDataSetCacheObject(sessionTempDir);
break;
default :
return false;
}
}
cacheMap.put(dsAndDs,dsCacheObject);
return true;
}
}
}

Fixed version (ground truth):
/** 
 * @param appContext 
 * @param collection 
 * @param baseDataSetDesign 
 * @param baseDataSourceDesign 
 * @return
 * @throws DataException 
 */
boolean doesSaveToCache(DataSourceAndDataSet dsAndDs,DataSetCacheConfig dscc) throws DataException {
synchronized (cacheMap) {
    IDataSetCacheObject cacheObject=(IDataSetCacheObject)cacheMap.get(dsAndDs);
    if (cacheObject != null) {
      return cacheObject.needUpdateCache(dscc.getCacheCapability());
    }
 else {
      IDataSetCacheObject dsco=dscc.createDataSetCacheObject();
      cacheMap.put(dsAndDs,dsco);
      return true;
    }
  }
}
Program: 73556
Project: 73556
Buggy source:
/** 
 * Return the cached result metadata featured by the given DataSourceAndDataSet. Please note that the paramter would have no impact to DataSourceAndDataSet so that will be omited.
 * @param dsAndDs
 * @return
 * @throws DataException
 */
IResultClass getCachedResultClass(DataSourceAndDataSet dsAndDs) throws DataException {
  Object cacheObject=null;
  Object key=getKey(dsAndDs);
  if (key != null) {
    cacheObject=cacheMap.get(key);
  }
  if (cacheObject instanceof MemoryDataSetCacheObject) {
    return ((MemoryDataSetCacheObject)cacheObject).getResultClass();
  }
 else   if (cacheObject instanceof DiskDataSetCacheObject) {
    IResultClass rsClass;
    FileInputStream fis1=null;
    BufferedInputStream bis1=null;
    try {
      fis1=new FileInputStream(((DiskDataSetCacheObject)cacheObject).getMetaFile());
      bis1=new BufferedInputStream(fis1);
      IOUtil.readInt(bis1);
      rsClass=new ResultClass(bis1);
      bis1.close();
      fis1.close();
      return rsClass;
    }
 catch (    FileNotFoundException e) {
      throw new DataException(ResourceConstants.DATASETCACHE_LOAD_ERROR,e);
    }
catch (    IOException e) {
      throw new DataException(ResourceConstants.DATASETCACHE_LOAD_ERROR,e);
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Return the cached result metadata featured by the given DataSourceAndDataSet. Please note that the paramter would have no impact to DataSourceAndDataSet so that will be omited.
 * @param dsAndDs
 * @return
 * @throws DataException
 */
IResultClass getCachedResultClass(DataSourceAndDataSet dsAndDs) throws DataException {
  IDataSetCacheObject cacheObject=null;
  Object key=getKey(dsAndDs);
  if (key != null) {
    cacheObject=(IDataSetCacheObject)cacheMap.get(key);
  }
  if (cacheObject != null) {
    return cacheObject.getResultClass();
  }
 else {
    return null;
  }
}
Program: 73558
Project: 73558
Buggy source:
private int getAdjustedColumnSpan(int columnId,int columnSpan){
  if (columnSpan == 1) {
    return columnSpan;
  }
  int endColumnId=columnId + columnSpan;
  return adjustedColumnIds[endColumnId] - adjustedColumnIds[columnId];
}

Fixed version (ground truth):
private int getAdjustedColumnSpan(int columnId,int columnSpan){
  if (columnSpan == 1) {
    return columnSpan;
  }
  int endColumnId=columnId + columnSpan - 1;
  return adjustedColumnIds[endColumnId] - adjustedColumnIds[columnId] + 1;
}
Program: 73559
Project: 73559
Buggy source:
/** 
 * Returns the formatted value for given Axis type and value.
 * @param iType
 * @param oValue
 * @return
 */
public final String formatCategoryValue(int iType,Object oValue,int iDateTimeUnit){
  if (oValue == null) {
    return IConstants.NULL_STRING;
  }
  if (iType == IConstants.TEXT) {
    return oValue.toString();
  }
 else   if (iType == IConstants.DATE_TIME) {
    final Calendar ca=(Calendar)oValue;
    IDateFormatWrapper sdf=null;
    if (fs == null) {
      sdf=DateFormatWrapperFactory.getPreferredDateFormat(iDateTimeUnit,rtc.getULocale());
    }
    try {
      return ValueFormatter.format(ca,fs,rtc.getULocale(),sdf);
    }
 catch (    ChartException dfex) {
      logger.log(dfex);
      return IConstants.NULL_STRING;
    }
  }
 else   if ((iType & IConstants.NUMERICAL) == IConstants.NUMERICAL) {
    DecimalFormat df=null;
    if (fs == null) {
      df=new DecimalFormat(getNumericPattern(((Number)oValue).doubleValue()));
    }
    try {
      return ValueFormatter.format(oValue,fs,rtc.getULocale(),df);
    }
 catch (    ChartException dfex) {
      logger.log(dfex);
      return IConstants.NULL_STRING;
    }
  }
  return IConstants.NULL_STRING;
}

Fixed version (ground truth):
/** 
 * Returns the formatted value for given Axis type and value.
 * @param iType
 * @param oValue
 * @return
 */
public final String formatCategoryValue(int iType,Object oValue,int iDateTimeUnit){
  if (oValue == null) {
    return IConstants.NULL_STRING;
  }
  if ((iType & IConstants.TEXT) == IConstants.TEXT) {
    if (oValue instanceof Number) {
      return formatCategoryValue(IConstants.NUMERICAL,oValue,iDateTimeUnit);
    }
    return oValue.toString();
  }
 else   if ((iType & IConstants.DATE_TIME) == IConstants.DATE_TIME) {
    final Calendar ca=(Calendar)oValue;
    IDateFormatWrapper sdf=null;
    if (fs == null) {
      sdf=DateFormatWrapperFactory.getPreferredDateFormat(iDateTimeUnit,rtc.getULocale());
    }
    try {
      return ValueFormatter.format(ca,fs,rtc.getULocale(),sdf);
    }
 catch (    ChartException dfex) {
      logger.log(dfex);
      return IConstants.NULL_STRING;
    }
  }
 else   if ((iType & IConstants.NUMERICAL) == IConstants.NUMERICAL) {
    DecimalFormat df=null;
    if (fs == null) {
      df=new DecimalFormat(getNumericPattern(((Number)oValue).doubleValue()));
    }
    try {
      return ValueFormatter.format(oValue,fs,rtc.getULocale(),df);
    }
 catch (    ChartException dfex) {
      logger.log(dfex);
      return IConstants.NULL_STRING;
    }
  }
  return IConstants.NULL_STRING;
}
Program: 73560
Project: 73560
Buggy source:
public IBaseResultSet execute(IBaseResultSet parent,IDataQueryDefinition query,boolean useCache) throws BirtException {
  if (query instanceof ISubqueryDefinition) {
    if (parent == null) {
      return null;
    }
 else     if (parent instanceof ICubeResultSet) {
      throw new EngineException("String_Node_Str" + ((ISubqueryDefinition)query).getName());
    }
    return doExecuteSubQuery((IQueryResultSet)parent,(ISubqueryDefinition)query);
  }
 else   if (query instanceof IQueryDefinition) {
    return doExecuteQuery(parent,(IQueryDefinition)query,useCache);
  }
 else   if (query instanceof ICubeQueryDefinition) {
    return doExecuteCube(parent,(ICubeQueryDefinition)query,useCache);
  }
 else   if (query instanceof ISubCubeQueryDefinition) {
    doExecuteSubCubeQuery((ICubeResultSet)parent,(ISubCubeQueryDefinition)query);
  }
  throw new EngineException("String_Node_Str" + query.getClass().getName());
}

Fixed version (ground truth):
public IBaseResultSet execute(IBaseResultSet parent,IDataQueryDefinition query,boolean useCache) throws BirtException {
  if (query instanceof ISubqueryDefinition) {
    if (parent == null) {
      return null;
    }
 else     if (parent instanceof ICubeResultSet) {
      throw new EngineException("String_Node_Str" + ((ISubqueryDefinition)query).getName());
    }
    return doExecuteSubQuery((IQueryResultSet)parent,(ISubqueryDefinition)query);
  }
 else   if (query instanceof IQueryDefinition) {
    return doExecuteQuery(parent,(IQueryDefinition)query,useCache);
  }
 else   if (query instanceof ICubeQueryDefinition) {
    return doExecuteCube(parent,(ICubeQueryDefinition)query,useCache);
  }
 else   if (query instanceof ISubCubeQueryDefinition) {
    return doExecuteSubCubeQuery((ICubeResultSet)parent,(ISubCubeQueryDefinition)query);
  }
  throw new EngineException("String_Node_Str" + query.getClass().getName());
}
Program: 73561
Project: 73561
Buggy source:
public ChartCubeQueryHelper(ExtendedItemHandle handle,Chart cm){
  this.handle=handle;
  this.cm=cm;
  this.bInXtabDetail=ChartXTabUtil.isChartInXTab(handle);
  IActionEvaluator iae=BIRTActionEvaluator.getInstance(handle);
  iae.addExpressionReplaceable(this);
}

Fixed version (ground truth):
public ChartCubeQueryHelper(ExtendedItemHandle handle,Chart cm){
  this.handle=handle;
  this.cm=cm;
  IActionEvaluator iae=BIRTActionEvaluator.getInstance(handle);
  iae.addExpressionReplaceable(this);
}
Program: 73563
Project: 73563
Buggy source:
private void initBindings(ICubeQueryDefinition cubeQuery,CubeHandle cube) throws BirtException {
  for (Iterator bindings=ChartReportItemUtil.getAllColumnBindingsIterator(handle); bindings.hasNext(); ) {
    ComputedColumnHandle column=(ComputedColumnHandle)bindings.next();
    Binding binding=new Binding(column.getName());
    binding.setDataType(DataAdapterUtil.adaptModelDataType(column.getDataType()));
    binding.setExpression(new ScriptExpression(column.getExpression()));
    if (column.getAggregateOn() != null) {
      String[] levelNames=CubeUtil.splitLevelName(column.getAggregateOn());
      String dimExpr=ExpressionUtil.createJSDimensionExpression(levelNames[0],levelNames[1]);
      if (!bInXtabDetail) {
        binding.addAggregateOn(dimExpr);
        binding.setAggrFunction(column.getAggregateFunction() == null ? null : DataAdapterUtil.adaptModelAggregationType(column.getAggregateFunction()));
      }
      bindSeriesQuery(QueryImpl.create(dimExpr),cubeQuery,cube);
    }
    registeredBindings.put(ExpressionUtil.createJSDataExpression(column.getName()),binding);
    registeredQueries.put(binding.getBindingName(),column.getExpression());
  }
}

Fixed version (ground truth):
private void initBindings(ICubeQueryDefinition cubeQuery,CubeHandle cube) throws BirtException {
  for (Iterator bindings=ChartReportItemUtil.getAllColumnBindingsIterator(handle); bindings.hasNext(); ) {
    ComputedColumnHandle column=(ComputedColumnHandle)bindings.next();
    Binding binding=new Binding(column.getName());
    binding.setDataType(DataAdapterUtil.adaptModelDataType(column.getDataType()));
    binding.setExpression(new ScriptExpression(column.getExpression()));
    List lstAggOn=column.getAggregateOnList();
    if (!lstAggOn.isEmpty()) {
      addAggregateOn(cubeQuery,cube,binding,lstAggOn);
      binding.setAggrFunction(column.getAggregateFunction() == null ? null : DataAdapterUtil.adaptModelAggregationType(column.getAggregateFunction()));
    }
    registeredBindings.put(ExpressionUtil.createJSDataExpression(column.getName()),binding);
    registeredQueries.put(binding.getBindingName(),column.getExpression());
  }
}
Program: 73588
Project: 73588
Buggy source:
private void printCube(CubeCursor cursor,List columnEdgeBindingNames,String rowEdgeBindingNames,String measureBindingNames,String columnAggr,String rowAggr,String overallAggr) throws Exception {
  EdgeCursor edge1=(EdgeCursor)(cursor.getOrdinateEdge().get(0));
  EdgeCursor edge2=(EdgeCursor)(cursor.getOrdinateEdge().get(1));
  String[] lines=new String[edge1.getDimensionCursor().size()];
  for (int i=0; i < lines.length; i++) {
    lines[i]="String_Node_Str";
  }
  while (edge1.next()) {
    for (int i=0; i < lines.length; i++) {
      lines[i]+=cursor.getObject(columnEdgeBindingNames.get(i).toString()) + "String_Node_Str";
    }
  }
  if (rowAggr != null)   lines[lines.length - 1]+="String_Node_Str";
  String output="String_Node_Str";
  for (int i=0; i < lines.length; i++) {
    output+="String_Node_Str" + lines[i];
  }
  while (edge2.next()) {
    String line=cursor.getObject(rowEdgeBindingNames).toString() + "String_Node_Str";
    edge1.beforeFirst();
    while (edge1.next()) {
      line+=cursor.getObject(measureBindingNames) + "String_Node_Str";
    }
    if (rowAggr != null)     line+=cursor.getObject(rowAggr);
    output+="String_Node_Str" + line;
  }
  if (columnAggr != null) {
    String line="String_Node_Str" + "String_Node_Str";
    edge1.beforeFirst();
    while (edge1.next()) {
      line+=cursor.getObject(columnAggr) + "String_Node_Str";
    }
    if (overallAggr != null)     line+=cursor.getObject(overallAggr);
    output+="String_Node_Str" + line;
  }
  this.testPrint(output);
  this.checkOutputFile();
  close(cursor);
}

Fixed version (ground truth):
private void printCube(CubeCursor cursor,List columnEdgeBindingNames,List rowEdgeBindingNames,String measureBindingNames,String columnAggr,String rowAggr,String overallAggr) throws Exception {
  String output=getOutputFromCursor(cursor,columnEdgeBindingNames,rowEdgeBindingNames,measureBindingNames,columnAggr,rowAggr,overallAggr);
  this.testPrint(output);
  this.checkOutputFile();
  close(cursor);
}
Program: 73596
Project: 73596
Buggy source:
public ICubeCursor getCubeCursor() throws DataException {
  if (this.cubeCursor != null)   return this.cubeCursor;
  try {
    stopSign.start();
    CubeQueryExecutor executor=new CubeQueryExecutor(this.outResults,preparedQuery.getCubeQueryDefinition(),this.session,this.scope,this.context);
    BirtCubeView bcv=new BirtCubeView(executor,appContext);
    CubeCursor cubeCursor=bcv.getCubeCursor(stopSign);
    String newResultSetId=executor.getQueryResultsId();
    if (newResultSetId != null) {
      this.queryResultsId=newResultSetId;
    }
    this.scope.put(ScriptConstants.MEASURE_SCRIPTABLE,this.scope,new JSMeasureAccessor(cubeCursor,bcv.getMeasureMapping()));
    this.scope.put(ScriptConstants.DIMENSION_SCRIPTABLE,this.scope,new JSLevelAccessor(this.preparedQuery.getCubeQueryDefinition(),bcv));
    this.cubeCursor=new CubeCursorImpl(outResults,cubeCursor,this.scope,this.preparedQuery.getCubeQueryDefinition(),bcv);
    return this.cubeCursor;
  }
 catch (  OLAPException e) {
    throw new DataException(e.getLocalizedMessage());
  }
}

Fixed version (ground truth):
public ICubeCursor getCubeCursor() throws DataException {
  if (this.cubeCursor != null)   return this.cubeCursor;
  try {
    stopSign.start();
    CubeQueryExecutor executor=new CubeQueryExecutor(this.outResults,(ICubeQueryDefinition)preparedQuery.getCubeQueryDefinition(),this.session,this.scope,this.context);
    BirtCubeView bcv=new BirtCubeView(executor,appContext);
    CubeCursor cubeCursor=bcv.getCubeCursor(stopSign);
    String newResultSetId=executor.getQueryResultsId();
    if (newResultSetId != null) {
      this.queryResultsId=newResultSetId;
    }
    this.scope.put(ScriptConstants.MEASURE_SCRIPTABLE,this.scope,new JSMeasureAccessor(cubeCursor,bcv.getMeasureMapping()));
    this.scope.put(ScriptConstants.DIMENSION_SCRIPTABLE,this.scope,new JSLevelAccessor((ICubeQueryDefinition)this.preparedQuery.getCubeQueryDefinition(),bcv));
    this.cubeCursor=new CubeCursorImpl(outResults,cubeCursor,this.scope,(ICubeQueryDefinition)this.preparedQuery.getCubeQueryDefinition(),bcv);
    return this.cubeCursor;
  }
 catch (  OLAPException e) {
    throw new DataException(e.getLocalizedMessage());
  }
}
Program: 73597
Project: 73597
Buggy source:
/** 
 * @param preparedQuery
 * @param scope
 */
public CubeQueryResults(IBaseQueryResults outResults,PreparedCubeQuery preparedQuery,DataEngineSession session,Scriptable scope,DataEngineContext context,Map appContext){
  this.preparedQuery=preparedQuery;
  this.scope=scope;
  this.context=context;
  this.session=session;
  this.appContext=appContext;
  this.queryResultsId=preparedQuery.getCubeQueryDefinition().getQueryResultsID();
  this.outResults=outResults;
  this.stopSign=new StopSign();
}

Fixed version (ground truth):
/** 
 * @param preparedQuery
 * @param scope
 */
public CubeQueryResults(IBaseQueryResults outResults,PreparedCubeQuery preparedQuery,DataEngineSession session,Scriptable scope,DataEngineContext context,Map appContext){
  this.preparedQuery=preparedQuery;
  this.scope=scope;
  this.context=context;
  this.session=session;
  this.appContext=appContext;
  this.queryResultsId=((ICubeQueryDefinition)preparedQuery.getCubeQueryDefinition()).getQueryResultsID();
  this.outResults=outResults;
  this.stopSign=new StopSign();
}
Program: 73598
Project: 73598
Buggy source:
public ICubeQueryDefinition getCubeQueryDefinition(){
  return this.cubeQueryDefn;
}

Fixed version (ground truth):
public IBaseCubeQueryDefinition getCubeQueryDefinition(){
  return this.cubeQueryDefn;
}
Program: 73600
Project: 73600
Buggy source:
public Object evaluate(String expression){
  Object result=null;
  try {
    result=cubeCursor.getObject(ChartCubeQueryHelper.getBindingName(expression));
  }
 catch (  OLAPException e) {
    logger.log(e);
  }
  return result;
}

Fixed version (ground truth):
public Object evaluate(String expression){
  Object result=null;
  try {
    String bindingName=ChartCubeQueryHelper.getBindingName(expression);
    if (bindingName != null) {
      result=cubeCursor.getObject(bindingName);
    }
 else {
      result=rs.evaluate(expression);
    }
  }
 catch (  OLAPException e) {
    logger.log(e);
  }
catch (  BirtException e) {
    logger.log(e);
  }
  return result;
}
Program: 73601
Project: 73601
Buggy source:
public ChartCubeQueryHelper(ExtendedItemHandle handle,Chart cm){
  this.handle=handle;
  this.cm=cm;
  this.bInXtabDetail=ChartXTabUtil.isChartInXTab(handle);
}

Fixed version (ground truth):
public ChartCubeQueryHelper(ExtendedItemHandle handle,Chart cm){
  this.handle=handle;
  this.cm=cm;
  this.bInXtabDetail=ChartXTabUtil.isChartInXTab(handle);
  IActionEvaluator iae=BIRTActionEvaluator.getInstance(handle);
  iae.addExpressionReplaceable(this);
}
Program: 73602
Project: 73602
Buggy source:
public List getRowExpressions(){
  try {
    return Generator.instance().getRowExpressions(cm,new BIRTActionEvaluator());
  }
 catch (  ChartException e) {
    logger.log(e);
  }
  return null;
}

Fixed version (ground truth):
public List getRowExpressions(){
  try {
    return Generator.instance().getRowExpressions(cm,BIRTActionEvaluator.getInstance(handle));
  }
 catch (  ChartException e) {
    logger.log(e);
  }
  return null;
}
Program: 73603
Project: 73603
Buggy source:
public Object onRowSets(IBaseResultSet[] baseResultSet) throws BirtException {
  IBaseResultSet resultSet=getDataToRender(baseResultSet);
  if (resultSet == null) {
    return null;
  }
  try {
    if (rtc.getScale() == null && ChartReportItemUtil.canScaleShared(handle,cm)) {
      rtc.setScale(createSharedScale(resultSet));
    }
    updateChartModel();
    BIRTExternalContext externalContext=new BIRTExternalContext(context);
    initializeScriptHandler(externalContext);
    IDataRowExpressionEvaluator rowAdapter=createEvaluator(resultSet);
    BIRTActionEvaluator evaluator=new BIRTActionEvaluator();
    Generator.instance().bindData(rowAdapter,evaluator,cm,rtc);
    prepareDeviceRenderer();
    GeneratedChartState gcs=buildChart(rowAdapter,externalContext);
    renderToImageFile(gcs);
    rowAdapter.close();
    if (rtc.getScale() != null && !rtc.getScale().isShared()) {
      rtc.getScale().setShared(true);
      ((ChartReportItemImpl)getReportItem(handle)).setScale(rtc.getScale());
    }
    return getImageToDisplay();
  }
 catch (  BirtException birtException) {
    if (isNoDataException(birtException)) {
      return null;
    }
 else {
      throw birtException;
    }
  }
catch (  RuntimeException ex) {
    logger.log(ILogger.ERROR,Messages.getString("String_Node_Str"));
    logger.log(ex);
    throw new ChartException(ChartReportItemPlugin.ID,ChartException.GENERATION,ex);
  }
}

Fixed version (ground truth):
public Object onRowSets(IBaseResultSet[] baseResultSet) throws BirtException {
  IBaseResultSet resultSet=getDataToRender(baseResultSet);
  if (resultSet == null) {
    return null;
  }
  try {
    if (rtc.getScale() == null && ChartReportItemUtil.canScaleShared(handle,cm)) {
      rtc.setScale(createSharedScale(resultSet));
    }
    updateChartModel();
    BIRTExternalContext externalContext=new BIRTExternalContext(context);
    initializeScriptHandler(externalContext);
    IDataRowExpressionEvaluator rowAdapter=createEvaluator(resultSet);
    IActionEvaluator evaluator=BIRTActionEvaluator.getInstance(handle);
    Generator.instance().bindData(rowAdapter,evaluator,cm,rtc);
    prepareDeviceRenderer();
    GeneratedChartState gcs=buildChart(rowAdapter,externalContext);
    renderToImageFile(gcs);
    rowAdapter.close();
    if (rtc.getScale() != null && !rtc.getScale().isShared()) {
      rtc.getScale().setShared(true);
      ((ChartReportItemImpl)getReportItem(handle)).setScale(rtc.getScale());
    }
    return getImageToDisplay();
  }
 catch (  BirtException birtException) {
    if (isNoDataException(birtException)) {
      return null;
    }
 else {
      throw birtException;
    }
  }
catch (  RuntimeException ex) {
    logger.log(ILogger.ERROR,Messages.getString("String_Node_Str"));
    logger.log(ex);
    throw new ChartException(ChartReportItemPlugin.ID,ChartException.GENERATION,ex);
  }
}
Program: 73605
Project: 73605
Buggy source:
public final String[] validate(Chart cm,Object oContext){
  final ArrayList alProblems=new ArrayList(4);
  final ExtendedItemHandle eih=(ExtendedItemHandle)oContext;
  if (DEUtil.getDataSetList(eih).size() == 0 && ChartReportItemUtil.getBindingCube(eih) == null) {
    alProblems.add(Messages.getString("String_Node_Str"));
  }
  final QueryUIHelper.SeriesQueries[] qsqa=new QueryUIHelper().getSeriesQueryDefinitions(cm);
  Collection co;
  for (int i=0; i < qsqa.length; i++) {
    co=qsqa[i].validate();
    if (co != null) {
      alProblems.addAll(co);
    }
  }
  return (String[])alProblems.toArray(new String[alProblems.size()]);
}

Fixed version (ground truth):
public final String[] validate(Chart cm,Object oContext){
  final ArrayList alProblems=new ArrayList(4);
  final ExtendedItemHandle eih=(ExtendedItemHandle)oContext;
  if (DEUtil.getDataSetList(eih).size() == 0 && ChartXTabUtil.getBindingCube(eih) == null) {
    alProblems.add(Messages.getString("String_Node_Str"));
  }
  final QueryUIHelper.SeriesQueries[] qsqa=new QueryUIHelper().getSeriesQueryDefinitions(cm);
  Collection co;
  for (int i=0; i < qsqa.length; i++) {
    co=qsqa[i].validate();
    if (co != null) {
      alProblems.addAll(co);
    }
  }
  return (String[])alProblems.toArray(new String[alProblems.size()]);
}
Program: 73606
Project: 73606
Buggy source:
private void updateChartModelAndSize(){
  if (crii != null) {
    cm=(Chart)crii.getProperty(ChartReportItemUtil.PROPERTY_CHART);
    if (ChartReportItemUtil.isChartInXTab(crii.getHandle())) {
      if (!crii.hasHostChart()) {
        cm=ChartReportItemUtil.updateModelToRenderPlot((Chart)EcoreUtil.copy(cm));
      }
 else {
        cm=ChartReportItemUtil.updateModelToRenderAxis((Chart)EcoreUtil.copy(cm));
      }
    }
    if (cm != null) {
      if (!crii.hasHostChart()) {
        final IDisplayServer idsSWT=ChartUIUtil.getDisplayServer();
        final Bounds bo=cm.getBlock().getBounds().scaledInstance(72d / idsSWT.getDpiResolution());
        setSize((int)bo.getWidth(),(int)bo.getHeight());
      }
    }
 else {
      setSize((int)ChartReportItemUtil.DEFAULT_CHART_BLOCK_WIDTH,(int)ChartReportItemUtil.DEFAULT_CHART_BLOCK_HEIGHT);
    }
  }
 else {
    setSize((int)ChartReportItemUtil.DEFAULT_CHART_BLOCK_WIDTH,(int)ChartReportItemUtil.DEFAULT_CHART_BLOCK_HEIGHT);
  }
}

Fixed version (ground truth):
private void updateChartModelAndSize(){
  if (crii != null) {
    cm=(Chart)crii.getProperty(ChartReportItemUtil.PROPERTY_CHART);
    if (ChartXTabUtil.isChartInXTab(crii.getHandle())) {
      if (!crii.hasHostChart()) {
        cm=ChartXTabUtil.updateModelToRenderPlot((Chart)EcoreUtil.copy(cm));
      }
 else {
        cm=ChartXTabUtil.updateModelToRenderAxis((Chart)EcoreUtil.copy(cm));
      }
    }
    if (cm != null) {
      if (!crii.hasHostChart()) {
        final IDisplayServer idsSWT=ChartUIUtil.getDisplayServer();
        final Bounds bo=cm.getBlock().getBounds().scaledInstance(72d / idsSWT.getDpiResolution());
        setSize((int)bo.getWidth(),(int)bo.getHeight());
      }
    }
 else {
      setSize((int)ChartReportItemUtil.DEFAULT_CHART_BLOCK_WIDTH,(int)ChartReportItemUtil.DEFAULT_CHART_BLOCK_HEIGHT);
    }
  }
 else {
    setSize((int)ChartReportItemUtil.DEFAULT_CHART_BLOCK_WIDTH,(int)ChartReportItemUtil.DEFAULT_CHART_BLOCK_HEIGHT);
  }
}
Program: 73607
Project: 73607
Buggy source:
public DataType getDataType(String expression){
  if (expression == null || expression.trim().length() == 0 || ChartReportItemUtil.getBindingCube(itemHandle) != null) {
    return null;
  }
  Object[] returnObj=findDataType(expression,itemHandle);
  if (((Boolean)returnObj[0]).booleanValue()) {
    return (DataType)returnObj[1];
  }
  ReportItemHandle parentHandle=DEUtil.getBindingHolder(itemHandle);
  if (parentHandle != null) {
    returnObj=findDataType(expression,parentHandle);
    if (((Boolean)returnObj[0]).booleanValue()) {
      return (DataType)returnObj[1];
    }
  }
  try {
    NumberFormat.getInstance().parse(expression);
    return DataType.NUMERIC_LITERAL;
  }
 catch (  ParseException e) {
  }
  try {
    DateFormat.getInstance().parse(expression);
    return DataType.DATE_TIME_LITERAL;
  }
 catch (  ParseException e) {
  }
  return null;
}

Fixed version (ground truth):
public DataType getDataType(String expression){
  if (expression == null || expression.trim().length() == 0 || ChartXTabUtil.getBindingCube(itemHandle) != null) {
    return null;
  }
  Object[] returnObj=findDataType(expression,itemHandle);
  if (((Boolean)returnObj[0]).booleanValue()) {
    return (DataType)returnObj[1];
  }
  ReportItemHandle parentHandle=DEUtil.getBindingHolder(itemHandle);
  if (parentHandle != null) {
    returnObj=findDataType(expression,parentHandle);
    if (((Boolean)returnObj[0]).booleanValue()) {
      return (DataType)returnObj[1];
    }
  }
  try {
    NumberFormat.getInstance().parse(expression);
    return DataType.NUMERIC_LITERAL;
  }
 catch (  ParseException e) {
  }
  try {
    DateFormat.getInstance().parse(expression);
    return DataType.DATE_TIME_LITERAL;
  }
 catch (  ParseException e) {
  }
  return null;
}
Program: 73608
Project: 73608
Buggy source:
private void initDataSelector(){
  cmbDataItems.setItems(createDataComboItems());
  String sItemRef=getDataServiceProvider().getReportItemReference();
  if (sItemRef != null) {
    btnUseData.setSelection(true);
    cmbDataItems.setText(sItemRef);
    return;
  }
  String sDataSet=getDataServiceProvider().getBoundDataSet();
  if (sDataSet != null && !getDataServiceProvider().isInMultiViews()) {
    btnUseData.setSelection(true);
    cmbDataItems.setText(sDataSet);
    if (sDataSet != null) {
      switchDataTable();
    }
    return;
  }
  String sDataCube=getDataServiceProvider().getDataCube();
  if (sDataCube != null && !getDataServiceProvider().isInMultiViews()) {
    btnUseData.setSelection(true);
    cmbDataItems.setText(sDataCube);
    return;
  }
  btnInherit.setSelection(true);
  if (getDataServiceProvider().isInMultiViews()) {
    btnUseData.setSelection(false);
    btnUseData.setEnabled(false);
  }
  cmbDataItems.select(0);
  cmbDataItems.setEnabled(false);
  getDataServiceProvider().setDataSet(null);
  String reportDataSet=getDataServiceProvider().getReportDataSet();
  if (reportDataSet != null) {
    switchDataTable();
  }
}

Fixed version (ground truth):
private void initDataSelector(){
  cmbDataItems.setItems(createDataComboItems());
  String sItemRef=getDataServiceProvider().getReportItemReference();
  if (sItemRef != null) {
    btnUseData.setSelection(true);
    cmbDataItems.setText(sItemRef);
    return;
  }
  String sDataSet=getDataServiceProvider().getBoundDataSet();
  if (sDataSet != null && !getDataServiceProvider().isInheritanceOnly()) {
    btnUseData.setSelection(true);
    cmbDataItems.setText(sDataSet);
    if (sDataSet != null) {
      switchDataTable();
    }
    return;
  }
  String sDataCube=getDataServiceProvider().getDataCube();
  if (sDataCube != null && !getDataServiceProvider().isInheritanceOnly()) {
    btnUseData.setSelection(true);
    cmbDataItems.setText(sDataCube);
    return;
  }
  btnInherit.setSelection(true);
  if (getDataServiceProvider().isInheritanceOnly()) {
    btnUseData.setSelection(false);
    btnUseData.setEnabled(false);
  }
  cmbDataItems.select(0);
  cmbDataItems.setEnabled(false);
  getDataServiceProvider().setDataSet(null);
  String reportDataSet=getDataServiceProvider().getReportDataSet();
  if (reportDataSet != null) {
    switchDataTable();
  }
}
Program: 73609
Project: 73609
Buggy source:
private CubeHandle getCube(){
  return ChartReportItemUtil.getBindingCube(itemHandle);
}

Fixed version (ground truth):
private CubeHandle getCube(){
  return ChartXTabUtil.getBindingCube(itemHandle);
}
Program: 73610
Project: 73610
Buggy source:
private void addMenu(IMenuManager manager,Object item){
  if (item instanceof IAction) {
    manager.add((IAction)item);
  }
 else   if (item instanceof IContributionItem) {
    manager.add((IContributionItem)item);
  }
}

Fixed version (ground truth):
private void addMenu(IMenuManager manager,Object item){
  if (item instanceof IAction) {
    manager.add((IAction)item);
  }
 else   if (item instanceof IContributionItem) {
    manager.add((IContributionItem)item);
  }
  if (getDataServiceProvider().isInXTab()) {
    if (item instanceof IAction) {
      ((IAction)item).setEnabled(false);
    }
  }
}
Program: 73611
Project: 73611
Buggy source:
private boolean isCubeMode(){
  return ChartReportItemUtil.getBindingCube(itemHandle) != null;
}

Fixed version (ground truth):
private boolean isCubeMode(){
  return ChartXTabUtil.getBindingCube(itemHandle) != null;
}
Program: 73612
Project: 73612
Buggy source:
private MenuManager createMenuManager(final Object data){
  MenuManager menuManager=new MenuManager();
  menuManager.setRemoveAllWhenShown(true);
  menuManager.addMenuListener(new IMenuListener(){
    public void menuAboutToShow(    IMenuManager manager){
      if (data instanceof Integer) {
        addMenu(manager,new HeaderShowAction(tablePreview.getCurrentColumnHeading()));
        String expr=ExpressionUtil.createJSRowExpression(tablePreview.getCurrentColumnHeading());
        addMenu(manager,getBaseSeriesMenu(getChartModel(),expr));
        addMenu(manager,getOrthogonalSeriesMenu(getChartModel(),expr));
        addMenu(manager,getGroupSeriesMenu(getChartModel(),expr));
      }
 else       if (data instanceof MeasureHandle) {
        String expr=createCubeExpression();
        addMenu(manager,getOrthogonalSeriesMenu(getChartModel(),expr));
      }
 else       if (data instanceof LevelHandle) {
        String expr=createCubeExpression();
        addMenu(manager,getBaseSeriesMenu(getChartModel(),expr));
        addMenu(manager,getGroupSeriesMenu(getChartModel(),expr));
      }
    }
    private void addMenu(    IMenuManager manager,    Object item){
      if (item instanceof IAction) {
        manager.add((IAction)item);
      }
 else       if (item instanceof IContributionItem) {
        manager.add((IContributionItem)item);
      }
    }
  }
);
  return menuManager;
}

Fixed version (ground truth):
private MenuManager createMenuManager(final Object data){
  MenuManager menuManager=new MenuManager();
  menuManager.setRemoveAllWhenShown(true);
  menuManager.addMenuListener(new IMenuListener(){
    public void menuAboutToShow(    IMenuManager manager){
      if (data instanceof Integer) {
        addMenu(manager,new HeaderShowAction(tablePreview.getCurrentColumnHeading()));
        String expr=ExpressionUtil.createJSRowExpression(tablePreview.getCurrentColumnHeading());
        addMenu(manager,getBaseSeriesMenu(getChartModel(),expr));
        addMenu(manager,getOrthogonalSeriesMenu(getChartModel(),expr));
        addMenu(manager,getGroupSeriesMenu(getChartModel(),expr));
      }
 else       if (data instanceof MeasureHandle) {
        String expr=createCubeExpression();
        addMenu(manager,getOrthogonalSeriesMenu(getChartModel(),expr));
      }
 else       if (data instanceof LevelHandle) {
        String expr=createCubeExpression();
        addMenu(manager,getBaseSeriesMenu(getChartModel(),expr));
        addMenu(manager,getGroupSeriesMenu(getChartModel(),expr));
      }
    }
    private void addMenu(    IMenuManager manager,    Object item){
      if (item instanceof IAction) {
        manager.add((IAction)item);
      }
 else       if (item instanceof IContributionItem) {
        manager.add((IContributionItem)item);
      }
      if (getDataServiceProvider().isInXTab()) {
        if (item instanceof IAction) {
          ((IAction)item).setEnabled(false);
        }
      }
    }
  }
);
  return menuManager;
}
Program: 73613
Project: 73613
Buggy source:
private void updatePredefinedQueries(){
  CubeHandle cube=getCube();
  if (cube == null) {
    getContext().addPredefinedQuery(ChartUIConstants.QUERY_CATEGORY,null);
    getContext().addPredefinedQuery(ChartUIConstants.QUERY_VALUE,null);
    getContext().addPredefinedQuery(ChartUIConstants.QUERY_OPTIONAL,null);
  }
 else {
    List measures=ChartReportItemUtil.getAllMeasures(cube);
    if (!measures.isEmpty()) {
      String[] exprs=new String[measures.size()];
      for (int i=0; i < exprs.length; i++) {
        exprs[i]=ExpressionUtil.createJSMeasureExpression(((MeasureHandle)measures.get(i)).getName());
      }
      getContext().addPredefinedQuery(ChartUIConstants.QUERY_VALUE,exprs);
    }
    List levels=ChartReportItemUtil.getAllLevels(cube);
    if (!levels.isEmpty()) {
      String[] exprs=new String[levels.size()];
      for (int i=0; i < exprs.length; i++) {
        exprs[i]=ChartReportItemUtil.createDimensionExpression((LevelHandle)levels.get(i));
      }
      getContext().addPredefinedQuery(ChartUIConstants.QUERY_CATEGORY,exprs);
      getContext().addPredefinedQuery(ChartUIConstants.QUERY_OPTIONAL,exprs);
    }
  }
  fireEvent(btnBinding,EVENT_QUERY);
}

Fixed version (ground truth):
private void updatePredefinedQueries(){
  if (dataProvider.isInXTab()) {
    try {
      CrosstabReportItemHandle xtab=ChartXTabUtil.getXtabContainerCell(itemHandle).getCrosstab();
      List levels=ChartXTabUtil.getAllLevels(xtab);
      String[] exprs=(String[])levels.toArray(new String[levels.size()]);
      getContext().addPredefinedQuery(ChartUIConstants.QUERY_CATEGORY,exprs);
      xtab.getMeasure(0).getAggregationCell(0);
    }
 catch (    BirtException e) {
      WizardBase.displayException(e);
    }
  }
 else {
    CubeHandle cube=getCube();
    if (cube == null) {
      getContext().addPredefinedQuery(ChartUIConstants.QUERY_CATEGORY,null);
      getContext().addPredefinedQuery(ChartUIConstants.QUERY_VALUE,null);
      getContext().addPredefinedQuery(ChartUIConstants.QUERY_OPTIONAL,null);
    }
 else {
      List measures=ChartXTabUtil.getAllMeasures(cube);
      if (!measures.isEmpty()) {
        String[] exprs=new String[measures.size()];
        for (int i=0; i < exprs.length; i++) {
          exprs[i]=ExpressionUtil.createJSMeasureExpression(((MeasureHandle)measures.get(i)).getName());
        }
        getContext().addPredefinedQuery(ChartUIConstants.QUERY_VALUE,exprs);
      }
      List levels=ChartXTabUtil.getAllLevels(cube);
      if (!levels.isEmpty()) {
        String[] exprs=new String[levels.size()];
        for (int i=0; i < exprs.length; i++) {
          exprs[i]=ChartXTabUtil.createDimensionExpression((LevelHandle)levels.get(i));
        }
        getContext().addPredefinedQuery(ChartUIConstants.QUERY_CATEGORY,exprs);
        getContext().addPredefinedQuery(ChartUIConstants.QUERY_OPTIONAL,exprs);
      }
    }
  }
  fireEvent(btnBinding,EVENT_QUERY);
}
Program: 73617
Project: 73617
Buggy source:
/** 
 * Prepare the cube query definition, return an IPreparedCubeQuery instance 
 * @param query
 * @param appContext
 * @return
 * @throws BirtException
 */
abstract public IPreparedCubeQuery prepare(ICubeQueryDefinition query,Map appContext) throws BirtException ;

Fixed version (ground truth):
/** 
 * Prepare the sub cube query definition, return an IPreparedCubeQuery instance
 * @param query
 * @param appContext
 * @return
 * @throws BirtException
 */
abstract public IPreparedCubeQuery prepare(ISubCubeQueryDefinition query,Map appContext) throws BirtException ;
Program: 73618
Project: 73618
Buggy source:
/** 
 * Executes the prepared                       execution plan as an inner query  that appears within the scope of another query.  The outer query must have been prepared and executed, and  its results given as a parameter to this method.
 * @param outerResults
 * @param scope
 * @return
 * @throws DataException
 */
public ICubeQueryResults execute(IBaseQueryResults outerResults,Scriptable scope) throws DataException ;

Fixed version (ground truth):
/** 
 * Executes the prepared execution plan as an inner query  that appears within the scope of another query.  The outer query must have been prepared and executed, and  its results given as a parameter to this method.
 * @param outerResults
 * @param scope
 * @return
 * @throws DataException
 */
public ICubeQueryResults execute(IBaseQueryResults outerResults,Scriptable scope) throws DataException ;
Program: 73619
Project: 73619
Buggy source:
/** 
 * Return the query definition which is used to generate current IPreparedCubeQuery instance.
 * @return
 */
public ICubeQueryDefinition getCubeQueryDefinition();

Fixed version (ground truth):
/** 
 * Return the query definition which is used to generate current IPreparedCubeQuery instance.
 * @return
 */
public IBaseCubeQueryDefinition getCubeQueryDefinition();
Program: 73621
Project: 73621
Buggy source:
/** 
 * @param cubeView
 * @param result
 * @param relationMap
 * @param manager
 * @param appContext
 * @throws OLAPException
 */
public CubeCursorImpl(BirtCubeView cubeView,IResultSet result,Map relationMap,MeasureNameManager manager,Map appContext) throws OLAPException {
  super(null,new AggregationAccessor(cubeView,result,relationMap,manager));
  if (result == null)   return;
  EdgeAxis[] calculatedMemberAxis=result.getMeasureResult();
  BirtEdgeView[] calculatedMemberView=cubeView.getMeasureEdgeView();
  if (calculatedMemberAxis != null) {
    for (int i=0; i < calculatedMemberAxis.length; i++) {
      pageEdge.add(new EdgeCursorImpl(calculatedMemberView[i],true,calculatedMemberAxis[i],this));
    }
  }
  if (cubeView.getColumnEdgeView() != null) {
    EdgeCursor columnEdgeCursor=new EdgeCursorImpl(cubeView.getColumnEdgeView(),false,result.getColumnEdgeResult(),this);
    if (appContext != null)     columnEdgeCursor.setFetchSize(populateFetchLimitSize(appContext.get(DataEngine.CUBECURSOR_FETCH_LIMIT_ON_COLUMN_EDGE)));
    result.getColumnEdgeResult().populateEdgeInfo();
    ordinateEdge.add(columnEdgeCursor);
  }
  if (cubeView.getRowEdgeView() != null) {
    EdgeCursor rowEdgeCursor=new EdgeCursorImpl(cubeView.getRowEdgeView(),false,result.getRowEdgeResult(),this);
    if (appContext != null)     rowEdgeCursor.setFetchSize(populateFetchLimitSize(appContext.get(DataEngine.CUBECUSROR_FETCH_LIMIT_ON_ROW_EDGE)));
    result.getRowEdgeResult().populateEdgeInfo();
    ordinateEdge.add(rowEdgeCursor);
  }
}

Fixed version (ground truth):
/** 
 * @param cubeView
 * @param result
 * @param relationMap
 * @param manager
 * @param appContext
 * @throws OLAPException
 */
public CubeCursorImpl(BirtCubeView cubeView,IResultSet result,Map relationMap,MeasureNameManager manager,Map appContext) throws OLAPException {
  super(null,new AggregationAccessor(cubeView,result,relationMap,manager));
  if (result == null)   return;
  if (cubeView.getColumnEdgeView() != null) {
    EdgeCursor columnEdgeCursor=new EdgeCursorImpl(cubeView.getColumnEdgeView(),false,result.getColumnEdgeResult(),this);
    if (appContext != null)     columnEdgeCursor.setFetchSize(populateFetchLimitSize(appContext.get(DataEngine.CUBECURSOR_FETCH_LIMIT_ON_COLUMN_EDGE)));
    result.getColumnEdgeResult().populateEdgeInfo(false);
    ordinateEdge.add(columnEdgeCursor);
  }
  if (cubeView.getRowEdgeView() != null) {
    EdgeCursor rowEdgeCursor=new EdgeCursorImpl(cubeView.getRowEdgeView(),false,result.getRowEdgeResult(),this);
    if (appContext != null)     rowEdgeCursor.setFetchSize(populateFetchLimitSize(appContext.get(DataEngine.CUBECUSROR_FETCH_LIMIT_ON_ROW_EDGE)));
    result.getRowEdgeResult().populateEdgeInfo(false);
    ordinateEdge.add(rowEdgeCursor);
  }
  if (cubeView.getPageEdgeView() != null) {
    EdgeCursor pageEdgeCursor=new EdgeCursorImpl(cubeView.getPageEdgeView(),true,result.getPageEdgeResult(),this);
    result.getPageEdgeResult().populateEdgeInfo(true);
    pageEdge.add(pageEdgeCursor);
  }
}
Program: 73622
Project: 73622
Buggy source:
public void synchronizePages() throws OLAPException {
}

Fixed version (ground truth):
public void synchronizePages() throws OLAPException {
  if (this.pageEdge != null && !this.pageEdge.isEmpty()) {
    EdgeCursorImpl pageCursor=(EdgeCursorImpl)this.pageEdge.get(0);
    long position=pageCursor.getPosition();
    Iterator iter=this.ordinateEdge.iterator();
    while (iter.hasNext()) {
      EdgeCursorImpl cursor=(EdgeCursorImpl)iter.next();
      cursor.synchronizedPages((int)position);
    }
  }
}
Program: 73624
Project: 73624
Buggy source:
/** 
 * get the start row index for the certain dimension.
 * @param dimAxisIndex
 * @return
 */
int getEdgeStart(int dimAxisIndex){
  if (this.relationMap.mirrorStartPosition == 0) {
    int outer=this.relationMap.mirrorStartPosition == 0 ? this.dimAxis.length : this.relationMap.mirrorStartPosition;
    EdgeInfo edgeInfo=findCurrentEdgeInfo(dimAxisIndex);
    if (edgeInfo == null)     return -1;
    int endPosition=edgeInfo.firstChild, position;
    EdgeInfo info=edgeInfo;
    for (position=dimAxisIndex + 1; position < outer; position++) {
      info=(EdgeInfo)((List)this.relationMap.relation[position]).get(endPosition);
      endPosition=info.firstChild;
    }
    return info.firstChild;
  }
 else {
    if (!this.dimAxis[dimAxisIndex].isMirrored()) {
      EdgeInfo edgeInfo=findCurrentEdgeInfo(dimAxisIndex);
      int start=findOuterMostChildEdgeInfoIndex(dimAxisIndex,edgeInfo);
      if (relationMap.mirrorStartPosition > 0 && start >= 0)       for (int i=relationMap.mirrorStartPosition; i < this.dimAxis.length; i++) {
        start=start * this.relationMap.mirrorLength[i];
      }
      return start;
    }
 else {
      int start=caculateOffset(dimAxisIndex,true);
      if (start < 0)       return start;
      if (dimAxisIndex == this.dimAxis.length - 1) {
        start+=this.dimensionCursorPosition[dimAxisIndex];
      }
      return start;
    }
  }
}

Fixed version (ground truth):
/** 
 * get the start row index for the certain dimension.
 * @param dimAxisIndex
 * @return
 */
int getEdgeStart(int dimAxisIndex){
  if (this.relationMap.mirrorStartPosition == 0) {
    int outer=this.relationMap.mirrorStartPosition == 0 ? this.dimAxis.length : this.relationMap.mirrorStartPosition;
    EdgeInfo edgeInfo=findCurrentEdgeInfo(dimAxisIndex);
    if (edgeInfo == null)     return -1;
    int endPosition=edgeInfo.firstChild, position;
    EdgeInfo info=edgeInfo;
    for (position=dimAxisIndex + 1; position < outer; position++) {
      info=(EdgeInfo)((List)this.relationMap.currentRelation[position]).get(endPosition);
      endPosition=info.firstChild;
    }
    return info.firstChild;
  }
 else {
    if (!this.dimAxis[dimAxisIndex].isMirrored()) {
      EdgeInfo edgeInfo=findCurrentEdgeInfo(dimAxisIndex);
      int start=findOuterMostChildEdgeInfoIndex(dimAxisIndex,edgeInfo);
      if (relationMap.mirrorStartPosition > 0 && start >= 0)       for (int i=relationMap.mirrorStartPosition; i < this.dimAxis.length; i++) {
        start=start * this.relationMap.mirrorLength[i];
      }
      return start;
    }
 else {
      int start=caculateOffset(dimAxisIndex,true);
      if (start < 0)       return start;
      if (dimAxisIndex == this.dimAxis.length - 1) {
        start+=this.dimensionCursorPosition[dimAxisIndex];
      }
      return start;
    }
  }
}
Program: 73625
Project: 73625
Buggy source:
/** 
 * @param currentPosition
 * @return
 */
private int[] findDimensionPosition(int currentPosition){
  int position=currentPosition;
  int[] pos=new int[this.relationMap.mirrorLength.length];
  int count=0;
  for (int i=pos.length - 1; i >= 0; i--) {
    count=0;
    if (position < 0) {
      pos[i]=-1;
      continue;
    }
    if (this.relationMap.mirrorLength[i] == 0) {
      EdgeInfo info=null;
      if (this.relationMap.relation[i].size() > position) {
        info=(EdgeInfo)this.relationMap.relation[i].get(position);
      }
 else {
        pos[i]=-1;
        continue;
      }
      for (int j=position - 1; j >= 0; j--) {
        EdgeInfo lastInfo=(EdgeInfo)this.relationMap.relation[i].get(j);
        if (info.parent == lastInfo.parent) {
          count++;
        }
 else {
          break;
        }
      }
      position=info.parent;
      pos[i]=count;
    }
 else {
      int offset=position % this.relationMap.mirrorLength[i];
      position=(position - offset) / this.relationMap.mirrorLength[i];
      pos[i]=offset;
    }
  }
  return pos;
}

Fixed version (ground truth):
/** 
 * @param currentPosition
 * @return
 */
private int[] findDimensionPosition(int currentPosition){
  int position=currentPosition;
  int[] pos=new int[this.relationMap.mirrorLength.length];
  int count=0;
  for (int i=pos.length - 1; i >= 0; i--) {
    count=0;
    if (position < 0) {
      pos[i]=-1;
      continue;
    }
    if (this.relationMap.mirrorLength[i] == 0) {
      EdgeInfo info=null;
      if (this.relationMap.currentRelation[i].size() > position) {
        info=(EdgeInfo)this.relationMap.currentRelation[i].get(position);
      }
 else {
        pos[i]=-1;
        continue;
      }
      for (int j=position - 1; j >= 0; j--) {
        EdgeInfo lastInfo=(EdgeInfo)this.relationMap.currentRelation[i].get(j);
        if (info.parent == lastInfo.parent) {
          count++;
        }
 else {
          break;
        }
      }
      position=info.parent;
      pos[i]=count;
    }
 else {
      int offset=position % this.relationMap.mirrorLength[i];
      position=(position - offset) / this.relationMap.mirrorLength[i];
      pos[i]=offset;
    }
  }
  return pos;
}