nus-yam/ex-repair huggingface dataset:
Program: 64375
Project: 64375
Buggy source:
/** 
 * Update the display for the current items. 
 * @param items Current items to display.
 */
private void updateDisplay(ACSElement[] items){
  if (_customizer != null) {
    _container.remove((Component)_customizer);
    _customizer=null;
  }
  if (items != null && items.length > 0) {
    ACSElement item=items[items.length - 1];
    try {
      BeanInfo info=Introspector.getBeanInfo(item.getClass());
      _customizer=(Customizer)info.getBeanDescriptor().getCustomizerClass().newInstance();
      _customizer.setObject(item);
      _container.add(BorderLayout.CENTER,(Component)_customizer);
    }
 catch (    Exception ex) {
      ex.printStackTrace();
    }
  }
  _container.repaint();
}

Fixed version (ground truth):
/** 
 * Update the display for the current items. 
 * @param items Current items to display.
 */
private void updateDisplay(ACSElement[] items){
  if (_customizer != null) {
    _container.remove((Component)_customizer);
    _customizer=null;
  }
  if (items != null && items.length > 0) {
    ACSElement item=items[items.length - 1];
    try {
      BeanInfo info=Introspector.getBeanInfo(item.getClass());
      _customizer=(Customizer)info.getBeanDescriptor().getCustomizerClass().newInstance();
      _customizer.setObject(item);
      _container.add(BorderLayout.CENTER,(Component)_customizer);
    }
 catch (    Exception ex) {
      ex.printStackTrace();
    }
  }
  _container.validate();
  _container.repaint();
}
Program: 64377
Project: 64377
Buggy source:
/** 
 * Load a project from the given XML file. XXX fix me.
 * @param f File to load.
 * @return 
 */
public ACSProjectElement load(File f) throws IOException, SAXException {
  XmlDocument doc=null;
  try {
    SAXParser sax=SAXParserFactory.newInstance().newSAXParser();
    Parser parser=(Parser)sax.getParser();
    XmlDocumentBuilder builder=new XmlDocumentBuilder();
    builder.setIgnoringLexicalInfo(false);
    SimpleElementFactory fact=new SimpleElementFactory();
    fact.addMapping(_elementMap,ACSFactory.class.getClassLoader());
    builder.setElementFactory(fact);
    parser.setDocumentHandler(builder);
    parser.setEntityResolver(new Resolver());
    sax.parse(f,null);
    doc=builder.getDocument();
  }
 catch (  ParserConfigurationException ex) {
    ex.printStackTrace();
    throw new IOException(ex.getMessage());
  }
  return (ACSProjectElement)doc.getDocumentElement();
}

Fixed version (ground truth):
/** 
 * Load a project from the given XML file. XXX fix me.
 * @param location Location of the file.
 * @return Loaded project.
 */
public ACSProjectElement load(URL location) throws IOException {
  XmlDocument doc=null;
  try {
    SAXParser sax=SAXParserFactory.newInstance().newSAXParser();
    Parser parser=(Parser)sax.getParser();
    XmlDocumentBuilder builder=new XmlDocumentBuilder();
    builder.setIgnoringLexicalInfo(false);
    SimpleElementFactory fact=new SimpleElementFactory();
    fact.addMapping(_elementMap,ACSFactory.class.getClassLoader());
    builder.setElementFactory(fact);
    parser.setDocumentHandler(builder);
    parser.setEntityResolver(new Resolver());
    sax.parse(location.openStream(),null);
    doc=builder.getDocument();
  }
 catch (  ParserConfigurationException ex) {
    ex.printStackTrace();
    throw new IOException(ex.getMessage());
  }
catch (  SAXException ex) {
    ex.printStackTrace();
    throw new IOException(ex.getMessage());
  }
  return (ACSProjectElement)doc.getDocumentElement();
}
Program: 64378
Project: 64378
Buggy source:
/** 
 * Standard ctor.
 * @param bus Event bus to post events to.
 */
public ActionManager(EventBus bus){
  _bus=bus;
  bus.addMember(EventBus.RESPONDING,new Enabler());
  _mapper=new EventToActionMapper();
  String toTok=_resources.getString("String_Node_Str");
  StringTokenizer tok=new StringTokenizer(toTok,"String_Node_Str");
  _actionIDs=new String[tok.countTokens()];
  for (int i=0; i < _actionIDs.length; i++) {
    _actionIDs[i]=tok.nextToken();
    AntAction action=new AntAction(_resources,_bus,_actionIDs[i]);
    _actions.put(_actionIDs[i],action);
    _mapper.addAction(action);
  }
}

Fixed version (ground truth):
/** 
 * Standard ctor.
 * @param bus Event bus to post events to.
 * @param resources Location of resources.
 */
public ActionManager(EventBus bus,ResourceManager resources){
  _bus=bus;
  _resources=resources;
  bus.addMember(EventBus.RESPONDING,new Enabler());
  _mapper=new EventToActionMapper();
  String[] names=_resources.getStringArray("String_Node_Str");
  _actionIDs=new String[names.length];
  for (int i=0; i < _actionIDs.length; i++) {
    _actionIDs[i]=names[i];
    AntAction action=new AntAction(_resources,_bus,_actionIDs[i]);
    _actions.put(_actionIDs[i],action);
    _mapper.addAction(action);
  }
}
Program: 64379
Project: 64379
Buggy source:
/** 
 * Standard ctor.
 * @param id Unique id for the action
 */
public AntAction(ResourceBundle resources,EventBus bus,String id){
  _resources=resources;
  _bus=bus;
  _id=id;
  putValue(NAME,getString("String_Node_Str"));
  putValue(SHORT_DESCRIPTION,getString("String_Node_Str"));
  putValue(PARENT_MENU_NAME,getString(PARENT_MENU_NAME));
  putValue(SEPARATOR,getString(SEPARATOR));
  String enabled=getString(ENABLED);
  if (enabled != null) {
    setEnabled(Boolean.valueOf(enabled).booleanValue());
  }
  String accelerator=getString(ACCELERATOR);
  if (accelerator != null) {
    putValue(ACCELERATOR,KeyStroke.getKeyStroke(accelerator));
  }
  String toggle=getString(TOGGLE);
  if (toggle != null) {
    _toggle=Boolean.valueOf(toggle).booleanValue();
  }
  String command=getString(COMMAND);
  if (command != null) {
    try {
      Class cmd=Class.forName(command);
      putValue(COMMAND,cmd);
    }
 catch (    Exception ex) {
      ex.printStackTrace();
    }
  }
  String iconName=getString("String_Node_Str");
  if (iconName != null) {
    try {
      URL imageLoc=AntAction.class.getResource("String_Node_Str" + iconName);
      if (imageLoc != null) {
        putValue(SMALL_ICON,new ImageIcon(imageLoc));
      }
    }
 catch (    Exception ex) {
      ex.printStackTrace();
    }
  }
  _enableOn=resolveClasses(getString(ENABLE_ON));
  _disableOn=resolveClasses(getString(DISABLE_ON));
}

