nus-yam/ex-repair huggingface dataset:
Program: 51529
Project: 51529
Buggy source:
NativeEvaluator createEvaluator(RolapEvaluator evaluator,FunDef fun,Exp[] args){
  if (!isEnabled())   return null;
  String funName=fun.getName();
  if (!"String_Node_Str".equalsIgnoreCase(funName))   return null;
  if (args.length != 2)   return null;
  CrossJoinArg[] cargs=checkCrossJoinArg(args[0]);
  if (cargs == null)   return null;
  if (isPreferInterpreter(cargs))   return null;
  RolapSchemaReader schemaReader=(RolapSchemaReader)evaluator.getSchemaReader();
  DataSource ds=schemaReader.getDataSource();
  Connection con=null;
  try {
    con=ds.getConnection();
    final SqlQuery.Dialect dialect=SqlQuery.Dialect.create(con.getMetaData());
    if (dialect.isDerby()) {
      return null;
    }
    SqlQuery sqlQuery=SqlTupleReader.newQuery(con,"String_Node_Str");
    RolapNativeSql sql=new RolapNativeSql(sqlQuery);
    String filterExpr=sql.generateFilterCondition(args[1]);
    if (filterExpr == null) {
      return null;
    }
    LOGGER.info("String_Node_Str");
    TupleConstraint constraint=new FilterConstraint(cargs,evaluator,filterExpr);
    return new SetEvaluator(cargs,schemaReader,constraint);
  }
 catch (  SQLException e) {
    throw Util.newInternal(e,"String_Node_Str");
  }
 finally {
    if (con != null) {
      try {
        con.close();
      }
 catch (      SQLException e) {
        LOGGER.error(null,e);
      }
    }
  }
}

Fixed version (ground truth):
NativeEvaluator createEvaluator(RolapEvaluator evaluator,FunDef fun,Exp[] args){
  if (!isEnabled())   return null;
  String funName=fun.getName();
  if (!"String_Node_Str".equalsIgnoreCase(funName))   return null;
  if (args.length != 2)   return null;
  CrossJoinArg[] cargs=checkCrossJoinArg(args[0]);
  if (cargs == null)   return null;
  if (isPreferInterpreter(cargs))   return null;
  RolapSchemaReader schemaReader=(RolapSchemaReader)evaluator.getSchemaReader();
  DataSource ds=schemaReader.getDataSource();
  Connection con=null;
  try {
    con=ds.getConnection();
    SqlQuery sqlQuery=SqlTupleReader.newQuery(con,"String_Node_Str");
    RolapNativeSql sql=new RolapNativeSql(sqlQuery);
    String filterExpr=sql.generateFilterCondition(args[1]);
    if (filterExpr == null) {
      return null;
    }
    LOGGER.info("String_Node_Str");
    TupleConstraint constraint=new FilterConstraint(cargs,evaluator,filterExpr);
    return new SetEvaluator(cargs,schemaReader,constraint);
  }
 catch (  SQLException e) {
    throw Util.newInternal(e,"String_Node_Str");
  }
 finally {
    if (con != null) {
      try {
        con.close();
      }
 catch (      SQLException e) {
        LOGGER.error(null,e);
      }
    }
  }
}
Program: 51533
Project: 51533
Buggy source:
private String makeKeysSql(Connection jdbcConnection){
  SqlQuery sqlQuery=newQuery(jdbcConnection,"String_Node_Str" + hierarchy);
  RolapLevel[] levels=(RolapLevel[])hierarchy.getLevels();
  for (int i=0; i < levels.length; i++) {
    RolapLevel level=levels[i];
    if (level.isAll()) {
      continue;
    }
    MondrianDef.Expression exp=level.getKeyExp();
    hierarchy.addToFrom(sqlQuery,exp);
    String expString=exp.getExpression(sqlQuery);
    sqlQuery.addSelect(expString);
    sqlQuery.addGroupBy(expString);
    exp=level.getOrdinalExp();
    hierarchy.addToFrom(sqlQuery,exp);
    expString=exp.getExpression(sqlQuery);
    sqlQuery.addOrderBy(expString);
    sqlQuery.addGroupBy(expString);
    RolapProperty[] properties=level.getRolapProperties();
    for (int j=0; j < properties.length; j++) {
      RolapProperty property=properties[j];
      exp=property.getExp();
      hierarchy.addToFrom(sqlQuery,exp);
      expString=exp.getExpression(sqlQuery);
      sqlQuery.addSelect(expString);
      sqlQuery.addGroupBy(expString);
    }
  }
  return sqlQuery.toString();
}

Fixed version (ground truth):
private String makeKeysSql(Connection jdbcConnection){
  SqlQuery sqlQuery=newQuery(jdbcConnection,"String_Node_Str" + hierarchy);
  RolapLevel[] levels=(RolapLevel[])hierarchy.getLevels();
  for (int i=0; i < levels.length; i++) {
    RolapLevel level=levels[i];
    if (level.isAll()) {
      continue;
    }
    MondrianDef.Expression exp=level.getKeyExp();
    hierarchy.addToFrom(sqlQuery,exp);
    String expString=exp.getExpression(sqlQuery);
    sqlQuery.addSelect(expString);
    sqlQuery.addGroupBy(expString);
    exp=level.getOrdinalExp();
    hierarchy.addToFrom(sqlQuery,exp);
    expString=exp.getExpression(sqlQuery);
    sqlQuery.addOrderBy(expString,true,false);
    sqlQuery.addGroupBy(expString);
    RolapProperty[] properties=level.getRolapProperties();
    for (int j=0; j < properties.length; j++) {
      RolapProperty property=properties[j];
      exp=property.getExp();
      hierarchy.addToFrom(sqlQuery,exp);
      expString=exp.getExpression(sqlQuery);
      sqlQuery.addSelect(expString);
      sqlQuery.addGroupBy(expString);
    }
  }
  return sqlQuery.toString();
}
Program: 51536
Project: 51536
Buggy source:
/** 
 * quotes a value so it may be used in SQL
 * @throws NumberFormatException if numeric == true and value can notbe parsed as a number
 */
public String quote(boolean numeric,Object value) throws NumberFormatException {
  String string=String.valueOf(value);
  if (numeric) {
    if (value instanceof Number)     return string;
    Double.valueOf(string);
    return string;
  }
  return Util.singleQuoteString(string);
}

Fixed version (ground truth):
/** 
 * Quotes a value so it may be used in SQL.
 * @throws NumberFormatException if numeric == true and value can notbe parsed as a number
 */
