nus-yam/ex-repair huggingface dataset:
Program: 51120
Project: 51120
Buggy source:
public Calc compileCall(ResolvedFunCall call,ExpCompiler compiler){
  final ListCalc listCalc=compiler.compileList(call.getArg(0));
  final IntegerCalc integerCalc=call.getArgCount() > 1 ? compiler.compileInteger(call.getArg(1)) : ConstantCalc.constantInteger(1);
  if (head) {
    return new AbstractListCalc(call,new Calc[]{listCalc,integerCalc}){
      public List evaluateList(      Evaluator evaluator){
        List list=listCalc.evaluateList(evaluator);
        int count=integerCalc.evaluateInteger(evaluator);
        return head(count,list);
      }
    }
;
  }
 else {
    return new AbstractListCalc(call,new Calc[]{listCalc,integerCalc}){
      public List evaluateList(      Evaluator evaluator){
        List list=listCalc.evaluateList(evaluator);
        int count=integerCalc.evaluateInteger(evaluator);
        return tail(count,list);
      }
    }
;
  }
}

Fixed version (ground truth):
public Calc compileCall(ResolvedFunCall call,ExpCompiler compiler){
  final ListCalc listCalc=compiler.compileList(call.getArg(0));
  final IntegerCalc integerCalc=call.getArgCount() > 1 ? compiler.compileInteger(call.getArg(1)) : ConstantCalc.constantInteger(1);
  if (head) {
    return new AbstractListCalc(call,new Calc[]{listCalc,integerCalc}){
      public List evaluateList(      Evaluator evaluator){
        evaluator=evaluator.push(false);
        List list=listCalc.evaluateList(evaluator);
        int count=integerCalc.evaluateInteger(evaluator);
        return head(count,list);
      }
    }
;
  }
 else {
    return new AbstractListCalc(call,new Calc[]{listCalc,integerCalc}){
      public List evaluateList(      Evaluator evaluator){
        evaluator=evaluator.push(false);
        List list=listCalc.evaluateList(evaluator);
        int count=integerCalc.evaluateInteger(evaluator);
        return tail(count,list);
      }
    }
;
  }
}
Program: 51121
Project: 51121
Buggy source:
public List evaluateList(Evaluator evaluator){
  List list=listCalc.evaluateList(evaluator);
  int count=integerCalc.evaluateInteger(evaluator);
  return tail(count,list);
}

Fixed version (ground truth):
public List evaluateList(Evaluator evaluator){
  evaluator=evaluator.push(false);
  List list=listCalc.evaluateList(evaluator);
  int count=integerCalc.evaluateInteger(evaluator);
  return tail(count,list);
}
Program: 51122
Project: 51122
Buggy source:
protected static LinReg.Value process(Evaluator evaluator,ListCalc listCalc,DoubleCalc yCalc,DoubleCalc xCalc,boolean isTuples){
  List members=listCalc.evaluateList(evaluator);
  evaluator=evaluator.push();
  SetWrapper[] sws=evaluateSet(evaluator,members,new DoubleCalc[]{yCalc,xCalc},isTuples);
  SetWrapper swY=sws[0];
  SetWrapper swX=sws[1];
  if (swY.errorCount > 0) {
    debug("String_Node_Str","String_Node_Str" + swY.errorCount);
    return null;
  }
 else   if (swY.v.size() == 0) {
    return null;
  }
  return linearReg(swX.v,swY.v);
}

Fixed version (ground truth):
protected static LinReg.Value process(Evaluator evaluator,ListCalc listCalc,DoubleCalc yCalc,DoubleCalc xCalc,boolean isTuples){
  List members=listCalc.evaluateList(evaluator.push(false));
  evaluator=evaluator.push();
  SetWrapper[] sws=evaluateSet(evaluator,members,new DoubleCalc[]{yCalc,xCalc},isTuples);
  SetWrapper swY=sws[0];
  SetWrapper swX=sws[1];
  if (swY.errorCount > 0) {
    debug("String_Node_Str","String_Node_Str" + swY.errorCount);
    return null;
  }
 else   if (swY.v.size() == 0) {
    return null;
  }
  return linearReg(swX.v,swY.v);
}
Program: 51123
Project: 51123
Buggy source:
public double evaluateDouble(Evaluator evaluator){
  List memberList=evaluateCurrentList(listCalc,evaluator);
  return percentile(evaluator.push(),memberList,calc,0.5);
}

Fixed version (ground truth):
public double evaluateDouble(Evaluator evaluator){
  List memberList=evaluateCurrentList(listCalc,evaluator);
  return percentile(evaluator.push(false),memberList,calc,0.5);
}
Program: 51124
Project: 51124
Buggy source:
public Calc compileCall(ResolvedFunCall call,ExpCompiler compiler){
  final ListCalc listCalc=compiler.compileList(call.getArg(0));
  final Calc calc=call.getArgCount() > 1 ? compiler.compileScalar(call.getArg(1),true) : new ValueCalc(call);
  return new AbstractDoubleCalc(call,new Calc[]{listCalc,calc}){
    public double evaluateDouble(    Evaluator evaluator){
      List memberList=evaluateCurrentList(listCalc,evaluator);
      return percentile(evaluator.push(),memberList,calc,0.5);
    }
    public boolean dependsOn(    Dimension dimension){
      return anyDependsButFirst(getCalcs(),dimension);
    }
  }
;
}

Fixed version (ground truth):
public Calc compileCall(ResolvedFunCall call,ExpCompiler compiler){
  final ListCalc listCalc=compiler.compileList(call.getArg(0));
  final Calc calc=call.getArgCount() > 1 ? compiler.compileScalar(call.getArg(1),true) : new ValueCalc(call);
  return new AbstractDoubleCalc(call,new Calc[]{listCalc,calc}){
    public double evaluateDouble(    Evaluator evaluator){
      List memberList=evaluateCurrentList(listCalc,evaluator);
      return percentile(evaluator.push(false),memberList,calc,0.5);
    }
    public boolean dependsOn(    Dimension dimension){
      return anyDependsButFirst(getCalcs(),dimension);
    }
  }
;
}
Program: 51125
Project: 51125
Buggy source:
public double evaluateDouble(Evaluator evaluator){
  List memberList=evaluateCurrentList(listCalc,evaluator);
  return (Double)(max ? max(evaluator.push(),memberList,calc) : min(evaluator.push(),memberList,calc));
}