Fixed version (ground truth):
/** 
 * Standard ctor.
 * @param id Unique id for the action
 */
public AntAction(ResourceManager resources,EventBus bus,String id){
  _resources=resources;
  _bus=bus;
  _id=id;
  putValue(NAME,getString("String_Node_Str"));
  putValue(SHORT_DESCRIPTION,getString("String_Node_Str"));
  putValue(PARENT_MENU_NAME,getString(PARENT_MENU_NAME));
  putValue(SEPARATOR,getString(SEPARATOR));
  String enabled=getString(ENABLED);
  if (enabled != null) {
    setEnabled(Boolean.valueOf(enabled).booleanValue());
  }
  String accelerator=getString(ACCELERATOR);
  if (accelerator != null) {
    putValue(ACCELERATOR,KeyStroke.getKeyStroke(accelerator));
  }
  String toggle=getString(TOGGLE);
  if (toggle != null) {
    _toggle=Boolean.valueOf(toggle).booleanValue();
  }
  String command=getString(COMMAND);
  if (command != null) {
    try {
      Class cmd=Class.forName(command);
      putValue(COMMAND,cmd);
    }
 catch (    Exception ex) {
      ex.printStackTrace();
    }
  }
  String iconName=getString("String_Node_Str");
  if (iconName != null) {
    putValue(SMALL_ICON,_resources.loadImageIcon(iconName));
  }
  _enableOn=resolveClasses(getString(ENABLE_ON));
  _disableOn=resolveClasses(getString(DISABLE_ON));
}
Program: 64380
Project: 64380
Buggy source:
/** 
 * Generate a composit key from the given class and key name.
 * @param clazz Class to find resource for.
 * @param name Name of the resource.
 * @return Composite key.
 */
private String getKey(Class clazz,String name){
  return clazz.getName() + "String_Node_Str" + name;
}

Fixed version (ground truth):
/** 
 * Generate a composit key from the given class and key name.
 * @param clazz Class to find resource for.
 * @param name Name of the resource.
 * @return Composite key.
 */
private String getKey(Class clazz,String name){
  name=name == null ? "String_Node_Str" : name;
  return clazz == null ? name : clazz.getName() + "String_Node_Str" + name;
}
Program: 64381
Project: 64381
Buggy source:
/** 
 * Generate a localized message using the given set of arguments to  format the message with.
 * @param clazz Class to get message resource for.
 * @param name 
 * @param arguments 
 * @return 
 */
public String getMessage(Class clazz,String name,Object[] arguments){
  String format=getString(clazz,name);
  return MessageFormat.format(format,arguments);
}

Fixed version (ground truth):
/** 
 * Generate a localized message using the given set of arguments to  format the message with.
 * @param clazz Class to get message resource for.
 * @param name Name of the message.
 * @param arguments Arguments to the message.
 * @return The formatted message.
 */
public String getMessage(Class clazz,String name,Object[] arguments){
  String format=getString(clazz,name);
  return MessageFormat.format(format,arguments);
}
Program: 64382
Project: 64382
Buggy source:
/** 
 * Get an array of string resources for the given class.
 * @param clazz Class to get resource for.
 * @param name Name of the string resource.
 * @return Array of string resources for the given class.
 */
public String[] getStringArray(Class clazz,String name){
  if (clazz == null || name == null) {
    return null;
  }
  String key=getKey(clazz,name);
  String toTok=null;
  try {
    toTok=_resources.getString(key);
  }
 catch (  MissingResourceException ex) {
  }
  if (toTok == null) {
    return _resources.getStringArray(key);
  }
 else {
    StringTokenizer tok=new StringTokenizer(toTok,"String_Node_Str");
    String[] retval=new String[tok.countTokens()];
    for (int i=0; i < retval.length; i++) {
      retval[i]=tok.nextToken();
    }
    return retval;
  }
}

Fixed version (ground truth):
/** 
 * Get an array of string resources for the given class.
 * @param clazz Class to get resource for.
 * @param name Name of the string resource.
 * @return Array of string resources for the given class.
 */
public String[] getStringArray(Class clazz,String name){
  if (name == null) {
    return null;
  }
  String key=getKey(clazz,name);
  String toTok=null;
  try {
    toTok=_resources.getString(key);
  }
 catch (  MissingResourceException ex) {
  }
  if (toTok == null) {
    return _resources.getStringArray(key);
  }
 else {
    StringTokenizer tok=new StringTokenizer(toTok,"String_Node_Str");
    String[] retval=new String[tok.countTokens()];
    for (int i=0; i < retval.length; i++) {
      retval[i]=tok.nextToken();
    }
    return retval;
  }
}
Program: 64383
Project: 64383
Buggy source:
/** 
 * Get a string resource for the given class.
 * @param clazz Class to get resource for.
 * @param name Name of the string resource.
 * @return String resource for the given class.
 */
public String getString(Class clazz,String name){
  if (clazz == null || name == null) {
    return null;
  }
  return _resources.getString(getKey(clazz,name));
}

Fixed version (ground truth):
/** 
 * Get a string resource for the given class.
 * @param clazz Class to get resource for.
 * @param name Name of the string resource.
 * @return String resource for the given class.
 */
public String getString(Class clazz,String name){
  if (name == null) {
    return null;
  }
  return _resources.getString(getKey(clazz,name));
}
Program: 64384
Project: 64384
Buggy source:
/** 
 * Get the image as an ImageIcon with the given file name.  For example "open.gif". The image is loaded from the resources package.
 * @param fileName Image file to load.
 * @return Image as an ImageIcon, or null if not found.
 */
public ImageIcon getImageIcon(String fileName){
  if (fileName == null)   return null;
  ImageIcon icon=null;
  URL location=getClass().getResource(IMG_PATH + "String_Node_Str" + fileName);
  if (location != null) {
    icon=new ImageIcon(location);
  }
  return icon;
}

Fixed version (ground truth):
/** 
 * Get the image as an ImageIcon assigned to the given class with the given key.
 * @param clazz The class to load icon for.
 * @param key The key for looking up the icon.
 * @return Image as an ImageIcon, or null if not found.
 */