public String quote(boolean numeric,Object value) throws NumberFormatException {
  String string=String.valueOf(value);
  if (numeric) {
    if (value instanceof Number) {
      return string;
    }
    Double.valueOf(string);
    return string;
  }
  return Util.singleQuoteString(string);
}
Program: 51537
Project: 51537
Buggy source:
/** 
 * creates an ORDER BY
 * @param expr the expr to order by
 * @param ascending sort direction
 * @param prepend true = prepend to the current list of order by elements.
 */
public void addOrderBy(String expr,boolean ascending,boolean prepend){
  if (ascending)   expr=expr + "String_Node_Str";
 else   expr=expr + "String_Node_Str";
  if (prepend)   orderBy.add(0,expr);
 else   orderBy.add(expr);
}

Fixed version (ground truth):
/** 
 * Adds an item to the ORDER BY clause.
 * @param expr the expr to order by
 * @param ascending sort direction
 * @param prepend true = prepend to the current list of order by elements.
 */
public void addOrderBy(String expr,boolean ascending,boolean prepend){
  if (ascending) {
    expr=expr + "String_Node_Str";
  }
 else {
    expr=expr + "String_Node_Str";
  }
  if (prepend) {
    orderBy.add(0,expr);
  }
 else {
    orderBy.add(expr);
  }
}
Program: 51538
Project: 51538
Buggy source:
/** 
 * Chooses the variant within an array of   {@link mondrian.olap.MondrianDef.SQL} which best matches the current SQLdialect.
 */
public String chooseQuery(final MondrianDef.SQL[] sqls){
  String best=getBestName();
  String generic=null;
  for (int i=0; i < sqls.length; i++) {
    MondrianDef.SQL sql=sqls[i];
    if (sql.dialect.equals(best)) {
      return sql.cdata;
    }
    if (sql.dialect.equals("String_Node_Str")) {
      generic=sql.cdata;
    }
  }
  if (generic == null) {
    throw Util.newError("String_Node_Str");
  }
  return generic;
}

Fixed version (ground truth):
/** 
 * Chooses the variant within an array of  {@link mondrian.olap.MondrianDef.SQL} which best matches the currentSQL dialect.
 */
public String chooseQuery(final MondrianDef.SQL[] sqls){
  String best=getBestName();
  String generic=null;
  for (int i=0; i < sqls.length; i++) {
    MondrianDef.SQL sql=sqls[i];
    if (sql.dialect.equals(best)) {
      return sql.cdata;
    }
    if (sql.dialect.equals("String_Node_Str")) {
      generic=sql.cdata;
    }
  }
  if (generic == null) {
    throw Util.newError("String_Node_Str");
  }
  return generic;
}
Program: 51539
Project: 51539
Buggy source:
/** 
 * @return SQL syntax that converts <code>expr</code> into upper case.
 */
public String toUpper(String expr){
  if (isDB2() || isAccess())   return "String_Node_Str" + expr + "String_Node_Str";
  return "String_Node_Str" + expr + "String_Node_Str";
}

Fixed version (ground truth):
/** 
 * @return SQL syntax that converts <code>expr</code>into upper case.
 */
public String toUpper(String expr){
  if (isDB2() || isAccess())   return "String_Node_Str" + expr + "String_Node_Str";
  return "String_Node_Str" + expr + "String_Node_Str";
}
Program: 51540
Project: 51540
Buggy source:
public Object getCacheKey(){
  List key=new ArrayList();
  key.add(super.getCacheKey());
  key.add(orderByExpr);
  return key;
}

Fixed version (ground truth):
public Object getCacheKey(){
  List key=new ArrayList();
  key.add(super.getCacheKey());
  key.add(orderByExpr);
  key.add(Boolean.valueOf(ascending));
  return key;
}
Program: 51541
Project: 51541
Buggy source:
NativeEvaluator createEvaluator(RolapEvaluator evaluator,FunDef fun,Exp[] args){
  if (!isEnabled())   return null;
  String funName=fun.getName();
  if ("String_Node_Str".equalsIgnoreCase(funName))   ascending=false;
 else   if ("String_Node_Str".equalsIgnoreCase(funName))   ascending=true;
 else   return null;
  if (args.length < 2 || args.length > 3)   return null;
  CrossJoinArg[] cargs=checkCrossJoinArg(args[0]);
  if (cargs == null)   return null;
  if (isPreferInterpreter(cargs))   return null;
  if (!(args[1] instanceof Literal))   return null;
  int count=((Literal)args[1]).getIntValue();
  RolapSchemaReader schemaReader=(RolapSchemaReader)evaluator.getSchemaReader();
  DataSource ds=schemaReader.getDataSource();
  try {
    RolapNativeSql sql=new RolapNativeSql(SqlTupleReader.newQuery(ds.getConnection(),"String_Node_Str"));
    String orderByExpr=null;
    if (args.length == 3) {
      orderByExpr=sql.generateTopCountOrderBy(args[2]);
      if (orderByExpr == null)       return null;
    }
    LOGGER.info("String_Node_Str");
    System.out.println("String_Node_Str");
    TupleConstraint constraint=new TopCountConstraint(cargs,evaluator,orderByExpr);
    SetEvaluator sev=new SetEvaluator(cargs,schemaReader,constraint);
    sev.setMaxRows(count);
    return sev;
  }
 catch (  SQLException e) {
    throw Util.newInternal(e,"String_Node_Str");
  }
}

Fixed version (ground truth):
NativeEvaluator createEvaluator(RolapEvaluator evaluator,FunDef fun,Exp[] args){
  if (!isEnabled())   return null;
  String funName=fun.getName();
  if ("String_Node_Str".equalsIgnoreCase(funName))   ascending=false;
 else   if ("String_Node_Str".equalsIgnoreCase(funName))   ascending=true;
 else   return null;
  if (args.length < 2 || args.length > 3)   return null;
  CrossJoinArg[] cargs=checkCrossJoinArg(args[0]);
  if (cargs == null)   return null;
  if (isPreferInterpreter(cargs))   return null;
  if (!(args[1] instanceof Literal))   return null;
  int count=((Literal)args[1]).getIntValue();
  RolapSchemaReader schemaReader=(RolapSchemaReader)evaluator.getSchemaReader();
  DataSource ds=schemaReader.getDataSource();
  Connection con=null;
  try {
    con=ds.getConnection();
    SqlQuery sqlQuery=SqlTupleReader.newQuery(con,"String_Node_Str");
    RolapNativeSql sql=new RolapNativeSql(sqlQuery);
    String orderByExpr=null;
    if (args.length == 3) {
      orderByExpr=sql.generateTopCountOrderBy(args[2]);
      if (orderByExpr == null)       return null;
    }
    LOGGER.info("String_Node_Str");
    TupleConstraint constraint=new TopCountConstraint(cargs,evaluator,orderByExpr);
    SetEvaluator sev=new SetEvaluator(cargs,schemaReader,constraint);
    sev.setMaxRows(count);
    return sev;
  }
 catch (  SQLException e) {
    throw Util.newInternal(e,"String_Node_Str");
  }
 finally {
    if (con != null) {
      try {
        con.close();
      }
 catch (      SQLException e) {
        LOGGER.error(null,e);
      }
    }
  }
}
Program: 51542
Project: 51542
Buggy source:
NativeEvaluator createEvaluator(RolapEvaluator evaluator,FunDef fun,Exp[] args){
  if (!evaluator.isNonEmpty())   return null;
  CrossJoinArg[] cargs=checkCrossJoin(fun,args);
  if (cargs == null)   return null;
  if (isPreferInterpreter(cargs))   return null;
  LOGGER.info("String_Node_Str");
  TupleConstraint constraint=new NonEmptyCrossJoinConstraint(cargs,evaluator);
  RolapSchemaReader schemaReader=(RolapSchemaReader)evaluator.getSchemaReader();
  return new SetEvaluator(getCache(),cargs,schemaReader,constraint);
}