Fixed version (ground truth):
public double evaluateDouble(Evaluator evaluator){
  List memberList=evaluateCurrentList(listCalc,evaluator);
  return (Double)(max ? max(evaluator.push(false),memberList,calc) : min(evaluator.push(false),memberList,calc));
}
Program: 51126
Project: 51126
Buggy source:
public Calc compileCall(ResolvedFunCall call,ExpCompiler compiler){
  final ListCalc listCalc=compiler.compileList(call.getArg(0));
  final Calc calc=call.getArgCount() > 1 ? compiler.compileScalar(call.getArg(1),true) : new ValueCalc(call);
  return new AbstractDoubleCalc(call,new Calc[]{listCalc,calc}){
    public double evaluateDouble(    Evaluator evaluator){
      List memberList=evaluateCurrentList(listCalc,evaluator);
      return (Double)(max ? max(evaluator.push(),memberList,calc) : min(evaluator.push(),memberList,calc));
    }
    public boolean dependsOn(    Dimension dimension){
      return anyDependsButFirst(getCalcs(),dimension);
    }
  }
;
}

Fixed version (ground truth):
public Calc compileCall(ResolvedFunCall call,ExpCompiler compiler){
  final ListCalc listCalc=compiler.compileList(call.getArg(0));
  final Calc calc=call.getArgCount() > 1 ? compiler.compileScalar(call.getArg(1),true) : new ValueCalc(call);
  return new AbstractDoubleCalc(call,new Calc[]{listCalc,calc}){
    public double evaluateDouble(    Evaluator evaluator){
      List memberList=evaluateCurrentList(listCalc,evaluator);
      return (Double)(max ? max(evaluator.push(false),memberList,calc) : min(evaluator.push(false),memberList,calc));
    }
    public boolean dependsOn(    Dimension dimension){
      return anyDependsButFirst(getCalcs(),dimension);
    }
  }
;
}
Program: 51127
Project: 51127
Buggy source:
public Calc compileCall(final ResolvedFunCall call,ExpCompiler compiler){
  final ListCalc listCalc1=compiler.compileList(call.getArg(0));
  final ListCalc listCalc2=compiler.compileList(call.getArg(1));
  return new AbstractListCalc(call,new Calc[]{listCalc1,listCalc2},false){
    public List evaluateList(    Evaluator evaluator){
      SchemaReader schemaReader=evaluator.getSchemaReader();
      evaluator.setNonEmpty(true);
      NativeEvaluator nativeEvaluator=schemaReader.getNativeSetEvaluator(call.getFunDef(),call.getArgs(),evaluator,this);
      if (nativeEvaluator != null) {
        return (List)nativeEvaluator.execute(ResultStyle.LIST);
      }
      final List list1=listCalc1.evaluateList(evaluator);
      if (list1.isEmpty()) {
        return Collections.EMPTY_LIST;
      }
      final List list2=listCalc2.evaluateList(evaluator);
      evaluator=evaluator.push();
      evaluator.setNonEmpty(true);
      List<Member[]> result=crossJoin(list1,list2);
      result=nonEmptyList(evaluator,result,call);
      return result;
    }
    public boolean dependsOn(    Dimension dimension){
      if (super.dependsOn(dimension)) {
        return true;
      }
      if (listCalc1.getType().usesDimension(dimension,true)) {
        return false;
      }
      if (listCalc2.getType().usesDimension(dimension,true)) {
        return false;
      }
      return true;
    }
  }
;
}

Fixed version (ground truth):
public Calc compileCall(final ResolvedFunCall call,ExpCompiler compiler){
  final ListCalc listCalc1=compiler.compileList(call.getArg(0));
  final ListCalc listCalc2=compiler.compileList(call.getArg(1));
  return new AbstractListCalc(call,new Calc[]{listCalc1,listCalc2},false){
    public List evaluateList(    Evaluator evaluator){
      SchemaReader schemaReader=evaluator.getSchemaReader();
      evaluator=evaluator.push(true);
      NativeEvaluator nativeEvaluator=schemaReader.getNativeSetEvaluator(call.getFunDef(),call.getArgs(),evaluator,this);
      if (nativeEvaluator != null) {
        return (List)nativeEvaluator.execute(ResultStyle.LIST);
      }
      final List list1=listCalc1.evaluateList(evaluator);
      if (list1.isEmpty()) {
        return Collections.EMPTY_LIST;
      }
      final List list2=listCalc2.evaluateList(evaluator);
      List<Member[]> result=crossJoin(list1,list2);
      result=nonEmptyList(evaluator,result,call);
      return result;
    }
    public boolean dependsOn(    Dimension dimension){
      if (super.dependsOn(dimension)) {
        return true;
      }
      if (listCalc1.getType().usesDimension(dimension,true)) {
        return false;
      }
      if (listCalc2.getType().usesDimension(dimension,true)) {
        return false;
      }
      return true;
    }
  }
;
}
Program: 51128
Project: 51128
Buggy source:
public List evaluateList(Evaluator evaluator){
  SchemaReader schemaReader=evaluator.getSchemaReader();
  evaluator.setNonEmpty(true);
  NativeEvaluator nativeEvaluator=schemaReader.getNativeSetEvaluator(call.getFunDef(),call.getArgs(),evaluator,this);
  if (nativeEvaluator != null) {
    return (List)nativeEvaluator.execute(ResultStyle.LIST);
  }
  final List list1=listCalc1.evaluateList(evaluator);
  if (list1.isEmpty()) {
    return Collections.EMPTY_LIST;
  }
  final List list2=listCalc2.evaluateList(evaluator);
  evaluator=evaluator.push();
  evaluator.setNonEmpty(true);
  List<Member[]> result=crossJoin(list1,list2);
  result=nonEmptyList(evaluator,result,call);
  return result;
}

