nus-yam/ex-repair huggingface dataset:
Program: 51216
Project: 51216
Buggy source:
SmartMemberReader getSmartMemberReader(Connection con,String hierName){
  RolapCube cube=(RolapCube)con.getSchema().lookupCube("String_Node_Str",true);
  RolapSchemaReader schemaReader=(RolapSchemaReader)cube.getSchemaReader();
  RolapHierarchy hierarchy=(RolapHierarchy)cube.lookupHierarchy(new Id.Segment(hierName,Id.Quoting.UNQUOTED),false);
  assertNotNull(hierarchy);
  return (SmartMemberReader)hierarchy.createMemberReader(schemaReader.getRole());
}

Fixed version (ground truth):
RolapCubeHierarchy.RolapCubeHierarchyMemberReader getSmartMemberReader(Connection con,String hierName){
  RolapCube cube=(RolapCube)con.getSchema().lookupCube("String_Node_Str",true);
  RolapSchemaReader schemaReader=(RolapSchemaReader)cube.getSchemaReader();
  RolapHierarchy hierarchy=(RolapHierarchy)cube.lookupHierarchy(new Id.Segment(hierName,Id.Quoting.UNQUOTED),false);
  assertNotNull(hierarchy);
  return (RolapCubeHierarchy.RolapCubeHierarchyMemberReader)hierarchy.createMemberReader(schemaReader.getRole());
}
Program: 51217
Project: 51217
Buggy source:
SmartMemberReader getSmartMemberReader(Connection con,String hierName){
  RolapCube cube=(RolapCube)con.getSchema().lookupCube("String_Node_Str",true);
  RolapSchemaReader schemaReader=(RolapSchemaReader)cube.getSchemaReader();
  RolapHierarchy hierarchy=(RolapHierarchy)cube.lookupHierarchy(new Id.Segment(hierName,Id.Quoting.UNQUOTED),false);
  assertNotNull(hierarchy);
  return (SmartMemberReader)hierarchy.createMemberReader(schemaReader.getRole());
}

Fixed version (ground truth):
RolapCubeHierarchy.RolapCubeHierarchyMemberReader getSmartMemberReader(Connection con,String hierName){
  RolapCube cube=(RolapCube)con.getSchema().lookupCube("String_Node_Str",true);
  RolapSchemaReader schemaReader=(RolapSchemaReader)cube.getSchemaReader();
  RolapHierarchy hierarchy=(RolapHierarchy)cube.lookupHierarchy(new Id.Segment(hierName,Id.Quoting.UNQUOTED),false);
  assertNotNull(hierarchy);
  return (RolapCubeHierarchy.RolapCubeHierarchyMemberReader)hierarchy.createMemberReader(schemaReader.getRole());
}
Program: 51218
Project: 51218
Buggy source:
/** 
 * when Mondrian parses a string like "[Store].[All Stores].[USA].[CA].[San Francisco]" it shall not lookup additional members.
 */
public void testLookupMemberCache(){
  if (MondrianProperties.instance().TestExpDependencies.get() > 0) {
    return;
  }
  SmartMemberReader smr=getSharedSmartMemberReader("String_Node_Str");
  MemberCacheHelper smrch=smr.cacheHelper;
  clearAndHardenCache(smrch);
  RolapResult result=(RolapResult)executeQuery("String_Node_Str");
  assertTrue("String_Node_Str" + smrch.mapKeyToMember.size(),smrch.mapKeyToMember.size() <= 5);
  RolapMember sf=(RolapMember)result.getAxes()[0].getPositions().get(0).get(0);
  RolapMember ca=sf.getParentMember();
  ca=((RolapCubeMember)ca).getRolapMember();
  sf=((RolapCubeMember)sf).getRolapMember();
  List list=smrch.mapMemberToChildren.get(ca,scf.getMemberChildrenConstraint(null));
  assertNull("String_Node_Str",list);
  list=smrch.mapMemberToChildren.get(ca,scf.getChildByNameConstraint(ca,new Id.Segment("String_Node_Str",Id.Quoting.QUOTED)));
  assertNotNull("String_Node_Str",list);
  assertEquals("String_Node_Str",sf,list.get(0));
}

Fixed version (ground truth):
/** 
 * when Mondrian parses a string like "[Store].[All Stores].[USA].[CA].[San Francisco]" it shall not lookup additional members.
 */
public void testLookupMemberCache(){
  if (MondrianProperties.instance().TestExpDependencies.get() > 0) {
    return;
  }
  RolapCubeHierarchy.RolapCubeHierarchyMemberReader smr=getSmartMemberReader("String_Node_Str");
  MemberCacheHelper smrch=smr.cacheHelper;
  MemberCacheHelper rcsmrch=smr.getRolapCubeMemberCacheHelper();
  SmartMemberReader ssmr=getSharedSmartMemberReader("String_Node_Str");
  MemberCacheHelper ssmrch=ssmr.cacheHelper;
  clearAndHardenCache(smrch);
  clearAndHardenCache(rcsmrch);
  clearAndHardenCache(ssmrch);
  RolapResult result=(RolapResult)executeQuery("String_Node_Str");
  assertTrue("String_Node_Str" + ssmrch.mapKeyToMember.size(),ssmrch.mapKeyToMember.size() <= 5);
  RolapMember sf=(RolapMember)result.getAxes()[0].getPositions().get(0).get(0);
  RolapMember ca=sf.getParentMember();
  ca=((RolapCubeMember)ca).getRolapMember();
  sf=((RolapCubeMember)sf).getRolapMember();
  List list=ssmrch.mapMemberToChildren.get(ca,scf.getMemberChildrenConstraint(null));
  assertNull("String_Node_Str",list);
  list=ssmrch.mapMemberToChildren.get(ca,scf.getChildByNameConstraint(ca,new Id.Segment("String_Node_Str",Id.Quoting.QUOTED)));
  assertNotNull("String_Node_Str",list);
  assertEquals("String_Node_Str",sf,list.get(0));
}
Program: 51219
Project: 51219
Buggy source:
/** 
 * Scans for memberChildren, levelMembers, memberDescendants, crossJoin.
 */