Fixed version (ground truth):
NativeEvaluator createEvaluator(RolapEvaluator evaluator,FunDef fun,Exp[] args){
  if (!isEnabled())   return null;
  if (!evaluator.isNonEmpty())   return null;
  CrossJoinArg[] cargs=checkCrossJoin(fun,args);
  if (cargs == null)   return null;
  if (isPreferInterpreter(cargs))   return null;
  LOGGER.info("String_Node_Str");
  TupleConstraint constraint=new NonEmptyCrossJoinConstraint(cargs,evaluator);
  RolapSchemaReader schemaReader=(RolapSchemaReader)evaluator.getSchemaReader();
  return new SetEvaluator(cargs,schemaReader,constraint);
}
Program: 51543
Project: 51543
Buggy source:
public RolapNativeRegistry(){
  register(new RolapNativeCrossJoin());
}

Fixed version (ground truth):
public RolapNativeRegistry(){
  register(new RolapNativeCrossJoin());
  register(new RolapNativeTopCount());
}
Program: 51544
Project: 51544
Buggy source:
public void register(RolapNative rn){
  evaluators.add(rn);
}

Fixed version (ground truth):
public void register(RolapNative rn){
  natives.add(rn);
}
Program: 51545
Project: 51545
Buggy source:
/** 
 * Creates the   {@link Member} or {@link NamedSet} object which this formuladefines.
 */
void createElement(Query q){
  if (isMember) {
    OlapElement mdxElement=q.getCube();
    final SchemaReader schemaReader=q.getSchemaReader(true);
    for (int i=0; i < names.length; i++) {
      OlapElement parent=mdxElement;
      mdxElement=schemaReader.getElementChild(parent,names[i]);
      if (mdxElement == null) {
        Level level;
        Member parentMember=null;
        if (parent instanceof Member) {
          parentMember=(Member)parent;
          level=parentMember.getLevel().getChildLevel();
        }
 else {
          Hierarchy hierarchy=parent.getHierarchy();
          if (hierarchy == null) {
            throw MondrianResource.instance().MdxCalculatedHierarchyError.ex(Util.quoteMdxIdentifier(names));
          }
          level=hierarchy.getLevels()[0];
        }
        Member mdxMember=level.getHierarchy().createMember(parentMember,level,names[i],this);
        mdxElement=mdxMember;
      }
    }
    this.mdxMember=(Member)mdxElement;
  }
 else {
    Util.assertTrue(names.length == 1,"String_Node_Str");
    mdxSet=new SetBase(names[0],exp);
  }
}

Fixed version (ground truth):
/** 
 * Creates the   {@link Member} or {@link NamedSet} object which this formuladefines.
 */
void createElement(Query q){
  if (isMember) {
    if (mdxMember != null) {
      return;
    }
    OlapElement mdxElement=q.getCube();
    final SchemaReader schemaReader=q.getSchemaReader(true);
    for (int i=0; i < names.length; i++) {
      OlapElement parent=mdxElement;
      mdxElement=schemaReader.getElementChild(parent,names[i]);
      if (mdxElement == null || i == names.length - 1) {
        Level level;
        Member parentMember=null;
        if (parent instanceof Member) {
          parentMember=(Member)parent;
          level=parentMember.getLevel().getChildLevel();
        }
 else {
          Hierarchy hierarchy=parent.getHierarchy();
          if (hierarchy == null) {
            throw MondrianResource.instance().MdxCalculatedHierarchyError.ex(Util.quoteMdxIdentifier(names));
          }
          level=hierarchy.getLevels()[0];
        }
        Member mdxMember=level.getHierarchy().createMember(parentMember,level,names[i],this);
        mdxElement=mdxMember;
      }
    }
    this.mdxMember=(Member)mdxElement;
  }
 else {
    Util.assertTrue(names.length == 1,"String_Node_Str");
    mdxSet=new SetBase(names[0],exp);
  }
}
Program: 51546
Project: 51546
Buggy source:
private Formula(boolean isMember,String[] names,ExpBase exp,MemberProperty[] memberProperties){
  this.isMember=isMember;
  this.names=names;
  this.exp=exp;
  this.memberProperties=memberProperties;
}

Fixed version (ground truth):
private Formula(boolean isMember,String[] names,ExpBase exp,MemberProperty[] memberProperties,Member mdxMember,NamedSet mdxSet){
}
Program: 51547
Project: 51547
Buggy source:
public Object clone(){
  return new Formula(isMember,names,(ExpBase)exp.clone(),MemberProperty.cloneArray(memberProperties));
}

Fixed version (ground truth):
public Object clone(){
  return new Formula(isMember,names,(ExpBase)exp.clone(),MemberProperty.cloneArray(memberProperties),mdxMember,mdxSet);
}
Program: 51548
Project: 51548
Buggy source:
/** 
 * Deduce the line and column (0-based) of a symbol.  Called by   {@link Parser#syntax_error}. 
 */
void getLocation(Symbol symbol,int[] loc){
  int iTarget=symbol.left;
  int iLine=-1;
  int iLineEnd=0;
  int iLineStart;
  do {
    iLine++;
    iLineStart=iLineEnd;
    iLineEnd=Integer.MAX_VALUE;
    if (iLine < lines.size()) {
      iLineEnd=((Integer)lines.get(iLine)).intValue();
    }
  }
 while (iLineEnd < iTarget);
  loc[0]=iLine;
  loc[1]=iTarget - iLineStart;
}