public ImageIcon getImageIcon(Class clazz,String key){
  return loadImageIcon(getString(clazz,key));
}
Program: 64385
Project: 64385
Buggy source:
/** 
 * Iterate over the given Vector of relocatablefilesets and add all files to the ZipOutputStream using the given prefix.
 */
protected void addPrefixedFiles(Vector v,ZipOutputStream zOut) throws IOException {
  for (int i=0; i < v.size(); i++) {
    PrefixedFileSet fs=(PrefixedFileSet)v.elementAt(i);
    DirectoryScanner ds=fs.getDirectoryScanner(project);
    String prefix=fs.getPrefix();
    if (prefix.length() > 0 && !prefix.endsWith("String_Node_Str") && !prefix.endsWith("String_Node_Str")) {
      prefix+="String_Node_Str";
    }
    zipDir(null,zOut,prefix);
    addFiles(ds,zOut,prefix);
  }
}

Fixed version (ground truth):
/** 
 * Iterate over the given Vector of prefixedfilesets and add all files to the ZipOutputStream using the given prefix.
 */
protected void addPrefixedFiles(Vector v,ZipOutputStream zOut) throws IOException {
  for (int i=0; i < v.size(); i++) {
    PrefixedFileSet fs=(PrefixedFileSet)v.elementAt(i);
    DirectoryScanner ds=fs.getDirectoryScanner(project);
    String prefix=fs.getPrefix();
    if (prefix.length() > 0 && !prefix.endsWith("String_Node_Str") && !prefix.endsWith("String_Node_Str")) {
      prefix+="String_Node_Str";
    }
    if (prefix.length() > 0) {
      addParentDirs(null,prefix,zOut,"String_Node_Str");
      zipDir(null,zOut,prefix);
    }
    addFiles(ds,zOut,prefix);
  }
}
Program: 64387
Project: 64387
Buggy source:
/** 
 * File loading ctor.
 * @param file File containing build file to load.
 */
public ProjectProxy(AppContext context,File file) throws IOException {
  _file=file;
  _context=context;
  loadProject();
}

Fixed version (ground truth):
/** 
 * File loading ctor.
 * @param file File containing build file to load.
 */
public ProjectProxy(AppContext context,File file) throws IOException, SAXException {
  _file=file;
  _context=context;
  loadProject();
}
Program: 64388
Project: 64388
Buggy source:
/** 
 * Load the project from the build file.
 */
private void loadProject() throws IOException {
  _project=ACSFactory.getInstance().load(_file);
  _selections=new ElementSelectionModel();
  _selections.addTreeSelectionListener(new SelectionForwarder());
}

Fixed version (ground truth):
/** 
 * Load the project from the build file.
 */
private void loadProject() throws IOException, SAXException {
  _project=ACSFactory.getInstance().load(_file);
  _selections=new ElementSelectionModel();
  _selections.addTreeSelectionListener(new SelectionForwarder());
}
Program: 64389
Project: 64389
Buggy source:
/** 
 * Scans the directory looking for source files to be compiled.   The results are returned in the class variable compileList
 */
protected void scanDir(File srcDir,File destDir,String files[]){
  GlobPatternMapper m=new GlobPatternMapper();
  m.setFrom("String_Node_Str");
  m.setTo("String_Node_Str");
  SourceFileScanner sfs=new SourceFileScanner(this);
  compileList=sfs.restrictAsFiles(files,srcDir,destDir,m);
}

Fixed version (ground truth):
/** 
 * Scans the directory looking for source files to be compiled.   The results are returned in the class variable compileList
 */
protected void scanDir(File srcDir,File destDir,String files[]){
  GlobPatternMapper m=new GlobPatternMapper();
  m.setFrom("String_Node_Str");
  m.setTo("String_Node_Str");
  SourceFileScanner sfs=new SourceFileScanner(this);
  File[] newFiles=sfs.restrictAsFiles(files,srcDir,destDir,m);
  if (newFiles.length > 0) {
    File[] newCompileList=new File[compileList.length + newFiles.length];
    System.arraycopy(compileList,0,newCompileList,0,compileList.length);
    System.arraycopy(newFiles,0,newCompileList,compileList.length,newFiles.length);
    compileList=newCompileList;
  }
}
Program: 64390
Project: 64390
Buggy source:
/** 
 * Ensure we have a consistent and legal set of attributes, and set any internal flags necessary based on different combinations  of attributes.
 */
protected void validateAttributes() throws BuildException {
  if (file == null && filesets.size() == 0) {
    throw new BuildException("String_Node_Str");
  }
  if (destFile != null && destDir != null) {
    throw new BuildException("String_Node_Str");
  }
  if (destFile == null && destDir == null) {
    throw new BuildException("String_Node_Str");
  }
  if (file != null && destFile != null && file.exists() && file.isDirectory()) {
    throw new BuildException("String_Node_Str");
  }
  if (destFile != null && filesets.size() > 0) {
    throw new BuildException("String_Node_Str");
  }
  if (destFile != null) {
    destDir=new File(destFile.getParent());
  }
}

Fixed version (ground truth):
/** 
 * Ensure we have a consistent and legal set of attributes, and set any internal flags necessary based on different combinations  of attributes.
 */
protected void validateAttributes() throws BuildException {
  if (file == null && filesets.size() == 0) {
    throw new BuildException("String_Node_Str");
  }
  if (destFile != null && destDir != null) {
    throw new BuildException("String_Node_Str");
  }
  if (destFile == null && destDir == null) {
    throw new BuildException("String_Node_Str");
  }
  if (file != null && file.exists() && file.isDirectory()) {
    throw new BuildException("String_Node_Str");
  }
  if (destFile != null && filesets.size() > 0) {
    throw new BuildException("String_Node_Str");
  }
  if (destFile != null) {
    destDir=new File(destFile.getParent());
  }
}
Program: 64391
Project: 64391
Buggy source:
protected ExecuteStreamHandler createHandler() throws BuildException {
  if (out != null) {
    try {
      fos=new FileOutputStream(out);
      log("String_Node_Str" + out,Project.MSG_VERBOSE);
      return new PumpStreamHandler(fos);
    }
 catch (    FileNotFoundException fne) {
      throw new BuildException("String_Node_Str" + out,fne,location);
    }
  }
 else {
    return new LogStreamHandler(this,Project.MSG_INFO,Project.MSG_WARN);
  }
}