Fixed version (ground truth):
public List evaluateList(Evaluator evaluator){
  SchemaReader schemaReader=evaluator.getSchemaReader();
  evaluator=evaluator.push(true);
  NativeEvaluator nativeEvaluator=schemaReader.getNativeSetEvaluator(call.getFunDef(),call.getArgs(),evaluator,this);
  if (nativeEvaluator != null) {
    return (List)nativeEvaluator.execute(ResultStyle.LIST);
  }
  final List list1=listCalc1.evaluateList(evaluator);
  if (list1.isEmpty()) {
    return Collections.EMPTY_LIST;
  }
  final List list2=listCalc2.evaluateList(evaluator);
  List<Member[]> result=crossJoin(list1,list2);
  result=nonEmptyList(evaluator,result,call);
  return result;
}
Program: 51129
Project: 51129
Buggy source:
public List<Member[]> evaluateTupleList(Evaluator evaluator){
  final Iterable<Member[]> iterable=iterCalc.evaluateTupleIterable(evaluator);
  final List<Member[]> list=iterable instanceof List && false ? Util.<Member[]>cast((List)iterable) : null;
  if (originalKeySpecCount == 1) {
    Flag sortKeyDir=keySpecList.get(0).getDirection();
    return sortTuples(evaluator.push(),iterable,list,sortKeyCalcList[1],sortKeyDir.descending,sortKeyDir.brk,arity);
  }
 else {
    purgeKeySpecList(keySpecList,list);
    if (!keySpecList.isEmpty()) {
      return sortTuples(evaluator.push(),iterable,list,keySpecList,arity);
    }
 else {
      return list;
    }
  }
}

Fixed version (ground truth):
public List<Member[]> evaluateTupleList(Evaluator evaluator){
  final Iterable<Member[]> iterable=iterCalc.evaluateTupleIterable(evaluator);
  final List<Member[]> list=iterable instanceof List && false ? Util.<Member[]>cast((List)iterable) : null;
  if (originalKeySpecCount == 1) {
    Flag sortKeyDir=keySpecList.get(0).getDirection();
    return sortTuples(evaluator.push(false),iterable,list,sortKeyCalcList[1],sortKeyDir.descending,sortKeyDir.brk,arity);
  }
 else {
    purgeKeySpecList(keySpecList,list);
    if (!keySpecList.isEmpty()) {
      return sortTuples(evaluator.push(false),iterable,list,keySpecList,arity);
    }
 else {
      return list;
    }
  }
}
Program: 51130
Project: 51130
Buggy source:
public List<Member> evaluateMemberList(Evaluator evaluator){
  final Iterable<Member> iterable=listCalc.evaluateMemberIterable(evaluator);
  final List<Member> list=null;
  if (originalKeySpecCount == 1) {
    Flag sortKeyDir=keySpecList.get(0).getDirection();
    return sortMembers(evaluator.push(),iterable,list,sortKeyCalcList[1],sortKeyDir.descending,sortKeyDir.brk);
  }
 else {
    purgeKeySpecList(keySpecList,list);
    if (!keySpecList.isEmpty()) {
      return sortMembers(evaluator.push(),iterable,list,keySpecList);
    }
 else {
      return list;
    }
  }
}

Fixed version (ground truth):
public List<Member> evaluateMemberList(Evaluator evaluator){
  final Iterable<Member> iterable=listCalc.evaluateMemberIterable(evaluator);
  final List<Member> list=null;
  if (originalKeySpecCount == 1) {
    Flag sortKeyDir=keySpecList.get(0).getDirection();
    return sortMembers(evaluator.push(false),iterable,list,sortKeyCalcList[1],sortKeyDir.descending,sortKeyDir.brk);
  }
 else {
    purgeKeySpecList(keySpecList,list);
    if (!keySpecList.isEmpty()) {
      return sortMembers(evaluator.push(false),iterable,list,keySpecList);
    }
 else {
      return list;
    }
  }
}
Program: 51131
Project: 51131
Buggy source:
public double evaluateDouble(Evaluator evaluator){
  List memberList=evaluateCurrentList(listCalc,evaluator);
  double percent=percentCalc.evaluateDouble(evaluator) * 0.01;
  return percentile(evaluator.push(),memberList,calc,percent);
}

Fixed version (ground truth):
public double evaluateDouble(Evaluator evaluator){
  List memberList=evaluateCurrentList(listCalc,evaluator);
  double percent=percentCalc.evaluateDouble(evaluator) * 0.01;
  return percentile(evaluator.push(false),memberList,calc,percent);
}
Program: 51132
Project: 51132
Buggy source:
public Calc compileCall(ResolvedFunCall call,ExpCompiler compiler){
  final ListCalc listCalc=compiler.compileList(call.getArg(0));
  final Calc calc=compiler.compileScalar(call.getArg(1),true);
  final DoubleCalc percentCalc=compiler.compileDouble(call.getArg(2));
  return new AbstractDoubleCalc(call,new Calc[]{listCalc,calc,percentCalc}){
    public double evaluateDouble(    Evaluator evaluator){
      List memberList=evaluateCurrentList(listCalc,evaluator);
      double percent=percentCalc.evaluateDouble(evaluator) * 0.01;
      return percentile(evaluator.push(),memberList,calc,percent);
    }
    public boolean dependsOn(    Dimension dimension){
      return anyDependsButFirst(getCalcs(),dimension);
    }
  }
;
}

Fixed version (ground truth):
public Calc compileCall(ResolvedFunCall call,ExpCompiler compiler){
  final ListCalc listCalc=compiler.compileList(call.getArg(0));
  final Calc calc=compiler.compileScalar(call.getArg(1),true);
  final DoubleCalc percentCalc=compiler.compileDouble(call.getArg(2));
  return new AbstractDoubleCalc(call,new Calc[]{listCalc,calc,percentCalc}){
    public double evaluateDouble(    Evaluator evaluator){
      List memberList=evaluateCurrentList(listCalc,evaluator);
      double percent=percentCalc.evaluateDouble(evaluator) * 0.01;
      return percentile(evaluator.push(false),memberList,calc,percent);
    }
    public boolean dependsOn(    Dimension dimension){
      return anyDependsButFirst(getCalcs(),dimension);
    }
  }
;
}
Program: 51133
Project: 51133
Buggy source:
public double evaluateDouble(Evaluator evaluator){
  List memberList=evaluateCurrentList(listCalc,evaluator);
  return (Double)stdev(evaluator.push(),memberList,calc,false);
}

Fixed version (ground truth):
public double evaluateDouble(Evaluator evaluator){
  List memberList=evaluateCurrentList(listCalc,evaluator);
  return (Double)stdev(evaluator.push(false),memberList,calc,false);
}
Program: 51134
Project: 51134
Buggy source:
public Calc compileCall(ResolvedFunCall call,ExpCompiler compiler){
  final ListCalc listCalc=compiler.compileList(call.getArg(0));
  final Calc calc=call.getArgCount() > 1 ? compiler.compileScalar(call.getArg(1),true) : new ValueCalc(call);
  return new AbstractDoubleCalc(call,new Calc[]{listCalc,calc}){
    public double evaluateDouble(    Evaluator evaluator){
      List memberList=evaluateCurrentList(listCalc,evaluator);
      return (Double)stdev(evaluator.push(),memberList,calc,false);
    }
    public boolean dependsOn(    Dimension dimension){
      return anyDependsButFirst(getCalcs(),dimension);
    }
  }
;
}

