nus-yam/ex-repair huggingface dataset:
Program: 51176
Project: 51176
Buggy source:
public Calc compileCall(ResolvedFunCall call,ExpCompiler compiler){
  final ListCalc listCalc=compiler.compileList(call.getArg(0),true);
  final Calc expCalc=compiler.compileScalar(call.getArg(1),true);
  final Flag order=getLiteralArg(call,2,Flag.ASC,Flag.class);
  if (expCalc instanceof MemberValueCalc) {
    MemberValueCalc memberValueCalc=(MemberValueCalc)expCalc;
    List<Calc> constantList=new ArrayList<Calc>();
    List<Calc> variableList=new ArrayList<Calc>();
    final MemberCalc[] calcs=(MemberCalc[])memberValueCalc.getCalcs();
    for (    MemberCalc memberCalc : calcs) {
      if (memberCalc instanceof ConstantCalc && !listCalc.dependsOn(memberCalc.getType().getHierarchy().getDimension())) {
        constantList.add(memberCalc);
      }
 else {
        variableList.add(memberCalc);
      }
    }
    if (constantList.isEmpty()) {
    }
 else     if (variableList.isEmpty()) {
      return new ContextCalc(calcs,new CalcImpl(call,listCalc,new ValueCalc(new DummyExp(expCalc.getType())),order.descending,order.brk));
    }
 else {
      return new ContextCalc(constantList.toArray(new MemberCalc[constantList.size()]),new CalcImpl(call,listCalc,new MemberValueCalc(new DummyExp(expCalc.getType()),variableList.toArray(new MemberCalc[variableList.size()])),order.descending,order.brk));
    }
  }
  return new CalcImpl(call,listCalc,expCalc,order.descending,order.brk);
}

Fixed version (ground truth):
public Calc compileCall(ResolvedFunCall call,ExpCompiler compiler){
  final ListCalc listCalc=compiler.compileList(call.getArg(0),true);
  final Calc expCalc=compiler.compileScalar(call.getArg(1),true);
  final Flag order=getLiteralArg(call,2,Flag.ASC,Flag.class);
  if (expCalc instanceof MemberValueCalc) {
    MemberValueCalc memberValueCalc=(MemberValueCalc)expCalc;
    List<Calc> constantList=new ArrayList<Calc>();
    List<Calc> variableList=new ArrayList<Calc>();
    final MemberCalc[] calcs=(MemberCalc[])memberValueCalc.getCalcs();
    for (    MemberCalc memberCalc : calcs) {
      if (memberCalc instanceof ConstantCalc && !listCalc.dependsOn(memberCalc.getType().getDimension())) {
        constantList.add(memberCalc);
      }
 else {
        variableList.add(memberCalc);
      }
    }
    if (constantList.isEmpty()) {
    }
 else     if (variableList.isEmpty()) {
      return new ContextCalc(calcs,new CalcImpl(call,listCalc,new ValueCalc(new DummyExp(expCalc.getType())),order.descending,order.brk));
    }
 else {
      return new ContextCalc(constantList.toArray(new MemberCalc[constantList.size()]),new CalcImpl(call,listCalc,new MemberValueCalc(new DummyExp(expCalc.getType()),variableList.toArray(new MemberCalc[variableList.size()])),order.descending,order.brk));
    }
  }
  return new CalcImpl(call,listCalc,expCalc,order.descending,order.brk);
}
Program: 51177
Project: 51177
Buggy source:
public Calc compileCall(ResolvedFunCall call,ExpCompiler compiler){
  Exp[] args=call.getArgs();
  final MemberCalc memberCalc;
switch (args.length) {
case 3:
    memberCalc=compiler.compileMember(args[2]);
  break;
case 1:
final Dimension dimension=args[0].getType().getHierarchy().getDimension();
memberCalc=new DimensionCurrentMemberCalc(dimension);
break;
default :
final Dimension timeDimension=compiler.getEvaluator().getCube().getTimeDimension();
if (timeDimension == null) {
throw MondrianResource.instance().NoTimeDimensionInCube.ex(getName());
}
memberCalc=new DimensionCurrentMemberCalc(timeDimension);
break;
}
final IntegerCalc lagValueCalc=(args.length >= 2) ? compiler.compileInteger(args[1]) : ConstantCalc.constantInteger(1);
final LevelCalc ancestorLevelCalc=args.length >= 1 ? compiler.compileLevel(args[0]) : null;
return new AbstractMemberCalc(call,new Calc[]{memberCalc,lagValueCalc,ancestorLevelCalc}){
public Member evaluateMember(Evaluator evaluator){
Member member=memberCalc.evaluateMember(evaluator);
int lagValue=lagValueCalc.evaluateInteger(evaluator);
Level ancestorLevel;
if (ancestorLevelCalc != null) {
ancestorLevel=ancestorLevelCalc.evaluateLevel(evaluator);
}
 else {
Member parent=member.getParentMember();
if (parent == null) {
return member.getHierarchy().getNullMember();
}
ancestorLevel=parent.getLevel();
}
return parallelPeriod(member,ancestorLevel,evaluator,lagValue);
}
}
;
}