Fixed version (ground truth):
protected ExecuteStreamHandler createHandler() throws BuildException {
  if (out != null) {
    try {
      fos=new FileOutputStream(out);
      log("String_Node_Str" + out,Project.MSG_VERBOSE);
      return new PumpStreamHandler(fos);
    }
 catch (    FileNotFoundException fne) {
      throw new BuildException("String_Node_Str" + out,fne,location);
    }
catch (    IOException ioe) {
      throw new BuildException("String_Node_Str" + out,ioe,location);
    }
  }
 else {
    return new LogStreamHandler(this,Project.MSG_INFO,Project.MSG_WARN);
  }
}
Program: 64393
Project: 64393
Buggy source:
/** 
 * Return the package name of the given java source file. This method performs valid java parsing to figure out the package.
 */
private String getPackageName(File file){
  String name=null;
  try {
    BufferedReader reader=new BufferedReader(new JavaReader(new BufferedReader(new FileReader(file))));
    String line;
    while (true) {
      line=reader.readLine();
      if (line == null) {
        log("String_Node_Str" + file,Project.MSG_WARN);
        return null;
      }
      if (line.trim().startsWith("String_Node_Str")) {
        name=line.substring(8,line.indexOf("String_Node_Str")).trim();
        break;
      }
    }
    reader.close();
  }
 catch (  Exception e) {
    log("String_Node_Str" + e + "String_Node_Str"+ file,Project.MSG_WARN);
    return null;
  }
  log(file + "String_Node_Str" + name,Project.MSG_VERBOSE);
  return name;
}

Fixed version (ground truth):
/** 
 * Return the package name of the given java source file. This method performs valid java parsing to figure out the package.
 */
private String getPackageName(File file){
  String name=null;
  try {
    BufferedReader reader=new BufferedReader(new JavaReader(new BufferedReader(new FileReader(file))));
    String line;
    while (true) {
      line=reader.readLine();
      if (line == null) {
        log("String_Node_Str" + file,Project.MSG_WARN);
        return null;
      }
      if (line.trim().startsWith("String_Node_Str") || line.trim().startsWith("String_Node_Str")) {
        name=line.substring(8,line.indexOf("String_Node_Str")).trim();
        break;
      }
    }
    reader.close();
  }
 catch (  Exception e) {
    log("String_Node_Str" + e + "String_Node_Str"+ file,Project.MSG_WARN);
    return null;
  }
  log(file + "String_Node_Str" + name,Project.MSG_VERBOSE);
  return name;
}
Program: 64394
Project: 64394
Buggy source:
public void setTag(String p){
  this.tag=p;
}

Fixed version (ground truth):
public void setTag(String p){
  if (p != null) {
    if (p.trim().equals("String_Node_Str"))     p=null;
  }
  this.tag=p;
}
Program: 64396
Project: 64396
Buggy source:
public void addAttachment(String filePath,String fileName) throws Exception {
  BodyPart messageBodyPart=new MimeBodyPart();
  DataSource source=new FileDataSource(filePath);
  messageBodyPart.setDataHandler(new DataHandler(source));
  messageBodyPart.setFileName(fileName);
  multipart.addBodyPart(messageBodyPart);
}

