nus-yam/ex-repair huggingface dataset:
Program: 180006
Project: 180006
Buggy source:
private ArrayList<StringValue> getParameters(ArrayList<Token> tokens) throws Exception {
  for (int i=0; i < tokens.size(); i++) {
    Token token=tokens.get(i);
    if (token.getTokenType() == TokenType.OPENBRACKET) {
      ArrayList<Token> parameterTokens=Tokens.sliceBody(tokens,TokenType.OPENBRACKET,i);
      ArrayList<ArrayList<Token>> parameterValues=new ArrayList<ArrayList<Token>>();
      parameterValues.add(new ArrayList<Token>());
      int k=0;
      for (int o=0; o < parameterTokens.size(); o++) {
        if (parameterTokens.get(o).getTokenType() == TokenType.COMMA) {
          parameterValues.add(new ArrayList<Token>());
          k++;
        }
 else {
          parameterValues.get(k).add(parameterTokens.get(o));
        }
      }
      ArrayList<StringValue> argumentValues=new ArrayList<StringValue>();
      for (int x=0; x < parameterValues.size(); x++) {
        if (parameterValues.get(x).size() > 1) {
          throw new Exception("String_Node_Str");
        }
        try {
          argumentValues.add((StringValue)parameterValues.get(x).get(0).getTokenValue());
        }
 catch (        ClassCastException ex) {
          throw new Exception("String_Node_Str" + parameterValues.get(0).get(0).getTokenValue().getType());
        }
      }
      return argumentValues;
    }
  }
  throw new Exception("String_Node_Str");
}

Fixed version (ground truth):
private ArrayList<StringValue> getParameters(ArrayList<Token> tokens) throws Exception {
  for (int i=0; i < tokens.size(); i++) {
    Token token=tokens.get(i);
    if (token.getTokenType() == TokenType.OPENBRACKET) {
      ArrayList<Token> parameterTokens=Tokens.sliceBody(tokens,TokenType.OPENBRACKET,i);
      ArrayList<ArrayList<Token>> parameterValues=new ArrayList<ArrayList<Token>>();
      parameterValues.add(new ArrayList<Token>());
      int k=0;
      for (int o=0; o < parameterTokens.size(); o++) {
        if (parameterTokens.get(o).getTokenType() == TokenType.COMMA) {
          parameterValues.add(new ArrayList<Token>());
          k++;
        }
 else {
          parameterValues.get(k).add(parameterTokens.get(o));
        }
      }
      ArrayList<StringValue> argumentValues=new ArrayList<StringValue>();
      if (!parameterValues.isEmpty()) {
        for (int x=0; x < parameterValues.size(); x++) {
          if (parameterValues.get(x).size() == 0) {
            continue;
          }
          if (parameterValues.get(x).size() > 1) {
            throw new Exception("String_Node_Str");
          }
          try {
            argumentValues.add((StringValue)parameterValues.get(x).get(0).getTokenValue());
          }
 catch (          ClassCastException ex) {
            throw new Exception("String_Node_Str" + parameterValues.get(0).get(0).getTokenValue().getType());
          }
        }
      }
      return argumentValues;
    }
  }
  throw new Exception("String_Node_Str");
}
Program: 180007
Project: 180007
Buggy source:
public Value evaluate(ArrayList<Token> tokens,ComplexScope scope) throws Exception {
  if (tokens.isEmpty())   return new NullValue();
  compileFunctions(tokens,scope);
  doFunctionCalls(tokens,scope);
  doBrackets(tokens,scope);
  for (  MathOperation op : this.operations) {
    op.doOperation(tokens,scope);
  }
  doAssignment(tokens,scope);
  if (tokens.size() > 1) {
    System.out.println(tokens);
    throw new Exception("String_Node_Str");
  }
  return getToken(tokens,0,scope);
}

Fixed version (ground truth):
public Value evaluate(ArrayList<Token> tokens,ComplexScope scope) throws Exception {
  if (tokens.isEmpty())   return new NullValue();
  compileFunctions(tokens,scope);
  doFunctionCalls(tokens,scope);
  doBrackets(tokens,scope);
  for (  MathOperation op : this.operations) {
    op.doOperation(tokens,scope);
  }
  doAssignment(tokens,scope);
  cleanEndStatements(tokens);
  if (tokens.size() > 1) {
    System.out.println(tokens);
    throw new Exception("String_Node_Str");
  }
  return getToken(tokens,0,scope);
}
Program: 180008
Project: 180008
Buggy source:
public TokenType getToken(){
  return TokenType.LOCAL_DECLARE;
}

Fixed version (ground truth):
public TokenType getToken(){
  return TokenType.RETURN;
}
Program: 180009
Project: 180009
Buggy source:
private void processDeclaration(ArrayList<Token> tokens,ComplexScope scope) throws Exception {
  Token declare=tokens.get(0);
  Token name=tokens.get(1);
  if (declare.getTokenType() == TokenType.GLOBAL_DECLARE) {
    declareVariable(name.toString(),scope,false);
  }
 else   if (declare.getTokenType() == TokenType.LOCAL_DECLARE) {
    declareVariable(name.toString(),scope,true);
  }
 else {
    throw new Exception("String_Node_Str" + declare.getTokenType());
  }
}

Fixed version (ground truth):
private void processDeclaration(ArrayList<Token> tokens,ComplexScope scope) throws Exception {
  Token declare=tokens.get(0);
  Token name=tokens.get(1);
  if (declare.getTokenType() == TokenType.GLOBAL_DECLARE) {
    declareVariable(name.getTokenValue().toString(),scope,false);
  }
 else   if (declare.getTokenType() == TokenType.LOCAL_DECLARE) {
    declareVariable(name.getTokenValue().toString(),scope,true);
  }
 else {
    throw new Exception("String_Node_Str" + declare.getTokenType());
  }
}
Program: 180010
Project: 180010
Buggy source:
private void declareVariable(String name,ComplexScope scope,boolean local) throws Exception {
  if (local == true) {
    System.out.println("String_Node_Str");
    scope.getLocal().addVariable(name);
    System.out.println(scope.getVariables());
  }
 else {
    scope.getGlobal().addVariable(name);
  }
}

Fixed version (ground truth):
private void declareVariable(String name,ComplexScope scope,boolean local) throws Exception {
  if (local == true) {
    scope.getLocal().addVariable(name);
  }
 else {
    scope.getGlobal().addVariable(name);
  }
}
Program: 180011
Project: 180011
Buggy source:
private Value parseLine(TokenScanner statement,ComplexScope fullScope) throws Exception {
  Token token=statement.next(false);
  if (token.getTokenType() == TokenType.CLOSEBRACES || token.getTokenType() == TokenType.OPENBRACES) {
    if (token.getTokenType() == TokenType.CLOSEBRACES)     fullScope.local.removeStack("String_Node_Str");
 else     fullScope.local.addStack("String_Node_Str");
    statement.next();
    token=statement.next(false);
    statement=statement.getTokenToEndStatement();
  }
  if (token.getTokenType() == TokenType.LOCAL_DECLARE || token.getTokenType() == TokenType.GLOBAL_DECLARE) {
    processDeclaration(statement.getTokens(),fullScope);
    statement.getTokens().remove(0);
    return evaluateOperation(statement,fullScope);
  }
 else   if (token.getTokenType() == TokenType.RETURN) {
    statement.next();
    statement=statement.getTokenToEndStatement();
    return new ReturnValue(evaluateOperation(statement,fullScope));
  }
 else   if (token.getTokenType() == TokenType.IF) {
    statement.next();
    statement=statement.getTokenToEndStatement();
    return evaluateConditional(statement,fullScope);
  }
 else {
    return evaluateOperation(statement,fullScope);
  }
}