Fixed version (ground truth):
public Calc compileCall(ResolvedFunCall call,ExpCompiler compiler){
  final ListCalc listCalc=compiler.compileList(call.getArg(0));
  final Calc calc=call.getArgCount() > 1 ? compiler.compileScalar(call.getArg(1),true) : new ValueCalc(call);
  return new AbstractDoubleCalc(call,new Calc[]{listCalc,calc}){
    public double evaluateDouble(    Evaluator evaluator){
      List memberList=evaluateCurrentList(listCalc,evaluator);
      return (Double)stdev(evaluator.push(false),memberList,calc,false);
    }
    public boolean dependsOn(    Dimension dimension){
      return anyDependsButFirst(getCalcs(),dimension);
    }
  }
;
}
Program: 51135
Project: 51135
Buggy source:
public double evaluateDouble(Evaluator evaluator){
  List memberList=evaluateCurrentList(listCalc,evaluator);
  return (Double)stdev(evaluator.push(),memberList,calc,true);
}

Fixed version (ground truth):
public double evaluateDouble(Evaluator evaluator){
  List memberList=evaluateCurrentList(listCalc,evaluator);
  return (Double)stdev(evaluator.push(false),memberList,calc,true);
}
Program: 51136
Project: 51136
Buggy source:
public Calc compileCall(ResolvedFunCall call,ExpCompiler compiler){
  final ListCalc listCalc=compiler.compileList(call.getArg(0));
  final Calc calc=call.getArgCount() > 1 ? compiler.compileScalar(call.getArg(1),true) : new ValueCalc(call);
  return new AbstractDoubleCalc(call,new Calc[]{listCalc,calc}){
    public double evaluateDouble(    Evaluator evaluator){
      List memberList=evaluateCurrentList(listCalc,evaluator);
      return (Double)stdev(evaluator.push(),memberList,calc,true);
    }
    public boolean dependsOn(    Dimension dimension){
      return anyDependsButFirst(getCalcs(),dimension);
    }
  }
;
}

Fixed version (ground truth):
public Calc compileCall(ResolvedFunCall call,ExpCompiler compiler){
  final ListCalc listCalc=compiler.compileList(call.getArg(0));
  final Calc calc=call.getArgCount() > 1 ? compiler.compileScalar(call.getArg(1),true) : new ValueCalc(call);
  return new AbstractDoubleCalc(call,new Calc[]{listCalc,calc}){
    public double evaluateDouble(    Evaluator evaluator){
      List memberList=evaluateCurrentList(listCalc,evaluator);
      return (Double)stdev(evaluator.push(false),memberList,calc,true);
    }
    public boolean dependsOn(    Dimension dimension){
      return anyDependsButFirst(getCalcs(),dimension);
    }
  }
;
}
Program: 51137
Project: 51137
Buggy source:
/** 
 * Returns whether another Batch can be batched to this Batch. <p>This is possible if: <li>columns list is super set of other batch's constraint columns; and <li>both have same Fact Table; and <li>matching columns of this and other batch has the same value; and <li>non matching columns of this batch have ALL VALUES </ul>
 */
boolean canBatch(Batch other){
  return hasOverlappingBitKeys(other) && constraintsMatch(other) && hasSameMeasureList(other)&& haveSameStarAndAggregation(other);
}

Fixed version (ground truth):
/** 
 * Returns whether another Batch can be batched to this Batch. <p>This is possible if: <li>columns list is super set of other batch's constraint columns; and <li>both have same Fact Table; and <li>matching columns of this and other batch has the same value; and <li>non matching columns of this batch have ALL VALUES </ul>
 */
boolean canBatch(Batch other){
  return hasOverlappingBitKeys(other) && constraintsMatch(other) && hasSameMeasureList(other)&& !hasDistinctCountMeasure()&& !other.hasDistinctCountMeasure()&& haveSameStarAndAggregation(other);
}
Program: 51138
Project: 51138
Buggy source:
static List head(final int count,final List members){
}

Fixed version (ground truth):
static <T>List<T> head(final int count,final List<T> members){
}
Program: 51139
Project: 51139
Buggy source:
static List tail(final int count,final List members){
}

Fixed version (ground truth):
static <T>List<T> tail(final int count,final List<T> members){
}
Program: 51140
Project: 51140
Buggy source:
private void resetWorkbench(){
  Iterator theSchemaFrames=schemaWindowMap.keySet().iterator();
  while (theSchemaFrames.hasNext()) {
    JInternalFrame theSchemaFrame=(JInternalFrame)theSchemaFrames.next();
    SchemaExplorer theSchemaExplorer=(SchemaExplorer)theSchemaFrame.getContentPane().getComponent(0);
    File theFile=theSchemaExplorer.getSchemaFile();
    checkSchemaFile(theFile);
    jdbcMetaData=new JDBCMetaData(this,jdbcDriverClassName,jdbcConnectionUrl,jdbcUsername,jdbcPassword,jdbcSchema,requireSchema);
    theSchemaExplorer.resetMetaData(jdbcMetaData);
    theSchemaFrame.updateUI();
  }
  displayWarningOnFailedConnection();
}

Fixed version (ground truth):
private void resetWorkbench(){
  jdbcMetaData=new JDBCMetaData(this,jdbcDriverClassName,jdbcConnectionUrl,jdbcUsername,jdbcPassword,jdbcSchema,requireSchema);
  Iterator theSchemaFrames=schemaWindowMap.keySet().iterator();
  while (theSchemaFrames.hasNext()) {
    JInternalFrame theSchemaFrame=(JInternalFrame)theSchemaFrames.next();
    SchemaExplorer theSchemaExplorer=(SchemaExplorer)theSchemaFrame.getContentPane().getComponent(0);
    File theFile=theSchemaExplorer.getSchemaFile();
    checkSchemaFile(theFile);
    theSchemaExplorer.resetMetaData(jdbcMetaData);
    theSchemaFrame.updateUI();
  }
  displayWarningOnFailedConnection();
}
Program: 51144
Project: 51144
Buggy source:
private void checkSchemaFile(File file){
  try {
    PropertyList list=new PropertyList();
    list.put("String_Node_Str","String_Node_Str");
    list.put("String_Node_Str",jdbcConnectionUrl);
    list.put("String_Node_Str",file.toURL().toString());
    list.put("String_Node_Str",jdbcDriverClassName);
    if (jdbcUsername != null && jdbcUsername.length() > 0) {
      list.put("String_Node_Str",jdbcUsername);
    }
    if (jdbcPassword != null && jdbcPassword.length() > 0) {
      list.put("String_Node_Str",jdbcPassword);
    }
    DriverManager.getConnection(list,null);
  }
 catch (  Exception ex) {
    LOGGER.error("String_Node_Str" + file.getAbsolutePath() + "String_Node_Str"+ ex.getMessage(),ex);
  }
catch (  Error err) {
    LOGGER.error("String_Node_Str" + file.getAbsolutePath() + "String_Node_Str"+ err.getMessage(),err);
  }
}