Fixed version (ground truth):
public Calc compileCall(ResolvedFunCall call,ExpCompiler compiler){
  Exp[] args=call.getArgs();
  final MemberCalc memberCalc;
switch (args.length) {
case 3:
    memberCalc=compiler.compileMember(args[2]);
  break;
case 1:
final Dimension dimension=args[0].getType().getDimension();
memberCalc=new DimensionCurrentMemberCalc(dimension);
break;
default :
final Dimension timeDimension=compiler.getEvaluator().getCube().getTimeDimension();
if (timeDimension == null) {
throw MondrianResource.instance().NoTimeDimensionInCube.ex(getName());
}
memberCalc=new DimensionCurrentMemberCalc(timeDimension);
break;
}
final IntegerCalc lagValueCalc=(args.length >= 2) ? compiler.compileInteger(args[1]) : ConstantCalc.constantInteger(1);
final LevelCalc ancestorLevelCalc=args.length >= 1 ? compiler.compileLevel(args[0]) : null;
return new AbstractMemberCalc(call,new Calc[]{memberCalc,lagValueCalc,ancestorLevelCalc}){
public Member evaluateMember(Evaluator evaluator){
Member member=memberCalc.evaluateMember(evaluator);
int lagValue=lagValueCalc.evaluateInteger(evaluator);
Level ancestorLevel;
if (ancestorLevelCalc != null) {
ancestorLevel=ancestorLevelCalc.evaluateLevel(evaluator);
}
 else {
Member parent=member.getParentMember();
if (parent == null) {
return member.getHierarchy().getNullMember();
}
ancestorLevel=parent.getLevel();
}
return parallelPeriod(member,ancestorLevel,evaluator,lagValue);
}
}
;
}
Program: 51178
Project: 51178
Buggy source:
public void testParallelPeriod(){
  assertAxisReturns("String_Node_Str","String_Node_Str");
  assertAxisReturns("String_Node_Str","String_Node_Str");
  assertAxisReturns("String_Node_Str","String_Node_Str");
  assertAxisReturns("String_Node_Str","String_Node_Str");
  assertAxisReturns("String_Node_Str","String_Node_Str");
  assertAxisReturns("String_Node_Str","String_Node_Str");
  if (isDefaultNullMemberRepresentation()) {
    assertQueryReturns("String_Node_Str" + "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"));
  }
  assertQueryReturns("String_Node_Str" + "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"));
  assertQueryReturns("String_Node_Str" + "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"));
  if (isDefaultNullMemberRepresentation()) {
    assertQueryReturns("String_Node_Str" + "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"));
  }
}

Fixed version (ground truth):
public void testParallelPeriod(){
  getTestContext().assertSetExprDependsOn("String_Node_Str","String_Node_Str");
  assertAxisReturns("String_Node_Str","String_Node_Str");
  assertAxisReturns("String_Node_Str","String_Node_Str");
  assertAxisReturns("String_Node_Str","String_Node_Str");
  assertAxisReturns("String_Node_Str","String_Node_Str");
  assertAxisReturns("String_Node_Str","String_Node_Str");
  assertAxisReturns("String_Node_Str","String_Node_Str");
  if (isDefaultNullMemberRepresentation()) {
    assertQueryReturns("String_Node_Str" + "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"));
  }
  assertQueryReturns("String_Node_Str" + "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"));
  assertQueryReturns("String_Node_Str" + "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"));
  if (isDefaultNullMemberRepresentation()) {
    assertQueryReturns("String_Node_Str" + "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"));
  }
}
Program: 51179
Project: 51179
Buggy source:
public MondrianOlap4jMdxValidator(OlapConnection connection){
  this.connection=connection;
}

Fixed version (ground truth):
public MondrianOlap4jMdxValidator(OlapConnection connection){
  this.connection=(MondrianOlap4jConnection)connection;
}
Program: 51180
Project: 51180
Buggy source:
public SelectNode validateSelect(SelectNode selectNode) throws OlapException {
  StringWriter sw=new StringWriter();
  selectNode.unparse(new ParseTreeWriter(new PrintWriter(sw)));
  String mdx=sw.toString();
  final MondrianOlap4jConnection olap4jConnection=(MondrianOlap4jConnection)connection;
  Query query=olap4jConnection.connection.parseQuery(mdx);
  query.resolve();
  return olap4jConnection.toOlap4j(query);
}

Fixed version (ground truth):
public SelectNode validateSelect(SelectNode selectNode) throws OlapException {
  try {
    StringWriter sw=new StringWriter();
    selectNode.unparse(new ParseTreeWriter(new PrintWriter(sw)));
    String mdx=sw.toString();
    Query query=connection.connection.parseQuery(mdx);
    query.resolve();
    return connection.toOlap4j(query);
  }
 catch (  MondrianException e) {
    throw connection.helper.createException("String_Node_Str",e);
  }
}
Program: 51181
Project: 51181
Buggy source:
/** 
 * Executes query test trying to [Promotions].[Promotion Name] elements into an axis from the results.
 */
private void execHighCardTest(final String queryString,final int axisIndex,final String highDimensionName,final String results,final String results2,final boolean shouldForget) throws Exception {
}

Fixed version (ground truth):
/** 
 * Executes query test trying to [Promotions].[Promotion Name] elements into an axis from the results.
 */
private void execHighCardTest(final String queryString,final int axisIndex,final String highDimensionName,final String results,final String results2,final boolean shouldForget) throws Exception {
  final int old=MondrianProperties.instance().ResultLimit.get();
  try {
    MondrianProperties.instance().ResultLimit.set(40);
    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"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    final Connection connection=testContext.getConnection();
    final Query query=connection.parseQuery(queryString);
    query.setResultStyle(ResultStyle.ITERABLE);
    Result result=connection.execute(query);
    StringBuffer buffer=new StringBuffer();
    StringBuffer buffer2=new StringBuffer();
    final List<SoftReference> softReferences=new ArrayList<SoftReference>();
    int ii=0;
    for (    final Position o : result.getAxes()[axisIndex].getPositions()) {
      assertNotNull(o.get(0));
      buffer2.append(result.getCell(new int[]{0,ii}).getValue().toString());
      ii++;
      softReferences.add(new SoftReference(o.get(0)));
      buffer.append(o.get(0).toString());
    }
    assertEquals(buffer.toString().length(),results.length());
    if (results2 != null) {
      assertEquals(buffer2.toString().length(),results2.length());
    }
    buffer2=null;
    buffer=null;
    if (!shouldForget) {
      return;
    }
    final List overloader=new ArrayList();
    try {
      for (; ; ) {
        overloader.add(new long[99999999]);
      }
    }
 catch (    OutOfMemoryError out) {
    }
    System.gc();
    for (int i=4; i < ii - 40; i++) {
      assertNull(softReferences.get(i).get());
    }
    for (int i=4; i < ii - 40; i++) {
      try {
        result.getAxes()[axisIndex].getPositions().get(i).get(0);
        Assert.fail("String_Node_Str" + "String_Node_Str");
      }
 catch (      RuntimeException nsee) {
      }
    }
  }
  finally {
    MondrianProperties.instance().ResultLimit.set(old);
  }
}
Program: 51182
Project: 51182
Buggy source:
private void register(){
  if (isVirtual()) {
    return;
  }
  List<Member> list=new ArrayList<Member>();
  List<Member> measures=getMeasures();
  for (  Member measure : measures) {
    if (measure instanceof RolapBaseCubeMeasure) {
      list.add(measure);
    }
  }
  RolapBaseCubeMeasure[] storedMeasures=list.toArray(new RolapBaseCubeMeasure[list.size()]);
  RolapStar star=getStar();
  RolapStar.Table table=star.getFactTable();
  for (  RolapBaseCubeMeasure storedMeasure : storedMeasures) {
    table.makeMeasure(storedMeasure);
  }
}