Fixed version (ground truth):
private Value parseLine(TokenScanner statement,ComplexScope fullScope) throws Exception {
  System.out.println(statement.getTokens());
  Token token=statement.next(false);
  if (token.getTokenType() == TokenType.CLOSEBRACES || token.getTokenType() == TokenType.OPENBRACES) {
    if (token.getTokenType() == TokenType.CLOSEBRACES)     fullScope.local.removeStack("String_Node_Str");
 else     fullScope.local.addStack("String_Node_Str");
    statement.next();
    token=statement.next(false);
    statement=statement.getTokenToEndStatement();
  }
  if (token.getTokenType() == TokenType.LOCAL_DECLARE || token.getTokenType() == TokenType.GLOBAL_DECLARE) {
    processDeclaration(statement.getTokens(),fullScope);
    statement.getTokens().remove(0);
    return evaluateOperation(statement,fullScope);
  }
 else   if (token.getTokenType() == TokenType.RETURN) {
    statement.next();
    statement=statement.getTokenToEndStatement();
    return new ReturnValue(evaluateOperation(statement,fullScope));
  }
 else   if (token.getTokenType() == TokenType.IF) {
    statement.next();
    statement=statement.getTokenToEndStatement();
    return evaluateConditional(statement,fullScope);
  }
 else {
    return evaluateOperation(statement,fullScope);
  }
}
Program: 180012
Project: 180012
Buggy source:
public String toString(){
  return this.value;
}

Fixed version (ground truth):
@Override public String toString(){
  return this.value;
}
Program: 180013
Project: 180013
Buggy source:
@Override public Token toToken(){
  return new Token(TokenType.BOOLEAN);
}

Fixed version (ground truth):
@Override public Token toToken(){
  return new Token(TokenType.BOOLEAN,this);
}
Program: 180015
Project: 180015
Buggy source:
public void process(ArrayList<Token> tokens,ComplexScope scope,ExpressionProcessor processor) throws Exception {
  for (int i=0; i < tokens.size(); i++) {
    Token token=tokens.get(i);
    if (token.getTokenType() == TokenType.FUNCTION_DECLARE) {
      tokens.remove(i);
      FunctionValue value=getFunction(tokens,scope);
      tokens.add(i,new Token(TokenType.USERFUNC,value));
      i=0;
    }
  }
}

Fixed version (ground truth):
public void process(ArrayList<Token> tokens,ComplexScope scope,ExpressionProcessor processor) throws Exception {
  for (int i=0; i < tokens.size(); i++) {
    Token token=tokens.get(i);
    if (token.getTokenType() == TokenType.FUNCTION_DECLARE) {
      tokens.remove(i);
      System.out.println(tokens);
      replaceFunction(i,tokens,scope);
      i=0;
    }
  }
}
Program: 180016
Project: 180016
Buggy source:
private ArrayList<Token> getBody(ArrayList<Token> tokens) throws Exception {
  for (int i=0; i < tokens.size(); i++) {
    Token token=tokens.get(i);
    if (token.getTokenType() == TokenType.OPENBRACES)     return Tokens.sliceBody(tokens,TokenType.OPENBRACES,i);
  }
  throw new Exception("String_Node_Str");
}

Fixed version (ground truth):
private ArrayList<Token> getBody(int startIndex,ArrayList<Token> tokens) throws Exception {
  for (int i=startIndex; i < tokens.size(); i++) {
    Token token=tokens.get(i);
    if (token.getTokenType() == TokenType.OPENBRACES)     return Tokens.sliceBody(tokens,TokenType.OPENBRACES,i);
  }
  throw new Exception("String_Node_Str");
}
Program: 180017
Project: 180017
Buggy source:
public void process(ArrayList<Token> tokens,ComplexScope scope,ExpressionProcessor processor) throws Exception {
  for (int i=0; i < tokens.size(); i++) {
    Token token=tokens.get(i);
    if (token.getTokenType() == TokenType.OBJECT) {
      if (tokens.size() <= i + 1)       continue;
      if (tokens.get(i + 1).getTokenType() == TokenType.DOT) {
        if (tokens.get(i + 2).getTokenType() != TokenType.STRING) {
          throw new SyntaxException("String_Node_Str",tokens);
        }
        String identifier=tokens.get(i + 2).getTokenValue().toString();
        VariableValue container=(VariableValue)token.getTokenValue();
        ObjectValue object=(ObjectValue)container.getValue();
        Value value=object.getValue(identifier);
        tokens.remove(i);
        tokens.remove(i);
        tokens.remove(i);
        tokens.add(value.toToken());
        i=0;
      }
    }
 else     if (token.getTokenType() == TokenType.STRING) {
      Value value=scope.getVariable(token.toString());
      if (value == null) {
        scope.local.addVariable(token.toString());
        value=scope.local.getVariable(token.toString());
      }
      tokens.remove(i);
      tokens.add(i,value.toToken());
      process(tokens,scope,processor);
    }
  }
}

Fixed version (ground truth):
public void process(ArrayList<Token> tokens,ComplexScope scope,ExpressionProcessor processor) throws Exception {
  for (int i=0; i < tokens.size(); i++) {
    Token token=tokens.get(i);
    if (token.getTokenType() == TokenType.OBJECT) {
      if (tokens.size() <= i + 1)       continue;
      if (tokens.get(i + 1).getTokenType() == TokenType.DOT) {
        if (tokens.get(i + 2).getTokenType() != TokenType.STRING) {
          throw new SyntaxException("String_Node_Str",tokens);
        }
        String identifier=tokens.get(i + 2).getTokenValue().toString();
        VariableValue container=(VariableValue)token.getTokenValue();
        ObjectValue object=(ObjectValue)container.getValue();
        Value value=object.getValue(identifier);
        tokens.remove(i);
        tokens.remove(i);
        tokens.remove(i);
        tokens.add(i,value.toToken());
        i=0;
      }
    }
 else     if (token.getTokenType() == TokenType.STRING) {
      Value value=scope.getVariable(token.toString());
      if (value == null) {
        scope.local.addVariable(token.toString());
        value=scope.local.getVariable(token.toString());
      }
      tokens.remove(i);
      tokens.add(i,value.toToken());
      process(tokens,scope,processor);
    }
  }
}
Program: 180018
Project: 180018
Buggy source:
public ExpressionProcessor(){
  this.operations.add(new Add(this));
  this.operations.add(new Subtract(this));
  this.operations.add(new Multiply(this));
  this.operations.add(new Divide(this));
  this.operations.add(new Equality(this));
  this.operations.add(new And(this));
  this.operations.add(new Or(this));
  this.compilers.add(new FunctionCompiler());
  this.compilers.add(new CallingCompiler());
  this.compilers.add(new ObjectCompiler());
  this.compilers.add(new ReferenceCompiler());
  this.compilers.add(new BracketCompiler());
}