Fixed version (ground truth):
private void checkSchemaFile(File file){
  try {
    PropertyList list=new PropertyList();
    list.put("String_Node_Str","String_Node_Str");
    list.put("String_Node_Str",jdbcConnectionUrl);
    list.put("String_Node_Str",file.toURL().toString());
    list.put("String_Node_Str",jdbcDriverClassName);
    if (jdbcUsername != null && jdbcUsername.length() > 0) {
      list.put("String_Node_Str",jdbcUsername);
    }
    if (jdbcPassword != null && jdbcPassword.length() > 0) {
      list.put("String_Node_Str",jdbcPassword);
    }
    AggregationManager.instance().getCacheControl(null).flushSchemaCache();
    DriverManager.getConnection(list,null);
  }
 catch (  Exception ex) {
    LOGGER.error("String_Node_Str" + file.getAbsolutePath() + "String_Node_Str"+ ex.getMessage(),ex);
  }
catch (  Error err) {
    LOGGER.error("String_Node_Str" + file.getAbsolutePath() + "String_Node_Str"+ err.getMessage(),err);
  }
}
Program: 51145
Project: 51145
Buggy source:
private void tileMenuItemActionPerformed(java.awt.event.ActionEvent evt){
  Dimension dsize=desktopPane.getSize();
  int desktopW=(int)dsize.getWidth();
  int desktopH=(int)dsize.getHeight();
  int darea=(int)(desktopW * desktopH);
  double eacharea=darea / (schemaWindowMap.size() + mdxWindows.size());
  int wh=(int)Math.sqrt(eacharea);
  Iterator[] its=new Iterator[2];
  its[0]=schemaWindowMap.keySet().iterator();
  its[1]=mdxWindows.iterator();
  JInternalFrame sf=null;
  int x=0, y=0;
  try {
    for (int i=0; i < its.length; i++) {
      Iterator it=its[i];
      while (it.hasNext()) {
        sf=(JInternalFrame)it.next();
        if (sf != null) {
          if (sf.isIcon()) {
          }
 else {
            sf.setMaximum(false);
            sf.moveToFront();
            if ((x >= desktopW) || (((desktopW - x) * wh) < (eacharea / 2))) {
              y+=wh;
              x=0;
            }
            int sfwidth=((x + wh) < desktopW ? wh : desktopW - x);
            int sfheight=((y + wh) < desktopH ? wh : desktopH - y);
            sf.setBounds(x,y,sfwidth,sfheight);
            x+=sfwidth;
          }
        }
      }
    }
  }
 catch (  Exception ex) {
    LOGGER.error("String_Node_Str",ex);
  }
}

Fixed version (ground truth):
private void tileMenuItemActionPerformed(java.awt.event.ActionEvent evt){
  Dimension dsize=desktopPane.getSize();
  int desktopW=(int)dsize.getWidth();
  int desktopH=(int)dsize.getHeight();
  int darea=(int)(desktopW * desktopH);
  double eacharea=darea / (schemaWindowMap.size() + mdxWindows.size() + jdbcWindows.size());
  int wh=(int)Math.sqrt(eacharea);
  Iterator[] its=new Iterator[3];
  its[0]=schemaWindowMap.keySet().iterator();
  its[1]=mdxWindows.iterator();
  its[2]=jdbcWindows.iterator();
  JInternalFrame sf=null;
  int x=0, y=0;
  try {
    for (int i=0; i < its.length; i++) {
      Iterator it=its[i];
      while (it.hasNext()) {
        sf=(JInternalFrame)it.next();
        if (sf != null) {
          if (sf.isIcon()) {
          }
 else {
            sf.setMaximum(false);
            sf.moveToFront();
            if ((x >= desktopW) || (((desktopW - x) * wh) < (eacharea / 2))) {
              y+=wh;
              x=0;
            }
            int sfwidth=((x + wh) < desktopW ? wh : desktopW - x);
            int sfheight=((y + wh) < desktopH ? wh : desktopH - y);
            sf.setBounds(x,y,sfwidth,sfheight);
            x+=sfwidth;
          }
        }
      }
    }
  }
 catch (  Exception ex) {
    LOGGER.error("String_Node_Str",ex);
  }
}
Program: 51146
Project: 51146
Buggy source:
private void cascadeMenuItemActionPerformed(java.awt.event.ActionEvent evt){
  Iterator[] its=new Iterator[2];
  its[0]=schemaWindowMap.keySet().iterator();
  its[1]=mdxWindows.iterator();
  int sfi=1;
  JInternalFrame sf=null;
  try {
    for (int i=0; i < its.length; i++) {
      Iterator it=its[i];
      while (it.hasNext()) {
        sf=(JInternalFrame)it.next();
        if (sf != null) {
          if (sf.isIcon()) {
          }
 else {
            sf.setMaximum(false);
            sf.setLocation(30 * sfi,30 * sfi);
            sf.moveToFront();
            sf.setSelected(true);
            sfi++;
          }
        }
      }
    }
  }
 catch (  Exception ex) {
    LOGGER.error("String_Node_Str",ex);
  }
}