Fixed version (ground truth):
/** 
 * Deduces the line and column (0-based) of a symbol. Called by   {@link Parser#syntax_error}.
 */
void getLocation(Symbol symbol,int[] loc){
  int iTarget=symbol.left;
  int iLine=-1;
  int iLineEnd=0;
  int iLineStart;
  do {
    iLine++;
    iLineStart=iLineEnd;
    iLineEnd=Integer.MAX_VALUE;
    if (iLine < lines.size()) {
      iLineEnd=((Integer)lines.get(iLine)).intValue();
    }
  }
 while (iLineEnd < iTarget);
  loc[0]=iLine;
  loc[1]=iTarget - iLineStart;
}
Program: 51550
Project: 51550
Buggy source:
public static String[] explode(String s){
  List list=new ArrayList();
  int i=0;
  while (i < s.length()) {
    if (s.charAt(i) != '[') {
      throw getRes().newMdxInvalidMember(s);
    }
    int j=s.indexOf("String_Node_Str",i);
    if (j == -1) {
      j=s.lastIndexOf(']');
    }
    if (j <= i) {
      throw getRes().newMdxInvalidMember(s);
    }
    String sub=s.substring(i + 1,j);
    list.add(sub);
    if (j + 1 < s.length())     if (s.charAt(j + 1) != '.') {
      throw getRes().newMdxInvalidMember(s);
    }
    i=j + 2;
  }
  String[] names=(String[])list.toArray(new String[list.size()]);
  return names;
}

Fixed version (ground truth):
public static String[] explode(String s){
  List list=new ArrayList();
  int i=0;
  while (i < s.length()) {
    if (s.charAt(i) != '[') {
      throw getRes().newMdxInvalidMember(s);
    }
    int j=s.indexOf("String_Node_Str",i);
    if (j == -1) {
      j=s.lastIndexOf(']');
    }
    if (j <= i) {
      throw getRes().newMdxInvalidMember(s);
    }
    String sub=s.substring(i + 1,j);
    sub=replace(sub,"String_Node_Str","String_Node_Str");
    list.add(sub);
    if (j + 1 < s.length()) {
      if (s.charAt(j + 1) != '.') {
        throw getRes().newMdxInvalidMember(s);
      }
    }
    i=j + 2;
  }
  String[] names=(String[])list.toArray(new String[list.size()]);
  return names;
}
Program: 51551
Project: 51551
Buggy source:
public static String implode(String[] names){
  if (names.length == 0) {
    return "String_Node_Str";
  }
  StringBuffer sb=new StringBuffer(64);
  sb.append('[');
  for (int i=0; i < names.length; i++) {
    if (i > 0) {
      sb.append("String_Node_Str");
    }
    sb.append(names[i]);
  }
  sb.append(']');
  return sb.toString();
}

Fixed version (ground truth):
/** 
 * Converts an array of name parts {"part1", "part2"} into a single string "[part1].[part2]". If the names contain "]" they are escaped as "]]".
 */
public static String implode(String[] names){
  StringBuffer sb=new StringBuffer(64);
  for (int i=0; i < names.length; i++) {
    if (i > 0) {
      sb.append("String_Node_Str");
    }
    quoteMdxIdentifier(names[i],sb);
  }
  return sb.toString();
}
Program: 51552
Project: 51552
Buggy source:
synchronized void createUsage(RolapHierarchy hierarchy,MondrianDef.CubeDimension cubeDim){
  HierarchyUsage usage=new HierarchyUsage(this,hierarchy,cubeDim);
  hierarchy.setCaption(usage.getName());
  Iterator it=this.hierarchyUsages.iterator();
  while (it.hasNext()) {
    HierarchyUsage hierUsage=(HierarchyUsage)it.next();
    if (hierUsage.equals(usage)) {
      getLogger().warn("String_Node_Str" + hierUsage);
      return;
    }
  }
  if (getLogger().isDebugEnabled()) {
    getLogger().debug("String_Node_Str" + usage);
  }
  this.hierarchyUsages.add(usage);
}

Fixed version (ground truth):
synchronized void createUsage(RolapHierarchy hierarchy,MondrianDef.CubeDimension cubeDim){
  HierarchyUsage usage=new HierarchyUsage(this,hierarchy,cubeDim);
  Iterator it=this.hierarchyUsages.iterator();
  while (it.hasNext()) {
    HierarchyUsage hierUsage=(HierarchyUsage)it.next();
    if (hierUsage.equals(usage)) {
      getLogger().warn("String_Node_Str" + hierUsage);
      return;
    }
  }
  if (getLogger().isDebugEnabled()) {
    getLogger().debug("String_Node_Str" + usage);
  }
  this.hierarchyUsages.add(usage);
}
Program: 51553
Project: 51553
Buggy source:
public Object evaluate(Evaluator evaluator,Exp[] args){
  Member member=getMemberArg(evaluator,args,0,true);
  String s=getStringArg(evaluator,args,1,null);
  Object o=member.getPropertyValue(s);
  if (o == null) {
    if (isValidProperty(member,s)) {
      o=member.getHierarchy().getNullMember();
    }
 else {
      throw new MondrianEvaluationException("String_Node_Str" + s + "String_Node_Str"+ member+ "String_Node_Str");
    }
  }
  return o;
}

Fixed version (ground truth):
public Object evaluate(Evaluator evaluator,Exp[] args){
  Member member=getMemberArg(evaluator,args,0,true);
  String s=getStringArg(evaluator,args,1,null);
  Object o=member.getPropertyValue(s);
  if (o == null) {
    if (!isValidProperty(member,s)) {
      throw new MondrianEvaluationException("String_Node_Str" + s + "String_Node_Str"+ member+ "String_Node_Str");
    }
  }
  return o;
}
Program: 51554
Project: 51554
Buggy source:
public OlapElement lookupChild(SchemaReader schemaReader,String s){
  OlapElement oe=lookupHierarchy(s);
  if ((oe == null) || oe.getName().equalsIgnoreCase(getName())) {
    oe=getHierarchy().lookupChild(schemaReader,s);
  }
  if (getLogger().isDebugEnabled()) {
    StringBuffer buf=new StringBuffer(64);
    buf.append("String_Node_Str");
    buf.append("String_Node_Str");
    buf.append(getName());
    buf.append("String_Node_Str");
    buf.append(s);
    if (oe == null) {
      buf.append("String_Node_Str");
    }
 else {
      buf.append("String_Node_Str" + oe.getName());
    }
    getLogger().debug(buf.toString());
  }
  return oe;
}