Fixed version (ground truth):
public ExpressionProcessor(){
  this.operations.add(new Add(this));
  this.operations.add(new Subtract(this));
  this.operations.add(new Multiply(this));
  this.operations.add(new Divide(this));
  this.operations.add(new Equality(this));
  this.operations.add(new And(this));
  this.operations.add(new Or(this));
  this.compilers.add(new FunctionCompiler());
  this.compilers.add(new ReferenceCompiler());
  this.compilers.add(new CallingCompiler());
  this.compilers.add(new ObjectCompiler());
  this.compilers.add(new BracketCompiler());
}
Program: 180019
Project: 180019
Buggy source:
private ArrayList<StringValue> getParameters(ArrayList<Token> tokens) throws Exception {
  for (int i=0; i < tokens.size(); i++) {
    Token token=tokens.get(i);
    if (token.getTokenType() == TokenType.OPENBRACKET) {
      ArrayList<Token> parameterTokens=Tokens.sliceBody(tokens,TokenType.OPENBRACKET,i);
      ArrayList<ArrayList<Token>> parameterValues=new ArrayList<ArrayList<Token>>();
      parameterValues.add(new ArrayList<Token>());
      int k=0;
      for (int o=0; o < parameterTokens.size(); o++) {
        if (parameterTokens.get(o).getTokenType() == TokenType.COMMA) {
          parameterValues.add(new ArrayList<Token>());
          k++;
        }
 else {
          parameterValues.get(k).add(parameterTokens.get(o));
        }
      }
      ArrayList<StringValue> argumentValues=new ArrayList<StringValue>();
      if (!parameterValues.isEmpty()) {
        for (int x=0; x < parameterValues.size(); x++) {
          if (parameterValues.get(x).size() == 0) {
            continue;
          }
          if (parameterValues.get(x).size() > 1) {
            throw new Exception("String_Node_Str");
          }
          try {
            argumentValues.add((StringValue)parameterValues.get(x).get(0).getTokenValue());
          }
 catch (          ClassCastException ex) {
            throw new Exception("String_Node_Str" + parameterValues.get(0).get(0).getTokenValue().getType());
          }
        }
      }
      return argumentValues;
    }
  }
  throw new Exception("String_Node_Str");
}

Fixed version (ground truth):
private ArrayList<StringValue> getParameters(ArrayList<Token> tokens) throws Exception {
  for (int i=0; i < tokens.size(); i++) {
    Token token=tokens.get(i);
    if (token.getTokenType() == TokenType.OPENBRACKET) {
      ArrayList<Token> parameterTokens=Tokens.sliceBody(tokens,TokenType.OPENBRACKET,i);
      ArrayList<ArrayList<Token>> parameterValues=new ArrayList<ArrayList<Token>>();
      parameterValues.add(new ArrayList<Token>());
      int k=0;
      for (int o=0; o < parameterTokens.size(); o++) {
        if (parameterTokens.get(o).getTokenType() == TokenType.COMMA) {
          parameterValues.add(new ArrayList<Token>());
          k++;
        }
 else {
          parameterValues.get(k).add(parameterTokens.get(o));
        }
      }
      ArrayList<StringValue> argumentValues=new ArrayList<StringValue>();
      if (!parameterValues.isEmpty()) {
        for (int x=0; x < parameterValues.size(); x++) {
          if (parameterValues.get(x).size() == 0) {
            continue;
          }
          if (parameterValues.get(x).size() > 1) {
            throw new Exception("String_Node_Str");
          }
          try {
            argumentValues.add(new StringValue(parameterValues.get(x).get(0).getTokenValue().toString()));
          }
 catch (          ClassCastException ex) {
            throw new Exception("String_Node_Str" + parameterValues.get(0).get(0).getTokenValue().getType());
          }
        }
      }
      return argumentValues;
    }
  }
  throw new Exception("String_Node_Str");
}
Program: 180020
Project: 180020
Buggy source:
@Override public void packetReceived(IBroadcastStream stream,IStreamPacket packet){
  if (packet instanceof IRTMPEvent) {
    outputStream.dispatchEvent((IEvent)packet);
  }
}

Fixed version (ground truth):
@Override public void packetReceived(IBroadcastStream stream,IStreamPacket packet){
  if (packet instanceof IRTMPEvent) {
    try {
      IBroadcastStream bstream=getPublishStream(stream.getScope(),stream.getPublishedName().substring(1));
      ((BroadcastStream)bstream).dispatchEvent((IEvent)packet);
    }
 catch (    Exception e) {
    }
  }
}
Program: 180021
Project: 180021
Buggy source:
@Override public boolean appStart(IScope scope){
  final ApplicationAdapterEx aaex=this;
  final IScope scopeex=scope;
  System.out.println("String_Node_Str");
  this.addScheduledJob(10000,new IScheduledJob(){
    @Override public void execute(    ISchedulingService service) throws CloneNotSupportedException {
      List<String> list=aaex.getBroadcastStreamNames(scopeex);
      for (      String name : list) {
        System.out.println(name);
      }
    }
  }
);
  return super.appStart(scope);
}

Fixed version (ground truth):
@Override public boolean appStart(IScope scope){
  final IScope scopeex=scope;
  this.addScheduledJob(10000,new IScheduledJob(){
    @Override public void execute(    ISchedulingService service) throws CloneNotSupportedException {
      List<String> list=getBroadcastStreamNames(scopeex);
      for (      String name : list) {
        IBroadcastStream stream=getPublishStream(scopeex,name);
        if (stream instanceof BroadcastStream) {
          ((BroadcastStream)stream).terminateGhostConnection();
        }
      }
    }
  }
);
  return super.appStart(scope);
}
Program: 180022
Project: 180022
Buggy source:
@Override public void streamBroadcastClose(IBroadcastStream stream){
  String publishName=stream.getPublishedName();
  System.out.println(publishName);
  if (publishName.startsWith("String_Node_Str")) {
    outputStream.stop();
  }
  super.streamBroadcastClose(stream);
}