protected CrossJoinArg[] checkCrossJoinArg(RolapEvaluator evaluator,Exp exp){
  if (exp instanceof NamedSetExpr) {
    NamedSet namedSet=((NamedSetExpr)exp).getNamedSet();
    exp=namedSet.getExp();
  }
  if (!(exp instanceof ResolvedFunCall)) {
    return null;
  }
  final ResolvedFunCall funCall=(ResolvedFunCall)exp;
  FunDef fun=funCall.getFunDef();
  Exp[] args=funCall.getArgs();
  CrossJoinArg arg;
  arg=checkMemberChildren(fun,args);
  if (arg != null) {
    return new CrossJoinArg[]{arg};
  }
  arg=checkLevelMembers(fun,args);
  if (arg != null) {
    return new CrossJoinArg[]{arg};
  }
  arg=checkDescendants(fun,args);
  if (arg != null) {
    return new CrossJoinArg[]{arg};
  }
  arg=checkEnumeration(fun,args);
  if (arg != null) {
    return new CrossJoinArg[]{arg};
  }
  return checkCrossJoin(evaluator,fun,args);
}

Fixed version (ground truth):
/** 
 * Scans for memberChildren, levelMembers, memberDescendants, crossJoin.
 */
protected CrossJoinArg[] checkCrossJoinArg(RolapEvaluator evaluator,Exp exp){
  if (exp instanceof NamedSetExpr) {
    NamedSet namedSet=((NamedSetExpr)exp).getNamedSet();
    exp=namedSet.getExp();
  }
  if (!(exp instanceof ResolvedFunCall)) {
    return null;
  }
  final ResolvedFunCall funCall=(ResolvedFunCall)exp;
  FunDef fun=funCall.getFunDef();
  Exp[] args=funCall.getArgs();
  final Role role=evaluator.getSchemaReader().getRole();
  CrossJoinArg arg;
  arg=checkMemberChildren(role,fun,args);
  if (arg != null) {
    return new CrossJoinArg[]{arg};
  }
  arg=checkLevelMembers(role,fun,args);
  if (arg != null) {
    return new CrossJoinArg[]{arg};
  }
  arg=checkDescendants(role,fun,args);
  if (arg != null) {
    return new CrossJoinArg[]{arg};
  }
  arg=checkEnumeration(fun,args);
  if (arg != null) {
    return new CrossJoinArg[]{arg};
  }
  return checkCrossJoin(evaluator,fun,args);
}
Program: 51220
Project: 51220
Buggy source:
/** 
 * returns null to prevent the member/childern from being cached. There exists no valid MemberChildrenConstraint that would fetch those children that were extracted as a side effect from evaluating a non empty crossjoin
 */
public MemberChildrenConstraint getMemberChildrenConstraint(RolapMember parent){
  return null;
}

Fixed version (ground truth):
/** 
 * Returns null to prevent the member/childern from being cached. There exists no valid MemberChildrenConstraint that would fetch those children that were extracted as a side effect from evaluating a non empty crossjoin
 */
public MemberChildrenConstraint getMemberChildrenConstraint(RolapMember parent){
  return null;
}
Program: 51221
Project: 51221
Buggy source:
/** 
 * Checks for Descendants(&lt;member&gt;, &lt;Level&gt;)
 * @return an {@link CrossJoinArg} instance describing the Descendantsfunction, or null if <code>fun</code> represents something else.
 */
protected CrossJoinArg checkDescendants(FunDef fun,Exp[] args){
  if (!"String_Node_Str".equalsIgnoreCase(fun.getName())) {
    return null;
  }
  if (args.length != 2) {
    return null;
  }
  if (!(args[0] instanceof MemberExpr)) {
    return null;
  }
  RolapMember member=(RolapMember)((MemberExpr)args[0]).getMember();
  if (member.isCalculated()) {
    return null;
  }
  if (!(args[1] instanceof LevelExpr)) {
    return null;
  }
  RolapLevel level=(RolapLevel)((LevelExpr)args[1]).getLevel();
  if (!isSimpleLevel(level)) {
    return null;
  }
  return new DescendantsCrossJoinArg(level,member);
}

Fixed version (ground truth):
/** 
 * Checks for Descendants(&lt;member&gt;, &lt;Level&gt;)
 * @return an {@link CrossJoinArg} instance describing the Descendantsfunction, or null if <code>fun</code> represents something else.
 */
protected CrossJoinArg checkDescendants(Role role,FunDef fun,Exp[] args){
  if (!"String_Node_Str".equalsIgnoreCase(fun.getName())) {
    return null;
  }
  if (args.length != 2) {
    return null;
  }
  if (!(args[0] instanceof MemberExpr)) {
    return null;
  }
  RolapMember member=(RolapMember)((MemberExpr)args[0]).getMember();
  if (member.isCalculated()) {
    return null;
  }
  if (!(args[1] instanceof LevelExpr)) {
    return null;
  }
  RolapLevel level=(RolapLevel)((LevelExpr)args[1]).getLevel();
  if (!isSimpleLevel(level)) {
    return null;
  }
  final Access access=role.getAccess(level.getHierarchy());
switch (access) {
case ALL:
    break;
default :
  return null;
}
return new DescendantsCrossJoinArg(level,member);
}
Program: 51222
Project: 51222
Buggy source:
/** 
 * Checks for <code>&lt;Member&gt;.Children</code>.
 * @return an {@link CrossJoinArg} instance describing the member.childrenfunction, or null if <code>fun</code> represents something else.
 */
protected CrossJoinArg checkMemberChildren(FunDef fun,Exp[] args){
  if (!"String_Node_Str".equalsIgnoreCase(fun.getName())) {
    return null;
  }
  if (args.length != 1) {
    return null;
  }
  if (!(args[0] instanceof MemberExpr)) {
    return null;
  }
  RolapMember member=(RolapMember)((MemberExpr)args[0]).getMember();
  if (member.isCalculated()) {
    return null;
  }
  RolapLevel level=member.getLevel();
  level=(RolapLevel)level.getChildLevel();
  if (level == null || !isSimpleLevel(level)) {
    return null;
  }
  return new DescendantsCrossJoinArg(level,member);
}

Fixed version (ground truth):
/** 
 * Checks for <code>&lt;Member&gt;.Children</code>.
 * @return an {@link CrossJoinArg} instance describing the member.childrenfunction, or null if <code>fun</code> represents something else.
 */