Fixed version (ground truth):
public void addAttachment(String filePath,String fileName) throws Exception {
  BodyPart messageBodyPart=new MimeBodyPart();
  ((MimeBodyPart)messageBodyPart).attachFile(filePath);
  multipart.addBodyPart(messageBodyPart);
}
Program: 64397
Project: 64397
Buggy source:
public boolean send() throws MessagingException {
  if (!user.equals("String_Node_Str") && !pass.equals("String_Node_Str") && !to.equals("String_Node_Str")&& !from.equals("String_Node_Str")) {
    Session session=Session.getDefaultInstance(props,this);
    Log.d("String_Node_Str",host + "String_Node_Str" + port+ "String_Node_Str"+ user+ "String_Node_Str"+ pass);
    MimeMessage msg=new MimeMessage(session);
    msg.setFrom(new InternetAddress(from));
    InternetAddress addressTo=new InternetAddress(to);
    msg.setRecipient(MimeMessage.RecipientType.TO,addressTo);
    msg.setSubject(subject);
    msg.setSentDate(new Date());
    BodyPart messageBodyPart=new MimeBodyPart();
    messageBodyPart.setText(body);
    multipart.addBodyPart(messageBodyPart);
    msg.setContent(multipart);
    Transport.send(msg);
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
public boolean send() throws MessagingException {
  if (!user.equals("String_Node_Str") && !pass.equals("String_Node_Str") && !to.equals("String_Node_Str")&& !from.equals("String_Node_Str")) {
    Session session=Session.getDefaultInstance(props,this);
    Log.d("String_Node_Str",host + "String_Node_Str" + port+ "String_Node_Str"+ user+ "String_Node_Str"+ pass);
    MimeMessage msg=new MimeMessage(session);
    msg.setFrom(new InternetAddress(from));
    InternetAddress addressTo=new InternetAddress(to);
    msg.setRecipient(MimeMessage.RecipientType.TO,addressTo);
    msg.setSubject(subject);
    msg.setSentDate(new Date());
    BodyPart messageBodyPart=new MimeBodyPart();
    messageBodyPart.setText(body);
    multipart.addBodyPart(messageBodyPart,0);
    msg.setContent(multipart);
    Transport.send(msg);
    return true;
  }
 else {
    return false;
  }
}
Program: 64399
Project: 64399
Buggy source:
@Override protected Object doMainTask(TaskMonitor monitor,ObjectRepository repository){
  Object result=null;
  Task taskBase=(Task)task;
  for (int i=0; i < this.numStreamsOption.getValue(); i++) {
    this.task=(Task)((MOAObject)taskBase).copy();
    result=this.task.doTask(monitor,repository);
  }
  return result;
}

Fixed version (ground truth):
@Override protected Object doMainTask(TaskMonitor monitor,ObjectRepository repository){
  Object result=null;
  String arffFile, outputFile;
  FileStream fStream;
  for (int i=0; i < this.numStreamsOption.getValue(); i++) {
    this.task=new EvaluateClustering();
    this.task.learnerOption.setValueViaCLIString(this.learnerOption.getValueAsCLIString());
    fStream=(FileStream)getPreparedClassOption(this.streamOption);
    arffFile=fStream.arffFileOption.getValueAsCLIString();
    arffFile=arffFile.substring(0,arffFile.length() - 6).concat(i + "String_Node_Str");
    fStream.arffFileOption.setValueViaCLIString(arffFile);
    this.task.streamOption.setValueViaCLIString(fStream.getCLICreationString(fStream.getClass()));
    outputFile=this.dumpFileOption.getValueAsCLIString();
    if (outputFile.substring(outputFile.length() - 4,outputFile.length()).equals("String_Node_Str")) {
      outputFile=outputFile.substring(0,outputFile.length() - 4);
    }
    outputFile=outputFile.concat("String_Node_Str" + i + "String_Node_Str");
    this.task.dumpFileOption.setValueViaCLIString(outputFile);
    this.task.instanceLimitOption.setValue(-1);
    this.task.measureCollectionTypeOption.setValue(0);
    System.out.println(this.task.getCLICreationString(this.task.getClass()));
    result=this.task.doTask(monitor,repository);
  }
  return result;
}
Program: 64401
Project: 64401
Buggy source:
/** 
 * Performs classwise kMeans++ clustering for given samples with corresponding labels. The number of samples is halved per class.
 */
private void clusterDown(){
  int classIndex=this.ltm.classIndex();
  for (int c=0; c <= this.maxClassValue; c++) {
    List<double[]> classSamples=new ArrayList<>();
    for (int i=this.ltm.numInstances() - 1; i > -1; i--) {
      if (this.ltm.get(i).classValue() == c) {
        classSamples.add(this.ltm.get(i).toDoubleArray());
        this.ltm.delete(i);
      }
    }
    for (    double[] sample : classSamples) {
      if (classIndex != 0) {
        sample[classIndex]=sample[0];
      }
      sample[0]=1;
    }
    List<double[]> centroids=this.kMeans(classSamples,Math.max(classSamples.size() / 2,1));
    for (    double[] centroid : centroids) {
      double[] attributes=new double[this.ltm.numAttributes()];
      System.arraycopy(centroid,0,attributes,1,this.ltm.numAttributes() - 1);
      if (classIndex != 0) {
        attributes[0]=attributes[classIndex];
      }
      attributes[classIndex]=c;
      Instance inst=new InstanceImpl(1,attributes);
      inst.setDataset(this.ltm);
      this.ltm.add(inst);
    }
  }
}

Fixed version (ground truth):
/** 
 * Performs classwise kMeans++ clustering for given samples with corresponding labels. The number of samples is halved per class.
 */
private void clusterDown(){
  int classIndex=this.ltm.classIndex();
  for (int c=0; c <= this.maxClassValue; c++) {
    List<double[]> classSamples=new ArrayList<>();
    for (int i=this.ltm.numInstances() - 1; i > -1; i--) {
      if (this.ltm.get(i).classValue() == c) {
        classSamples.add(this.ltm.get(i).toDoubleArray());
        this.ltm.delete(i);
      }
    }
    if (classSamples.size() > 0) {
      for (      double[] sample : classSamples) {
        if (classIndex != 0) {
          sample[classIndex]=sample[0];
        }
        sample[0]=1;
      }
      List<double[]> centroids=this.kMeans(classSamples,Math.max(classSamples.size() / 2,1));
      for (      double[] centroid : centroids) {
        double[] attributes=new double[this.ltm.numAttributes()];
        System.arraycopy(centroid,0,attributes,1,this.ltm.numAttributes() - 1);
        if (classIndex != 0) {
          attributes[0]=attributes[classIndex];
        }
        attributes[classIndex]=c;
        Instance inst=new InstanceImpl(1,attributes);
        inst.setDataset(this.ltm);
        this.ltm.add(inst);
      }
    }
  }
}
Program: 64402
Project: 64402
Buggy source:
/** 
 * Generates the initial centroids like the k-means++ algorithm.
 * @param k number of centroids
 * @param input input clustering
 * @param random instance to generate a stream of pseudorandom numbers
 * @return the generated centroids
 */
public static List<double[]> generatekMeansPlusPlusCentroids(int k,List<double[]> input,Random random){
  int n=input.size();
  assert(n > 0);
  int d=input.get(0).length - 1;
  assert(k <= n);
  List<double[]> centerValue=new ArrayList<double[]>(k);
  double[] lastCenter=new double[d];
  System.arraycopy(input.get(random.nextInt(n)),1,lastCenter,0,d);
  centerValue.add(lastCenter);
  double[] distance=new double[n];
  for (int j=0; j < n; j++) {
    distance[j]=Double.POSITIVE_INFINITY;
  }
  for (int i=1; i < k; i++) {
    double sum=0.0;
    Iterator<double[]> jIter=input.iterator();
    for (int j=0; j < n; j++) {
      double[] point=jIter.next();
      distance[j]=Math.min(distance[j],point[0] * Metric.distanceSquared(lastCenter,point,1));
      sum+=distance[j];
    }
    double nextCenterValue=sum * random.nextDouble();
    double currentValue=distance[0];
    int candidate=0;
    while (!(nextCenterValue < currentValue)) {
      currentValue+=distance[++candidate];
    }
    lastCenter=new double[d];
    System.arraycopy(input.get(candidate),1,lastCenter,0,d);
    centerValue.add(lastCenter);
  }
  return centerValue;
}

Fixed version (ground truth):
/** 
 * Generates the initial centroids like the k-means++ algorithm.
 * @param k number of centroids
 * @param input input clustering
 * @param random instance to generate a stream of pseudorandom numbers
 * @return the generated centroids
 */
public static List<double[]> generatekMeansPlusPlusCentroids(int k,List<double[]> input,Random random){
  int n=input.size();
  assert(n > 0);
  int d=input.get(0).length - 1;
  assert(k <= n);
  List<double[]> centerValue=new ArrayList<double[]>(k);
  double[] lastCenter=new double[d];
  System.arraycopy(input.get(random.nextInt(n)),1,lastCenter,0,d);
  centerValue.add(lastCenter);
  double[] distance=new double[n];
  for (int j=0; j < n; j++) {
    distance[j]=Double.POSITIVE_INFINITY;
  }
  for (int i=1; i < k; i++) {
    double sum=0.0;
    Iterator<double[]> jIter=input.iterator();
    for (int j=0; j < n; j++) {
      double[] point=jIter.next();
      distance[j]=Math.min(distance[j],point[0] * Metric.distanceSquared(lastCenter,point,1));
      sum+=distance[j];
    }
    int candidate=0;
    if (sum > 0) {
      double nextCenterValue=sum * random.nextDouble();
      double currentValue=distance[0];
      while (!(nextCenterValue < currentValue)) {
        currentValue+=distance[++candidate];
      }
    }
    lastCenter=new double[d];
    System.arraycopy(input.get(candidate),1,lastCenter,0,d);
    centerValue.add(lastCenter);
  }
  return centerValue;
}
Program: 64405
Project: 64405
Buggy source:
/** 
 * Constructor.
 * @param value score value
 * @param isPositive true if the example's true label is positive
 */
public Score(double value,int position,boolean isPositive){
  this.value=value;
  this.isPositive=isPositive;
}

Fixed version (ground truth):
/** 
 * Constructor.
 * @param value score value
 * @param isPositive true if the example's true label is positive
 */
public Score(double value,int position,boolean isPositive){
  this.value=value;
  this.isPositive=isPositive;
  this.position=position;
}
Program: 64407
Project: 64407
Buggy source:
/** 
 * discarding all instances which are exluded until an instance which can be seen by this stream or the stream is empty
 */
protected void discardNexInstancesNotFromPartition(){
  while (!isNextInstanceFromPartition() && baseStream.hasMoreInstances()) {
    baseStream.nextInstance();
  }
}

Fixed version (ground truth):
/** 
 * discarding all instances which are exluded until an instance which can be seen by this stream or the stream is empty
 */
protected void discardNexInstancesNotFromPartition(){
  while (!isNextInstanceFromPartition() && baseStream.hasMoreInstances() && numPartitions > 1) {
    baseStream.nextInstance();
  }
}
Program: 64408
Project: 64408
Buggy source:
@Override public long estimatedRemainingInstances(){
  long baseEstimatedRemainingInstances=baseStream.estimatedRemainingInstances();
  if (baseEstimatedRemainingInstances < 0) {
    return baseEstimatedRemainingInstances;
  }
  return (baseEstimatedRemainingInstances * (numPartitions - 1)) / (numPartitions);
}

Fixed version (ground truth):
@Override public long estimatedRemainingInstances(){
  long baseEstimatedRemainingInstances=baseStream.estimatedRemainingInstances();
  if (baseEstimatedRemainingInstances < 0) {
    return baseEstimatedRemainingInstances;
  }
  long numRemaining=(baseEstimatedRemainingInstances * (numPartitions - 1)) / (numPartitions);
  if (numPartitions == 1) {
    numRemaining=baseEstimatedRemainingInstances;
  }
  return numRemaining;
}
Program: 64409
Project: 64409
Buggy source:
/** 
 * Draws a single curve on the canvas.
 * @param g 	  the Graphics context in which to paint
 * @param m 	  curve information
 * @param mSelect currently selected measure
 * @param pf 	  process frequency of the curve
 * @param color   colour the curve will be drawn in
 */
private void paintFullCurve(Graphics g,MeasureCollection m,int mSelect,int pf,Color color){
  if (m.getNumberOfValues(mSelect) == 0) {
    return;
  }
  g.setColor(color);
  int height=getHeight();
  int n=m.getNumberOfValues(mSelect);
  int[] x=new int[n];
  int[] y=new int[n];
  for (int i=0; i < n; i++) {
    x[i]=(int)(i * x_resolution);
    y[i]=(int)(height - (m.getValue(mSelect,i) / this.upper_y_value) * height);
    if (this.isStandardDeviationPainted) {
      double std=m.getValue(mSelect + 7,i);
      int len=(int)((std / this.upper_y_value) * height);
      paintStandardDeviation(g,len,x[i],y[i]);
    }
  }
  g.drawPolyline(x,y,n);
}

Fixed version (ground truth):
/** 
 * Draws a single curve on the canvas.
 * @param g 	  the Graphics context in which to paint
 * @param m 	  curve information
 * @param mSelect currently selected measure
 * @param pf 	  process frequency of the curve
 * @param color   colour the curve will be drawn in
 */
private void paintFullCurve(Graphics g,MeasureCollection m,int mSelect,int pf,Color color){
  if (m.getNumberOfValues(mSelect) == 0) {
    return;
  }
  g.setColor(color);
  int height=getHeight();
  int n=m.getNumberOfValues(mSelect);
  int[] x=new int[n];
  int[] y=new int[n];
  for (int i=0; i < n; i++) {
    x[i]=(int)(i * x_resolution);
    y[i]=(int)(height - (m.getValue(mSelect,i) / this.upper_y_value) * height);
    if (this.isStandardDeviationPainted && mSelect <= 6) {
      double std=m.getValue(mSelect + 7,i);
      int len=(int)((std / this.upper_y_value) * height);
      paintStandardDeviation(g,len,x[i],y[i]);
    }
  }
  g.drawPolyline(x,y,n);
}
Program: 64410
Project: 64410
Buggy source:
/** 
 * Draws the y axis, containing og the axis line, the horizontal helping line and the labels.
 * @param g the Graphics context in which to paint
 */
private void yAxis(Graphics g){
  g.setColor(Color.BLACK);
  g.drawLine(X_OFFSET_LEFT,calcY(0),X_OFFSET_LEFT,Y_OFFSET_TOP);
  g.setColor(new Color(220,220,220));
  g.drawLine(X_OFFSET_LEFT,height / 2 + Y_OFFSET_TOP,getWidth(),height / 2 + Y_OFFSET_TOP);
  g.setColor(Color.BLACK);
  DecimalFormat d=new DecimalFormat("String_Node_Str");
  int digits_y=(int)(Math.log10(max_value)) - 1;
  double upper=Math.ceil(max_value / Math.pow(10,digits_y));
  if (digits_y < 0)   upper*=Math.pow(10,digits_y);
  if (Double.isNaN(upper)) {
    upper=1.0;
  }
  double numLabels=Math.min(Math.pow(2,y_resolution),32);
  for (int i=0; i <= numLabels; i++) {
    double fraction=i / numLabels;
    double value=fraction * upper;
    g.drawString(d.format(value),1,(int)((1 - fraction) * height) + Y_OFFSET_TOP + 5);
    g.drawLine(X_OFFSET_LEFT - 5,(int)((1 - fraction) * height) + Y_OFFSET_TOP,X_OFFSET_LEFT,(int)((1 - fraction) * height) + Y_OFFSET_TOP);
  }
}

Fixed version (ground truth):
/** 
 * Draws the y axis, containing og the axis line, the horizontal helping line and the labels.
 * @param g the Graphics context in which to paint
 */
private void yAxis(Graphics g){
  g.setColor(Color.BLACK);
  g.drawLine(X_OFFSET_LEFT,calcY(0),X_OFFSET_LEFT,Y_OFFSET_TOP);
  g.setColor(new Color(220,220,220));
  g.drawLine(X_OFFSET_LEFT,height / 2 + Y_OFFSET_TOP,getWidth(),height / 2 + Y_OFFSET_TOP);
  g.setColor(Color.BLACK);
  DecimalFormat d=new DecimalFormat("String_Node_Str");
  double numLabels=Math.min(Math.pow(2,y_resolution),32);
  for (int i=0; i <= numLabels; i++) {
    double fraction=i / numLabels;
    double value=fraction * upper_value;
    g.drawString(d.format(value),1,(int)((1 - fraction) * height) + Y_OFFSET_TOP + 5);
    g.drawLine(X_OFFSET_LEFT - 5,(int)((1 - fraction) * height) + Y_OFFSET_TOP,X_OFFSET_LEFT,(int)((1 - fraction) * height) + Y_OFFSET_TOP);
  }
}
Program: 64411
Project: 64411
Buggy source:
/** 
 * Sets the maximum y value
 * @param max maximum y value
 */
public void setYMaxValue(double max){
  max_value=max;
}

Fixed version (ground truth):
/** 
 * Sets the maximum y value
 * @param max maximum y value
 */
public void setYMaxValue(double max){
  this.max_value=max;
}
Program: 64412
Project: 64412
Buggy source:
/** 
 * Initialises a AbstractGraphAxes by setting the initial values and the layout.
 */
public AbstractGraphAxes(){
  this.max_value=1;
  javax.swing.GroupLayout layout=new javax.swing.GroupLayout(this);
  this.setLayout(layout);
  layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0,400,Short.MAX_VALUE));
  layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0,300,Short.MAX_VALUE));
}