Fixed version (ground truth):
@Override public void streamBroadcastClose(IBroadcastStream stream){
  String publishName=stream.getPublishedName();
  if (publishName.startsWith("String_Node_Str")) {
    IBroadcastStream bstream=getPublishStream(stream.getScope(),publishName.substring(1));
    if (stream instanceof BroadcastStream) {
      bstream.stop();
    }
  }
  super.streamBroadcastClose(stream);
}
Program: 180023
Project: 180023
Buggy source:
@Override public void streamBroadcastStart(IBroadcastStream stream){
  String publishName=stream.getPublishedName();
  if (publishName.startsWith("String_Node_Str")) {
    if (outputStream == null) {
      String outputName=publishName.substring(1);
      IScope scope=stream.getScope();
      outputStream=new BroadcastStream(outputName);
      outputStream.setScope(scope);
      IProviderService providerService=(IProviderService)this.getContext().getBean(IProviderService.BEAN_NAME);
      if (providerService.registerBroadcastStream(scope,outputName,outputStream)) {
        IBroadcastScope bsScope=(BroadcastScope)providerService.getLiveProviderInput(scope,outputName,true);
        bsScope.setAttribute(IBroadcastScope.STREAM_ATTRIBUTE,outputStream);
      }
 else {
        throw new RuntimeException("String_Node_Str");
      }
    }
    outputStream.start();
    stream.addStreamListener(new IStreamListener(){
      @Override public void packetReceived(      IBroadcastStream stream,      IStreamPacket packet){
        if (packet instanceof IRTMPEvent) {
          outputStream.dispatchEvent((IEvent)packet);
        }
      }
    }
);
  }
  super.streamBroadcastStart(stream);
}

Fixed version (ground truth):
@Override public void streamBroadcastStart(IBroadcastStream stream){
  String publishName=stream.getPublishedName();
  if (publishName.startsWith("String_Node_Str")) {
    String outputName=publishName.substring(1);
    IBroadcastStream outputStream=getPublishStream(stream.getScope(),outputName);
    if (outputStream == null) {
      IScope scope=stream.getScope();
      outputStream=new BroadcastStream(outputName);
      ((BroadcastStream)outputStream).setScope(scope);
      IProviderService providerService=(IProviderService)this.getContext().getBean(IProviderService.BEAN_NAME);
      System.out.println(providerService);
      if (providerService.registerBroadcastStream(scope,outputName,outputStream)) {
        IBroadcastScope bsScope=(BroadcastScope)providerService.getLiveProviderInput(scope,outputName,true);
        bsScope.setAttribute(IBroadcastScope.STREAM_ATTRIBUTE,outputStream);
      }
 else {
        throw new RuntimeException("String_Node_Str");
      }
    }
    outputStream.start();
    stream.addStreamListener(new IStreamListener(){
      @Override public void packetReceived(      IBroadcastStream stream,      IStreamPacket packet){
        if (packet instanceof IRTMPEvent) {
          try {
            IBroadcastStream bstream=getPublishStream(stream.getScope(),stream.getPublishedName().substring(1));
            ((BroadcastStream)bstream).dispatchEvent((IEvent)packet);
          }
 catch (          Exception e) {
          }
        }
      }
    }
);
  }
  super.streamBroadcastStart(stream);
}
Program: 180024
Project: 180024
Buggy source:
@Override public void execute(ISchedulingService service) throws CloneNotSupportedException {
  List<String> list=aaex.getBroadcastStreamNames(scopeex);
  for (  String name : list) {
    System.out.println(name);
  }
}

Fixed version (ground truth):
@Override public void execute(ISchedulingService service) throws CloneNotSupportedException {
  List<String> list=getBroadcastStreamNames(scopeex);
  for (  String name : list) {
    IBroadcastStream stream=getPublishStream(scopeex,name);
    if (stream instanceof BroadcastStream) {
      ((BroadcastStream)stream).terminateGhostConnection();
    }
  }
}
Program: 180025
Project: 180025
Buggy source:
public boolean close(int i){
  if (mLivePipe != null) {
  }
  return true;
}

Fixed version (ground truth):
@Override public void close(){
  log.trace("String_Node_Str");
}
Program: 180026
Project: 180026
Buggy source:
public void maintainMenu(boolean preserve){
  if (!preserve)   selString="String_Node_Str";
  m.setText(getTitle() + selString);
}

Fixed version (ground truth):
public void maintainMenu(int step){
  selString+="String_Node_Str" + step + "String_Node_Str";
  m.setText(getTitle() + selString);
}
Program: 180027
Project: 180027
Buggy source:
public void loadDataSet(File file,String dataFrameName){
  ProgIndicatorImpl progIndicator=new ProgIndicatorImpl();
  DataSet dataSet=new AsciiFileLoader(progIndicator,getMonFrame()).loadAsciiFile(file);
  progIndicator.dispose();
  if (dataSet != null) {
    Mondrian mondrian=new Mondrian(dataSet,this);
    addAndActiviate(mondrian);
  }
}

Fixed version (ground truth):
public void loadDataSet(File file,String dsName){
  ProgIndicatorImpl progIndicator=new ProgIndicatorImpl();
  DataSet dataSet=new AsciiFileLoader(progIndicator,getMonFrame()).loadAsciiFile(file);
  progIndicator.dispose();
  if (dataSet != null) {
    if (dsName != null) {
      dataSet.setName=dsName;
    }
    Mondrian mondrian=new Mondrian(dataSet,this);
    addAndActiviate(mondrian);
  }
}
Program: 180028
Project: 180028
Buggy source:
public void addAndActiviate(Mondrian mondrian){
  mondrians.add(mondrian);
  monFrame.closeDataSetMenuItem.setEnabled(true);
  monFrame.saveMenuItem.setEnabled(true);
  monFrame.maintainOptionMenu();
}

Fixed version (ground truth):
public void addAndActiviate(Mondrian mondrian){
  mondrians.add(mondrian);
  monFrame.maintainOptionMenu();
}
Program: 180029
Project: 180029
Buggy source:
public MDialog(MonFrame parentFrame,Mondrian mondrian){
  this.mondrian=mondrian;
  this.parentFrame=parentFrame;
  this.getContentPane().setBackground(ColorManager.backgroundColor);
  addWindowListener(this);
}

Fixed version (ground truth):
public MDialog(MonFrame parentFrame,Mondrian mondrian){
  this.mondrian=mondrian;
  this.parentFrame=parentFrame;
  this.getContentPane().setBackground(ColorManager.backgroundColor);
}
Program: 180030
Project: 180030
Buggy source:
public void clearColors(){
  if (controller.countInstances() > -1) {
    controller.getCurrentDataSet().colorsOff();
    controller.getCurrent().dataChanged(-1);
  }
}

Fixed version (ground truth):
public void clearColors(){
  if (controller.countInstances() > 0) {
    controller.getCurrentDataSet().colorsOff();
    controller.getCurrent().dataChanged(-1);
  }
}
Program: 180031
Project: 180031
Buggy source:
public void toggleSelection(){
  if (controller.countInstances() > -1) {
    controller.getCurrentDataSet().toggleSelection();
    controller.getCurrent().updateSelection();
  }
}