protected CrossJoinArg checkMemberChildren(Role role,FunDef fun,Exp[] args){
  if (!"String_Node_Str".equalsIgnoreCase(fun.getName())) {
    return null;
  }
  if (args.length != 1) {
    return null;
  }
  if (!(args[0] instanceof MemberExpr)) {
    return null;
  }
  RolapMember member=(RolapMember)((MemberExpr)args[0]).getMember();
  if (member.isCalculated()) {
    return null;
  }
  RolapLevel level=member.getLevel();
  level=(RolapLevel)level.getChildLevel();
  if (level == null || !isSimpleLevel(level)) {
    return null;
  }
  final Access access=role.getAccess(level.getHierarchy());
switch (access) {
case ALL:
    break;
default :
  return null;
}
return new DescendantsCrossJoinArg(level,member);
}
Program: 51223
Project: 51223
Buggy source:
/** 
 * Checks for <code>&lt;Level&gt;.Members</code>.
 * @return an {@link CrossJoinArg} instance describing the Level.membersfunction, or null if <code>fun</code> represents something else.
 */
protected CrossJoinArg checkLevelMembers(FunDef fun,Exp[] args){
  if (!"String_Node_Str".equalsIgnoreCase(fun.getName())) {
    return null;
  }
  if (args.length != 1) {
    return null;
  }
  if (!(args[0] instanceof LevelExpr)) {
    return null;
  }
  RolapLevel level=(RolapLevel)((LevelExpr)args[0]).getLevel();
  if (!isSimpleLevel(level)) {
    return null;
  }
  return new DescendantsCrossJoinArg(level,null);
}

Fixed version (ground truth):
/** 
 * Checks for <code>&lt;Level&gt;.Members</code>.
 * @return an {@link CrossJoinArg} instance describing the Level.membersfunction, or null if <code>fun</code> represents something else.
 */
protected CrossJoinArg checkLevelMembers(Role role,FunDef fun,Exp[] args){
  if (!"String_Node_Str".equalsIgnoreCase(fun.getName())) {
    return null;
  }
  if (args.length != 1) {
    return null;
  }
  if (!(args[0] instanceof LevelExpr)) {
    return null;
  }
  RolapLevel level=(RolapLevel)((LevelExpr)args[0]).getLevel();
  if (!isSimpleLevel(level)) {
    return null;
  }
  final Access access=role.getAccess(level.getHierarchy());
switch (access) {
case ALL:
    break;
default :
  return null;
}
return new DescendantsCrossJoinArg(level,null);
}
Program: 51224
Project: 51224
Buggy source:
/** 
 * Test to verify that non empty crossjoins enforce role access 
 */
public void testNonEmptyAccess(){
  if (Bug.Bug1888821Fixed) {
    TestContext testContext=TestContext.create(null,null,null,null,null,"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str").withRole("String_Node_Str");
    testContext.assertQueryReturns("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str",fold("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"));
    testContext.assertQueryReturns("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str",fold("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"));
  }
}

Fixed version (ground truth):
/** 
 * Test to verify that non empty crossjoins enforce role access. Testcase for bug 1888821, "Non Empty Crossjoin fails to enforce role access".
 */