Fixed version (ground truth):
/** 
 * Initialises a AbstractGraphAxes by setting the initial values and the layout.
 */
public AbstractGraphAxes(){
  this.max_value=1;
  this.upper_value=1;
  javax.swing.GroupLayout layout=new javax.swing.GroupLayout(this);
  this.setLayout(layout);
  layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0,400,Short.MAX_VALUE));
  layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0,300,Short.MAX_VALUE));
}
Program: 64413
Project: 64413
Buggy source:
/** 
 * Computes the maximum values of the registered measure collections and updates the member values accordingly.
 * @return true, if the values have changed
 */
private boolean updateMaxValues(){
  int max_x_value_new;
  double max_y_value_new;
  if (this.measures == null) {
    max_x_value_new=1;
    max_y_value_new=1;
  }
 else {
    max_x_value_new=maxNumValues();
    max_y_value_new=maxValue();
  }
  if (max_x_value_new != this.max_x_value || max_y_value_new != this.max_y_value) {
    this.max_x_value=max_x_value_new;
    this.max_y_value=max_y_value_new;
    updateMaxYValue();
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Computes the maximum values of the registered measure collections and updates the member values accordingly.
 * @return true, if the values have changed
 */
private boolean updateMaxValues(){
  int max_x_value_new;
  double max_y_value_new;
  if (this.measures == null) {
    max_x_value_new=1;
    max_y_value_new=1;
  }
 else {
    max_x_value_new=maxNumValues();
    max_y_value_new=maxValue();
  }
  if (max_x_value_new != this.max_x_value || max_y_value_new != this.max_y_value) {
    this.max_x_value=max_x_value_new;
    this.max_y_value=max_y_value_new;
    updateMaxYValue();
    updateYUpperValue();
    return true;
  }
  return false;
}
Program: 64414
Project: 64414
Buggy source:
public AbstractGraphPlot(){
  this.max_value=1;
  this.measureSelected=0;
  setOpaque(false);
  javax.swing.GroupLayout layout=new javax.swing.GroupLayout(this);
  this.setLayout(layout);
  layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0,1000,Short.MAX_VALUE));
  layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0,300,Short.MAX_VALUE));
}