Fixed version (ground truth):
public void toggleSelection(){
  if (controller.countInstances() > 0) {
    controller.getCurrentDataSet().toggleSelection();
    controller.getCurrent().updateSelection();
  }
}
Program: 180032
Project: 180032
Buggy source:
public Barchart(MDialog frame,int width,int height,Table tablep){
  super(frame);
  this.tablep=tablep;
  this.name=tablep.name;
  this.levels=tablep.levels;
  this.names=tablep.names;
  this.lnames=tablep.lnames;
  this.width=width;
  this.height=height;
  sb.setUnitIncrement(22);
  sb.setBlockIncrement(22);
  this.k=levels[0];
  for (int i=0; i < k; i++)   max=Math.max(max,tablep.table[i]);
  iniMax=max;
  setCoordinates(0,0,max,1,-1);
  this.setScrollX();
  frame.getContentPane().add(this,"String_Node_Str");
  Font SF=new Font("String_Node_Str",Font.PLAIN,11);
  frame.setFont(SF);
  border=20;
  String titletext;
  if (tablep.count == -1)   titletext="String_Node_Str" + names[0] + "String_Node_Str";
 else   titletext="String_Node_Str" + names[0] + "String_Node_Str"+ tablep.data.getName(tablep.count)+ "String_Node_Str";
  frame.setTitle(titletext);
  evtq=Toolkit.getDefaultToolkit().getSystemEventQueue();
}

Fixed version (ground truth):
public Barchart(MDialog frame,int width,int height,Table tablep){
  super(frame);
  this.tablep=tablep;
  this.name=tablep.name;
  this.levels=tablep.levels;
  this.names=tablep.names;
  this.lnames=tablep.lnames;
  this.width=width;
  this.height=height;
  sb.setUnitIncrement(22);
  sb.setBlockIncrement(22);
  this.k=levels[0];
  for (int i=0; i < k; i++)   max=Math.max(max,tablep.table[i]);
  iniMax=max;
  setCoordinates(0,0,max,1,-1);
  this.setScrollX();
  Font SF=new Font("String_Node_Str",Font.PLAIN,11);
  frame.setFont(SF);
  border=20;
  String titletext;
  if (tablep.count == -1)   titletext="String_Node_Str" + names[0] + "String_Node_Str";
 else   titletext="String_Node_Str" + names[0] + "String_Node_Str"+ tablep.data.getName(tablep.count)+ "String_Node_Str";
  setName(titletext);
  evtq=Toolkit.getDefaultToolkit().getSystemEventQueue();
}
Program: 180033
Project: 180033
Buggy source:
public PlotPanel createPlotPanel(Mondrian mondrian,MDialog plotDialog,DataSet dataSet,JList varNames){
  int[] indices=varNames.getSelectedIndices();
  PlotPanel barChartsContainer=new PlotPanel();
  plotDialog.setLayout(new GridLayout(1,indices.length));
  int weight=-1;
  for (int i=0; i < indices.length; i++) {
    int[] dummy={0};
    dummy[0]=indices[i];
    Table breakdown=dataSet.breakDown(dataSet.setName,dummy,weight);
    int totHeight=(Toolkit.getDefaultToolkit().getScreenSize()).height;
    int tmpHeight=Math.min(totHeight - 30,60 + breakdown.levels[0] * 30);
    Barchart barchart=new Barchart(plotDialog,300,tmpHeight,breakdown);
    barChartsContainer.add(barchart);
  }
  return barChartsContainer;
}

Fixed version (ground truth):
public PlotPanel createPlotPanel(Mondrian mondrian,MDialog plotDialog,DataSet dataSet,JList varNames){
  int[] indices=varNames.getSelectedIndices();
  PlotPanel barChartsContainer=new PlotPanel();
  int numPlots=indices.length;
  barChartsContainer.setLayout(new GridLayout(1,numPlots));
  int weight=-1;
  Table[] breakdowns=new Table[numPlots];
  int maxLevels=-1;
  for (int i=0; i < numPlots; i++) {
    int[] dummy={0};
    dummy[0]=indices[i];
    Table breakdown=dataSet.breakDown(dataSet.setName,dummy,weight);
    maxLevels=Math.max(maxLevels,breakdown.levels[0]);
    breakdowns[i]=breakdown;
  }
  Dimension screenSize=Toolkit.getDefaultToolkit().getScreenSize();
  int height=Math.min(screenSize.height - 30,60 + maxLevels * 30);
  int frameWidth=Math.min(screenSize.width - 50,300 * numPlots);
  int plotWidth=frameWidth / numPlots;
  plotDialog.setSize(frameWidth - plotDialog.getInsets().left - plotDialog.getInsets().right,height);
  for (int i=0; i < numPlots; i++) {
    Barchart barchart=new Barchart(plotDialog,plotWidth,height,breakdowns[i]);
    barChartsContainer.add(barchart);
    if (barChartsContainer.getName() != null)     barChartsContainer.setName(barChartsContainer.getName() + "String_Node_Str" + barchart.getName());
 else     barChartsContainer.setName(barchart.getName());
  }
  return barChartsContainer;
}
Program: 180034
Project: 180034
Buggy source:
public Histogram(MDialog frame,int width,int height,Table tablep,double bStart,double bWidth,int weight){
  super(frame);
  this.tablep=tablep;
  this.name=tablep.name;
  this.levels=tablep.levels;
  this.names=tablep.names;
  this.lnames=tablep.lnames;
  this.bStart=bStart;
  this.bWidth=bWidth;
  this.width=width;
  this.height=height;
  this.weight=weight;
  frame.getContentPane().add(this);
  border=20;
  yShift=-10;
  data=tablep.data;
  dvar=tablep.initialVars[0];
  this.k=levels[0];
  round=(int)Math.max(0,3 - Math.round((Math.log(data.getMax(dvar) - data.getMin(dvar)) / Math.log(10))));
  Font SF=new Font("String_Node_Str",Font.PLAIN,11);
  frame.setFont(SF);
  String titletext;
  if (weight == -1)   titletext="String_Node_Str" + names[0] + "String_Node_Str";
 else   titletext="String_Node_Str" + names[0] + "String_Node_Str"+ data.getName(weight)+ "String_Node_Str";
  frame.setTitle(titletext);
  xMin=tablep.data.getMin(tablep.initialVars[0]);
  xMax=tablep.data.getMax(tablep.initialVars[0]);
  double range=xMax - xMin;
  yMin=0;
  yMax=1 / range * 4.25;
  if (rects.size() == 0) {
    setCoordinates(xMin - range * 0.05,yMin,xMax + range * 0.05,yMax,-1);
    coordsSet=false;
  }
  this.enableEvents(AWTEvent.WINDOW_EVENT_MASK);
  this.enableEvents(AWTEvent.KEY_EVENT_MASK);
  this.enableEvents(AWTEvent.MOUSE_EVENT_MASK);
  this.requestFocus();
  evtq=Toolkit.getDefaultToolkit().getSystemEventQueue();
}