Fixed version (ground truth):
private void register(){
  if (isVirtual()) {
    return;
  }
  List<RolapBaseCubeMeasure> storedMeasures=new ArrayList<RolapBaseCubeMeasure>();
  for (  Member measure : getMeasures()) {
    if (measure instanceof RolapBaseCubeMeasure) {
      storedMeasures.add((RolapBaseCubeMeasure)measure);
    }
  }
  RolapStar star=getStar();
  RolapStar.Table table=star.getFactTable();
  for (  RolapBaseCubeMeasure storedMeasure : storedMeasures) {
    table.makeMeasure(storedMeasure);
  }
}
Program: 51184
Project: 51184
Buggy source:
public LimitedRollupSubstitutingMemberReader(Role role,Role.HierarchyAccess hierarchyAccess,Exp exp){
  super(new RestrictedMemberReader(RolapHierarchy.this.getMemberReader(),role));
  this.hierarchyAccess=hierarchyAccess;
  this.exp=exp;
}

Fixed version (ground truth):
/** 
 * Creates a LimitedRollupSubstitutingMemberReader.
 * @param memberReader Underlying member reader
 * @param role Role to enforce
 * @param hierarchyAccess Access this role has to the hierarchy
 * @param exp Expression for hidden member
 */
public LimitedRollupSubstitutingMemberReader(MemberReader memberReader,Role role,Role.HierarchyAccess hierarchyAccess,Exp exp){
  super(new RestrictedMemberReader(memberReader,role));
  this.hierarchyAccess=hierarchyAccess;
  this.exp=exp;
}
Program: 51185
Project: 51185
Buggy source:
MemberReader getMemberReader(){
  return this.memberReader;
}

Fixed version (ground truth):
MemberReader getMemberReader(){
  return memberReader;
}
Program: 51186
Project: 51186
Buggy source:
public Type getResultType(Validator validator,Exp[] args){
  if (args.length == 0) {
    Dimension defaultTimeDimension=validator.getQuery().getCube().getTimeDimension();
    if (defaultTimeDimension == null) {
      throw MondrianResource.instance().NoTimeDimensionInCube.ex(getName());
    }
    Hierarchy hierarchy=defaultTimeDimension.getHierarchy();
    return new SetType(MemberType.forHierarchy(hierarchy));
  }
  final Type type=args[0].getType();
  if (type.getDimension() == null || type.getDimension().getDimensionType() != mondrian.olap.DimensionType.TimeDimension) {
    throw MondrianResource.instance().TimeArgNeeded.ex(getName());
  }
  return super.getResultType(validator,args);
}

Fixed version (ground truth):
public Type getResultType(Validator validator,Exp[] args){
  if (args.length == 0) {
    Dimension defaultTimeDimension=validator.getQuery().getCube().getTimeDimension();
    if (defaultTimeDimension == null) {
      throw MondrianResource.instance().NoTimeDimensionInCube.ex(getName());
    }
    Hierarchy hierarchy=defaultTimeDimension.getHierarchy();
    return new SetType(MemberType.forHierarchy(hierarchy));
  }
  return super.getResultType(validator,args);
}
Program: 51188
Project: 51188
Buggy source:
public Type getResultType(Validator validator,Exp[] args){
  if (args.length == 0) {
    Dimension defaultTimeDimension=validator.getQuery().getCube().getTimeDimension();
    if (defaultTimeDimension == null) {
      throw MondrianResource.instance().NoTimeDimensionInCube.ex(getName());
    }
    Hierarchy hierarchy=defaultTimeDimension.getHierarchy();
    return new SetType(MemberType.forHierarchy(hierarchy));
  }
  final Type type=args[0].getType();
  if (type.getHierarchy().getDimension().getDimensionType() != DimensionType.TimeDimension) {
    throw MondrianResource.instance().TimeArgNeeded.ex(getName());
  }
  return super.getResultType(validator,args);
}

Fixed version (ground truth):
public Type getResultType(Validator validator,Exp[] args){
  if (args.length == 0) {
    Dimension defaultTimeDimension=validator.getQuery().getCube().getTimeDimension();
    if (defaultTimeDimension == null) {
      throw MondrianResource.instance().NoTimeDimensionInCube.ex(getName());
    }
    Hierarchy hierarchy=defaultTimeDimension.getHierarchy();
    return new SetType(MemberType.forHierarchy(hierarchy));
  }
  final Type type=args[0].getType();
  if (type.getDimension().getDimensionType() != DimensionType.TimeDimension) {
    throw MondrianResource.instance().TimeArgNeeded.ex(getName());
  }
  return super.getResultType(validator,args);
}
Program: 51191
Project: 51191
Buggy source:
public String toString(){
  StringBuilder sb=new StringBuilder(64);
  for (int i=0, n=list.size(); i < n; i++) {
    Pair<String,String> pair=list.get(i);
    if (i > 0) {
      sb.append("String_Node_Str");
    }
    sb.append(pair.left);
    sb.append('=');
    final String right=pair.right;
    if (right == null) {
      sb.append("String_Node_Str");
    }
 else {
      if (right.indexOf(';') >= 0 && right.charAt(0) != '\'') {
        sb.append("String_Node_Str");
      }
      sb.append(right);
      if (right.indexOf(';') >= 0 && right.charAt(right.length() - 1) != '\'') {
        sb.append("String_Node_Str");
      }
    }
  }
  return sb.toString();
}