Fixed version (ground truth):
public AbstractGraphPlot(){
  this.max_value=1;
  this.upper_value=1;
  this.measureSelected=0;
  setOpaque(false);
  javax.swing.GroupLayout layout=new javax.swing.GroupLayout(this);
  this.setLayout(layout);
  layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0,1000,Short.MAX_VALUE));
  layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0,300,Short.MAX_VALUE));
}
Program: 64415
Project: 64415
Buggy source:
/** 
 * Draws a single curve on the canvas.
 * @param g 	  the Graphics context in which to paint
 * @param m 	  curve information
 * @param mSelect currently selected measure
 * @param pf 	  process frequency of the curve
 * @param color   colour the curve will be drawn in
 */
private void paintFullCurve(Graphics g,MeasureCollection m,int mSelect,int pf,Color color){
  if (m.getNumberOfValues(mSelect) == 0) {
    return;
  }
  int height=getHeight();
  int n=m.getNumberOfValues(mSelect);
  int[] x=new int[n];
  int[] y=new int[n];
  for (int i=0; i < n; i++) {
    x[i]=(int)(i / x_resolution);
    y[i]=(int)(height - (m.getValue(mSelect,i) / this.max_value) * height);
  }
  g.setColor(color);
  g.drawPolyline(x,y,n);
}

Fixed version (ground truth):
/** 
 * Draws a single curve on the canvas.
 * @param g 	  the Graphics context in which to paint
 * @param m 	  curve information
 * @param mSelect currently selected measure
 * @param pf 	  process frequency of the curve
 * @param color   colour the curve will be drawn in
 */
private void paintFullCurve(Graphics g,MeasureCollection m,int mSelect,int pf,Color color){
  if (m.getNumberOfValues(mSelect) == 0) {
    return;
  }
  int height=getHeight();
  int n=m.getNumberOfValues(mSelect);
  int[] x=new int[n];
  int[] y=new int[n];
  for (int i=0; i < n; i++) {
    x[i]=(int)(i / x_resolution);
    y[i]=(int)(height - (m.getValue(mSelect,i) / this.upper_value) * height);
  }
  g.setColor(color);
  g.drawPolyline(x,y,n);
}
Program: 64416
Project: 64416
Buggy source:
/** 
 * Paint a dot onto the panel.
 * @param g graphics object
 * @param m MeasureCollection containing the data
 */
private void scatter(Graphics g,MeasureCollection m,double variedParamValue){
  int height=getHeight();
  int width=getWidth();
  int x=(int)(width * variedParamValue);
  double value=m.getLastValue(this.measureSelected);
  if (Double.isNaN(value)) {
    return;
  }
  int y=(int)(height - (value / this.max_value) * height);
  g.fillOval(x - DOT_SIZE / 2,y - DOT_SIZE / 2,DOT_SIZE,DOT_SIZE);
}

Fixed version (ground truth):
/** 
 * Paint a dot onto the panel.
 * @param g graphics object
 * @param m MeasureCollection containing the data
 */