Fixed version (ground truth):
public Histogram(MDialog frame,int width,int height,Table tablep,double bStart,double bWidth,int weight){
  super(frame);
  this.tablep=tablep;
  this.name=tablep.name;
  this.levels=tablep.levels;
  this.names=tablep.names;
  this.lnames=tablep.lnames;
  this.bStart=bStart;
  this.bWidth=bWidth;
  this.width=width;
  this.height=height;
  this.weight=weight;
  frame.getContentPane().add(this);
  border=20;
  yShift=-10;
  data=tablep.data;
  dvar=tablep.initialVars[0];
  this.k=levels[0];
  round=(int)Math.max(0,3 - Math.round((Math.log(data.getMax(dvar) - data.getMin(dvar)) / Math.log(10))));
  Font SF=new Font("String_Node_Str",Font.PLAIN,11);
  frame.setFont(SF);
  String titletext;
  if (weight == -1)   titletext="String_Node_Str" + names[0] + "String_Node_Str";
 else   titletext="String_Node_Str" + names[0] + "String_Node_Str"+ data.getName(weight)+ "String_Node_Str";
  setName(titletext);
  xMin=tablep.data.getMin(tablep.initialVars[0]);
  xMax=tablep.data.getMax(tablep.initialVars[0]);
  double range=xMax - xMin;
  yMin=0;
  yMax=1 / range * 4.25;
  if (rects.size() == 0) {
    setCoordinates(xMin - range * 0.05,yMin,xMax + range * 0.05,yMax,-1);
    coordsSet=false;
  }
  this.enableEvents(AWTEvent.WINDOW_EVENT_MASK);
  this.enableEvents(AWTEvent.KEY_EVENT_MASK);
  this.enableEvents(AWTEvent.MOUSE_EVENT_MASK);
  this.requestFocus();
  evtq=Toolkit.getDefaultToolkit().getSystemEventQueue();
}
Program: 180036
Project: 180036
Buggy source:
public MissPlot(MDialog frame,DataSet data,int[] vars){
  super(frame);
  this.vars=vars;
  this.data=data;
  this.k=vars.length;
  permA=new int[k];
  IpermA=new int[k];
  for (int j=0; j < k; j++) {
    permA[j]=j;
    IpermA[permA[j]]=j;
  }
  sb.setUnitIncrement(22);
  sb.setBlockIncrement(22);
  frame.getContentPane().add(this);
  Font SF=new Font("String_Node_Str",Font.PLAIN,11);
  frame.setFont(SF);
  border=20;
  String titletext;
  titletext="String_Node_Str";
  for (int j=0; j < this.k; j++) {
    boolean[] tmpMiss;
    double[] values=new double[2];
    int[][] Ids=new int[2][];
    tmpMiss=data.getMissings(vars[j]);
    values[0]=data.getN(vars[j]);
    values[1]=data.n - values[0];
    Ids[0]=new int[(int)values[0]];
    Ids[1]=new int[(int)values[1]];
    int obsPointer=0;
    int NAPointer=0;
    for (int i=0; i < data.n; i++) {
      if (!tmpMiss[i])       Ids[0][obsPointer++]=i;
 else       Ids[1][NAPointer++]=i;
    }
    tables.addElement(new Table("String_Node_Str",values,1,new int[]{2},new String[]{data.getName(vars[j])},new String[][]{{"String_Node_Str","String_Node_Str"}},new int[]{vars[j]},Ids,data,-1));
  }
  frame.setTitle(titletext);
  setScrollX();
  EventQueue evtq=Toolkit.getDefaultToolkit().getSystemEventQueue();
}

Fixed version (ground truth):
public MissPlot(MDialog frame,DataSet data,int[] vars){
  super(frame);
  this.vars=vars;
  this.data=data;
  this.k=vars.length;
  permA=new int[k];
  IpermA=new int[k];
  for (int j=0; j < k; j++) {
    permA[j]=j;
    IpermA[permA[j]]=j;
  }
  sb.setUnitIncrement(22);
  sb.setBlockIncrement(22);
  frame.getContentPane().add(this);
  Font SF=new Font("String_Node_Str",Font.PLAIN,11);
  frame.setFont(SF);
  border=20;
  String titletext;
  titletext="String_Node_Str";
  for (int j=0; j < this.k; j++) {
    boolean[] tmpMiss;
    double[] values=new double[2];
    int[][] Ids=new int[2][];
    tmpMiss=data.getMissings(vars[j]);
    values[0]=data.getN(vars[j]);
    values[1]=data.n - values[0];
    Ids[0]=new int[(int)values[0]];
    Ids[1]=new int[(int)values[1]];
    int obsPointer=0;
    int NAPointer=0;
    for (int i=0; i < data.n; i++) {
      if (!tmpMiss[i])       Ids[0][obsPointer++]=i;
 else       Ids[1][NAPointer++]=i;
    }
    tables.addElement(new Table("String_Node_Str",values,1,new int[]{2},new String[]{data.getName(vars[j])},new String[][]{{"String_Node_Str","String_Node_Str"}},new int[]{vars[j]},Ids,data,-1));
  }
  setName(titletext);
  setScrollX();
  EventQueue evtq=Toolkit.getDefaultToolkit().getSystemEventQueue();
}
Program: 180038
Project: 180038
Buggy source:
public PlotPanel createPlotPanel(Mondrian mondrian,MDialog plotDialog,DataSet dataSet,JList varNames){
  int k=(varNames.getSelectedIndices()).length;
  int[] passBuffer=new int[k];
  for (int i=0; i < k; i++)   passBuffer[i]=mondrian.getSelector().selectBuffer[k - i - 1];
  Table breakdown=dataSet.breakDown(dataSet.setName,passBuffer,-1);
  for (int i=0; i < (varNames.getSelectedIndices()).length - 1; i++) {
    breakdown.addInteraction(new int[]{i},false);
  }
  breakdown.addInteraction(new int[]{(varNames.getSelectedIndices()).length - 1},true);
  return new MosaicPlot(plotDialog,400,400,breakdown);
}

Fixed version (ground truth):
public PlotPanel createPlotPanel(Mondrian mondrian,MDialog plotDialog,DataSet dataSet,JList varNames){
  int k=(varNames.getSelectedIndices()).length;
  int[] passBuffer=new int[k];
  for (int i=0; i < k; i++)   passBuffer[i]=mondrian.getSelector().selectBuffer[k - i - 1];
  Table breakdown=dataSet.breakDown(dataSet.setName,passBuffer,-1);
  for (int i=0; i < (varNames.getSelectedIndices()).length - 1; i++) {
    breakdown.addInteraction(new int[]{i},false);
  }
  breakdown.addInteraction(new int[]{(varNames.getSelectedIndices()).length - 1},true);
  plotDialog.setSize(400,400);
  plotDialog.setLocation(Utils.genRandomLoacation(plotDialog));
  return new MosaicPlot(plotDialog,400,400,breakdown);
}
Program: 180039
Project: 180039
Buggy source:
public boolean isCompliant(DataSet dataSet,int numVariables,int numCategoricalVariables){
  return numVariables > 2 && (numVariables - 1) == numCategoricalVariables;
}