Fixed version (ground truth):
public String toString(){
  StringBuilder sb=new StringBuilder(64);
  for (int i=0, n=list.size(); i < n; i++) {
    Pair<String,String> pair=list.get(i);
    if (i > 0) {
      sb.append("String_Node_Str");
    }
    sb.append(pair.left);
    sb.append('=');
    final String right=pair.right;
    if (right == null) {
      sb.append("String_Node_Str");
    }
 else {
      final int needsQuote=right.indexOf(';');
      if (needsQuote >= 0) {
        if (right.charAt(0) != '\'') {
          sb.append("String_Node_Str");
        }
        sb.append(replace(right,"String_Node_Str","String_Node_Str"));
        if (right.charAt(right.length() - 1) != '\'') {
          sb.append("String_Node_Str");
        }
      }
 else {
        sb.append(right);
      }
    }
  }
  return sb.toString();
}
Program: 51193
Project: 51193
Buggy source:
public void testParseConnectStringComplex(){
  Util.PropertyList properties=Util.parseConnectString("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"+ "String_Node_Str"+ "String_Node_Str");
  assertEquals(11,properties.list.size());
  String value;
  value=properties.get("String_Node_Str");
  assertEquals("String_Node_Str",value);
  value=properties.get("String_Node_Str");
  assertEquals("String_Node_Str",value);
  value=properties.get("String_Node_Str");
  assertEquals("String_Node_Str",value);
  value=properties.get("String_Node_Str");
  assertEquals("String_Node_Str",value);
  value=properties.get("String_Node_Str");
  assertEquals(value,"String_Node_Str");
  value=properties.get("String_Node_Str");
  assertEquals("String_Node_Str",value);
  value=properties.get("String_Node_Str");
  assertEquals("String_Node_Str",value);
  value=properties.get("String_Node_Str");
  assertEquals("String_Node_Str",value);
  value=properties.get("String_Node_Str");
  assertEquals("String_Node_Str",value);
  value=properties.get("String_Node_Str");
  assertEquals(value,"String_Node_Str");
  value=properties.get("String_Node_Str");
  assertEquals(value,"String_Node_Str");
}

Fixed version (ground truth):
public void testParseConnectStringComplex(){
  Util.PropertyList properties=Util.parseConnectString("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"+ "String_Node_Str"+ "String_Node_Str");
  assertEquals(11,properties.list.size());
  String value;
  value=properties.get("String_Node_Str");
  assertEquals("String_Node_Str",value);
  value=properties.get("String_Node_Str");
  assertEquals("String_Node_Str",value);
  value=properties.get("String_Node_Str");
  assertEquals("String_Node_Str",value);
  value=properties.get("String_Node_Str");
  assertEquals("String_Node_Str",value);
  value=properties.get("String_Node_Str");
  assertEquals(value,"String_Node_Str");
  value=properties.get("String_Node_Str");
  assertEquals("String_Node_Str",value);
  value=properties.get("String_Node_Str");
  assertEquals("String_Node_Str",value);
  value=properties.get("String_Node_Str");
  assertEquals("String_Node_Str",value);
  value=properties.get("String_Node_Str");
  assertEquals("String_Node_Str",value);
  value=properties.get("String_Node_Str");
  assertEquals(value,"String_Node_Str");
  value=properties.get("String_Node_Str");
  assertEquals(value,"String_Node_Str");
  assertEquals("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"+ "String_Node_Str"+ "String_Node_Str",properties.toString());
}
Program: 51194
Project: 51194
Buggy source:
/** 
 * Generates the SQL string corresponding to the levels referenced.
 * @param dataSource jdbc connection that they query will execute against
 * @param baseCube this is the cube object for regular cubes, and theunderlying base cube for virtual cubes
 * @param whichSelect Position of this select statement in a union
 * @return SQL statement string
 */
private String generateSelectForLevels(DataSource dataSource,RolapCube baseCube,WhichSelect whichSelect){
  String s="String_Node_Str" + targets;
  SqlQuery sqlQuery=SqlQuery.newQuery(dataSource,s);
  for (  Target target : targets) {
    if (target.srcMembers == null) {
      addLevelMemberSql(sqlQuery,target.getLevel(),baseCube,whichSelect);
    }
  }
  constraint.addConstraint(sqlQuery,baseCube);
  return sqlQuery.toString();
}

Fixed version (ground truth):
/** 
 * Generates the SQL string corresponding to the levels referenced.
 * @param dataSource jdbc connection that they query will execute against
 * @param baseCube this is the cube object for regular cubes, and theunderlying base cube for virtual cubes
 * @param whichSelect Position of this select statement in a union
 * @return SQL statement string
 */
private String generateSelectForLevels(DataSource dataSource,RolapCube baseCube,WhichSelect whichSelect){
  String s="String_Node_Str" + targets;
  SqlQuery sqlQuery=SqlQuery.newQuery(dataSource,s);
  for (  Target target : targets) {
    if (target.srcMembers == null) {
      addLevelMemberSql(sqlQuery,target.getLevel(),baseCube,whichSelect);
    }
  }
  if (baseCube == null || constraint.getEvaluator().getMeasureCube().equals(baseCube)) {
    constraint.addConstraint(sqlQuery,baseCube);
  }
  return sqlQuery.toString();
}
Program: 51196
Project: 51196
Buggy source:
/** 
 * Closes all resources (statement, result set) held by this SqlStatement. <p>If any of them fails, wraps them in a  {@link RuntimeException} describing the high-level operation whichthis statement was performing. No further error-handling is required to produce a descriptive stack trace, unless you want to absorb the error.
 */
public void close(){
  if (haveSemaphore) {
    haveSemaphore=false;
    querySemaphore.leave();
  }
  if (resultSet != null) {
    try {
      resultSet.close();
    }
 catch (    SQLException e) {
      throw Util.newError(message + "String_Node_Str" + sql+ "String_Node_Str");
    }
 finally {
      resultSet=null;
    }
  }
  if (jdbcConnection != null) {
    try {
      jdbcConnection.close();
    }
 catch (    SQLException e) {
      throw Util.newError(message + "String_Node_Str" + sql+ "String_Node_Str");
    }
 finally {
      jdbcConnection=null;
    }
  }
  long time=System.currentTimeMillis();
  long totalMs=time - startTime;
  String status="String_Node_Str" + totalMs + "String_Node_Str"+ rowCount+ "String_Node_Str";
  RolapUtil.SQL_LOGGER.debug(status);
  if (RolapUtil.LOGGER.isDebugEnabled()) {
    RolapUtil.LOGGER.debug(component + "String_Node_Str" + sql+ "String_Node_Str"+ status);
  }
}