Fixed version (ground truth):
private void cascadeMenuItemActionPerformed(java.awt.event.ActionEvent evt){
  Iterator[] its=new Iterator[3];
  its[0]=schemaWindowMap.keySet().iterator();
  its[1]=mdxWindows.iterator();
  its[2]=jdbcWindows.iterator();
  int sfi=1;
  JInternalFrame sf=null;
  try {
    for (int i=0; i < its.length; i++) {
      Iterator it=its[i];
      while (it.hasNext()) {
        sf=(JInternalFrame)it.next();
        if (sf != null) {
          if (sf.isIcon()) {
          }
 else {
            sf.setMaximum(false);
            sf.setLocation(30 * sfi,30 * sfi);
            sf.moveToFront();
            sf.setSelected(true);
            sfi++;
          }
        }
      }
    }
  }
 catch (  Exception ex) {
    LOGGER.error("String_Node_Str",ex);
  }
}
Program: 51147
Project: 51147
Buggy source:
private void minimizeMenuItemActionPerformed(java.awt.event.ActionEvent evt){
  Iterator[] its=new Iterator[2];
  its[0]=schemaWindowMap.keySet().iterator();
  its[1]=mdxWindows.iterator();
  JInternalFrame sf;
  try {
    for (int i=0; i < its.length; i++) {
      Iterator it=its[i];
      while (it.hasNext()) {
        sf=(JInternalFrame)it.next();
        if (sf != null) {
          if (sf.isIcon()) {
          }
 else {
            sf.setIcon(true);
          }
        }
      }
    }
  }
 catch (  Exception ex) {
    LOGGER.error("String_Node_Str",ex);
  }
}

Fixed version (ground truth):
private void minimizeMenuItemActionPerformed(java.awt.event.ActionEvent evt){
  Iterator[] its=new Iterator[3];
  its[0]=schemaWindowMap.keySet().iterator();
  its[1]=mdxWindows.iterator();
  its[2]=jdbcWindows.iterator();
  JInternalFrame sf;
  try {
    for (int i=0; i < its.length; i++) {
      Iterator it=its[i];
      while (it.hasNext()) {
        sf=(JInternalFrame)it.next();
        if (sf != null) {
          if (sf.isIcon()) {
          }
 else {
            sf.setIcon(true);
          }
        }
      }
    }
  }
 catch (  Exception ex) {
    LOGGER.error("String_Node_Str",ex);
  }
}
Program: 51148
Project: 51148
Buggy source:
private void closeAllSchemaFrames(boolean exitAfterClose){
  Object[][] its=new Object[2][];
  its[0]=schemaWindowMap.keySet().toArray();
  its[1]=mdxWindows.toArray();
  JInternalFrame sf=null;
  try {
    for (int i=0; i < its.length; i++) {
      for (int j=0; j < its[i].length; j++) {
        sf=(JInternalFrame)its[i][j];
        if (sf != null) {
          if (sf.getContentPane().getComponent(0) instanceof SchemaExplorer) {
            SchemaExplorer se=(SchemaExplorer)sf.getContentPane().getComponent(0);
            sf.setSelected(true);
            int response=confirmFrameClose(sf,se);
            if (response == 2) {
              return;
            }
            if (response == 3) {
              sf.setClosed(true);
            }
          }
        }
      }
    }
    if (((schemaWindowMap.keySet().size()) == 0) && exitAfterClose) {
      System.exit(0);
    }
  }
 catch (  Exception ex) {
    LOGGER.error("String_Node_Str",ex);
  }
}

Fixed version (ground truth):
private void closeAllSchemaFrames(boolean exitAfterClose){
  Object[][] its=new Object[3][];
  its[0]=schemaWindowMap.keySet().toArray();
  its[1]=mdxWindows.toArray();
  its[2]=jdbcWindows.toArray();
  JInternalFrame sf=null;
  try {
    for (int i=0; i < its.length; i++) {
      for (int j=0; j < its[i].length; j++) {
        sf=(JInternalFrame)its[i][j];
        if (sf != null) {
          if (sf.getContentPane().getComponent(0) instanceof SchemaExplorer) {
            SchemaExplorer se=(SchemaExplorer)sf.getContentPane().getComponent(0);
            sf.setSelected(true);
            int response=confirmFrameClose(sf,se);
            if (response == 2) {
              return;
            }
            if (response == 3) {
              sf.setClosed(true);
            }
          }
 else {
            sf.setClosed(true);
          }
        }
      }
    }
    if (((schemaWindowMap.keySet().size()) == 0) && exitAfterClose) {
      System.exit(0);
    }
  }
 catch (  Exception ex) {
    LOGGER.error("String_Node_Str",ex);
  }
}
Program: 51149
Project: 51149
Buggy source:
private void maximizeMenuItemActionPerformed(java.awt.event.ActionEvent evt){
  Iterator[] its=new Iterator[2];
  its[0]=schemaWindowMap.keySet().iterator();
  its[1]=mdxWindows.iterator();
  JInternalFrame sf;
  try {
    for (int i=0; i < its.length; i++) {
      Iterator it=its[i];
      while (it.hasNext()) {
        sf=(JInternalFrame)it.next();
        if (sf != null) {
          sf.setIcon(false);
          sf.setMaximum(true);
        }
      }
    }
  }
 catch (  Exception ex) {
    LOGGER.error("String_Node_Str",ex);
  }
}

Fixed version (ground truth):
private void maximizeMenuItemActionPerformed(java.awt.event.ActionEvent evt){
  Iterator[] its=new Iterator[3];
  its[0]=schemaWindowMap.keySet().iterator();
  its[1]=mdxWindows.iterator();
  its[2]=jdbcWindows.iterator();
  JInternalFrame sf;
  try {
    for (int i=0; i < its.length; i++) {
      Iterator it=its[i];
      while (it.hasNext()) {
        sf=(JInternalFrame)it.next();
        if (sf != null) {
          sf.setIcon(false);
          sf.setMaximum(true);
        }
      }
    }
  }
 catch (  Exception ex) {
    LOGGER.error("String_Node_Str",ex);
  }
}
Program: 51151
Project: 51151
Buggy source:
public Member createMember(Member parent,Level level,String name,Formula formula){
  RolapLevel rolapLevel=((RolapCubeLevel)level).getRolapLevel();
  if (formula == null) {
    RolapMember member=new RolapMember((RolapMember)parent,rolapLevel,name);
    return new RolapCubeMember((RolapCubeMember)parent,member,(RolapCubeLevel)level,parentDimension.getCube());
  }
 else   if (level.getDimension().isMeasures()) {
    RolapCalculatedMeasure member=new RolapCalculatedMeasure((RolapMember)parent,rolapLevel,name,formula);
    return new RolapCubeMember((RolapCubeMember)parent,member,(RolapCubeLevel)level,parentDimension.getCube());
  }
 else {
    RolapCalculatedMember member=new RolapCalculatedMember((RolapMember)parent,rolapLevel,name,formula);
    return new RolapCubeMember((RolapCubeMember)parent,member,(RolapCubeLevel)level,parentDimension.getCube());
  }
}