Fixed version (ground truth):
public boolean isCompliant(DataSet dataSet,int numVariables,int numCategoricalVariables){
  return numVariables >= 2 && numVariables == numCategoricalVariables;
}
Program: 180041
Project: 180041
Buggy source:
public PlotPanel createPlotPanel(Mondrian mondrian,MDialog plotDialog,DataSet dataSet,JList varNames){
  int k=(varNames.getSelectedIndices()).length;
  int[] passTmpBuffer=new int[k];
  int count=0;
  for (int i=0; i < k; i++) {
    if (dataSet.getNumMissings(mondrian.getSelector().selectBuffer[k - i - 1]) < dataSet.n)     passTmpBuffer[count++]=mondrian.getSelector().selectBuffer[k - i - 1];
  }
  int[] passBuffer=new int[count];
  System.arraycopy(passTmpBuffer,0,passBuffer,0,count);
  return new ParallelPlot(plotDialog,dataSet,passBuffer,getMode(),varNames);
}

Fixed version (ground truth):
public PlotPanel createPlotPanel(Mondrian mondrian,MDialog plotDialog,DataSet dataSet,JList varNames){
  int totWidth=(Toolkit.getDefaultToolkit().getScreenSize()).width;
  int tmpWidth=50 * (1 + (varNames.getSelectedIndices()).length);
  if (tmpWidth > totWidth)   if (20 * (1 + (varNames.getSelectedIndices()).length) < totWidth)   tmpWidth=totWidth;
 else   tmpWidth=20 * (1 + (varNames.getSelectedIndices()).length);
  plotDialog.setSize(tmpWidth,400);
  plotDialog.setLocation(Utils.genRandomLoacation(plotDialog));
  int k=(varNames.getSelectedIndices()).length;
  int[] passTmpBuffer=new int[k];
  int count=0;
  for (int i=0; i < k; i++) {
    if (dataSet.getNumMissings(mondrian.getSelector().selectBuffer[k - i - 1]) < dataSet.n)     passTmpBuffer[count++]=mondrian.getSelector().selectBuffer[k - i - 1];
  }
  int[] passBuffer=new int[count];
  System.arraycopy(passTmpBuffer,0,passBuffer,0,count);
  return new ParallelPlot(plotDialog,dataSet,passBuffer,getMode(),varNames);
}
Program: 180042
Project: 180042
Buggy source:
public PlotPanel createPlotPanel(Mondrian mondrian,MDialog plotDialog,DataSet dataSet,JList varNames){
  int numVars=(varNames.getSelectedIndices()).length;
  PlotPanel splomPanel=new PlotPanel();
  splomPanel.setLayout(new GridLayout(numVars - 1,numVars - 1));
  splomPanel.setMinimumSize(new Dimension(200 * numVars,200 * numVars));
  for (int i=0; i < (numVars - 1); i++)   for (int j=1; j < numVars; j++) {
    if (i >= j) {
      JPanel Filler=new JPanel();
      Filler.setBackground(ColorManager.backgroundColor);
      splomPanel.add(Filler);
    }
 else {
      int[] tmpVars=new int[2];
      tmpVars[0]=mondrian.getSelector().selectBuffer[numVars - j - 1];
      tmpVars[1]=mondrian.getSelector().selectBuffer[numVars - i - 1];
      Scatter2DPlot scat=new Scatter2DPlot(plotDialog,200,200,dataSet,tmpVars,varNames,true);
      splomPanel.add(scat);
    }
  }
  return splomPanel;
}

Fixed version (ground truth):
public PlotPanel createPlotPanel(Mondrian mondrian,MDialog plotDialog,DataSet dataSet,JList varNames){
  int numVars=(varNames.getSelectedIndices()).length;
  PlotPanel splomPanel=new PlotPanel();
  splomPanel.setLayout(new GridLayout(numVars - 1,numVars - 1));
  splomPanel.setMinimumSize(new Dimension(200 * numVars,200 * numVars));
  int dims=Math.min(200 * numVars,(Toolkit.getDefaultToolkit().getScreenSize()).height);
  plotDialog.setSize(dims - 20,dims);
  for (int i=0; i < (numVars - 1); i++)   for (int j=1; j < numVars; j++) {
    if (i >= j) {
      JPanel Filler=new JPanel();
      Filler.setBackground(ColorManager.backgroundColor);
      splomPanel.add(Filler);
    }
 else {
      int[] tmpVars=new int[2];
      tmpVars[0]=mondrian.getSelector().selectBuffer[numVars - j - 1];
      tmpVars[1]=mondrian.getSelector().selectBuffer[numVars - i - 1];
      Scatter2DPlot scat=new Scatter2DPlot(plotDialog,200,200,dataSet,tmpVars,varNames,true);
      splomPanel.add(scat);
    }
  }
  return splomPanel;
}
Program: 180043
Project: 180043
Buggy source:
public PlotPanel createPlotPanel(Mondrian mondrian,MDialog plotDialog,DataSet dataSet,JList varNames){
  int[] indices=varNames.getSelectedIndices();
  PlotPanel barChartsContainer=new PlotPanel();
  plotDialog.setLayout(new GridLayout(1,indices.length));
  int[] vars=WeightCaclulator.getWeightVariable(varNames.getSelectedIndices(),dataSet,mondrian.calcNumCategoricalVars(),mondrian.determineWeightIndex(),null,varNames);
  int[] passed=new int[vars.length - 1];
  System.arraycopy(vars,0,passed,0,vars.length - 1);
  int weight=vars[vars.length - 1];
  for (int i=0; i < passed.length; i++) {
    int[] dummy={0};
    dummy[0]=passed[i];
    Table breakdown=dataSet.breakDown(dataSet.setName,dummy,weight);
    int totHeight=(Toolkit.getDefaultToolkit().getScreenSize()).height;
    int tmpHeight=Math.min(totHeight - 20,60 + breakdown.levels[0] * 30);
    Barchart weightedBarchart=new Barchart(plotDialog,300,tmpHeight,breakdown);
    barChartsContainer.add(weightedBarchart);
  }
  return barChartsContainer;
}

Fixed version (ground truth):
public PlotPanel createPlotPanel(Mondrian mondrian,MDialog plotDialog,DataSet dataSet,JList varNames){
  int[] indices=varNames.getSelectedIndices();
  PlotPanel barChartsContainer=new PlotPanel();
  plotDialog.setLayout(new GridLayout(1,indices.length));
  int[] vars=WeightCaclulator.getWeightVariable(varNames.getSelectedIndices(),dataSet,mondrian.calcNumCategoricalVars(),mondrian.determineWeightIndex(),null,varNames);
  int[] passed=new int[vars.length - 1];
  System.arraycopy(vars,0,passed,0,vars.length - 1);
  int weight=vars[vars.length - 1];
  for (int i=0; i < passed.length; i++) {
    int[] dummy={0};
    dummy[0]=passed[i];
    Table breakdown=dataSet.breakDown(dataSet.setName,dummy,weight);
    int totHeight=(Toolkit.getDefaultToolkit().getScreenSize()).height;
    int tmpHeight=Math.min(totHeight - 20,60 + breakdown.levels[0] * 30);
    Barchart weightedBarchart=new Barchart(plotDialog,300,tmpHeight,breakdown);
    barChartsContainer.setSize(300,tmpHeight);
    barChartsContainer.add(weightedBarchart);
  }
  plotDialog.setLocation(100,100);
  return barChartsContainer;
}
Program: 180044
Project: 180044
Buggy source:
public boolean isCompliant(DataSet dataSet,int numVariables,int numCategoricalVariables){
  return numVariables == numCategoricalVariables;
}