Fixed version (ground truth):
/** 
 * Closes all resources (statement, result set) held by this SqlStatement. <p>If any of them fails, wraps them in a  {@link RuntimeException} describing the high-level operation whichthis statement was performing. No further error-handling is required to produce a descriptive stack trace, unless you want to absorb the error.
 */
public void close(){
  if (haveSemaphore) {
    haveSemaphore=false;
    querySemaphore.leave();
  }
  if (resultSet != null) {
    try {
      resultSet.close();
    }
 catch (    SQLException e) {
      throw Util.newError(message + "String_Node_Str" + sql+ "String_Node_Str");
    }
 finally {
      resultSet=null;
    }
  }
  if (jdbcConnection != null) {
    try {
      jdbcConnection.close();
    }
 catch (    SQLException e) {
      throw Util.newError(message + "String_Node_Str" + sql+ "String_Node_Str");
    }
 finally {
      jdbcConnection=null;
    }
  }
  long time=System.currentTimeMillis();
  long totalMs=time - startTime;
  String status="String_Node_Str" + totalMs + "String_Node_Str"+ rowCount+ "String_Node_Str";
  RolapUtil.SQL_LOGGER.debug(executeCount + "String_Node_Str" + status);
  if (RolapUtil.LOGGER.isDebugEnabled()) {
    RolapUtil.LOGGER.debug(component + "String_Node_Str" + sql+ "String_Node_Str"+ status);
  }
}
Program: 51197
Project: 51197
Buggy source:
/** 
 * Calls various   {@link SchemaReader} methods on the members returned ina result set.
 * @param testContext Test context
 * @param mdx MDX query
 */