public void testNonEmptyAccess(){
  TestContext testContext=TestContext.create(null,null,null,null,null,"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str").withRole("String_Node_Str");
  final String expected=fold("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  testContext.assertQueryReturns("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str",expected);
  testContext.assertQueryReturns("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str",expected);
}
Program: 51225
Project: 51225
Buggy source:
/** 
 * Tests that long levels do not result in column aliases larger than the database can handle. For example, Access allows maximum of 64; Oracle allows 30. <p>Testcase for bug 1893959, "Generated drill-through columns too long for DBMS".
 * @throws Exception on error
 */
public void testTruncateLevelName() throws Exception {
  final TestContext testContext=TestContext.createSubstitutingCube("String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",null);
  Result result=testContext.executeQuery("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
  String sql=result.getCell(new int[]{0,0}).getDrillThroughSQL(false);
  java.sql.Connection connection=null;
  try {
    DataSource dataSource=getConnection().getDataSource();
    connection=dataSource.getConnection();
    final Statement statement=connection.createStatement();
    final ResultSet resultSet=statement.executeQuery(sql);
    assertEquals(6,resultSet.getMetaData().getColumnCount());
    final String columnName=resultSet.getMetaData().getColumnName(5);
    assertTrue(columnName,columnName.startsWith("String_Node_Str"));
    int n=0;
    while (resultSet.next()) {
      ++n;
    }
    assertEquals(2,n);
  }
  finally {
    if (connection != null) {
      connection.close();
    }
  }
}

Fixed version (ground truth):
/** 
 * Tests that long levels do not result in column aliases larger than the database can handle. For example, Access allows maximum of 64; Oracle allows 30. <p>Testcase for bug 1893959, "Generated drill-through columns too long for DBMS".
 * @throws Exception on error
 */
public void testTruncateLevelName() throws Exception {
  final TestContext testContext=TestContext.createSubstitutingCube("String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",null);
  Result result=testContext.executeQuery("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
  String sql=result.getCell(new int[]{0,0}).getDrillThroughSQL(false);
  java.sql.Connection connection=null;
  try {
    DataSource dataSource=getConnection().getDataSource();
    connection=dataSource.getConnection();
    final Statement statement=connection.createStatement();
    final ResultSet resultSet=statement.executeQuery(sql);
    final int columnCount=resultSet.getMetaData().getColumnCount();
    if (testContext.getDialect().isDerby()) {
      assertEquals(11,columnCount);
    }
 else {
      assertEquals(6,columnCount);
    }
    final String columnName=resultSet.getMetaData().getColumnName(5);
    assertTrue(columnName,columnName.startsWith("String_Node_Str"));
    int n=0;
    while (resultSet.next()) {
      ++n;
    }
    assertEquals(2,n);
  }
  finally {
    if (connection != null) {
      connection.close();
    }
  }
}
Program: 51226
Project: 51226
Buggy source:
public Calc compileExpression(Exp exp,boolean scalar){
  Evaluator evaluator=RolapEvaluator.create(this);
  final Validator validator=createValidator();
  final ExpCompiler compiler=createCompiler(evaluator,validator);
  Calc calc=(scalar) ? compiler.compileScalar(exp,false) : compiler.compile(exp);
  return calc;
}

Fixed version (ground truth):
/** 
 * Compiles an expression, using a cached compiled expression if available.
 * @param exp Expression
 * @param scalar Whether expression is scalar
 * @param resultStyle Preferred result style; if null, use query's defaultresult style; ignored if expression is scalar
 * @return compiled expression
 */
public Calc compileExpression(Exp exp,boolean scalar,ResultStyle resultStyle){
  Evaluator evaluator=RolapEvaluator.create(this);
  final Validator validator=createValidator();
  List<ResultStyle> resultStyleList;
  resultStyleList=Collections.singletonList(resultStyle != null ? resultStyle : this.resultStyle);
  final ExpCompiler compiler=createCompiler(evaluator,validator,resultStyleList);
  if (scalar) {
    return compiler.compileScalar(exp,false);
  }
 else {
    return compiler.compile(exp);
  }
}
Program: 51227
Project: 51227
Buggy source:
private ExpCompiler createCompiler(final Evaluator evaluator,final Validator validator){
  ExpCompiler compiler=ExpCompiler.Factory.getExpCompiler(evaluator,validator,Collections.singletonList(resultStyle));
  final int expDeps=MondrianProperties.instance().TestExpDependencies.get();
  if (expDeps > 0) {
    compiler=RolapUtil.createDependencyTestingCompiler(compiler);
  }
  return compiler;
}

Fixed version (ground truth):
private ExpCompiler createCompiler(final Evaluator evaluator,final Validator validator,List<ResultStyle> resultStyleList){
  ExpCompiler compiler=ExpCompiler.Factory.getExpCompiler(evaluator,validator,resultStyleList);
  final int expDeps=MondrianProperties.instance().TestExpDependencies.get();
  if (expDeps > 0) {
    compiler=RolapUtil.createDependencyTestingCompiler(compiler);
  }
  return compiler;
}
Program: 51228
Project: 51228
Buggy source:
/** 
 * Implements a cheap-and-cheerful mapping from expressions to compiled expressions. <p>TODO: Save compiled expressions somewhere better.
 */
final Calc getCompiled(Exp exp,boolean scalar){
  Calc calc=compiledExps.get(exp);
  if (calc == null) {
    calc=query.compileExpression(exp,scalar);
    compiledExps.put(exp,calc);
  }
  return calc;
}

Fixed version (ground truth):
/** 
 * Implements a cheap-and-cheerful mapping from expressions to compiled expressions. <p>TODO: Save compiled expressions somewhere better.
 * @param exp Expression
 * @param scalar Whether expression is scalar
 * @param resultStyle Preferred result style; if null, use query's defaultresult style; ignored if expression is scalar
 * @return compiled expression
 */
final Calc getCompiled(Exp exp,boolean scalar,ResultStyle resultStyle){
  List<Object> key=Arrays.asList(exp,scalar,resultStyle);
  Calc calc=compiledExps.get(key);
  if (calc == null) {
    calc=query.compileExpression(exp,scalar,resultStyle);
    compiledExps.put(key,calc);
  }
  return calc;
}
Program: 51229
Project: 51229
Buggy source:
/** 
 * Returns the format string for this cell. This is computed by evaluating the format expression in the current context, and therefore different cells may have different format strings.
 * @post return != null
 */
public final String getFormatString(){
  final Exp formatExp=(Exp)getProperty(Property.FORMAT_EXP.name,null);
  if (formatExp == null) {
    return "String_Node_Str";
  }
  final Calc formatCalc=root.getCompiled(formatExp,true);
  final Object o=formatCalc.evaluate(this);
  if (o == null) {
    return "String_Node_Str";
  }
  return o.toString();
}

Fixed version (ground truth):
/** 
 * Returns the format string for this cell. This is computed by evaluating the format expression in the current context, and therefore different cells may have different format strings.
 * @post return != null
 */
public final String getFormatString(){
  final Exp formatExp=(Exp)getProperty(Property.FORMAT_EXP.name,null);
  if (formatExp == null) {
    return "String_Node_Str";
  }
  final Calc formatCalc=root.getCompiled(formatExp,true,null);
  final Object o=formatCalc.evaluate(this);
  if (o == null) {
    return "String_Node_Str";
  }
  return o.toString();
}
Program: 51230
Project: 51230
Buggy source:
public final Object evaluateCurrent(){
  final Member maxSolveMember=peekCalcMember();
  if (maxSolveMember == null) {
    final Object o=cellReader.get(this);
    if (o == Util.nullValue) {
      return null;
    }
    return o;
  }
  final RolapMember defaultMember=root.defaultMembers[maxSolveMember.getDimension().getOrdinal(root.cube)];
  final RolapEvaluator evaluator=push(defaultMember);
  evaluator.setExpanding(maxSolveMember);
  final Exp exp=maxSolveMember.getExpression();
  final Calc calc=root.getCompiled(exp,true);
  final Object o=calc.evaluate(evaluator);
  if (o == Util.nullValue) {
    return null;
  }
  return o;
}

Fixed version (ground truth):
public final Object evaluateCurrent(){
  final Member maxSolveMember=peekCalcMember();
  if (maxSolveMember == null) {
    final Object o=cellReader.get(this);
    if (o == Util.nullValue) {
      return null;
    }
    return o;
  }
  final RolapMember defaultMember=root.defaultMembers[maxSolveMember.getDimension().getOrdinal(root.cube)];
  final RolapEvaluator evaluator=push(defaultMember);
  evaluator.setExpanding(maxSolveMember);
  final Exp exp=maxSolveMember.getExpression();
  final Calc calc=root.getCompiled(exp,true,null);
  final Object o=calc.evaluate(evaluator);
  if (o == Util.nullValue) {
    return null;
  }
  return o;
}
Program: 51231
Project: 51231
Buggy source:
protected Object evaluateNamedSet(String name,Exp exp){
  Object value=namedSetValues.get(name);
  if (value == null) {
    final RolapEvaluator.RolapEvaluatorRoot root=slicerEvaluator.root;
    final Calc calc=root.getCompiled(exp,false);
    Object o=result.evaluateExp(calc,slicerEvaluator.push());
    List list;
    if (o instanceof List) {
      list=(List)o;
    }
 else {
      Iterable iter=(Iterable)o;
      list=new ArrayList();
      for (      Object e : iter) {
        list.add(e);
      }
    }
    value=Collections.unmodifiableList(list);
    namedSetValues.put(name,value);
  }
  return value;
}

Fixed version (ground truth):
protected Object evaluateNamedSet(String name,Exp exp){
  Object value=namedSetValues.get(name);
  if (value == null) {
    final RolapEvaluator.RolapEvaluatorRoot root=slicerEvaluator.root;
    final Calc calc=root.getCompiled(exp,false,ResultStyle.LIST);
    Object o=result.evaluateExp(calc,slicerEvaluator.push());
    List list;
    if (o instanceof List) {
      list=(List)o;
    }
 else {
      Iterable iter=(Iterable)o;
      list=new ArrayList();
      for (      Object e : iter) {
        list.add(e);
      }
    }
    value=Collections.unmodifiableList(list);
    namedSetValues.put(name,value);
  }
  return value;
}
Program: 51232
Project: 51232
Buggy source:
private void checkDependsOn(final Query query,final Exp expression,String expectedDimList,final boolean scalar){
  final Calc calc=query.compileExpression(expression,scalar);
  final Dimension[] dimensions=query.getCube().getDimensions();
  StringBuilder buf=new StringBuilder("String_Node_Str");
  int dependCount=0;
  for (  Dimension dimension : dimensions) {
    if (calc.dependsOn(dimension)) {
      if (dependCount++ > 0) {
        buf.append("String_Node_Str");
      }
      buf.append(dimension.getUniqueName());
    }
  }
  buf.append("String_Node_Str");
  String actualDimList=buf.toString();
  Assert.assertEquals(expectedDimList,actualDimList);
}

Fixed version (ground truth):
private void checkDependsOn(final Query query,final Exp expression,String expectedDimList,final boolean scalar){
  final Calc calc=query.compileExpression(expression,scalar,null);
  final Dimension[] dimensions=query.getCube().getDimensions();
  StringBuilder buf=new StringBuilder("String_Node_Str");
  int dependCount=0;
  for (  Dimension dimension : dimensions) {
    if (calc.dependsOn(dimension)) {
      if (dependCount++ > 0) {
        buf.append("String_Node_Str");
      }
      buf.append(dimension.getUniqueName());
    }
  }
  buf.append("String_Node_Str");
  String actualDimList=buf.toString();
  Assert.assertEquals(expectedDimList,actualDimList);
}
Program: 51233
Project: 51233
Buggy source:
/** 
 * Compiles a scalar expression in the context of the default cube.
 * @param expression The expression to evaluate
 * @param scalar Whether the expression is scalar
 * @return String form of the program
 */
public String compileExpression(String expression,final boolean scalar){
  String cubeName=getDefaultCubeName();
  if (cubeName.indexOf(' ') >= 0) {
    cubeName=Util.quoteMdxIdentifier(cubeName);
  }
  final String queryString;
  if (scalar) {
    queryString="String_Node_Str" + Util.singleQuoteString(expression) + "String_Node_Str"+ cubeName;
  }
 else {
    queryString="String_Node_Str" + expression + "String_Node_Str"+ cubeName;
  }
  Connection connection=getConnection();
  Query query=connection.parseQuery(queryString);
  final Exp exp;
  if (scalar) {
    exp=query.formulas[0].getExpression();
  }
 else {
    exp=query.axes[0].getSet();
  }
  final Calc calc=query.compileExpression(exp,scalar);
  final StringWriter sw=new StringWriter();
  final PrintWriter pw=new PrintWriter(sw);
  final CalcWriter calcWriter=new CalcWriter(pw);
  calc.accept(calcWriter);
  pw.flush();
  return sw.toString();
}

Fixed version (ground truth):
/** 
 * Compiles a scalar expression in the context of the default cube.
 * @param expression The expression to evaluate
 * @param scalar Whether the expression is scalar
 * @return String form of the program
 */
public String compileExpression(String expression,final boolean scalar){
  String cubeName=getDefaultCubeName();
  if (cubeName.indexOf(' ') >= 0) {
    cubeName=Util.quoteMdxIdentifier(cubeName);
  }
  final String queryString;
  if (scalar) {
    queryString="String_Node_Str" + Util.singleQuoteString(expression) + "String_Node_Str"+ cubeName;
  }
 else {
    queryString="String_Node_Str" + expression + "String_Node_Str"+ cubeName;
  }
  Connection connection=getConnection();
  Query query=connection.parseQuery(queryString);
  final Exp exp;
  if (scalar) {
    exp=query.formulas[0].getExpression();
  }
 else {
    exp=query.axes[0].getSet();
  }
  final Calc calc=query.compileExpression(exp,scalar,null);
  final StringWriter sw=new StringWriter();
  final PrintWriter pw=new PrintWriter(sw);
  final CalcWriter calcWriter=new CalcWriter(pw);
  calc.accept(calcWriter);
  pw.flush();
  return sw.toString();
}
Program: 51234
Project: 51234
Buggy source:
/** 
 * Reads "name=value;" or "name=value<EOF>".
 */
void parsePair(PropertyList list){
  String name=parseName();
  String value;
  if (i >= n) {
    value="String_Node_Str";
  }
 else   if (s.charAt(i) == ';') {
    i++;
    value="String_Node_Str";
  }
 else {
    value=parseValue();
  }
  list.put(name,value);
}

Fixed version (ground truth):
/** 
 * Reads "name=value;" or "name=value<EOF>".
 */
void parsePair(PropertyList list){
  String name=parseName();
  if (name == null) {
    return;
  }
  String value;
  if (i >= n) {
    value="String_Node_Str";
  }
 else   if (s.charAt(i) == ';') {
    i++;
    value="String_Node_Str";
  }
 else {
    value=parseValue();
  }
  list.put(name,value);
}
Program: 51235
Project: 51235
Buggy source:
/** 
 * Reads "name=". Name can contain equals sign if equals sign is doubled.
 */
String parseName(){
  nameBuf.setLength(0);
  while (true) {
    char c=s.charAt(i);
switch (c) {
case '=':
      i++;
    if (i < n && (c=s.charAt(i)) == '=') {
      i++;
      nameBuf.append(c);
      break;
    }
  String name=nameBuf.toString();
name=name.trim();
return name;
case ' ':
if (nameBuf.length() == 0) {
i++;
break;
}
 else {
}
default :
nameBuf.append(c);
i++;
if (i >= n) {
return nameBuf.toString().trim();
}
}
}
}

Fixed version (ground truth):
/** 
 * Reads "name=". Name can contain equals sign if equals sign is doubled. Returns null if there is no name to read.
 */
String parseName(){
  nameBuf.setLength(0);
  while (true) {
    char c=s.charAt(i);
switch (c) {
case '=':
      i++;
    if (i < n && (c=s.charAt(i)) == '=') {
      i++;
      nameBuf.append(c);
      break;
    }
  String name=nameBuf.toString();
name=name.trim();
return name;
case ' ':
if (nameBuf.length() == 0) {
i++;
if (i >= n) {
return null;
}
break;
}
 else {
}
default :
nameBuf.append(c);
i++;
if (i >= n) {
return nameBuf.toString().trim();
}
}
}
}
Program: 51236
Project: 51236
Buggy source:
public Object evaluate(Evaluator evaluator){
  for (int i=0; i < memberCalcs.length; i++) {
    MemberCalc memberCalc=memberCalcs[i];
    final Member member=memberCalc.evaluateMember(evaluator);
    if (member == null || member.isNull()) {
      for (int j=0; j < i; j++) {
        evaluator.setContext(savedMembers[j]);
      }
      return null;
    }
    savedMembers[i]=evaluator.setContext(member);
  }
  final Object o=evaluator.evaluateCurrent();
  evaluator.setContext(savedMembers);
  return o;
}

Fixed version (ground truth):
public Object evaluate(Evaluator evaluator){
  Member[] members=new Member[memberCalcs.length];
  for (int i=0; i < memberCalcs.length; i++) {
    MemberCalc memberCalc=memberCalcs[i];
    final Member member=memberCalc.evaluateMember(evaluator);
    if (member == null || member.isNull()) {
      for (int j=0; j < i; j++) {
        evaluator.setContext(savedMembers[j]);
      }
      return null;
    }
    savedMembers[i]=evaluator.setContext(member);
    members[i]=member;
  }
  final boolean needToReturnNull=evaluator.needToReturnNullForUnrelatedDimension(members);
  if (needToReturnNull) {
    evaluator.setContext(savedMembers);
    return null;
  }
  final Object result=evaluator.evaluateCurrent();
  evaluator.setContext(savedMembers);
  return result;
}
Program: 51237
Project: 51237
Buggy source:
public Object evaluate(Evaluator evaluator){
  final Member[] members=tupleCalc.evaluateTuple(evaluator);
  if (members == null) {
    return null;
  }
  final boolean needToReturnNull=handleUnrelatedDimension(evaluator,members);
  if (needToReturnNull) {
    return null;
  }
  Member[] savedMembers=new Member[members.length];
  for (int i=0; i < members.length; i++) {
    savedMembers[i]=evaluator.setContext(members[i]);
  }
  final Object o=evaluator.evaluateCurrent();
  evaluator.setContext(savedMembers);
  return o;
}

Fixed version (ground truth):
public Object evaluate(Evaluator evaluator){
  final Member[] members=tupleCalc.evaluateTuple(evaluator);
  if (members == null) {
    return null;
  }
  final boolean needToReturnNull=evaluator.needToReturnNullForUnrelatedDimension(members);
  if (needToReturnNull) {
    return null;
  }
  Member[] savedMembers=new Member[members.length];
  for (int i=0; i < members.length; i++) {
    savedMembers[i]=evaluator.setContext(members[i]);
  }
  Object result=evaluator.evaluateCurrent();
  evaluator.setContext(savedMembers);
  return result;
}
Program: 51238
Project: 51238
Buggy source:
/** 
 * Pushes unrelated dimensions to the top level member from the given list of tuples if the ignoreUnrelatedDimensions property is set on the base cube usage in the virtual cube. <p>If IgnoreMeasureForNonJoiningDimension is set to true and ignoreUnrelatedDimensions on CubeUsage is set to false then if a non joining dimension exists in the aggregation list then return an empty list else return the original list.
 * @param tuplesForAggregation is a list of members or tuples used incomputing the aggregate
 * @param evaluator
 * @return list of members or tuples
 */
private static List processUnrelatedDimensions(List tuplesForAggregation,Evaluator evaluator){
  RolapMember measure=(RolapMember)evaluator.getMembers()[0];
  if (measure.isCalculated()) {
    return tuplesForAggregation;
  }
  RolapCube virtualCube=(RolapCube)evaluator.getCube();
  RolapCube baseCube=((RolapStoredMeasure)measure).getCube();
  if (virtualCube.shouldIgnoreUnrelatedDimensions(baseCube.getName())) {
    return ignoreUnrelatedDimensions(tuplesForAggregation,baseCube);
  }
 else   if (MondrianProperties.instance().IgnoreMeasureForNonJoiningDimension.get()) {
    return ignoreMeasureForNonJoiningDimension(tuplesForAggregation,baseCube);
  }
  return tuplesForAggregation;
}

Fixed version (ground truth):
/** 
 * Pushes unrelated dimensions to the top level member from the given list of tuples if the ignoreUnrelatedDimensions property is set on the base cube usage in the virtual cube. <p>If IgnoreMeasureForNonJoiningDimension is set to true and ignoreUnrelatedDimensions on CubeUsage is set to false then if a non joining dimension exists in the aggregation list then return an empty list else return the original list.
 * @param tuplesForAggregation is a list of members or tuples used incomputing the aggregate
 * @param evaluator
 * @return list of members or tuples
 */
private static List processUnrelatedDimensions(List tuplesForAggregation,Evaluator evaluator){
  RolapMember measure=(RolapMember)evaluator.getMembers()[0];
  if (measure.isCalculated()) {
    return tuplesForAggregation;
  }
  RolapCube virtualCube=(RolapCube)evaluator.getCube();
  RolapCube baseCube=(RolapCube)evaluator.getMeasureCube();
  if (virtualCube.isVirtual() && baseCube != null) {
    if (virtualCube.shouldIgnoreUnrelatedDimensions(baseCube.getName())) {
      return ignoreUnrelatedDimensions(tuplesForAggregation,baseCube);
    }
 else     if (MondrianProperties.instance().IgnoreMeasureForNonJoiningDimension.get()) {
      return ignoreMeasureForNonJoiningDimension(tuplesForAggregation,baseCube);
    }
  }
  return tuplesForAggregation;
}
Program: 51239
Project: 51239
Buggy source:
/** 
 * Returns the base (non-virtual) cube that the current measure in the context belongs to.
 * @return Cube
 */
public Cube getMeasureCube(){
  return ((RolapStoredMeasure)currentMembers[0]).getCube();
}

Fixed version (ground truth):
/** 
 * Returns the base (non-virtual) cube that the current measure in the context belongs to.
 * @return Cube
 */
public RolapCube getMeasureCube(){
  RolapCube measureCube=null;
  if (currentMembers[0] instanceof RolapStoredMeasure) {
    measureCube=((RolapStoredMeasure)currentMembers[0]).getCube();
  }
  return measureCube;
}
Program: 51240
Project: 51240
Buggy source:
/** 
 * Returns whether another Batch can be batched to this Batch. <p>This is possible if: <li>columns list is super set of other batch's constraint columns; and <li>both have same Fact Table; and <li>matching columns of this and other batch has the same value; and <li>non matching columns of this batch have ALL VALUES </ul>
 */
boolean canBatch(Batch other){
  return hasOverlappingBitKeys(other) && (hasSameCompoundPredicate(other) || haveSameValuesForOverlappingColumnsOrHasAllChildrenForOthers(other)) && hasSameMeasureList(other)&& haveSameStarAndAggregation(other);
}

Fixed version (ground truth):
/** 
 * Returns whether another Batch can be batched to this Batch. <p>This is possible if: <li>columns list is super set of other batch's constraint columns; and <li>both have same Fact Table; and <li>matching columns of this and other batch has the same value; and <li>non matching columns of this batch have ALL VALUES </ul>
 */
boolean canBatch(Batch other){
  return hasOverlappingBitKeys(other) && constraintsMatch(other) && hasSameMeasureList(other)&& haveSameStarAndAggregation(other);
}
Program: 51241
Project: 51241
Buggy source:
protected static void copyFromLong(final BitSet bitSet,int pos,long x){
  while (x != 0) {
    copyFromByte(bitSet,pos,(byte)(x & 0xff));
    x>>=8;
    pos+=8;
  }
}

Fixed version (ground truth):
protected static void copyFromLong(final BitSet bitSet,int pos,long x){
  while (x != 0) {
    copyFromByte(bitSet,pos,(byte)(x & 0xff));
    x>>>=8;
    pos+=8;
  }
}
Program: 51242
Project: 51242
Buggy source:
public Member[] getLevelMembers(Level level,Evaluator context){
  TupleConstraint constraint=sqlConstraintFactory.getLevelMembersConstraint(context,new Level[]{level});
  final MemberReader memberReader=getMemberReader(level.getHierarchy());
  final List<RolapMember> membersInLevel=memberReader.getMembersInLevel((RolapLevel)level,0,Integer.MAX_VALUE,constraint);
  return RolapUtil.toArray(membersInLevel);
}

Fixed version (ground truth):
public Member[] getLevelMembers(Level level,Evaluator context){
  boolean[] satisfied={false};
  TupleConstraint constraint=sqlConstraintFactory.getLevelMembersConstraint(context,new Level[]{level},satisfied);
  final MemberReader memberReader=getMemberReader(level.getHierarchy());
  List<RolapMember> membersInLevel=memberReader.getMembersInLevel((RolapLevel)level,0,Integer.MAX_VALUE,constraint);
  if (!satisfied[0]) {
    final Evaluator evaluator=context.push();
    List<RolapMember> allMembersInLevel=membersInLevel;
    membersInLevel=new ArrayList<RolapMember>();
    for (    RolapMember member : allMembersInLevel) {
      evaluator.setContext(member);
      if (evaluator.evaluateCurrent() != null) {
        membersInLevel.add(member);
      }
    }
  }
  return RolapUtil.toArray(membersInLevel);
}
Program: 51243
Project: 51243
Buggy source:
public TupleConstraint getLevelMembersConstraint(Evaluator context,Level[] levels){
  if (!enabled || !SqlContextConstraint.isValidContext(context,false,levels)) {
    return DefaultTupleConstraint.instance();
  }
  return new SqlContextConstraint((RolapEvaluator)context,false);
}

Fixed version (ground truth):
/** 
 * Returns a constraint that restricts the members of a level to those that are non-empty in the given context. If the constraint cannot be implemented (say if native constraints are disabled) returns null.
 * @param context Context within which members must be non-empty
 * @param levels levels being referenced in the current context
 * @param satisfied Set to false if constraint does not satisfy non-emptycontext and caller still has to do it
 * @return Constraint
 */
public TupleConstraint getLevelMembersConstraint(Evaluator context,Level[] levels,boolean[] satisfied){
  if (context == null) {
    satisfied[0]=true;
    return DefaultTupleConstraint.instance();
  }
  if (!enabled) {
    satisfied[0]=false;
    return DefaultTupleConstraint.instance();
  }
  satisfied[0]=true;
  if (!SqlContextConstraint.isValidContext(context,false,levels)) {
    return DefaultTupleConstraint.instance();
  }
  return new SqlContextConstraint((RolapEvaluator)context,false);
}
Program: 51244
Project: 51244
Buggy source:
/** 
 * Returns a constraint that allows to read all children of multiple parents at once using a LevelMember query style. This does not work for parent/child hierarchies.
 */
public TupleConstraint getDescendantsConstraint(List<RolapMember> parentMembers,MemberChildrenConstraint mcc){
  return new DescendantsConstraint(parentMembers,mcc);
}

Fixed version (ground truth):
/** 
 * Returns a constraint that allows to read all children of multiple parents at once using a LevelMember query style. This does not work for parent/child hierarchies.
 * @param parentMembers List of parents (all must belong to same level)
 * @param mcc           The constraint that would return the children foreach single parent
 * @return constraint
 */
public TupleConstraint getDescendantsConstraint(List<RolapMember> parentMembers,MemberChildrenConstraint mcc){
  return new DescendantsConstraint(parentMembers,mcc);
}
Program: 51245
Project: 51245
Buggy source:
/** 
 * Returns whether to avoid a test because the memory monitor may cause it to fail. <p>Some tests fail if memory monitor is switched on, and Access and Derby tend to use a lot of memory because they are embedded.
 */
public static boolean avoidMemoryOverflow(SqlQuery.Dialect dialect){
  return dialect.isAccess() && MondrianProperties.instance().MemoryMonitor.get();
}

Fixed version (ground truth):
/** 
 * Returns whether to avoid a test because the memory monitor may cause it to fail. <p>Some tests fail if memory monitor is switched on, and Access and Derby tend to use a lot of memory because they are embedded.
 * @param dialect Dialect
 * @return Whether to avoid a test
 */
public static boolean avoidMemoryOverflow(SqlQuery.Dialect dialect){
  return dialect.isAccess() && MondrianProperties.instance().MemoryMonitor.get();
}
Program: 51246
Project: 51246
Buggy source:
public void testNonEmptyWithCognosCalcOneLiteral() throws Exception {
  if (!Bug.Bug1722959Fixed && !MondrianProperties.instance().EnableNativeNonEmpty.get()) {
    return;
  }
  final BooleanProperty property=MondrianProperties.instance().EnableNonEmptyOnAllAxis;
  boolean currentState=property.get();
  try {
    property.set(true);
    executeMDX();
  }
  finally {
    property.set(currentState);
  }
}

Fixed version (ground truth):
public void testNonEmptyWithCognosCalcOneLiteral() throws Exception {
  final BooleanProperty property=MondrianProperties.instance().EnableNonEmptyOnAllAxis;
  boolean currentState=property.get();
  try {
    property.set(true);
    executeMDX();
  }
  finally {
    property.set(currentState);
  }
}
Program: 51247
Project: 51247
Buggy source:
/** 
 * Compares this member to another   {@link RolapMember}. <p>The method first compares on keys; null keys always collate last. If the keys are equal, it compares using unique name. <p>This method does not consider   {@link #ordinal} field, becauseordinal is only unique within a parent. If you want to compare members which may be at any position in the hierarchy, use {@link mondrian.olap.fun.FunUtil#compareHierarchically}.
 * @return -1 if this is less, 0 if this is the same, 1 if this is greater
 */
public int compareTo(Object o){
  RolapMember other=(RolapMember)o;
  if (this.key != null && other.key == null) {
    return 1;
  }
  if (this.key == null && other.key != null) {
    return -1;
  }
  if (this.key == null && other.key == null) {
    return this.getUniqueName().compareTo(other.getUniqueName());
  }
  if (this.key == RolapUtil.sqlNullValue || other.key == RolapUtil.sqlNullValue) {
    return this.getUniqueName().compareTo(other.getUniqueName());
  }
  if (this.key.getClass().equals(other.key.getClass())) {
    if (this.key instanceof String) {
      return Util.compareName((String)this.key,(String)other.key);
    }
 else {
      return Util.compareKey(this.key,other.key);
    }
  }
  return this.getUniqueName().compareTo(other.getUniqueName());
}

Fixed version (ground truth):
/** 
 * Compares this member to another   {@link RolapMember}. <p>The method first compares on keys; null keys always collate last. If the keys are equal, it compares using unique name. <p>This method does not consider   {@link #ordinal} field, becauseordinal is only unique within a parent. If you want to compare members which may be at any position in the hierarchy, use {@link mondrian.olap.fun.FunUtil#compareHierarchically}.
 * @return -1 if this is less, 0 if this is the same, 1 if this is greater
 */
public int compareTo(Object o){
  RolapMember other=(RolapMember)o;
  if (this.key != null && other.key == null) {
    return 1;
  }
  if (this.key == null && other.key != null) {
    return -1;
  }
  if (this.key == null && other.key == null) {
    return this.getUniqueName().compareTo(other.getUniqueName());
  }
  if (this.key == RolapUtil.sqlNullValue || other.key == RolapUtil.sqlNullValue) {
    return this.getUniqueName().compareTo(other.getUniqueName());
  }
  if (this.key.getClass().equals(other.key.getClass())) {
    if (this.key instanceof String) {
      return Util.caseSensitiveCompareName((String)this.key,(String)other.key);
    }
 else {
      return Util.compareKey(this.key,other.key);
    }
  }
  return this.getUniqueName().compareTo(other.getUniqueName());
}
Program: 51248
Project: 51248
Buggy source:
public Object evaluate(Evaluator evaluator){
  final Member[] members=tupleCalc.evaluateTuple(evaluator);
  if (members == null) {
    return null;
  }
  Member[] savedMembers=new Member[members.length];
  for (int i=0; i < members.length; i++) {
    savedMembers[i]=evaluator.setContext(members[i]);
  }
  final Object o=evaluator.evaluateCurrent();
  evaluator.setContext(savedMembers);
  return o;
}

Fixed version (ground truth):
public Object evaluate(Evaluator evaluator){
  final Member[] members=tupleCalc.evaluateTuple(evaluator);
  if (members == null) {
    return null;
  }
  final boolean needToReturnNull=handleUnrelatedDimension(evaluator,members);
  if (needToReturnNull) {
    return null;
  }
  Member[] savedMembers=new Member[members.length];
  for (int i=0; i < members.length; i++) {
    savedMembers[i]=evaluator.setContext(members[i]);
  }
  final Object o=evaluator.evaluateCurrent();
  evaluator.setContext(savedMembers);
  return o;
}
Program: 51249
Project: 51249
Buggy source:
private static Set nonJoiningDimensions(RolapCube baseCube,List tuplesForAggregation){
  Set nonJoiningDimensions=new HashSet();
  Dimension[] baseCubeDimensions=baseCube.getDimensions();
  Member[] tuple=tupleAsArray(tuplesForAggregation.get(0));
  for (  Member member : tuple) {
    nonJoiningDimensions.add(member.getHierarchy().getDimension().getUniqueName());
  }
  for (  Dimension dimension : baseCubeDimensions) {
    nonJoiningDimensions.remove(dimension.getUniqueName());
    if (nonJoiningDimensions.size() == 0) {
      break;
    }
  }
  return nonJoiningDimensions;
}

Fixed version (ground truth):
private static Set<Dimension> nonJoiningDimensions(RolapCube baseCube,List tuplesForAggregation){
  Member[] tuple=tupleAsArray(tuplesForAggregation.get(0));
  return baseCube.nonJoiningDimensions(tuple);
}