Fixed version (ground truth):
public Member createMember(Member parent,Level level,String name,Formula formula){
  RolapLevel rolapLevel=((RolapCubeLevel)level).getRolapLevel();
  if (formula == null) {
    RolapMember rolapParent=null;
    if (parent != null) {
      rolapParent=((RolapCubeMember)parent).getRolapMember();
    }
    RolapMember member=new RolapMember(rolapParent,rolapLevel,name);
    return new RolapCubeMember((RolapCubeMember)parent,member,(RolapCubeLevel)level,parentDimension.getCube());
  }
 else   if (level.getDimension().isMeasures()) {
    RolapCalculatedMeasure member=new RolapCalculatedMeasure((RolapMember)parent,rolapLevel,name,formula);
    return new RolapCubeMember((RolapCubeMember)parent,member,(RolapCubeLevel)level,parentDimension.getCube());
  }
 else {
    RolapCalculatedMember member=new RolapCalculatedMember((RolapMember)parent,rolapLevel,name,formula);
    return new RolapCubeMember((RolapCubeMember)parent,member,(RolapCubeLevel)level,parentDimension.getCube());
  }
}
Program: 51152
Project: 51152
Buggy source:
public RolapMember makeMember(RolapMember parentMember,RolapLevel childLevel,Object value,Object captionValue,boolean parentChild,ResultSet resultSet,Object key,int columnOffset) throws SQLException {
  RolapMember member=super.makeMember(parentMember,((RolapCubeLevel)childLevel).getRolapLevel(),value,captionValue,parentChild,resultSet,key,columnOffset);
  return memberReader.lookupCubeMember((RolapCubeMember)parentMember,member,(RolapCubeLevel)childLevel);
}

Fixed version (ground truth):
public RolapMember makeMember(RolapMember parentMember,RolapLevel childLevel,Object value,Object captionValue,boolean parentChild,ResultSet resultSet,Object key,int columnOffset) throws SQLException {
  RolapMember parent=null;
  if (parentMember != null) {
    parent=((RolapCubeMember)parentMember).getRolapMember();
  }
  RolapMember member=super.makeMember(parent,((RolapCubeLevel)childLevel).getRolapLevel(),value,captionValue,parentChild,resultSet,key,columnOffset);
  return memberReader.lookupCubeMember((RolapCubeMember)parentMember,member,(RolapCubeLevel)childLevel);
}
Program: 51153
Project: 51153
Buggy source:
public static void getTableNamesForJoin(MondrianGuiDef.RelationOrJoin aRelOrJoin,Set aTableNames){
  if (aRelOrJoin instanceof MondrianGuiDef.Join) {
    MondrianGuiDef.RelationOrJoin theRelOrJoin_L=((MondrianGuiDef.Join)aRelOrJoin).left;
    MondrianGuiDef.RelationOrJoin theRelOrJoin_R=((MondrianGuiDef.Join)aRelOrJoin).right;
    for (int i=0; i < 2; i++) {
      MondrianGuiDef.RelationOrJoin theCurrentRelOrJoin=(i == 0) ? theRelOrJoin_L : theRelOrJoin_R;
      if (theCurrentRelOrJoin instanceof MondrianGuiDef.Table) {
        MondrianGuiDef.Table theTable=((MondrianGuiDef.Table)theCurrentRelOrJoin);
        String theTableName=(theTable.alias != null && theTable.alias.trim().length() > 0) ? theTable.alias : theTable.name;
        aTableNames.add(theTableName);
      }
 else {
        getTableNamesForJoin(theCurrentRelOrJoin,aTableNames);
      }
    }
  }
}

Fixed version (ground truth):
public static void getTableNamesForJoin(MondrianGuiDef.RelationOrJoin aRelOrJoin,Set<String> aTableNames){
  if (aRelOrJoin instanceof MondrianGuiDef.Join) {
    MondrianGuiDef.RelationOrJoin theRelOrJoin_L=((MondrianGuiDef.Join)aRelOrJoin).left;
    MondrianGuiDef.RelationOrJoin theRelOrJoin_R=((MondrianGuiDef.Join)aRelOrJoin).right;
    for (int i=0; i < 2; i++) {
      MondrianGuiDef.RelationOrJoin theCurrentRelOrJoin=(i == 0) ? theRelOrJoin_L : theRelOrJoin_R;
      if (theCurrentRelOrJoin instanceof MondrianGuiDef.Table) {
        MondrianGuiDef.Table theTable=((MondrianGuiDef.Table)theCurrentRelOrJoin);
        String theTableName=(theTable.alias != null && theTable.alias.trim().length() > 0) ? theTable.alias : theTable.name;
        aTableNames.add(theTableName);
      }
 else {
        getTableNamesForJoin(theCurrentRelOrJoin,aTableNames);
      }
    }
  }
}
Program: 51158
Project: 51158
Buggy source:
private void acceptButtonActionPerformed(java.awt.event.ActionEvent evt){
  accepted=true;
  hide();
}

Fixed version (ground truth):
private void acceptButtonActionPerformed(java.awt.event.ActionEvent evt){
  accepted=true;
  setVisible(false);
}
Program: 51159
Project: 51159
Buggy source:
/** 
 * Creates new form PreferencesDialog 
 */
public PreferencesDialog(java.awt.Frame parent,boolean modal){
  super(parent,modal);
  initComponents();
}

Fixed version (ground truth):
/** 
 * Creates new form PreferencesDialog 
 */
public PreferencesDialog(java.awt.Frame parent,boolean modal){
  super(parent,modal);
  initComponents();
  pack();
  setLocationRelativeTo(parent);
}
Program: 51160
Project: 51160
Buggy source:
private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt){
  accepted=false;
  hide();
}

Fixed version (ground truth):
private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt){
  accepted=false;
  setVisible(false);
}
Program: 51161
Project: 51161
Buggy source:
/** 
 * @param args the command line arguments
 */
public static void main(String args[]){
  try {
    Workbench w=new Workbench();
    w.parseArgs(args);
    w.setSize(800,600);
    if (w.openFile != null) {
      File f=new File(w.openFile);
      if (f.canRead()) {
        w.openSchemaFrame(f.getAbsoluteFile(),false);
      }
    }
    w.show();
  }
 catch (  Throwable ex) {
    LOGGER.error("String_Node_Str",ex);
  }
}

Fixed version (ground truth):
/** 
 * @param args the command line arguments
 */