Fixed version (ground truth):
public boolean isCompliant(DataSet dataSet,int numVariables,int numCategoricalVariables){
  return numVariables == 1 && numVariables == numCategoricalVariables;
}
Program: 180045
Project: 180045
Buggy source:
public PlotPanel createPlotPanel(Mondrian mondrian,MDialog plotDialog,DataSet dataSet,JList varNames){
  int k=(varNames.getSelectedIndices()).length;
  int[] passBuffer=new int[k];
  for (int i=0; i < k; i++)   passBuffer[i]=mondrian.getSelector().selectBuffer[k - i - 1];
  int[] vars=WeightCaclulator.getWeightVariable(passBuffer,dataSet,mondrian.calcNumCategoricalVars(),mondrian.determineWeightIndex(),null,varNames);
  int[] passed=new int[vars.length - 1];
  System.arraycopy(vars,0,passed,0,vars.length - 1);
  int weight=vars[vars.length - 1];
  Table breakdown=dataSet.breakDown(dataSet.setName,passed,weight);
  for (int i=0; i < passed.length - 1; i++)   breakdown.addInteraction(new int[]{i},false);
  breakdown.addInteraction(new int[]{passed.length - 1},true);
  return new MosaicPlot(plotDialog,400,400,breakdown);
}

Fixed version (ground truth):
public PlotPanel createPlotPanel(Mondrian mondrian,MDialog plotDialog,DataSet dataSet,JList varNames){
  int k=(varNames.getSelectedIndices()).length;
  int[] passBuffer=new int[k];
  for (int i=0; i < k; i++)   passBuffer[i]=mondrian.getSelector().selectBuffer[k - i - 1];
  int[] vars=WeightCaclulator.getWeightVariable(passBuffer,dataSet,mondrian.calcNumCategoricalVars(),mondrian.determineWeightIndex(),null,varNames);
  int[] passed=new int[vars.length - 1];
  System.arraycopy(vars,0,passed,0,vars.length - 1);
  int weight=vars[vars.length - 1];
  Table breakdown=dataSet.breakDown(dataSet.setName,passed,weight);
  for (int i=0; i < passed.length - 1; i++)   breakdown.addInteraction(new int[]{i},false);
  breakdown.addInteraction(new int[]{passed.length - 1},true);
  plotDialog.setSize(400,400);
  plotDialog.setLocation(Utils.genRandomLoacation(plotDialog));
  return new MosaicPlot(plotDialog,400,400,breakdown);
}
Program: 180046
Project: 180046
Buggy source:
public void actionPerformed(ActionEvent e){
  Mondrian mondrian=monFrame.getController().getCurrent();
  mondrian.getSelector().checkHistoryBuffer();
  MDialog plotFrame=new MDialog(monFrame,mondrian);
  Font SF=new Font("String_Node_Str",Font.PLAIN,11);
  plotFrame.setFont(SF);
  PlotPanel plotPanel=plotFactory.createPlotPanel(mondrian,plotFrame,mondrian.getDataSet(),mondrian.getSelector().getVarNames());
  if (plotPanel != null) {
    for (    PlotPanel plot : plotPanel.getPlots()) {
      monFrame.getController().getCurrent().addPlot((DragBox)plot);
    }
    plotFrame.getContentPane().add(plotPanel);
    plotFrame.setTitle(plotPanel.getName() != null ? plotPanel.getName() : plotFactory.getPlotName());
    plotFrame.setVisible(true);
  }
}

Fixed version (ground truth):
public void actionPerformed(ActionEvent e){
  Mondrian mondrian=monFrame.getController().getCurrent();
  mondrian.getSelector().checkHistoryBuffer();
  MDialog plotFrame=new MDialog(monFrame,mondrian);
  Font SF=new Font("String_Node_Str",Font.PLAIN,11);
  plotFrame.setFont(SF);
  PlotPanel plotPanel=plotFactory.createPlotPanel(mondrian,plotFrame,mondrian.getDataSet(),mondrian.getSelector().getVarNames());
  if (plotPanel != null) {
    for (    PlotPanel plot : plotPanel.getPlots()) {
      mondrian.addPlot((DragBox)plot);
    }
    plotFrame.getContentPane().add(plotPanel);
    plotFrame.setTitle(plotPanel.getName() != null ? plotPanel.getName() : plotFactory.getPlotName());
    plotFrame.setVisible(true);
  }
}
Program: 180047
Project: 180047
Buggy source:
public PlotPanel createPlotPanel(Mondrian mondrian,MFrame plotFrame,DataSet dataSet,JList varNames){
  int[] indices=varNames.getSelectedIndices();
  PlotPanel barChartsContainer=new PlotPanel();
  int numPlots=indices.length;
  barChartsContainer.setLayout(new GridLayout(1,numPlots));
  int weight=-1;
  Table[] breakdowns=new Table[numPlots];
  int maxLevels=-1;
  for (int i=0; i < numPlots; i++) {
    int[] dummy={0};
    dummy[0]=indices[i];
    Table breakdown=dataSet.breakDown(dataSet.setName,dummy,weight);
    maxLevels=Math.max(maxLevels,breakdown.levels[0]);
    breakdowns[i]=breakdown;
  }
  Dimension screenSize=Toolkit.getDefaultToolkit().getScreenSize();
  int height=Math.min(screenSize.height - 30,60 + maxLevels * 30);
  int frameWidth=Math.min(screenSize.width - 50,300 * numPlots);
  int plotWidth=frameWidth / numPlots;
  plotFrame.setSize(frameWidth - plotFrame.getInsets().left - plotFrame.getInsets().right,height);
  for (int i=0; i < numPlots; i++) {
    Barchart barchart=new Barchart(plotFrame,plotWidth,height,breakdowns[i]);
    barChartsContainer.add(barchart);
    if (barChartsContainer.getName() != null)     barChartsContainer.setName(barChartsContainer.getName() + "String_Node_Str" + barchart.getName());
 else     barChartsContainer.setName(barchart.getName());
  }
  return barChartsContainer;
}

Fixed version (ground truth):
public PlotPanel createPlotPanel(Mondrian mondrian,MFrame plotFrame,DataSet dataSet,JList varNames){
  int[] indices=varNames.getSelectedIndices();
  int weight=-1;
  return createBarChart(mondrian,plotFrame,dataSet,indices,weight);
}