private void scatter(Graphics g,MeasureCollection m,double variedParamValue){
  int height=getHeight();
  int width=getWidth();
  int x=(int)(width * variedParamValue);
  double value=m.getLastValue(this.measureSelected);
  if (Double.isNaN(value)) {
    return;
  }
  int y=(int)(height - (value / this.upper_value) * height);
  g.fillOval(x - DOT_SIZE / 2,y - DOT_SIZE / 2,DOT_SIZE,DOT_SIZE);
}
Program: 64417
Project: 64417
Buggy source:
@Override public void setModelContext(InstancesHeader ih){
  super.setModelContext(ih);
  this.numClasses=ih.numClasses();
  for (int m=0; m <= mMax; ++m) {
    distributions.add(getAllDistributionPossibilities(m,numClasses));
  }
  kernelEstimators=new MCPALEstimatorMultivariate[numClasses];
  for (int cIdx=0; cIdx < numClasses; ++cIdx) {
    kernelEstimators[cIdx]=new MCPALEstimatorMultivariate(bandwidth);
  }
}

Fixed version (ground truth):
@Override public void setModelContext(InstancesHeader ih){
  super.setModelContext(ih);
  this.numClasses=ih.numClasses();
  for (int m=0; m <= mMax; ++m) {
    distributions.add(getAllDistributionPossibilities(m,numClasses));
  }
  kernelEstimators=new MCPALEstimatorMultivariate[numClasses];
  for (int cIdx=0; cIdx < numClasses; ++cIdx) {
    kernelEstimators[cIdx]=new MCPALEstimatorMultivariate(bandwidth,100);
  }
}
Program: 64418
Project: 64418
Buggy source:
public double getNormal(Matrix x,Matrix mu){
  double prob=0;
  Matrix diff=x.minus(mu);
  Matrix exponent=diff.transpose().times(invCovariance).times(diff);
  double pow=-0.5 * exponent.get(0,0);
  prob=Math.exp(pow);
  return prob;
}

Fixed version (ground truth):
public double getNormal(double[] x,double[] mu){
  int numFeatures=x.length;
  double v=0;
  for (int i=0; i < numFeatures; ++i) {
    double d=(x[i] - mu[i]);
    v+=d * d / bandwidth;
  }
  return Math.exp(-0.5 * v);
}
Program: 64419
Project: 64419
Buggy source:
public MCPALEstimatorMultivariate(double bandwidth){
  this.bandwidth=bandwidth;
  this.points=new ArrayList<Matrix>();
}

Fixed version (ground truth):
public MCPALEstimatorMultivariate(double bandwidth,int bufferSize){
  this.bandwidth=bandwidth;
  this.points=new RingBuffer<>(bufferSize);
}
Program: 64420
Project: 64420
Buggy source:
/** 
 * Returns the frequency of instances at position x NOT the density
 * @param x
 * @return
 */
public double getFrequencyEstimate(double[] x){
  if (points.size() == 0)   return 0;
  Matrix point=doubleArrayToMatrix(x);
  double prob=0;
  for (int i=0; i < points.size(); i++) {
    prob+=getNormal(point,points.get(i));
  }
  return prob;
}

Fixed version (ground truth):
/** 
 * Returns the frequency of instances at position x NOT the density
 * @param x
 * @return
 */
public double getFrequencyEstimate(double[] x){
  if (points.size() == 0)   return 0;
  double prob=0;
  for (int i=0; i < points.size(); i++) {
    prob+=getNormal(x,points.get(i));
  }
  return prob;
}
Program: 64421
Project: 64421
Buggy source:
public void addValue(double[] x){
  Matrix point=doubleArrayToMatrix(x);
  points.add(point);
  if (points.size() > 100) {
    points.remove(0);
  }
  if (dimSet == false)   initCovariance(x.length);
}

Fixed version (ground truth):
public void addValue(double[] x){
  points.add(x);
}
Program: 64422
Project: 64422
Buggy source:
@Override public Object getValueAt(int row,int column){
  return data.get(row)[column];
}

Fixed version (ground truth):
@Override public Object getValueAt(int row,int column){
  if (row >= data.size() || column >= data.get(row).length) {
    return 0.0;
  }
  return data.get(row)[column];
}
Program: 64423
Project: 64423
Buggy source:
@Override public double[] getEntryData(int entryIndex){
  double[] entry=new double[getMeasurementNameCount()];
  int numSubPreviews=subPreviews.size();
  int subPreviewIndex=entryIndex % numSubPreviews;
  int subPreviewEntryIndex=entryIndex / numSubPreviews;
  double[] subPreviewEntry=subPreviews.get(subPreviewIndex).getEntryData(subPreviewEntryIndex);
  entry[0]=entryIndex;
  entry[1]=subPreviewEntryIndex;
  for (int measurementIdx=0; measurementIdx < subPreviewEntry.length; ++measurementIdx) {
    entry[2 + measurementIdx]=subPreviewEntry[measurementIdx];
  }
  return entry;
}

Fixed version (ground truth):
@Override public double[] getEntryData(int entryIndex){
  double[] entry=new double[getMeasurementNameCount()];
  int numSubPreviews=subPreviews.size();
  int subPreviewIndex=entryIndex % numSubPreviews;
  int subPreviewEntryIndex=entryIndex / numSubPreviews;
  double[] subPreviewEntry=subPreviews.get(subPreviewIndex).getEntryData(subPreviewEntryIndex);
  entry[0]=entryIndex;
  entry[1]=subPreviewIndex;
  for (int measurementIdx=0; measurementIdx < subPreviewEntry.length; ++measurementIdx) {
    entry[2 + measurementIdx]=subPreviewEntry[measurementIdx];
  }
  return entry;
}
Program: 64424
Project: 64424
Buggy source:
/** 
 * Updates the TaskTextViewerPanel by adding the new text to the text area and updating the live graph.
 * @param newText  the new information used to update text and graph
 */
public void setText(Preview preview){
  Point p=this.scrollPane.getViewport().getViewPosition();
  this.previewTableModel.setPreview(preview);
  if (previewTableModel.structureChanged()) {
    rescaleTableColumns();
  }
  this.previewTable.repaint();
  this.scrollPane.getViewport().setViewPosition(p);
  this.exportButton.setEnabled(preview != null);
}

Fixed version (ground truth):
/** 
 * Updates the TaskTextViewerPanel by adding the new text to the text area and updating the live graph.
 * @param newText  the new information used to update text and graph
 */
public void setText(Preview preview){
  Point p=this.scrollPane.getViewport().getViewPosition();
  previewTableModel.setPreview(preview);
  SwingUtilities.invokeLater(new Runnable(){
    boolean structureChanged=previewTableModel.structureChanged();
    public void run(){
      if (structureChanged) {
        previewTableModel.fireTableStructureChanged();
        rescaleTableColumns();
      }
 else {
        previewTableModel.fireTableDataChanged();
      }
      previewTable.repaint();
    }
  }
);
  this.scrollPane.getViewport().setViewPosition(p);
  this.exportButton.setEnabled(preview != null);
}