public static void main(String args[]){
  try {
    Workbench w=new Workbench();
    w.parseArgs(args);
    w.setSize(800,600);
    if (w.openFile != null) {
      File f=new File(w.openFile);
      if (f.canRead()) {
        w.openSchemaFrame(f.getAbsoluteFile(),false);
      }
    }
    w.setVisible(true);
  }
 catch (  Throwable ex) {
    LOGGER.error("String_Node_Str",ex);
  }
}
Program: 51162
Project: 51162
Buggy source:
private void toolbarPreferencesButtonActionPerformed(java.awt.event.ActionEvent evt){
  PreferencesDialog pd=new PreferencesDialog(this,true);
  pd.setJDBCConnectionUrl(jdbcConnectionUrl);
  pd.setJDBCDriverClassName(jdbcDriverClassName);
  pd.setJDBCUsername(jdbcUsername);
  pd.setJDBCPassword(jdbcPassword);
  pd.show();
  if (pd.accepted()) {
    jdbcConnectionUrl=pd.getJDBCConnectionUrl();
    jdbcDriverClassName=pd.getJDBCDriverClassName();
    jdbcUsername=pd.getJDBCUsername();
    jdbcPassword=pd.getJDBCPassword();
    workbenchProperties.setProperty("String_Node_Str",jdbcDriverClassName);
    workbenchProperties.setProperty("String_Node_Str",jdbcConnectionUrl);
    workbenchProperties.setProperty("String_Node_Str",jdbcUsername);
    workbenchProperties.setProperty("String_Node_Str",jdbcPassword);
  }
}

Fixed version (ground truth):
private void toolbarPreferencesButtonActionPerformed(java.awt.event.ActionEvent evt){
  PreferencesDialog pd=new PreferencesDialog(this,true);
  pd.setJDBCConnectionUrl(jdbcConnectionUrl);
  pd.setJDBCDriverClassName(jdbcDriverClassName);
  pd.setJDBCUsername(jdbcUsername);
  pd.setJDBCPassword(jdbcPassword);
  pd.setVisible(true);
  if (pd.accepted()) {
    jdbcConnectionUrl=pd.getJDBCConnectionUrl();
    jdbcDriverClassName=pd.getJDBCDriverClassName();
    jdbcUsername=pd.getJDBCUsername();
    jdbcPassword=pd.getJDBCPassword();
    workbenchProperties.setProperty("String_Node_Str",jdbcDriverClassName);
    workbenchProperties.setProperty("String_Node_Str",jdbcConnectionUrl);
    workbenchProperties.setProperty("String_Node_Str",jdbcUsername);
    workbenchProperties.setProperty("String_Node_Str",jdbcPassword);
    resetWorkbench();
  }
}
Program: 51165
Project: 51165
Buggy source:
private MondrianGuiDef.Schema getSchema(){
  SchemaExplorer se=this.getSchemaExplorer();
  return (se == null) ? null : se.getSchema();
}

Fixed version (ground truth):
private MondrianGuiDef.Schema getSchema(){
  SchemaExplorer se=workbench.getCurrentSchemaExplorer();
  return (se == null) ? null : se.getSchema();
}
Program: 51166
Project: 51166
Buggy source:
private Object getParentObject(){
  SchemaExplorer se=this.getSchemaExplorer();
  if (se != null) {
    Object po=se.getParentObject();
    return po;
  }
  return null;
}

Fixed version (ground truth):
private Object getParentObject(){
  SchemaExplorer se=workbench.getCurrentSchemaExplorer();
  if (se != null) {
    Object po=se.getParentObject();
    return po;
  }
  return null;
}
Program: 51167
Project: 51167
Buggy source:
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 Member evaluateMember(Evaluator evaluator){
  Member member;
  int lagValue=lagValueCalc.evaluateInteger(evaluator);
  Level ancestorLevel;
  if (ancestorLevelCalc != null) {
    ancestorLevel=ancestorLevelCalc.evaluateLevel(evaluator);
    if (memberCalc == null) {
      member=evaluator.getContext(ancestorLevel.getDimension());
    }
 else {
      member=memberCalc.evaluateMember(evaluator);
    }
  }
 else {
    member=memberCalc.evaluateMember(evaluator);
    Member parent=member.getParentMember();
    if (parent == null) {
      return member.getHierarchy().getNullMember();
    }
    ancestorLevel=parent.getLevel();
  }
  return parallelPeriod(member,ancestorLevel,evaluator,lagValue);
}
Program: 51168
Project: 51168
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().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 IntegerCalc lagValueCalc=(args.length >= 2) ? compiler.compileInteger(args[1]) : ConstantCalc.constantInteger(1);
  final LevelCalc ancestorLevelCalc=args.length >= 1 ? compiler.compileLevel(args[0]) : null;
  final MemberCalc memberCalc;
switch (args.length) {
case 3:
    memberCalc=compiler.compileMember(args[2]);
  break;
case 1:
final Dimension dimension=args[0].getType().getDimension();
if (dimension != null) {
memberCalc=new DimensionCurrentMemberCalc(dimension);
}
 else {
memberCalc=null;
}
break;
default :
final Dimension timeDimension=compiler.getEvaluator().getCube().getTimeDimension();
if (timeDimension == null) {
throw MondrianResource.instance().NoTimeDimensionInCube.ex(getName());
}
memberCalc=new DimensionCurrentMemberCalc(timeDimension);
break;
}
return new AbstractMemberCalc(call,new Calc[]{memberCalc,lagValueCalc,ancestorLevelCalc}){
public Member evaluateMember(Evaluator evaluator){
Member member;
int lagValue=lagValueCalc.evaluateInteger(evaluator);
Level ancestorLevel;
if (ancestorLevelCalc != null) {
ancestorLevel=ancestorLevelCalc.evaluateLevel(evaluator);
if (memberCalc == null) {
member=evaluator.getContext(ancestorLevel.getDimension());
}
 else {
member=memberCalc.evaluateMember(evaluator);
}
}
 else {
member=memberCalc.evaluateMember(evaluator);
Member parent=member.getParentMember();
if (parent == null) {
return member.getHierarchy().getNullMember();
}
ancestorLevel=parent.getLevel();
}
return parallelPeriod(member,ancestorLevel,evaluator,lagValue);
}
}
;
}
Program: 51174
Project: 51174
Buggy source:
public void mouseReleased(MouseEvent e){
  if (e.isPopupTrigger()) {
    int x=e.getX();
    int y=e.getY();
    jPopupMenu.show(queryTextPane,x,y);
  }
}

Fixed version (ground truth):
public void mouseReleased(MouseEvent e){
  checkPopupTrigger(e);
}