Fixed version (ground truth):
public OlapElement lookupChild(SchemaReader schemaReader,String s){
  OlapElement oe=lookupHierarchy(s);
  if ((oe == null) || oe.getName().equalsIgnoreCase(getName())) {
    OlapElement oeLevel=getHierarchy().lookupChild(schemaReader,s);
    if (oeLevel != null)     oe=oeLevel;
  }
  if (getLogger().isDebugEnabled()) {
    StringBuffer buf=new StringBuffer(64);
    buf.append("String_Node_Str");
    buf.append("String_Node_Str");
    buf.append(getName());
    buf.append("String_Node_Str");
    buf.append(s);
    if (oe == null) {
      buf.append("String_Node_Str");
    }
 else {
      buf.append("String_Node_Str" + oe.getName());
    }
    getLogger().debug(buf.toString());
  }
  return oe;
}
Program: 51555
Project: 51555
Buggy source:
/** 
 * Executes the expression in the context of the cube indicated by <code>cubeName</code>, and returns the result.
 * @param cubeName The name of the cube to use
 * @param expression The expression to evaluate
 * @return Returns a {@link Cell} which is the result of the expression.
 */
public Cell executeExprRaw(String cubeName,String expression){
  Result result=TestContext.instance().executeFoodMart("String_Node_Str" + expression + "String_Node_Str"+ cubeName);
  return result.getCell(new int[]{0});
}

Fixed version (ground truth):
/** 
 * Executes the expression in the context of the cube indicated by <code>cubeName</code>, and returns the result.
 * @param cubeName The name of the cube to use
 * @param expression The expression to evaluate
 * @return Returns a {@link Cell} which is the result of the expression.
 */
public Cell executeExprRaw(String cubeName,String expression){
  if (cubeName.indexOf(' ') >= 0) {
    cubeName=Util.quoteMdxIdentifier(cubeName);
  }
  final String queryString="String_Node_Str" + expression + "String_Node_Str"+ cubeName;
  Result result=TestContext.instance().executeFoodMart(queryString);
  return result.getCell(new int[]{0});
}
Program: 51556
Project: 51556
Buggy source:
private String decimalFormat(String lengthStr,String placesStr){
  StringBuffer sb=new StringBuffer();
  int length=Integer.parseInt(lengthStr);
  int places=Integer.parseInt(placesStr);
  for (int i=0; i < length; i++) {
    sb.append("String_Node_Str");
    if ((length - i) == places) {
      sb.append('.');
    }
  }
  return sb.toString();
}

Fixed version (ground truth):
private String decimalFormat(String lengthStr,String placesStr){
  StringBuffer sb=new StringBuffer();
  int length=Integer.parseInt(lengthStr);
  int places=Integer.parseInt(placesStr);
  for (int i=0; i < length; i++) {
    if ((length - i) == places) {
      sb.append('.');
    }
    sb.append("String_Node_Str");
  }
  return sb.toString();
}
Program: 51557
Project: 51557
Buggy source:
public void testGenuineCycle(){
  Result result=runQuery("String_Node_Str" + nl + "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str");
  String resultString=toString(result);
  final String expected="String_Node_Str" + nl + "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl;
  final String expected2="String_Node_Str" + nl + "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl;
  if (!resultString.equals(expected) && !resultString.equals(expected2)) {
    System.out.println(resultString);
    Assert.assertEquals(expected,resultString);
  }
}

Fixed version (ground truth):
public void testGenuineCycle(){
  Result result=runQuery("String_Node_Str" + nl + "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str");
  String resultString=toString(result);
  final String expected="String_Node_Str" + nl + "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl;
  final String expected2="String_Node_Str" + nl + "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl;
  final String expected3="String_Node_Str" + nl + "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl;
  if (!resultString.equals(expected) && !resultString.equals(expected2) && !resultString.equals(expected3)) {
    System.out.println(resultString);
    Assert.assertEquals(expected,resultString);
  }
}
Program: 51558
Project: 51558
Buggy source:
public boolean hasRestrictions(){
  return bHasRestrictions;
}

Fixed version (ground truth):
public boolean hasRestrictions(){
  return hasRestrictions;
}
Program: 51559
Project: 51559
Buggy source:
/** 
 * Adds  restricted hierarchy or limited member based on bMember
 */
public void addGrantCubeSlicer(String sHierarchy,String sMember,boolean bMember){
  if (bMember) {
    boolean fail=false;
    Member member=mdxCube.getSchemaReader(null).getMemberByUniqueName(Util.explode(sMember),fail);
    if (member == null) {
      throw Util.getRes().newMdxCubeSlicerMemberError(sMember,sHierarchy,mdxCube.getUniqueName());
    }
    if (getLimitedMemberForHierarchy(member.getHierarchy()) == null) {
      vMember.addElement(member);
    }
  }
 else {
    boolean fail=false;
    Hierarchy hierarchy=mdxCube.lookupHierarchy(sHierarchy,fail);
    if (hierarchy == null) {
      throw Util.getRes().newMdxCubeSlicerHierarchyError(sHierarchy,mdxCube.getUniqueName());
    }
    vHierarchy.addElement(hierarchy);
  }
}

Fixed version (ground truth):
/** 
 * Adds  restricted hierarchy or limited member based on bMember
 */
public void addGrantCubeSlicer(String sHierarchy,String sMember,boolean bMember){
  if (bMember) {
    boolean fail=false;
    Member member=mdxCube.getSchemaReader(null).getMemberByUniqueName(Util.explode(sMember),fail);
    if (member == null) {
      throw Util.getRes().newMdxCubeSlicerMemberError(sMember,sHierarchy,mdxCube.getUniqueName());
    }
    if (getLimitedMemberForHierarchy(member.getHierarchy()) == null) {
      memberList.add(member);
    }
  }
 else {
    boolean fail=false;
    Hierarchy hierarchy=mdxCube.lookupHierarchy(sHierarchy,fail);
    if (hierarchy == null) {
      throw Util.getRes().newMdxCubeSlicerHierarchyError(sHierarchy,mdxCube.getUniqueName());
    }
    hierarchyList.add(hierarchy);
  }
}
Program: 51560
Project: 51560
Buggy source:
/** 
 * Initializes internal arrays of restricted hierarchies and limited members. It has to be called  after all 'addSlicer()' calls.
 */
public void normalizeCubeAccess(){
  if (vMember.size() > 0) {
    limitedMembers=new Member[vMember.size()];
    vMember.copyInto(limitedMembers);
    bHasRestrictions=true;
  }
  if (vHierarchy.size() > 0) {
    noAccessHierarchies=new Hierarchy[vHierarchy.size()];
    vHierarchy.copyInto(noAccessHierarchies);
    bHasRestrictions=true;
  }
}