private void checkQuery(TestContext testContext,String mdx){
  Result result=testContext.executeQuery(mdx);
  final SchemaReader schemaReader=testContext.getConnection().getSchemaReader();
  for (  Axis axis : result.getAxes()) {
    for (    Position position : axis.getPositions()) {
      for (      Member member : position) {
        final Member accessControlledParent=schemaReader.getMemberParent(member);
        if (member.getParentMember() == null) {
          assertNull(accessControlledParent);
        }
        final Member[] accessControlledChildren=schemaReader.getMemberChildren(member);
        assertNotNull(accessControlledChildren);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Calls various   {@link SchemaReader} methods on the members returned ina result set.
 * @param testContext Test context
 * @param mdx MDX query
 */
private void checkQuery(TestContext testContext,String mdx){
  Result result=testContext.executeQuery(mdx);
  final SchemaReader schemaReader=testContext.getConnection().getSchemaReader();
  for (  Axis axis : result.getAxes()) {
    for (    Position position : axis.getPositions()) {
      for (      Member member : position) {
        final Member accessControlledParent=schemaReader.getMemberParent(member);
        if (member.getParentMember() == null) {
          assertNull(accessControlledParent);
        }
        final List<Member> accessControlledChildren=schemaReader.getMemberChildren(member);
        assertNotNull(accessControlledChildren);
      }
    }
  }
}
Program: 51198
Project: 51198
Buggy source:
public HighCardSqlTupleReader(final TupleConstraint constraint){
  this.constraint=constraint;
}

Fixed version (ground truth):
public HighCardSqlTupleReader(final TupleConstraint constraint){
  super(constraint);
}
Program: 51199
Project: 51199
Buggy source:
protected List executeList(){
  HighCardSqlTupleReader tr=new HighCardSqlTupleReader(constraint);
  tr.setMaxRows(maxRows);
  for (  CrossJoinArg arg : args) {
    addLevel(tr,arg);
  }
  Object key=tr.getCacheKey();
  List<List<RolapMember>> result=cache.get(key);
  boolean hasEnumTargets=(tr.getEnumTargetCount() > 0);
  if (result != null && !hasEnumTargets) {
    if (listener != null) {
      TupleEvent e=new TupleEvent(this,tr);
      listener.foundInCache(e);
    }
    return copy(result);
  }
  if (result == null && listener != null) {
    TupleEvent e=new TupleEvent(this,tr);
    listener.excutingSql(e);
  }
  List<List<RolapMember>> partialResult=result;
  result=null;
  List<List<RolapMember>> newPartialResult=null;
  if (hasEnumTargets && partialResult == null) {
    newPartialResult=new ArrayList<List<RolapMember>>();
  }
  DataSource dataSource=schemaReader.getDataSource();
  if (args.length == 1) {
    result=(List)tr.readMembers(dataSource,partialResult,newPartialResult);
  }
 else {
    result=(List)tr.readTuples(dataSource,partialResult,newPartialResult);
  }
  if (hasEnumTargets) {
    if (newPartialResult != null) {
      cache.put(key,newPartialResult);
    }
  }
 else {
    cache.put(key,result);
  }
  return copy(result);
}

Fixed version (ground truth):
protected List executeList(final SqlTupleReader tr){
  tr.setMaxRows(maxRows);
  for (  CrossJoinArg arg : args) {
    addLevel(tr,arg);
  }
  Object key=tr.getCacheKey();
  List<List<RolapMember>> result=cache.get(key);
  boolean hasEnumTargets=(tr.getEnumTargetCount() > 0);
  if (result != null && !hasEnumTargets) {
    if (listener != null) {
      TupleEvent e=new TupleEvent(this,tr);
      listener.foundInCache(e);
    }
    return copy(result);
  }
  if (result == null && listener != null) {
    TupleEvent e=new TupleEvent(this,tr);
    listener.excutingSql(e);
  }
  List<List<RolapMember>> partialResult=result;
  result=null;
  List<List<RolapMember>> newPartialResult=null;
  if (hasEnumTargets && partialResult == null) {
    newPartialResult=new ArrayList<List<RolapMember>>();
  }
  DataSource dataSource=schemaReader.getDataSource();
  if (args.length == 1) {
    result=(List)tr.readMembers(dataSource,partialResult,newPartialResult);
  }
 else {
    result=(List)tr.readTuples(dataSource,partialResult,newPartialResult);
  }
  if (hasEnumTargets) {
    if (newPartialResult != null) {
      cache.put(key,newPartialResult);
    }
  }
 else {
    cache.put(key,result);
  }
  return copy(result);
}
Program: 51200
Project: 51200
Buggy source:
public Object execute(ResultStyle desiredResultStyle){
switch (desiredResultStyle) {
case ITERABLE:
    return executeIterable();
case MUTABLE_LIST:
case LIST:
  return executeList();
}
throw ResultStyleException.generate(ResultStyle.ITERABLE_MUTABLELIST_LIST,Collections.singletonList(desiredResultStyle));
}

Fixed version (ground truth):
public Object execute(ResultStyle desiredResultStyle){
switch (desiredResultStyle) {
case ITERABLE:
    return executeList(new HighCardSqlTupleReader(constraint));
case MUTABLE_LIST:
case LIST:
  return executeList(new SqlTupleReader(constraint));
}
throw ResultStyleException.generate(ResultStyle.ITERABLE_MUTABLELIST_LIST,Collections.singletonList(desiredResultStyle));
}
Program: 51201
Project: 51201
Buggy source:
String makeLevelMembersSql(DataSource dataSource){
  RolapCube cube=null;
  boolean virtualCube=false;
  if (constraint instanceof SqlContextConstraint) {
    SqlContextConstraint sqlConstraint=(SqlContextConstraint)constraint;
    if (sqlConstraint.isJoinRequired()) {
      Query query=constraint.getEvaluator().getQuery();
      cube=(RolapCube)query.getCube();
      virtualCube=cube.isVirtual();
    }
  }
  if (virtualCube) {
    String selectString="String_Node_Str";
    Query query=constraint.getEvaluator().getQuery();
    Set<RolapCube> baseCubes=query.getBaseCubes();
    int k=-1;
    for (    RolapCube baseCube : baseCubes) {
      boolean finalSelect=(++k == baseCubes.size() - 1);
      WhichSelect whichSelect=finalSelect ? WhichSelect.LAST : WhichSelect.NOT_LAST;
      selectString+=generateSelectForLevels(dataSource,baseCube,whichSelect);
      if (!finalSelect) {
        selectString+="String_Node_Str";
      }
    }
    return selectString;
  }
 else {
    return generateSelectForLevels(dataSource,cube,WhichSelect.ONLY);
  }
}

Fixed version (ground truth):
private String makeLevelMembersSql(DataSource dataSource){
  RolapCube cube=null;
  boolean virtualCube=false;
  if (constraint instanceof SqlContextConstraint) {
    SqlContextConstraint sqlConstraint=(SqlContextConstraint)constraint;
    if (sqlConstraint.isJoinRequired()) {
      Query query=constraint.getEvaluator().getQuery();
      cube=(RolapCube)query.getCube();
      virtualCube=cube.isVirtual();
    }
  }
  if (virtualCube) {
    String selectString="String_Node_Str";
    Query query=constraint.getEvaluator().getQuery();
    Set<RolapCube> baseCubes=query.getBaseCubes();
    int k=-1;
    for (    RolapCube baseCube : baseCubes) {
      boolean finalSelect=(++k == baseCubes.size() - 1);
      WhichSelect whichSelect=finalSelect ? WhichSelect.LAST : WhichSelect.NOT_LAST;
      selectString+=generateSelectForLevels(dataSource,baseCube,whichSelect);
      if (!finalSelect) {
        selectString+="String_Node_Str";
      }
    }
    return selectString;
  }
 else {
    return generateSelectForLevels(dataSource,cube,WhichSelect.ONLY);
  }
}
Program: 51205
Project: 51205
Buggy source:
private void prepareTuples(DataSource dataSource,List<List<RolapMember>> partialResult,List<List<RolapMember>> newPartialResult){
  String message="String_Node_Str" + targets;
  SqlStatement stmt=null;
  final ResultSet resultSet;
  boolean execQuery=(partialResult == null);
  try {
    if (execQuery) {
      List<Target> partialTargets=new ArrayList<Target>();
      for (      Target target : targets) {
        if (target.srcMembers == null) {
          partialTargets.add(target);
        }
      }
      String sql=makeLevelMembersSql(dataSource);
      stmt=RolapUtil.executeQuery(dataSource,sql,maxRows,"String_Node_Str" + partialTargets,message,-1,-1);
      resultSet=stmt.getResultSet();
    }
 else {
      resultSet=null;
    }
    for (    Target target : targets) {
      target.open();
    }
    int limit=MondrianProperties.instance().ResultLimit.get();
    int fetchCount=0;
    int enumTargetCount=getEnumTargetCount();
    int[] srcMemberIdxes=null;
    if (enumTargetCount > 0) {
      srcMemberIdxes=new int[enumTargetCount];
    }
    boolean moreRows;
    int currPartialResultIdx=0;
    if (execQuery) {
      moreRows=resultSet.next();
      if (moreRows) {
        ++stmt.rowCount;
      }
    }
 else {
      moreRows=currPartialResultIdx < partialResult.size();
    }
    while (moreRows) {
      if (limit > 0 && limit < ++fetchCount) {
        throw MondrianResource.instance().MemberFetchLimitExceeded.ex((long)limit);
      }
      if (enumTargetCount == 0) {
        int column=0;
        for (        Target target : targets) {
          target.currMember=null;
          column=target.addRow(resultSet,column);
        }
      }
 else {
        int firstEnumTarget=0;
        for (; firstEnumTarget < targets.size(); firstEnumTarget++) {
          if (targets.get(firstEnumTarget).srcMembers != null) {
            break;
          }
        }
        List<RolapMember> partialRow;
        if (execQuery) {
          partialRow=null;
        }
 else {
          partialRow=partialResult.get(currPartialResultIdx);
        }
        resetCurrMembers(partialRow);
        addTargets(0,firstEnumTarget,enumTargetCount,srcMemberIdxes,resultSet,message);
        if (newPartialResult != null) {
          savePartialResult(newPartialResult);
        }
      }
      if (execQuery) {
        moreRows=resultSet.next();
        if (moreRows) {
          ++stmt.rowCount;
        }
      }
 else {
        currPartialResultIdx++;
        moreRows=currPartialResultIdx < partialResult.size();
      }
    }
  }
 catch (  SQLException e) {
    if (stmt == null) {
      throw Util.newError(e,message);
    }
 else {
      stmt.handle(e);
    }
  }
 finally {
    if (stmt != null) {
      stmt.close();
    }
  }
}

Fixed version (ground truth):
private void prepareTuples(DataSource dataSource,List<List<RolapMember>> partialResult,List<List<RolapMember>> newPartialResult){
}
Program: 51206
Project: 51206
Buggy source:
protected int computeHashCode(){
  return super.computeHashCode() ^ (sharedHierarchyName == null ? 0 : sharedHierarchyName.hashCode());
}

Fixed version (ground truth):
protected int computeHashCode(){
  return Util.hash(super.computeHashCode(),sharedHierarchyName);
}
Program: 51207
Project: 51207
Buggy source:
public RolapMember substitute(final RolapMember member){
  if (hierarchyAccess.hasInaccessibleDescendants(member)) {
    return new LimitedRollupMember((RolapCubeMember)member,exp);
  }
 else {
    return member;
  }
}

Fixed version (ground truth):
public RolapMember substitute(final RolapMember member){
  if (hierarchyAccess.getAccess(member) == Access.CUSTOM || hierarchyAccess.hasInaccessibleDescendants(member)) {
    return new LimitedRollupMember((RolapCubeMember)member,exp);
  }
 else {
    return member;
  }
}
Program: 51208
Project: 51208
Buggy source:
public Member evaluateMember(Evaluator evaluator){
  Member member=memberCalc.evaluateMember(evaluator);
  int n=integerCalc.evaluateInteger(evaluator);
  if (lag) {
    n=-n;
  }
  return evaluator.getSchemaReader().getLeadMember(member,n);
}

Fixed version (ground truth):
public Member evaluateMember(Evaluator evaluator){
  Member member=memberCalc.evaluateMember(evaluator);
  int n=integerCalc.evaluateInteger(evaluator);
  if (lag) {
    if (n == Integer.MIN_VALUE) {
      n+=1;
    }
    n=-n;
  }
  return evaluator.getSchemaReader().getLeadMember(member,n);
}
Program: 51209
Project: 51209
Buggy source:
public Calc compileCall(ResolvedFunCall call,ExpCompiler compiler){
  final MemberCalc memberCalc=compiler.compileMember(call.getArg(0));
  final IntegerCalc integerCalc=compiler.compileInteger(call.getArg(1));
  final boolean lag=call.getFunName().equals("String_Node_Str");
  return new AbstractMemberCalc(call,new Calc[]{memberCalc,integerCalc}){
    public Member evaluateMember(    Evaluator evaluator){
      Member member=memberCalc.evaluateMember(evaluator);
      int n=integerCalc.evaluateInteger(evaluator);
      if (lag) {
        n=-n;
      }
      return evaluator.getSchemaReader().getLeadMember(member,n);
    }
  }
;
}

Fixed version (ground truth):
public Calc compileCall(ResolvedFunCall call,ExpCompiler compiler){
  final MemberCalc memberCalc=compiler.compileMember(call.getArg(0));
  final IntegerCalc integerCalc=compiler.compileInteger(call.getArg(1));
  final boolean lag=call.getFunName().equals("String_Node_Str");
  return new AbstractMemberCalc(call,new Calc[]{memberCalc,integerCalc}){
    public Member evaluateMember(    Evaluator evaluator){
      Member member=memberCalc.evaluateMember(evaluator);
      int n=integerCalc.evaluateInteger(evaluator);
      if (lag) {
        if (n == Integer.MIN_VALUE) {
          n+=1;
        }
        n=-n;
      }
      return evaluator.getSchemaReader().getLeadMember(member,n);
    }
  }
;
}
Program: 51210
Project: 51210
Buggy source:
Member parallelPeriod(Member member,Level ancestorLevel,Evaluator evaluator,int lagValue){
  if (member.getHierarchy() != ancestorLevel.getHierarchy()) {
    MondrianResource.instance().FunctionMbrAndLevelHierarchyMismatch.ex("String_Node_Str",ancestorLevel.getHierarchy().getUniqueName(),member.getHierarchy().getUniqueName());
  }
  int distance=member.getLevel().getDepth() - ancestorLevel.getDepth();
  Member ancestor=FunUtil.ancestor(evaluator,member,distance,ancestorLevel);
  Member inLaw=evaluator.getSchemaReader().getLeadMember(ancestor,-lagValue);
  return FunUtil.cousin(evaluator.getSchemaReader(),member,inLaw);
}

Fixed version (ground truth):
Member parallelPeriod(Member member,Level ancestorLevel,Evaluator evaluator,int lagValue){
  if (member.getHierarchy() != ancestorLevel.getHierarchy()) {
    MondrianResource.instance().FunctionMbrAndLevelHierarchyMismatch.ex("String_Node_Str",ancestorLevel.getHierarchy().getUniqueName(),member.getHierarchy().getUniqueName());
  }
  if (lagValue == Integer.MIN_VALUE) {
    lagValue+=1;
  }
  int distance=member.getLevel().getDepth() - ancestorLevel.getDepth();
  Member ancestor=FunUtil.ancestor(evaluator,member,distance,ancestorLevel);
  Member inLaw=evaluator.getSchemaReader().getLeadMember(ancestor,-lagValue);
  return FunUtil.cousin(evaluator.getSchemaReader(),member,inLaw);
}
Program: 51211
Project: 51211
Buggy source:
/** 
 * Loads pending aggregations, if any.
 * @param query the parent query object that initiated thiscall
 * @return Whether any aggregations were loaded.
 */
boolean loadAggregations(Query query){
  final long t1=System.currentTimeMillis();
  requestCount=0;
  if (!isDirty()) {
    return false;
  }
  List<Batch> batchList=new ArrayList<Batch>(batches.values());
  Collections.sort(batchList,BatchComparator.instance);
  if (shouldUseGroupingFunction()) {
    LOGGER.debug("String_Node_Str");
    List<CompositeBatch> groupedBatches=groupBatches(batchList);
    for (    CompositeBatch batch : groupedBatches) {
      loadAggregation(query,batch);
    }
  }
 else {
    for (    Batch batch : batchList) {
      loadAggregation(query,batch);
    }
  }
  batches.clear();
  dirty=false;
  if (LOGGER.isDebugEnabled()) {
    final long t2=System.currentTimeMillis();
    LOGGER.debug("String_Node_Str" + (t2 - t1));
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Loads pending aggregations, if any.
 * @param query the parent query object that initiated thiscall
 * @return Whether any aggregations were loaded.
 */
boolean loadAggregations(Query query){
  final long t1=System.currentTimeMillis();
  if (!isDirty()) {
    return false;
  }
  List<Batch> batchList=new ArrayList<Batch>(batches.values());
  Collections.sort(batchList,BatchComparator.instance);
  if (shouldUseGroupingFunction()) {
    LOGGER.debug("String_Node_Str");
    List<CompositeBatch> groupedBatches=groupBatches(batchList);
    for (    CompositeBatch batch : groupedBatches) {
      loadAggregation(query,batch);
    }
  }
 else {
    for (    Batch batch : batchList) {
      loadAggregation(query,batch);
    }
  }
  batches.clear();
  dirty=false;
  if (LOGGER.isDebugEnabled()) {
    final long t2=System.currentTimeMillis();
    LOGGER.debug("String_Node_Str" + (t2 - t1));
  }
  return true;
}
Program: 51213
Project: 51213
Buggy source:
/** 
 * Verify that naitve evaluation is possible when calculated members are present expanded member list inputs to NECJ.
 */
public void testExpandCalcMembers(){
  String query="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";
  String result="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"+ "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"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  boolean origExpandNonNative=MondrianProperties.instance().ExpandNonNative.get();
  MondrianProperties.instance().ExpandNonNative.set(true);
  boolean requestFreshConnection=true;
  try {
    checkNative(0,9,query,fold(result),requestFreshConnection);
  }
  finally {
    MondrianProperties.instance().ExpandNonNative.set(origExpandNonNative);
  }
}

Fixed version (ground truth):
/** 
 * Verify that naitve evaluation is possible when calculated members are present expanded member list inputs to NECJ, as long as the other input to NECJ can be expressed in SQL.
 */
public void testExpandCalcMembers(){
  String query="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";
  String result="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"+ "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"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  boolean origExpandNonNative=MondrianProperties.instance().ExpandNonNative.get();
  MondrianProperties.instance().ExpandNonNative.set(true);
  boolean requestFreshConnection=true;
  try {
    checkNative(0,9,query,fold(result),requestFreshConnection);
  }
  finally {
    MondrianProperties.instance().ExpandNonNative.set(origExpandNonNative);
  }
}
Program: 51214
Project: 51214
Buggy source:
public List<RolapMember> getMembersInLevel(RolapLevel level,int startOrdinal,int endOrdinal,TupleConstraint constraint){
synchronized (cacheHelper) {
    checkCacheStatus();
    List<RolapMember> members=rolapCubeCacheHelper.getLevelMembersFromCache(level,constraint);
    if (members != null) {
      return members;
    }
    boolean joinReq=(constraint instanceof SqlContextConstraint) && ((SqlContextConstraint)constraint).isJoinRequired();
    List<RolapMember> list;
    if (!joinReq) {
      list=rolapHierarchy.getMemberReader().getMembersInLevel(((RolapCubeLevel)level).getRolapLevel(),startOrdinal,endOrdinal,constraint);
    }
 else {
      list=super.getMembersInLevel(level,startOrdinal,endOrdinal,constraint);
    }
    List<RolapMember> newlist=new ArrayList<RolapMember>(list.size());
    for (    RolapMember member : list) {
      if (false && member == rolapHierarchy.getAllMember()) {
        newlist.add(getAllMember());
      }
 else {
        RolapCubeMember parent=null;
        if (member.getParentMember() != null) {
          parent=createAncestorMembers((RolapCubeLevel)level.getParentLevel(),member.getParentMember());
        }
        RolapCubeMember newmember=lookupCubeMember(parent,member,(RolapCubeLevel)level);
        newlist.add(newmember);
      }
    }
    if (enableCache) {
      rolapCubeCacheHelper.putLevelMembersInCache(level,constraint,newlist);
    }
    return newlist;
  }
}

Fixed version (ground truth):
public List<RolapMember> getMembersInLevel(RolapLevel level,int startOrdinal,int endOrdinal,TupleConstraint constraint){
synchronized (cacheHelper) {
    checkCacheStatus();
    List<RolapMember> members=rolapCubeCacheHelper.getLevelMembersFromCache(level,constraint);
    if (members != null) {
      return members;
    }
    boolean joinReq=(constraint instanceof SqlContextConstraint) && (((SqlContextConstraint)constraint).isJoinRequired() || ((SqlContextConstraint)constraint).getEvaluator().isNonEmpty());
    List<RolapMember> list;
    if (!joinReq) {
      list=rolapHierarchy.getMemberReader().getMembersInLevel(((RolapCubeLevel)level).getRolapLevel(),startOrdinal,endOrdinal,constraint);
    }
 else {
      list=super.getMembersInLevel(level,startOrdinal,endOrdinal,constraint);
    }
    List<RolapMember> newlist=new ArrayList<RolapMember>(list.size());
    for (    RolapMember member : list) {
      if (false && member == rolapHierarchy.getAllMember()) {
        newlist.add(getAllMember());
      }
 else {
        RolapCubeMember parent=null;
        if (member.getParentMember() != null) {
          parent=createAncestorMembers((RolapCubeLevel)level.getParentLevel(),member.getParentMember());
        }
        RolapCubeMember newmember=lookupCubeMember(parent,member,(RolapCubeLevel)level);
        newlist.add(newmember);
      }
    }
    if (enableCache) {
      rolapCubeCacheHelper.putLevelMembersInCache(level,constraint,newlist);
    }
    return newlist;
  }
}