Fixed version (ground truth):
/** 
 * Initializes internal arrays of restricted hierarchies and limited members. It has to be called  after all 'addSlicer()' calls.
 */
public void normalizeCubeAccess(){
  if (memberList.size() > 0) {
    limitedMembers=(Member[])memberList.toArray(new Member[memberList.size()]);
    hasRestrictions=true;
  }
  if (hierarchyList.size() > 0) {
    noAccessHierarchies=(Hierarchy[])hierarchyList.toArray(new Hierarchy[hierarchyList.size()]);
    hasRestrictions=true;
  }
}
Program: 51561
Project: 51561
Buggy source:
/** 
 * compares this CubeAccess to the specified Object
 */
public boolean equals(Object object){
  if (!(object instanceof CubeAccess)) {
    return false;
  }
  CubeAccess cubeAccess=(CubeAccess)object;
  Vector vMdxHierarchies=cubeAccess.getNoAccessHierarchiesAsVector();
  Vector vMembers=cubeAccess.getLimitedMembersAsVector();
  if ((this.vHierarchy.size() != vMdxHierarchies.size()) || (this.vMember.size() != vMembers.size())) {
    return false;
  }
  for (int i=0; i < vMdxHierarchies.size(); i++) {
    if (!this.vHierarchy.contains(vMdxHierarchies.elementAt(i))) {
      return false;
    }
  }
  for (int i=0; i < vMembers.size(); i++) {
    if (!this.vMember.contains(vMembers.elementAt(i))) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * compares this CubeAccess to the specified Object
 */
public boolean equals(Object object){
  if (!(object instanceof CubeAccess)) {
    return false;
  }
  CubeAccess cubeAccess=(CubeAccess)object;
  ArrayList hierarchyList=cubeAccess.getNoAccessHierarchyList();
  ArrayList limitedMemberList=cubeAccess.getLimitedMemberList();
  if ((this.hierarchyList.size() != hierarchyList.size()) || (this.memberList.size() != limitedMemberList.size())) {
    return false;
  }
  for (int i=0; i < hierarchyList.size(); i++) {
    if (!this.hierarchyList.contains(hierarchyList.get(i))) {
      return false;
    }
  }
  for (int i=0; i < limitedMemberList.size(); i++) {
    if (!this.memberList.contains(limitedMemberList.get(i))) {
      return false;
    }
  }
  return true;
}
Program: 51562
Project: 51562
Buggy source:
/** 
 * Creates cubeAccess object. User's code should be responsible for filling cubeAccess with restricted hierarchies and restricted  members by calling addSlicer(). Do NOT forfet to call 'normalizeCubeAccess()' after you done filling cubeAccess.
 */
public CubeAccess(Cube mdxCube){
  this.mdxCube=mdxCube;
  noAccessHierarchies=null;
  limitedMembers=null;
  bHasRestrictions=false;
  vHierarchy=new Vector();
  vMember=new Vector();
}

Fixed version (ground truth):
/** 
 * Creates a CubeAccess object. <p>User's code should be responsible for filling cubeAccess with restricted hierarchies and restricted  members by calling addSlicer(). Do NOT forget to call  {@link #normalizeCubeAccess()} after you done filling cubeAccess.
 */
public CubeAccess(Cube mdxCube){
  this.mdxCube=mdxCube;
  noAccessHierarchies=null;
  limitedMembers=null;
  hasRestrictions=false;
  hierarchyList=new ArrayList();
  memberList=new ArrayList();
}
Program: 51563
Project: 51563
Buggy source:
protected Object[] getAllowedChildren(CubeAccess cubeAccess){
  java.util.Vector vMdxHierarchies=new java.util.Vector();
  Hierarchy[] mdxHierarchies=getHierarchies();
  for (int i=0; i < mdxHierarchies.length; i++) {
    if (cubeAccess.isHierarchyAllowed(mdxHierarchies[i]))     vMdxHierarchies.addElement(mdxHierarchies[i]);
  }
  mdxHierarchies=new Hierarchy[vMdxHierarchies.size()];
  vMdxHierarchies.copyInto(mdxHierarchies);
  return mdxHierarchies;
}

Fixed version (ground truth):
protected Object[] getAllowedChildren(CubeAccess cubeAccess){
  ArrayList hierarchyList=new ArrayList();
  Hierarchy[] mdxHierarchies=getHierarchies();
  for (int i=0; i < mdxHierarchies.length; i++) {
    if (cubeAccess.isHierarchyAllowed(mdxHierarchies[i])) {
      hierarchyList.add(mdxHierarchies[i]);
    }
  }
  return hierarchyList.toArray(new Hierarchy[hierarchyList.size()]);
}
Program: 51564
Project: 51564
Buggy source:
public Member[] getAncestorMembers(){
  Vector v=new Vector();
  MemberBase parentMember=(MemberBase)getParentMember();
  while (parentMember != null) {
    v.addElement(parentMember);
    parentMember=(MemberBase)parentMember.getParentMember();
  }
  Member[] mdxAncestorMembers=new Member[v.size()];
  v.copyInto(mdxAncestorMembers);
  return mdxAncestorMembers;
}

Fixed version (ground truth):
public Member[] getAncestorMembers(){
  ArrayList list=new ArrayList();
  MemberBase parentMember=(MemberBase)getParentMember();
  while (parentMember != null) {
    list.add(parentMember);
    parentMember=(MemberBase)parentMember.getParentMember();
  }
  return (Member[])list.toArray(new Member[list.size()]);
}
Program: 51565
Project: 51565
Buggy source:
public boolean isCalculated(){
  if (isCalculatedInQuery()) {
    return true;
  }
  String type=memberTypes[getMemberType()];
  return type.equals("String_Node_Str");
}

Fixed version (ground truth):
public boolean isCalculated(){
  if (isCalculatedInQuery()) {
    return true;
  }
  return getMemberType() == FORMULA_MEMBER_TYPE;
}
Program: 51566
Project: 51566
Buggy source:
public OlapElement lookupCompound(OlapElement parent,String[] names,boolean failIfNotFound,int category){
switch (category) {
case Category.Unknown:
case Category.Member:
    if (parent == mdxCube) {
      final Member calculatedMember=getCalculatedMember(names);
      if (calculatedMember != null) {
        return calculatedMember;
      }
    }
}
return super.lookupCompound(parent,names,failIfNotFound,category);
}

Fixed version (ground truth):
public OlapElement lookupCompound(OlapElement parent,String[] names,boolean failIfNotFound,int category){
switch (category) {
case Category.Unknown:
case Category.Member:
    if (parent == mdxCube) {
      final Member calculatedMember=getCalculatedMember(names);
      if (calculatedMember != null) {
        return calculatedMember;
      }
    }
}
OlapElement olapElement=super.lookupCompound(parent,names,failIfNotFound,category);
if (olapElement instanceof Member) {
  Member member=(Member)olapElement;
  final Exp exp=(Exp)member.getPropertyValue(Property.PROPERTY_FORMULA);
  if (exp != null) {
    final Formula formula=new Formula(names,exp,new MemberProperty[0]);
    formula.createElement(Query.this);
    formula.resolve(createResolver());
    olapElement=formula.getMdxMember();
  }
}
return olapElement;
}
Program: 51567
Project: 51567
Buggy source:
/** 
 * Initialize the scanner 
 */
public void init() throws java.io.IOException {
  initReswords();
  lines=new Vector();
  iChar=iPrevChar=0;
  advance();
}

Fixed version (ground truth):
/** 
 * Initialize the scanner 
 */
public void init() throws java.io.IOException {
  initReswords();
  lines=new ArrayList();
  iChar=iPrevChar=0;
  advance();
}
Program: 51568
Project: 51568
Buggy source:
/** 
 * Deduce the line and column (0-based) of a symbol.  Called by   {@link Parser#syntax_error}. 
 */
void getLocation(Symbol symbol,int[] loc){
  int iTarget=symbol.left, iLine=-1, iLineEnd=0, iLineStart;
  do {
    iLine++;
    iLineStart=iLineEnd;
    iLineEnd=Integer.MAX_VALUE;
    if (iLine < lines.size())     iLineEnd=((Integer)lines.elementAt(iLine)).intValue();
  }
 while (iLineEnd < iTarget);
  loc[0]=iLine;
  loc[1]=iTarget - iLineStart;
}

Fixed version (ground truth):
/** 
 * Deduce the line and column (0-based) of a symbol.  Called by   {@link Parser#syntax_error}. 
 */
void getLocation(Symbol symbol,int[] loc){
  int iTarget=symbol.left, iLine=-1, iLineEnd=0, iLineStart;
  do {
    iLine++;
    iLineStart=iLineEnd;
    iLineEnd=Integer.MAX_VALUE;
    if (iLine < lines.size())     iLineEnd=((Integer)lines.get(iLine)).intValue();
  }
 while (iLineEnd < iTarget);
  loc[0]=iLine;
  loc[1]=iTarget - iLineStart;
}
Program: 51569
Project: 51569
Buggy source:
private final void advance() throws java.io.IOException {
  if (lookaheadChar == 0) {
    nextChar=getChar();
  }
 else {
    nextChar=lookaheadChar;
    lookaheadChar=0;
  }
  if (nextChar == '\012') {
    lines.addElement(new Integer(iChar));
  }
  iChar++;
}

Fixed version (ground truth):
private final void advance() throws java.io.IOException {
  if (lookaheadChar == 0) {
    nextChar=getChar();
  }
 else {
    nextChar=lookaheadChar;
    lookaheadChar=0;
  }
  if (nextChar == '\012') {
    lines.add(new Integer(iChar));
  }
  iChar++;
}
Program: 51570
Project: 51570
Buggy source:
synchronized RolapSchema get(String catalogName,String jdbcConnectString,String jdbcUser,String dataSource,Util.PropertyList connectInfo){
  String dynProc=connectInfo.get(RolapConnectionProperties.DynamicSchemaProcessor);
  if ((dynProc != null && dynProc.length() == 0) || catalogName.toLowerCase().startsWith("String_Node_Str")) {
    return new RolapSchema(catalogName,connectInfo);
  }
  final String key=makeKey(catalogName,jdbcConnectString,jdbcUser,dataSource);
  RolapSchema schema=(RolapSchema)mapUrlToSchema.get(key);
  if (schema == null) {
    schema=new RolapSchema(catalogName,connectInfo);
    mapUrlToSchema.put(key,schema);
  }
  return schema;
}

Fixed version (ground truth):
synchronized RolapSchema get(String catalogName,String jdbcConnectString,String jdbcUser,String dataSource,Util.PropertyList connectInfo){
  String dynProc=connectInfo.get(RolapConnectionProperties.DynamicSchemaProcessor);
  if ((dynProc != null && dynProc.length() > 0) || catalogName.toLowerCase().startsWith("String_Node_Str")) {
    return new RolapSchema(catalogName,connectInfo);
  }
  final String key=makeKey(catalogName,jdbcConnectString,jdbcUser,dataSource);
  RolapSchema schema=(RolapSchema)mapUrlToSchema.get(key);
  if (schema == null) {
    schema=new RolapSchema(catalogName,connectInfo);
    mapUrlToSchema.put(key,schema);
  }
  return schema;
}
Program: 51571
Project: 51571
Buggy source:
public void getMemberChildren(List parentMembers,List children){
  ArrayList missed=new ArrayList();
  for (Iterator it=parentMembers.iterator(); it.hasNext(); ) {
    RolapMember parent=(RolapMember)it.next();
    SoftCacheableReference ref=(SoftCacheableReference)mapMemberToChildren.get(parent);
    if (ref == null) {
      missed.add(parent);
    }
 else {
      ChildrenList v=(ChildrenList)ref.getCacheable();
      if (v == null) {
        it.remove();
        missed.add(parent);
      }
 else {
        children.addAll(v.list);
      }
    }
  }
  if (missed.size() > 0) {
    readMemberChildren(missed,children);
  }
}

Fixed version (ground truth):
public void getMemberChildren(List parentMembers,List children){
synchronized (CachePool.instance()) {
    ArrayList missed=new ArrayList();
    for (Iterator it=parentMembers.iterator(); it.hasNext(); ) {
      RolapMember parent=(RolapMember)it.next();
      SoftCacheableReference ref=(SoftCacheableReference)mapMemberToChildren.get(parent);
      if (ref == null) {
        missed.add(parent);
      }
 else {
        ChildrenList v=(ChildrenList)ref.getCacheable();
        if (v == null) {
          it.remove();
          missed.add(parent);
        }
 else {
          children.addAll(v.list);
        }
      }
    }
    if (missed.size() > 0) {
      readMemberChildren(missed,children);
    }
  }
}
Program: 51572
Project: 51572
Buggy source:
public OlapElement getElementChild(OlapElement parent,String s){
  OlapElement mdxElement=schemaReader.getElementChild(parent,s);
  if (mdxElement != null) {
    return mdxElement;
  }
  Iterator definedMembers=getDefinedMembers().iterator();
  while (definedMembers.hasNext()) {
    Member mdxMember=(Member)definedMembers.next();
    if (mdxMember.getName().equalsIgnoreCase(s)) {
      return mdxMember;
    }
  }
  for (int i=0; i < formulas.length; i++) {
    Formula formula=formulas[i];
    if (formula.isMember) {
      continue;
    }
    if (formula.names[0].equals(s)) {
      return formula.mdxSet;
    }
  }
  return mdxElement;
}

Fixed version (ground truth):
public OlapElement getElementChild(OlapElement parent,String s){
  OlapElement mdxElement=schemaReader.getElementChild(parent,s);
  if (mdxElement != null) {
    return mdxElement;
  }
  Iterator definedMembers=getDefinedMembers().iterator();
  definedMemberLoop:   while (definedMembers.hasNext()) {
    Member mdxMember=(Member)definedMembers.next();
    if (parent != null) {
      Level lev=mdxMember.getLevel();
      if (parent instanceof Level) {
        if (!parent.equals(lev))         continue definedMemberLoop;
      }
 else {
        Hierarchy hier=lev.getHierarchy();
        if (parent instanceof Hierarchy) {
          if (!parent.equals(hier))           continue definedMemberLoop;
        }
 else {
          Dimension dim=hier.getDimension();
          if (parent instanceof Dimension && !parent.equals(dim))           continue definedMemberLoop;
        }
      }
    }
    if (mdxMember.getName().equalsIgnoreCase(s)) {
      return mdxMember;
    }
  }
  for (int i=0; i < formulas.length; i++) {
    Formula formula=formulas[i];
    if (formula.isMember) {
      continue;
    }
    if (formula.names[0].equals(s)) {
      return formula.mdxSet;
    }
  }
  return mdxElement;
}
Program: 51574
Project: 51574
Buggy source:
public Member getHierarchyDefaultMember(Hierarchy hierarchy){
  Util.assertPrecondition(hierarchy != null,"String_Node_Str");
  RolapMember member=(RolapMember)hierarchy.getDefaultMember();
  final Role.HierarchyAccess hierarchyAccess=role.getAccessDetails(hierarchy);
  if (hierarchyAccess != null) {
    final Level level=member.getLevel();
    final int levelDepth=level.getDepth();
    final Level topLevel=hierarchyAccess.getTopLevel();
    final MemberReader unrestrictedMemberReader=((RolapHierarchy)hierarchy).memberReader;
    if (topLevel != null && topLevel.getDepth() > levelDepth) {
      ArrayList children=new ArrayList();
      do {
        unrestrictedMemberReader.getMemberChildren(member,children);
        Util.assertTrue(children.size() > 0);
        member=(RolapMember)children.get(0);
        children.clear();
      }
 while (member.getLevel() != topLevel);
      return member;
    }
    final Level bottomLevel=hierarchyAccess.getBottomLevel();
    if (bottomLevel != null && bottomLevel.getDepth() < levelDepth) {
      do {
        member=(RolapMember)member.getParentMember();
        Util.assertTrue(member != null);
      }
 while (member.getLevel() != bottomLevel);
      return member;
    }
  }
  return member;
}

Fixed version (ground truth):
public Member getHierarchyDefaultMember(Hierarchy hierarchy){
  Util.assertPrecondition(hierarchy != null,"String_Node_Str");
  Member[] rootMembers=this.getHierarchyRootMembers(hierarchy);
  if (rootMembers.length > 0)   return rootMembers[0];
  return null;
}
Program: 51575
Project: 51575
Buggy source:
public void testGrantHierarchyA(){
  Result result=execute(getRestrictedConnection(),"String_Node_Str" + nl + "String_Node_Str"+ nl+ "String_Node_Str");
  Assert.assertEquals("String_Node_Str" + nl + "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl,toString(result));
}

Fixed version (ground truth):
public void testGrantHierarchyA(){
  Result result=execute(getRestrictedConnection(false),"String_Node_Str" + nl + "String_Node_Str"+ nl+ "String_Node_Str");
  Assert.assertEquals("String_Node_Str" + nl + "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl,toString(result));
}
Program: 51576
Project: 51576
Buggy source:
/** 
 * Test that we only aggregate over SF, LA, even when called from functions. 
 */
public void testGrantHierarchy9(){
  Result result=execute(getRestrictedConnection(),"String_Node_Str" + "String_Node_Str" + nl + "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str");
  Assert.assertEquals("String_Node_Str" + nl + "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl,toString(result));
}

Fixed version (ground truth):
/** 
 * Test that we only aggregate over SF, LA, even when called from functions. 
 */
public void testGrantHierarchy9(){
  Result result=execute(getRestrictedConnection(false),"String_Node_Str" + "String_Node_Str" + nl + "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str");
  Assert.assertEquals("String_Node_Str" + nl + "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl+ "String_Node_Str"+ nl,toString(result));
}
Program: 51579
Project: 51579
Buggy source:
public Member getHierarchyDefaultMember(Hierarchy hierarchy){
  Util.assertPrecondition(hierarchy != null,"String_Node_Str");
  Member[] rootMembers=this.getHierarchyRootMembers(hierarchy);
  if (rootMembers.length > 0)   return rootMembers[0];
  return null;
}

Fixed version (ground truth):
public Member getHierarchyDefaultMember(Hierarchy hierarchy){
  Util.assertPrecondition(hierarchy != null,"String_Node_Str");
  if (role.getAccess(hierarchy) == Access.NONE)   return hierarchy.getDefaultMember();
  Member[] rootMembers=this.getHierarchyRootMembers(hierarchy);
  if (rootMembers.length > 0)   return rootMembers[0];
  return null;
}
Program: 51580
Project: 51580
Buggy source:
static List periodsToDate(Evaluator evaluator,Level level,Member member){
  if (member == null) {
    member=evaluator.getContext(level.getHierarchy().getDimension());
  }
  Member m=member;
  while (m != null) {
    if (m.getLevel() == level) {
      break;
    }
    m=m.getParentMember();
  }
  ArrayList members=new ArrayList();
  if (m != null)   evaluator.getSchemaReader().getMemberRange(level,m,member,members);
  return members;
}

Fixed version (ground truth):
static List periodsToDate(Evaluator evaluator,Level level,Member member){
  if (member == null) {
    member=evaluator.getContext(level.getHierarchy().getDimension());
  }
  Member m=member;
  while (m != null) {
    if (m.getLevel() == level) {
      break;
    }
    m=m.getParentMember();
  }
  ArrayList members=new ArrayList();
  if (m != null) {
    SchemaReader reader=evaluator.getSchemaReader();
    m=Util.getFirstDescendantOnLevel(reader,m,member.getLevel());
    reader.getMemberRange(level,m,member,members);
  }
  return members;
}