nus-yam/ex-repair huggingface dataset:
Program: 142498
Project: 142498
Buggy source:
/** 
 * Creates a server connection; provides a connection to the Perforce Server, initially client is undefined.
 * @return
 * @throws Exception
 */
public static IOptionsServer getConnection(ConnectionConfig config) throws Exception {
  IOptionsServer iserver=getRawConnection(config);
  if (config.isSsl()) {
    String serverTrust=iserver.getTrust();
    if (!serverTrust.equalsIgnoreCase(config.getTrust())) {
      logger.warning("String_Node_Str" + serverTrust);
    }
 else {
      iserver.addTrust(config.getTrust());
    }
  }
  iserver.connect();
  currentP4=iserver;
  return iserver;
}

Fixed version (ground truth):
/** 
 * Creates a server connection; provides a connection to the Perforce Server, initially client is undefined.
 * @throws Exception
 */
public static IOptionsServer getConnection(ConnectionConfig config) throws Exception {
  IOptionsServer iserver=getRawConnection(config);
  if (config.isSsl()) {
    String serverTrust=iserver.getTrust();
    if (!serverTrust.equalsIgnoreCase(config.getTrust())) {
      logger.warning("String_Node_Str" + serverTrust);
    }
 else {
      iserver.addTrust(config.getTrust());
    }
  }
  iserver.connect();
  currentP4=iserver;
  return iserver;
}
Program: 142499
Project: 142499
Buggy source:
/** 
 * Get Perforce Label
 * @param id
 * @return
 * @throws Exception
 */
public Label getLabel(String id) throws Exception {
  return (Label)connection.getLabel(id);
}

Fixed version (ground truth):
/** 
 * Get Perforce Label
 * @param id
 * @return Perforce Label
 * @throws Exception
 */
public Label getLabel(String id) throws Exception {
  return (Label)connection.getLabel(id);
}
Program: 142500
Project: 142500
Buggy source:
/** 
 * Find all files within a shelf.
 * @param id
 * @return
 * @throws Exception
 */
public List<IFileSpec> getShelvedFiles(int id) throws Exception {
  String cmd=CmdSpec.DESCRIBE.name();
  String[] args=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str" + id};
  List<Map<String,Object>> resultMaps;
  resultMaps=connection.execMapCmdList(cmd,args,null);
  List<IFileSpec> list=new ArrayList<IFileSpec>();
  if (resultMaps != null) {
    if ((resultMaps.size() > 0) && (resultMaps.get(0) != null)) {
      Map<String,Object> map=resultMaps.get(0);
      if (map.containsKey("String_Node_Str")) {
        for (int i=0; map.get("String_Node_Str" + i) != null; i++) {
          FileSpec fSpec=new FileSpec(map,connection,i);
          fSpec.setChangelistId(id);
          list.add(fSpec);
        }
      }
    }
  }
  return list;
}

Fixed version (ground truth):
/** 
 * Find all files within a shelf.
 * @param id
 * @return List of file specs
 * @throws Exception
 */
public List<IFileSpec> getShelvedFiles(int id) throws Exception {
  String cmd=CmdSpec.DESCRIBE.name();
  String[] args=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str" + id};
  List<Map<String,Object>> resultMaps;
  resultMaps=connection.execMapCmdList(cmd,args,null);
  List<IFileSpec> list=new ArrayList<IFileSpec>();
  if (resultMaps != null) {
    if ((resultMaps.size() > 0) && (resultMaps.get(0) != null)) {
      Map<String,Object> map=resultMaps.get(0);
      if (map.containsKey("String_Node_Str")) {
        for (int i=0; map.get("String_Node_Str" + i) != null; i++) {
          FileSpec fSpec=new FileSpec(map,connection,i);
          fSpec.setChangelistId(id);
          list.add(fSpec);
        }
      }
    }
  }
  return list;
}
Program: 142501
Project: 142501
Buggy source:
/** 
 * Gets the Changelist (p4 describe -s); shouldn't need a client, but p4-java throws an exception if one is not set.
 * @param id
 * @return
 * @throws Exception
 */
public Changelist getChange(int id) throws Exception {
  try {
    return (Changelist)connection.getChangelist(id);
  }
 catch (  RequestException e) {
    ChangelistOptions opts=new ChangelistOptions();
    opts.setOriginalChangelist(true);
    return (Changelist)connection.getChangelist(id,opts);
  }
}

Fixed version (ground truth):
/** 
 * Gets the Changelist (p4 describe -s); shouldn't need a client, but p4-java throws an exception if one is not set.
 * @param id
 * @return Perforce Changelist
 * @throws Exception
 */
public Changelist getChange(int id) throws Exception {
  try {
    return (Changelist)connection.getChangelist(id);
  }
 catch (  RequestException e) {
    ChangelistOptions opts=new ChangelistOptions();
    opts.setOriginalChangelist(true);
    return (Changelist)connection.getChangelist(id,opts);
  }
}
Program: 142502
Project: 142502
Buggy source:
/** 
 * Retry Connection with back off for each failed attempt.
 * @param attempt
 */
private void connectionRetry(){
  int trys=0;
  int attempt=getRetry();
  while (trys <= attempt) {
    if (connect()) {
      return;
    }
    trys++;
    String err="String_Node_Str" + trys;
    logger.severe(err);
    log(err);
    try {
      TimeUnit.SECONDS.sleep(trys ^ 2);
    }
 catch (    InterruptedException e) {
      Thread.currentThread().interrupt();
    }
  }
  String err="String_Node_Str";
  logger.severe(err);
  log(err);
}

Fixed version (ground truth):
/** 
 * Retry Connection with back off for each failed attempt.
 */
private void connectionRetry(){
  int trys=0;
  int attempt=getRetry();
  while (trys <= attempt) {
    if (connect()) {
      return;
    }
    trys++;
    String err="String_Node_Str" + trys;
    logger.severe(err);
    log(err);
    try {
      TimeUnit.SECONDS.sleep(trys ^ 2);
    }
 catch (    InterruptedException e) {
      Thread.currentThread().interrupt();
    }
  }
  String err="String_Node_Str";
  logger.severe(err);
  log(err);
}
Program: 142503
Project: 142503
Buggy source:
/** 
 * Find all files within a label or change. (Max results limited by limit)
 * @param label
 * @param limit
 * @return
 * @throws Exception
 */
public List<IFileSpec> getLabelFiles(String id,int limit) throws Exception {
  String path="String_Node_Str" + id;
  List<IFileSpec> spec=FileSpecBuilder.makeFileSpecList(path);
  GetDepotFilesOptions opts=new GetDepotFilesOptions();
  opts.setMaxResults(limit);
  List<IFileSpec> tagged=connection.getDepotFiles(spec,opts);
  return tagged;
}

Fixed version (ground truth):
/** 
 * Find all files within a label or change. (Max results limited by limit)
 * @param id
 * @param limit
 * @return List of file specs
 * @throws Exception
 */
public List<IFileSpec> getLabelFiles(String id,int limit) throws Exception {
  String path="String_Node_Str" + id;
  List<IFileSpec> spec=FileSpecBuilder.makeFileSpecList(path);
  GetDepotFilesOptions opts=new GetDepotFilesOptions();
  opts.setMaxResults(limit);
  List<IFileSpec> tagged=connection.getDepotFiles(spec,opts);
  return tagged;
}
Program: 142504
Project: 142504
Buggy source:
/** 
 * Delete a client workspace
 * @param userName
 * @return
 * @throws Exception
 */
public void deleteClient(String name) throws Exception {
  DeleteClientOptions opts=new DeleteClientOptions();
  connection.deleteClient(name,opts);
}

Fixed version (ground truth):
/** 
 * Delete a client workspace
 * @param name
 * @throws Exception
 */
public void deleteClient(String name) throws Exception {
  DeleteClientOptions opts=new DeleteClientOptions();
  connection.deleteClient(name,opts);
}
Program: 142505
Project: 142505
Buggy source:
/** 
 * Checks the Perforce server version number and returns true if greater than or equal to the min version. The value of min must be of the form 20092 or 20073 (corresponding to 2009.2 and 2007.3 respectively).
 * @param min
 * @return
 */
public boolean checkVersion(int min){
  int ver=connection.getServerVersionNumber();
  return (ver >= min);
}

Fixed version (ground truth):
/** 
 * Checks the Perforce server version number and returns true if greater than or equal to the min version. The value of min must be of the form 20092 or 20073 (corresponding to 2009.2 and 2007.3 respectively).
 * @param min
 * @return true if version supported.
 */
public boolean checkVersion(int min){
  int ver=connection.getServerVersionNumber();
  return (ver >= min);
}
Program: 142506
Project: 142506
Buggy source:
/** 
 * Create/Update a Perforce Label
 * @param id
 * @return
 * @throws Exception
 */
public void setLabel(Label label) throws Exception {
  String user=connection.getUserName();
  label.setOwnerName(user);
  connection.updateLabel(label);
}

Fixed version (ground truth):
/** 
 * Create/Update a Perforce Label
 * @param label
 * @throws Exception
 */
public void setLabel(Label label) throws Exception {
  String user=connection.getUserName();
  label.setOwnerName(user);
  connection.updateLabel(label);
}
Program: 142507
Project: 142507
Buggy source:
/** 
 * Jelly Method
 * @return
 */
public List<StringParameterValue> getAvailableParameters(){
  List<StringParameterValue> stringParameters=new ArrayList<StringParameterValue>();
  for (  ParameterDefinition parameterDefinition : getParameterDefinitions()) {
    StringParameterValue stringParameter=new StringParameterValue(parameterDefinition.getName(),parameterDefinition.getDescription());
    stringParameters.add(stringParameter);
  }
  return stringParameters;
}

Fixed version (ground truth):
/** 
 * Jelly Method
 */
public List<StringParameterValue> getAvailableParameters(){
  List<StringParameterValue> stringParameters=new ArrayList<StringParameterValue>();
  for (  ParameterDefinition parameterDefinition : getParameterDefinitions()) {
    StringParameterValue stringParameter=new StringParameterValue(parameterDefinition.getName(),parameterDefinition.getDescription());
    stringParameters.add(stringParameter);
  }
  return stringParameters;
}
Program: 142508
Project: 142508
Buggy source:
/** 
 * Method used by Jelly code to show Label information (do not remove)
 * @param tag
 * @return
 * @throws Exception
 */
public Label getLabel(String tag) throws Exception {
  ClientHelper p4=new ClientHelper(credential,null,client,charset);
  Label label=p4.getLabel(tag);
  return label;
}

Fixed version (ground truth):
/** 
 * Method used by Jelly code to show Label information (do not remove)
 * @param tag
 * @throws Exception
 */
public Label getLabel(String tag) throws Exception {
  ClientHelper p4=new ClientHelper(credential,null,client,charset);
  Label label=p4.getLabel(tag);
  return label;
}
Program: 142509
Project: 142509
Buggy source:
public void labelBuild(TaskListener listener,String name,String description,final FilePath nodeWorkspace) throws Exception {
  EnvVars env=getRun().getEnvironment(listener);
  Expand expand=new Expand(env);
  name=expand.format(name,false);
  description=expand.format(description,false);
  TaggingTask task=new TaggingTask(name,description);
  task.setListener(listener);
  task.setCredential(credential);
  task.setWorkspace(workspace);
  task.setBuildChange(buildChange);
  FilePath buildWorkspace=nodeWorkspace;
  if (nodeWorkspace == null) {
    buildWorkspace=build.getWorkspace();
  }
  buildWorkspace.act(task);
  if (!tags.contains(name)) {
    tags.add(name);
    getRun().save();
  }
}

Fixed version (ground truth):
public void labelBuild(TaskListener listener,String name,String description,final FilePath nodeWorkspace) throws Exception {
  EnvVars env=getRun().getEnvironment(listener);
  Expand expand=new Expand(env);
  name=expand.format(name,false);
  description=expand.format(description,false);
  TaggingTask task=new TaggingTask(name,description);
  task.setListener(listener);
  task.setCredential(credential);
  task.setWorkspace(workspace);
  task.setBuildChange(buildChange);
  FilePath buildWorkspace=nodeWorkspace;
  if (nodeWorkspace == null) {
    buildWorkspace=build.getWorkspace();
  }
  if (buildWorkspace == null) {
    logger.warning("String_Node_Str");
    return;
  }
  Boolean ok=buildWorkspace.act(task);
  if (ok && !tags.contains(name)) {
    tags.add(name);
    getRun().save();
  }
}
Program: 142511
Project: 142511
Buggy source:
public boolean setClient(Workspace workspace) throws Exception {
  if (isUnicode()) {
    String charset="String_Node_Str";
    connection.setCharsetName(charset);
  }
  iclient=workspace.setClient(connection,authorisationConfig.getUsername());
  if (!isClientValid(workspace)) {
    return false;
  }
  if (workspace instanceof StaticWorkspaceImpl) {
    connection.setCurrentClient(iclient);
    return true;
  }
  if (workspace.getRootPath() != null) {
    iclient.setRoot(workspace.getRootPath());
  }
  if (workspace.getHostName() != null) {
    iclient.setHostName(workspace.getHostName());
  }
  IClientOptions options=iclient.getOptions();
  options.setClobber(true);
  iclient.setOptions(options);
  iclient.update();
  connection.setCurrentClient(iclient);
  return true;
}

Fixed version (ground truth):
public void setClient(Workspace workspace) throws Exception {
  if (isUnicode()) {
    String charset="String_Node_Str";
    connection.setCharsetName(charset);
  }
  iclient=workspace.setClient(connection,authorisationConfig.getUsername());
  if (!isClientValid(workspace)) {
    String err="String_Node_Str" + workspace.getFullName();
    throw new AbortException(err);
  }
  if (workspace instanceof StaticWorkspaceImpl) {
    connection.setCurrentClient(iclient);
    return;
  }
  if (workspace.getRootPath() != null) {
    iclient.setRoot(workspace.getRootPath());
  }
  if (workspace.getHostName() != null) {
    iclient.setHostName(workspace.getHostName());
  }
  IClientOptions options=iclient.getOptions();
  options.setClobber(true);
  iclient.setOptions(options);
  iclient.update();
  connection.setCurrentClient(iclient);
  return;
}
Program: 142512
Project: 142512
Buggy source:
private void pop(MarkupText text){
  text.hide(0,text.length());
  StringBuffer sb=new StringBuffer();
  sb.append("String_Node_Str");
  text.addMarkup(text.length(),sb.toString());
}

Fixed version (ground truth):
private void pop(MarkupText text){
  text.hide(0,text.length());
  if (depth > 0) {
    StringBuffer sb=new StringBuffer();
    sb.append("String_Node_Str");
    text.addMarkup(text.length(),sb.toString());
    depth--;
  }
}
Program: 142513
Project: 142513
Buggy source:
private void push(MarkupText text){
  text.hide(0,COMMAND.length());
  String head="String_Node_Str";
  text.addMarkup(COMMAND.length(),head);
  StringBuffer sb=new StringBuffer();
  sb.append("String_Node_Str");
  sb.append("String_Node_Str" + id);
  sb.append("String_Node_Str");
  sb.append("String_Node_Str" + id);
  sb.append("String_Node_Str");
  sb.append("String_Node_Str" + id);
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  sb.append("String_Node_Str" + id);
  sb.append("String_Node_Str");
  text.addMarkup(text.length() - 1,sb.toString());
  text.hide(text.length() - 1,text.length());
  id++;
}

Fixed version (ground truth):
private void push(MarkupText text){
  text.hide(0,COMMAND.length());
  String head="String_Node_Str";
  text.addMarkup(COMMAND.length(),head);
  StringBuffer sb=new StringBuffer();
  sb.append("String_Node_Str");
  sb.append("String_Node_Str" + id);
  sb.append("String_Node_Str");
  sb.append("String_Node_Str" + id);
  sb.append("String_Node_Str");
  sb.append("String_Node_Str" + id);
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  sb.append("String_Node_Str" + id);
  sb.append("String_Node_Str");
  text.addMarkup(text.length() - 1,sb.toString());
  text.hide(text.length() - 1,text.length());
  id++;
  depth++;
}
Program: 142514
Project: 142514
Buggy source:
protected boolean checkConnection(ClientHelper p4){
  p4.log("String_Node_Str");
  if (!p4.isConnected()) {
    p4.log("String_Node_Str" + getCredential().getP4port());
    return false;
  }
  p4.log("String_Node_Str" + getCredential().getP4port());
  String host;
  try {
    host=InetAddress.getLocalHost().getHostName();
  }
 catch (  UnknownHostException e) {
    host="String_Node_Str";
  }
  p4.log("String_Node_Str" + host);
  if (p4.getClient() == null) {
    p4.log("String_Node_Str" + getClient());
    return false;
  }
  p4.log("String_Node_Str" + getClient() + "String_Node_Str");
  return true;
}

Fixed version (ground truth):
protected boolean checkConnection(ClientHelper p4){
  p4.log("String_Node_Str");
  if (!p4.isConnected()) {
    p4.log("String_Node_Str" + getCredential().getP4port());
    return false;
  }
  p4.log("String_Node_Str" + getCredential().getP4port());
  String host;
  try {
    host=InetAddress.getLocalHost().getHostName();
  }
 catch (  UnknownHostException e) {
    host="String_Node_Str";
  }
  p4.log("String_Node_Str" + host);
  return true;
}
Program: 142515
Project: 142515
Buggy source:
public void setWorkspace(Workspace workspace) throws AbortException {
  this.workspace=workspace;
  this.client=workspace.getFullName();
  ClientHelper p4=getConnection();
  if (!checkConnection(p4)) {
    String err="String_Node_Str";
    logger.severe(err);
    p4.log(err);
    throw new AbortException(err);
  }
  boolean status=false;
  try {
    status=p4.setClient(workspace);
  }
 catch (  Exception e) {
    String err="String_Node_Str" + e;
    logger.severe(err);
    p4.log(err);
    throw new AbortException(err);
  }
 finally {
    p4.disconnect();
  }
  if (!status) {
    String err="String_Node_Str" + workspace.getFullName();
    logger.severe(err);
    p4.log(err);
    throw new AbortException(err);
  }
}

Fixed version (ground truth):
public void setWorkspace(Workspace workspace) throws AbortException {
  this.workspace=workspace;
  this.client=workspace.getFullName();
  ClientHelper p4=getConnection();
  if (!checkConnection(p4)) {
    String err="String_Node_Str";
    logger.severe(err);
    p4.log(err);
    throw new AbortException(err);
  }
  try {
    p4.setClient(workspace);
    p4.log("String_Node_Str" + getClient() + "String_Node_Str");
  }
 catch (  Exception e) {
    String err="String_Node_Str" + e;
    logger.severe(err);
    p4.log(err);
    throw new AbortException(err);
  }
 finally {
    p4.disconnect();
  }
}
Program: 142516
Project: 142516
Buggy source:
public Boolean invoke(File f,VirtualChannel channel) throws IOException, InterruptedException {
  ClientHelper p4=getConnection();
  try {
    if (!checkConnection(p4)) {
      return false;
    }
    boolean open=p4.buildChange();
    if (open) {
      p4.publishChange(publish);
    }
  }
 catch (  Exception e) {
    String msg="String_Node_Str" + e;
    logger.warning(msg);
    throw new InterruptedException(msg);
  }
 finally {
    p4.disconnect();
  }
  return true;
}

Fixed version (ground truth):
public Boolean invoke(File f,VirtualChannel channel) throws IOException, InterruptedException {
  ClientHelper p4=getConnection();
  try {
    if (!checkConnection(p4)) {
      return false;
    }
    boolean open=p4.buildChange();
    if (open) {
      p4.publishChange(publish);
    }
  }
 catch (  Exception e) {
    p4.log("String_Node_Str");
    String msg="String_Node_Str" + e;
    logger.warning(msg);
    throw new InterruptedException(msg);
  }
 finally {
    p4.disconnect();
  }
  return true;
}
Program: 142517
Project: 142517
Buggy source:
/** 
 * Unshelve review into workspace. Workspace is sync'ed to head first then review unshelved.
 * @param review
 * @throws Exception
 */
public void unshelveFiles(int review) throws Exception {
  TimeTask timer=new TimeTask();
  log("String_Node_Str" + review);
  List<IFileSpec> files;
  String path=iclient.getRoot() + "String_Node_Str";
  files=FileSpecBuilder.makeFileSpecList(path);
  SyncOptions syncOpts=new SyncOptions();
  log("String_Node_Str" + path);
  List<IFileSpec> syncMsg=iclient.sync(files,syncOpts);
  validateFileSpecs(syncMsg,"String_Node_Str");
  List<IFileSpec> shelveMsg;
  log("String_Node_Str" + review + "String_Node_Str"+ path);
  shelveMsg=iclient.unshelveChangelist(review,files,0,true,false);
  validateFileSpecs(shelveMsg,"String_Node_Str","String_Node_Str","String_Node_Str");
  for (  IFileSpec spec : shelveMsg) {
    if (spec.getOpStatus() != FileSpecOpStatus.VALID) {
      String msg=spec.getStatusMessage();
      if (msg.contains("String_Node_Str")) {
        String rev=msg.substring(0,msg.indexOf("String_Node_Str"));
        printFile(rev);
        log("String_Node_Str" + rev);
      }
    }
  }
  RevertFilesOptions rOpts=new RevertFilesOptions();
  rOpts.setNoUpdate(true);
  log("String_Node_Str" + path);
  List<IFileSpec> rvtMsg=iclient.revertFiles(files,rOpts);
  validateFileSpecs(rvtMsg,"String_Node_Str");
  log("String_Node_Str" + timer.toString());
}

Fixed version (ground truth):
/** 
 * Unshelve review into workspace. Workspace is sync'ed to head first then review unshelved.
 * @param review
 * @throws Exception
 */
public void unshelveFiles(int review) throws Exception {
  TimeTask timer=new TimeTask();
  log("String_Node_Str" + review);
  List<IFileSpec> files;
  String path=iclient.getRoot() + "String_Node_Str";
  files=FileSpecBuilder.makeFileSpecList(path);
  SyncOptions syncOpts=new SyncOptions();
  log("String_Node_Str" + path);
  List<IFileSpec> syncMsg=iclient.sync(files,syncOpts);
  validateFileSpecs(syncMsg,"String_Node_Str");
  List<IFileSpec> shelveMsg;
  log("String_Node_Str" + review);
  shelveMsg=iclient.unshelveChangelist(review,null,0,true,false);
  validateFileSpecs(shelveMsg,"String_Node_Str","String_Node_Str","String_Node_Str");
  for (  IFileSpec spec : shelveMsg) {
    if (spec.getOpStatus() != FileSpecOpStatus.VALID) {
      String msg=spec.getStatusMessage();
      if (msg.contains("String_Node_Str")) {
        String rev=msg.substring(0,msg.indexOf("String_Node_Str"));
        printFile(rev);
        log("String_Node_Str" + rev);
      }
    }
  }
  RevertFilesOptions rOpts=new RevertFilesOptions();
  rOpts.setNoUpdate(true);
  log("String_Node_Str" + path);
  List<IFileSpec> rvtMsg=iclient.revertFiles(files,rOpts);
  validateFileSpecs(rvtMsg,"String_Node_Str");
  log("String_Node_Str" + timer.toString());
}
Program: 142518
Project: 142518
Buggy source:
public void setChange(ConnectionHelper p4,int changeId){
  try {
    Changelist changelist=(Changelist)p4.getChange(changeId);
    id=changelist.getId();
    String user=changelist.getUsername();
    author=User.get(user);
    date=changelist.getDate();
    clientId=changelist.getClientId();
    msg=changelist.getDescription();
    if (changelist.getStatus() == ChangelistStatus.PENDING) {
      files=p4.loadShelvedFiles(changeId);
      shelved=true;
    }
 else {
      files=p4.getFiles("String_Node_Str" + changeId,FILE_COUNT_LIMIT + 1);
      shelved=false;
    }
    if (files.size() > FILE_COUNT_LIMIT) {
      fileLimit=true;
      files=files.subList(0,FILE_COUNT_LIMIT);
    }
    List<String> affectedPaths=new ArrayList<String>();
    for (    IFileSpec item : files) {
      affectedPaths.add(item.getDepotPathString());
    }
    this.jobs=changelist.getJobs();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void setChange(ConnectionHelper p4,int changeId) throws Exception {
  Changelist changelist=(Changelist)p4.getChange(changeId);
  id=changelist.getId();
  String user=changelist.getUsername();
  author=User.get(user);
  date=changelist.getDate();
  clientId=changelist.getClientId();
  msg=changelist.getDescription();
  if (changelist.getStatus() == ChangelistStatus.PENDING) {
    files=p4.loadShelvedFiles(changeId);
    shelved=true;
  }
 else {
    files=p4.getFiles("String_Node_Str" + changeId,FILE_COUNT_LIMIT + 1);
    shelved=false;
  }
  if (files.size() > FILE_COUNT_LIMIT) {
    fileLimit=true;
    files=files.subList(0,FILE_COUNT_LIMIT);
  }
  List<String> affectedPaths=new ArrayList<String>();
  for (  IFileSpec item : files) {
    affectedPaths.add(item.getDepotPathString());
  }
  this.jobs=changelist.getJobs();
}
Program: 142519
Project: 142519
Buggy source:
public void setLabel(ConnectionHelper p4,String labelId){
  try {
    label=true;
    Label label=(Label)p4.getLabel(labelId);
    id=labelId;
    String user=label.getOwnerName();
    author=User.get(user);
    date=label.getLastAccess();
    clientId=labelId;
    msg=label.getDescription();
    files=p4.getFiles(labelId,FILE_COUNT_LIMIT + 1);
    if (files.size() > FILE_COUNT_LIMIT) {
      fileLimit=true;
      files=files.subList(0,FILE_COUNT_LIMIT);
    }
    List<String> affectedPaths=new ArrayList<String>();
    for (    IFileSpec item : files) {
      affectedPaths.add(item.getDepotPathString());
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void setLabel(ConnectionHelper p4,String labelId) throws Exception {
  label=true;
  Label label=(Label)p4.getLabel(labelId);
  id=labelId;
  String user=label.getOwnerName();
  author=User.get(user);
  date=label.getLastAccess();
  clientId=labelId;
  msg=label.getDescription();
  files=p4.getFiles(labelId,FILE_COUNT_LIMIT + 1);
  if (files.size() > FILE_COUNT_LIMIT) {
    fileLimit=true;
    files=files.subList(0,FILE_COUNT_LIMIT);
  }
  List<String> affectedPaths=new ArrayList<String>();
  for (  IFileSpec item : files) {
    affectedPaths.add(item.getDepotPathString());
  }
}
Program: 142520
Project: 142520
Buggy source:
@Override public void endElement(String uri,String localName,String qName) throws SAXException {
  if (qName.equalsIgnoreCase("String_Node_Str")) {
    return;
  }
  if (qName.equalsIgnoreCase("String_Node_Str")) {
    P4ChangeEntry entry=(P4ChangeEntry)objects.pop();
    changeEntries.add(entry);
    return;
  }
  if (objects.peek() instanceof P4ChangeEntry) {
    P4ChangeEntry entry=(P4ChangeEntry)objects.peek();
    try {
      AbstractProject<?,?> project=build.getProject();
      PerforceScm scm=(PerforceScm)project.getScm();
      String credential=scm.getCredential();
      ConnectionHelper p4=new ConnectionHelper(credential,null);
      if (qName.equalsIgnoreCase("String_Node_Str")) {
        int id=new Integer(text.toString());
        entry.setChange(p4,id);
      }
      if (qName.equalsIgnoreCase("String_Node_Str")) {
        String id=text.toString();
        entry.setLabel(p4,id);
      }
      p4.disconnect();
      return;
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
@Override public void endElement(String uri,String localName,String qName) throws SAXException {
  if (qName.equalsIgnoreCase("String_Node_Str")) {
    return;
  }
  if (qName.equalsIgnoreCase("String_Node_Str")) {
    P4ChangeEntry entry=(P4ChangeEntry)objects.pop();
    changeEntries.add(entry);
    return;
  }
  if (objects.peek() instanceof P4ChangeEntry) {
    P4ChangeEntry entry=(P4ChangeEntry)objects.peek();
    try {
      AbstractProject<?,?> project=build.getProject();
      PerforceScm scm=(PerforceScm)project.getScm();
      String credential=scm.getCredential();
      ConnectionHelper p4=new ConnectionHelper(credential,null);
      if (qName.equalsIgnoreCase("String_Node_Str")) {
        int id=new Integer(text.toString());
        entry.setChange(p4,id);
      }
      if (qName.equalsIgnoreCase("String_Node_Str")) {
        String id=text.toString();
        entry.setLabel(p4,id);
      }
      p4.disconnect();
      return;
    }
 catch (    Exception e) {
      entry=null;
    }
  }
}
Program: 142521
Project: 142521
Buggy source:
/** 
 * Register <var>EditText<var> with resource id <var>resid</var> (on the hosting activity) for using this custom keyboard.
 * @param resid The resource id of the EditText that registers to the custom keyboard.
 */
public void registerEditText(int resid){
  EditText edittext=(EditText)mHostActivity.findViewById(resid);
  edittext.setOnFocusChangeListener(new OnFocusChangeListener(){
    @Override public void onFocusChange(    View v,    boolean hasFocus){
      if (hasFocus)       showCustomKeyboard(v);
 else       hideCustomKeyboard();
    }
  }
);
  edittext.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      showCustomKeyboard(v);
    }
  }
);
  edittext.setOnTouchListener(new OnTouchListener(){
    @Override public boolean onTouch(    View v,    MotionEvent event){
      EditText edittext=(EditText)v;
      int inType=edittext.getInputType();
      edittext.setInputType(InputType.TYPE_NULL);
      edittext.onTouchEvent(event);
      edittext.setInputType(inType);
      return true;
    }
  }
);
  edittext.setInputType(edittext.getInputType() | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
}

Fixed version (ground truth):
/** 
 * Register <var>EditText<var> with resource id <var>resid</var> (on the hosting activity) for using this custom keyboard.
 * @param resid The resource id of the EditText that registers to the custom keyboard.
 */
public void registerEditText(int resid){
  EditText edittext=(EditText)mHostActivity.findViewById(resid);
  edittext.setOnFocusChangeListener(new OnFocusChangeListener(){
    @Override public void onFocusChange(    View v,    boolean hasFocus){
      if (hasFocus)       showCustomKeyboard(v);
 else       hideCustomKeyboard();
    }
  }
);
  edittext.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      showCustomKeyboard(v);
    }
  }
);
  edittext.setOnTouchListener(new OnTouchListener(){
    @Override public boolean onTouch(    View v,    MotionEvent event){
      EditText edittext=(EditText)v;
      int inType=edittext.getInputType();
      edittext.setInputType(InputType.TYPE_NULL);
      edittext.onTouchEvent(event);
      edittext.setInputType(inType);
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
        Layout layout=((EditText)v).getLayout();
      float x=event.getX() + v.getScrollX();
    int offset=layout.getOffsetForHorizontal(0,x);
  if (offset > 0)   if (x > layout.getLineMax(0)) {
    ((EditText)v).setSelection(offset);
  }
 else   ((EditText)v).setSelection(offset - 1);
break;
}
return true;
}
}
);
edittext.setInputType(edittext.getInputType() | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
}
Program: 142522
Project: 142522
Buggy source:
@Override public boolean onTouch(View v,MotionEvent event){
  EditText edittext=(EditText)v;
  int inType=edittext.getInputType();
  edittext.setInputType(InputType.TYPE_NULL);
  edittext.onTouchEvent(event);
  edittext.setInputType(inType);
  return true;
}

Fixed version (ground truth):
@Override public boolean onTouch(View v,MotionEvent event){
  EditText edittext=(EditText)v;
  int inType=edittext.getInputType();
  edittext.setInputType(InputType.TYPE_NULL);
  edittext.onTouchEvent(event);
  edittext.setInputType(inType);
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
    Layout layout=((EditText)v).getLayout();
  float x=event.getX() + v.getScrollX();
int offset=layout.getOffsetForHorizontal(0,x);
if (offset > 0) if (x > layout.getLineMax(0)) {
((EditText)v).setSelection(offset);
}
 else ((EditText)v).setSelection(offset - 1);
break;
}
return true;
}
Program: 142523
Project: 142523
Buggy source:
public AttributeModel getModel(Workspace workspace){
  AttributeModel model=workspace.getLookup().lookup(AttributeModel.class);
  if (model != null) {
    return model;
  }
  model=new IndexedAttributeModel();
  workspace.add(model);
  return model;
}

Fixed version (ground truth):
public synchronized AttributeModel getModel(Workspace workspace){
  AttributeModel model=workspace.getLookup().lookup(AttributeModel.class);
  if (model != null) {
    return model;
  }
  model=new IndexedAttributeModel();
  workspace.add(model);
  return model;
}
Program: 142524
Project: 142524
Buggy source:
public void refreshModel(HierarchicalGraph graph,AttributeColumn[] cols,final DataTablesModel dataTablesModel){
  showingColumns=cols;
  DynamicModel dm=Lookup.getDefault().lookup(DynamicController.class).getModel();
  if (dm != null) {
    timeIntervalsRenderer.setMinMax(dm.getMin(),dm.getMax());
    currentTimeFormat=dm.getTimeFormat();
    timeIntervalsRenderer.setTimeFormat(currentTimeFormat);
    timeIntervalCellEditor.setTimeFormat(currentTimeFormat);
    sparkLinesRenderer.setTimeFormat(currentTimeFormat);
  }
  timeIntervalsRenderer.setDrawGraphics(timeIntervalGraphics);
  refreshingTable=true;
  if (selectedNodes == null) {
    selectedNodes=getNodesFromSelectedRows();
  }
  NodeTreeModel nodeTreeModel=new NodeTreeModel(graph.wrapToTreeNode());
  final OutlineModel mdl=DefaultOutlineModel.createOutlineModel(nodeTreeModel,new NodeRowModel(cols),true);
  outlineTable.setRootVisible(false);
  outlineTable.setRenderDataProvider(new NodeRenderer());
  outlineTable.setModel(mdl);
  NodeDataTable.this.dataTablesModel=dataTablesModel;
  setNodesSelection(selectedNodes);
  selectedNodes=null;
  refreshingTable=false;
}

Fixed version (ground truth):
public void refreshModel(HierarchicalGraph graph,AttributeColumn[] cols,final DataTablesModel dataTablesModel){
  showingColumns=cols;
  DynamicModel dm=Lookup.getDefault().lookup(DynamicController.class).getModel();
  if (dm != null) {
    timeIntervalsRenderer.setMinMax(dm.getMin(),dm.getMax());
    currentTimeFormat=dm.getTimeFormat();
    timeIntervalsRenderer.setTimeFormat(currentTimeFormat);
    timeIntervalCellEditor.setTimeFormat(currentTimeFormat);
    sparkLinesRenderer.setTimeFormat(currentTimeFormat);
  }
  timeIntervalsRenderer.setDrawGraphics(timeIntervalGraphics);
  refreshingTable=true;
  if (selectedNodes == null) {
    selectedNodes=getNodesFromSelectedRows();
  }
  NodeTreeModel nodeTreeModel=new NodeTreeModel(graph.wrapToTreeNode());
  final OutlineModel mdl=DefaultOutlineModel.createOutlineModel(nodeTreeModel,new NodeRowModel(cols),true);
  ((ETableColumnModel)outlineTable.getColumnModel()).clearSortedColumns();
  outlineTable.setRootVisible(false);
  outlineTable.setRenderDataProvider(new NodeRenderer());
  outlineTable.setModel(mdl);
  NodeDataTable.this.dataTablesModel=dataTablesModel;
  setNodesSelection(selectedNodes);
  selectedNodes=null;
  refreshingTable=false;
}
Program: 142525
Project: 142525
Buggy source:
public void readRow(XMLStreamReader reader,AbstractAttributeModel model,AttributeTableImpl table,AttributeRowImpl row) throws XMLStreamException {
  row.setRowVersion(Integer.parseInt(reader.getAttributeValue(null,"String_Node_Str")));
  AttributeColumnImpl col=null;
  String value="String_Node_Str";
  boolean end=false;
  while (reader.hasNext() && !end) {
    int t=reader.next();
switch (t) {
case XMLStreamReader.START_ELEMENT:
      String name=reader.getLocalName();
    if (ELEMENT_VALUE.equalsIgnoreCase(name)) {
      col=(AttributeColumnImpl)table.getColumn(Integer.parseInt(reader.getAttributeValue(null,"String_Node_Str")));
    }
  break;
case XMLStreamReader.CHARACTERS:
if (!reader.isWhiteSpace() && col != null) {
  value+=reader.getText();
}
break;
case XMLStreamReader.END_ELEMENT:
if (ELEMENT_NODE_ROW.equalsIgnoreCase(reader.getLocalName()) || ELEMENT_EDGE_ROW.equalsIgnoreCase(reader.getLocalName())) {
end=true;
}
if (!value.isEmpty() && col != null) {
AttributeType type=col.getType();
Object v=type.parse(value);
v=model.getManagedValue(v,type);
row.setValue(col,value);
}
value="String_Node_Str";
col=null;
break;
}
}
}

Fixed version (ground truth):
public void readRow(XMLStreamReader reader,AbstractAttributeModel model,AttributeTableImpl table,AttributeRowImpl row) throws XMLStreamException {
  row.setRowVersion(Integer.parseInt(reader.getAttributeValue(null,"String_Node_Str")));
  AttributeColumnImpl col=null;
  String value="String_Node_Str";
  boolean end=false;
  while (reader.hasNext() && !end) {
    int t=reader.next();
switch (t) {
case XMLStreamReader.START_ELEMENT:
      String name=reader.getLocalName();
    if (ELEMENT_VALUE.equalsIgnoreCase(name)) {
      col=(AttributeColumnImpl)table.getColumn(Integer.parseInt(reader.getAttributeValue(null,"String_Node_Str")));
    }
  break;
case XMLStreamReader.CHARACTERS:
if (!reader.isWhiteSpace() && col != null) {
  value+=reader.getText();
}
break;
case XMLStreamReader.END_ELEMENT:
if (ELEMENT_NODE_ROW.equalsIgnoreCase(reader.getLocalName()) || ELEMENT_EDGE_ROW.equalsIgnoreCase(reader.getLocalName())) {
end=true;
}
if (!value.isEmpty() && col != null) {
AttributeType type=col.getType();
Object v=type.parse(value);
v=model.getManagedValue(v,type);
row.setValue(col,v);
}
value="String_Node_Str";
col=null;
break;
}
}
}
Program: 142526
Project: 142526
Buggy source:
public void execute(HierarchicalGraph hgraph,AttributeModel attributeModel){
  isCanceled=false;
  triangles(hgraph,attributeModel);
  AttributeTable nodeTable=attributeModel.getNodeTable();
  AttributeColumn clusteringCol=nodeTable.getColumn(CLUSTERING_COEFF);
  if (clusteringCol == null) {
    clusteringCol=nodeTable.addColumn(CLUSTERING_COEFF,"String_Node_Str",AttributeType.DOUBLE,AttributeOrigin.COMPUTED,new Double(0));
  }
  AttributeColumn triCount=nodeTable.getColumn("String_Node_Str");
  if (triCount == null) {
    triCount=nodeTable.addColumn("String_Node_Str","String_Node_Str",AttributeType.INT,AttributeOrigin.COMPUTED,new Integer(0));
  }
  for (int v=0; v < N; v++) {
    if (network[v].length() > 1) {
      AttributeRow row=(AttributeRow)network[v].node.getNodeData().getAttributes();
      row.setValue(clusteringCol,nodeClustering[v]);
      row.setValue(triCount,triangles[v]);
    }
  }
}

Fixed version (ground truth):
public void execute(HierarchicalGraph hgraph,AttributeModel attributeModel){
  isCanceled=false;
  triangles(hgraph);
  AttributeTable nodeTable=attributeModel.getNodeTable();
  AttributeColumn clusteringCol=nodeTable.getColumn(CLUSTERING_COEFF);
  if (clusteringCol == null) {
    clusteringCol=nodeTable.addColumn(CLUSTERING_COEFF,"String_Node_Str",AttributeType.DOUBLE,AttributeOrigin.COMPUTED,new Double(0));
  }
  AttributeColumn triCount=nodeTable.getColumn("String_Node_Str");
  if (triCount == null) {
    triCount=nodeTable.addColumn("String_Node_Str","String_Node_Str",AttributeType.INT,AttributeOrigin.COMPUTED,new Integer(0));
  }
  for (int v=0; v < N; v++) {
    if (network[v].length() > 1) {
      AttributeRow row=(AttributeRow)network[v].node.getNodeData().getAttributes();
      row.setValue(clusteringCol,nodeClustering[v]);
      row.setValue(triCount,triangles[v]);
    }
  }
}
Program: 142528
Project: 142528
Buggy source:
public Color getColor(Color parentColor){
  if (customColor == null) {
    return parentColor;
  }
  return customColor;
}

Fixed version (ground truth):
public Color getColor(Color parentColor){
  if (mode.equals(Mode.CUSTOM) && customColor != null) {
    return customColor;
  }
  return parentColor;
}
Program: 142533
Project: 142533
Buggy source:
private void refreshChooser(){
  DefaultComboBoxModel comboBoxModel=new DefaultComboBoxModel();
  comboBoxModel.addElement(NO_SELECTION);
  comboBoxModel.setSelectedItem(NO_SELECTION);
  if (model != null) {
    for (    LayoutBuilder builder : Lookup.getDefault().lookupAll(LayoutBuilder.class)) {
      LayoutBuilderWrapper item=new LayoutBuilderWrapper(builder);
      comboBoxModel.addElement(item);
      if (model.getSelectedLayout() != null && builder == model.getSelectedBuilder()) {
        comboBoxModel.setSelectedItem(item);
      }
    }
  }
  layoutCombobox.setModel(comboBoxModel);
  if (model != null) {
    layoutCombobox.setEnabled(!model.isRunning());
  }
}

Fixed version (ground truth):
private void refreshChooser(){
  DefaultComboBoxModel comboBoxModel=new DefaultComboBoxModel();
  comboBoxModel.addElement(NO_SELECTION);
  comboBoxModel.setSelectedItem(NO_SELECTION);
  if (model != null) {
    List<LayoutBuilder> builders=new ArrayList<LayoutBuilder>(Lookup.getDefault().lookupAll(LayoutBuilder.class));
    Collections.sort(builders,new Comparator(){
      public int compare(      Object o1,      Object o2){
        return ((LayoutBuilder)o1).getName().compareTo(((LayoutBuilder)o2).getName());
      }
    }
);
    for (    LayoutBuilder builder : builders) {
      LayoutBuilderWrapper item=new LayoutBuilderWrapper(builder);
      comboBoxModel.addElement(item);
      if (model.getSelectedLayout() != null && builder == model.getSelectedBuilder()) {
        comboBoxModel.setSelectedItem(item);
      }
    }
  }
  layoutCombobox.setModel(comboBoxModel);
  if (model != null) {
    layoutCombobox.setEnabled(!model.isRunning());
  }
}
Program: 142537
Project: 142537
Buggy source:
public void writeNodeData(XMLStreamWriter writer,NodeDataImpl nodeData) throws XMLStreamException {
  writer.writeStartElement(ELEMENT_NODEDATA);
  AbstractNode node=nodeData.getRootNode();
  writer.writeAttribute("String_Node_Str",String.valueOf(node.getPre()));
  if (nodeData.getId() != null && !nodeData.getId().equals("String_Node_Str" + node.getId())) {
    writer.writeAttribute("String_Node_Str",nodeData.getId());
  }
  writer.writeStartElement(ELEMENT_NODEDATA_POSITION);
  writer.writeAttribute("String_Node_Str",String.valueOf(nodeData.x()));
  writer.writeAttribute("String_Node_Str",String.valueOf(nodeData.y()));
  writer.writeAttribute("String_Node_Str",String.valueOf(nodeData.z()));
  writer.writeEndElement();
  writer.writeStartElement(ELEMENT_NODEDATA_COLOR);
  writer.writeAttribute("String_Node_Str",String.valueOf(nodeData.r()));
  writer.writeAttribute("String_Node_Str",String.valueOf(nodeData.g()));
  writer.writeAttribute("String_Node_Str",String.valueOf(nodeData.b()));
  writer.writeAttribute("String_Node_Str",String.valueOf(nodeData.alpha()));
  writer.writeEndElement();
  writer.writeStartElement(ELEMENT_NODEDATA_SIZE);
  writer.writeAttribute("String_Node_Str",String.valueOf(nodeData.getSize()));
  writer.writeEndElement();
  writer.writeEndElement();
}

Fixed version (ground truth):
public void writeNodeData(XMLStreamWriter writer,NodeDataImpl nodeData) throws XMLStreamException {
  writer.writeStartElement(ELEMENT_NODEDATA);
  AbstractNode node=nodeData.getRootNode();
  writer.writeAttribute("String_Node_Str",String.valueOf(node.getPre()));
  if (nodeData.getId() != null && !nodeData.getId().equals(String.valueOf(node.getId()))) {
    writer.writeAttribute("String_Node_Str",nodeData.getId());
  }
  writer.writeStartElement(ELEMENT_NODEDATA_POSITION);
  writer.writeAttribute("String_Node_Str",String.valueOf(nodeData.x()));
  writer.writeAttribute("String_Node_Str",String.valueOf(nodeData.y()));
  writer.writeAttribute("String_Node_Str",String.valueOf(nodeData.z()));
  writer.writeEndElement();
  writer.writeStartElement(ELEMENT_NODEDATA_COLOR);
  writer.writeAttribute("String_Node_Str",String.valueOf(nodeData.r()));
  writer.writeAttribute("String_Node_Str",String.valueOf(nodeData.g()));
  writer.writeAttribute("String_Node_Str",String.valueOf(nodeData.b()));
  writer.writeAttribute("String_Node_Str",String.valueOf(nodeData.alpha()));
  writer.writeEndElement();
  writer.writeStartElement(ELEMENT_NODEDATA_SIZE);
  writer.writeAttribute("String_Node_Str",String.valueOf(nodeData.getSize()));
  writer.writeEndElement();
  writer.writeEndElement();
}
Program: 142538
Project: 142538
Buggy source:
public void writeEdgeData(XMLStreamWriter writer,EdgeDataImpl edgeData) throws XMLStreamException {
  writer.writeStartElement(ELEMENT_EDGEDATA);
  AbstractEdge edge=edgeData.getEdge();
  writer.writeAttribute("String_Node_Str",String.valueOf(edge.getSource().getPre()));
  writer.writeAttribute("String_Node_Str",String.valueOf(edge.getTarget().getPre()));
  if (edgeData.getId() != null && !edgeData.getId().equals("String_Node_Str" + edge.getId())) {
    writer.writeAttribute("String_Node_Str",edgeData.getId());
  }
  writer.writeStartElement(ELEMENT_EDGEDATA_COLOR);
  writer.writeAttribute("String_Node_Str",String.valueOf(edgeData.r()));
  writer.writeAttribute("String_Node_Str",String.valueOf(edgeData.g()));
  writer.writeAttribute("String_Node_Str",String.valueOf(edgeData.b()));
  writer.writeAttribute("String_Node_Str",String.valueOf(edgeData.alpha()));
  writer.writeEndElement();
  writer.writeEndElement();
}

Fixed version (ground truth):
public void writeEdgeData(XMLStreamWriter writer,EdgeDataImpl edgeData) throws XMLStreamException {
  writer.writeStartElement(ELEMENT_EDGEDATA);
  AbstractEdge edge=edgeData.getEdge();
  writer.writeAttribute("String_Node_Str",String.valueOf(edge.getSource().getPre()));
  writer.writeAttribute("String_Node_Str",String.valueOf(edge.getTarget().getPre()));
  if (edgeData.getId() != null && !edgeData.getId().equals(String.valueOf(edge.getId()))) {
    writer.writeAttribute("String_Node_Str",edgeData.getId());
  }
  writer.writeStartElement(ELEMENT_EDGEDATA_COLOR);
  writer.writeAttribute("String_Node_Str",String.valueOf(edgeData.r()));
  writer.writeAttribute("String_Node_Str",String.valueOf(edgeData.g()));
  writer.writeAttribute("String_Node_Str",String.valueOf(edgeData.b()));
  writer.writeAttribute("String_Node_Str",String.valueOf(edgeData.alpha()));
  writer.writeEndElement();
  writer.writeEndElement();
}
Program: 142539
Project: 142539
Buggy source:
public void exportCurrentTable(ExportMode exportMode){
  JTable table;
  if (classDisplayed == classDisplayed.NODE) {
    table=nodeTable.getOutlineTable();
  }
 else {
    table=edgeTable.getTable();
  }
switch (exportMode) {
case CSV:
    showCSVExportUI(table);
  break;
}
}

Fixed version (ground truth):
public void exportCurrentTable(ExportMode exportMode){
  JTable table;
  String fileName=prepareTableExportFileName();
  if (classDisplayed == classDisplayed.NODE) {
    table=nodeTable.getOutlineTable();
    fileName+="String_Node_Str";
  }
 else {
    table=edgeTable.getTable();
    fileName+="String_Node_Str";
  }
  fileName+="String_Node_Str";
switch (exportMode) {
case CSV:
    showCSVExportUI(table,fileName);
  break;
}
}
Program: 142541
Project: 142541
Buggy source:
private void showCSVExportUI(JTable table){
  CSVExportUI csvUI=new CSVExportUI(table);
  DialogDescriptor dd=new DialogDescriptor(csvUI,csvUI.getDisplayName());
  if (DialogDisplayer.getDefault().notify(dd).equals(DialogDescriptor.OK_OPTION)) {
    DataTableTopComponent.exportTableAsCSV(this,table,csvUI.getSelectedSeparator(),csvUI.getSelectedCharset(),csvUI.getSelectedColumnsIndexes());
  }
  csvUI.unSetup();
}

Fixed version (ground truth):
private void showCSVExportUI(JTable table,String fileName){
  CSVExportUI csvUI=new CSVExportUI(table);
  DialogDescriptor dd=new DialogDescriptor(csvUI,csvUI.getDisplayName());
  if (DialogDisplayer.getDefault().notify(dd).equals(DialogDescriptor.OK_OPTION)) {
    DataTableTopComponent.exportTableAsCSV(this,table,csvUI.getSelectedSeparator(),csvUI.getSelectedCharset(),csvUI.getSelectedColumnsIndexes(),fileName);
  }
  csvUI.unSetup();
}
Program: 142542
Project: 142542
Buggy source:
private void printEdge(Edge edge) throws IOException {
  printOpen("String_Node_Str");
  printTag("String_Node_Str" + edge.getSource().getId());
  printTag("String_Node_Str" + edge.getTarget().getId());
  if (exportLabel && edge.getEdgeData().getLabel() != null) {
    printTag("String_Node_Str" + edge.getEdgeData().getLabel() + "String_Node_Str");
  }
  if (exportEdgeSize) {
    printTag("String_Node_Str" + edge.getWeight());
  }
  if (exportNotRecognizedElements) {
    for (int i=0; i < edge.getAttributes().countValues(); i++) {
      String s=attributeModel.getEdgeTable().getColumn(i).getTitle();
      if (s.charAt(0) >= 'a' && s.charAt(0) <= 'z' && edge.getAttributes().getValue(i) != null) {
        printTag(attributeModel.getEdgeTable().getColumn(i).getTitle() + "String_Node_Str" + (String)edge.getAttributes().getValue(i));
      }
    }
  }
  printClose();
  progressTicket.progress();
}

Fixed version (ground truth):
private void printEdge(Edge edge) throws IOException {
  printOpen("String_Node_Str");
  printTag("String_Node_Str" + edge.getSource().getId());
  printTag("String_Node_Str" + edge.getTarget().getId());
  if (exportLabel && edge.getEdgeData().getLabel() != null) {
    printTag("String_Node_Str" + edge.getEdgeData().getLabel() + "String_Node_Str");
  }
  if (exportEdgeSize) {
    printTag("String_Node_Str" + edge.getWeight());
  }
  if (exportNotRecognizedElements) {
    for (int i=0; i < edge.getAttributes().countValues(); i++) {
      String s=attributeModel.getEdgeTable().getColumn(i).getTitle();
      if (!(s.charAt(0) >= 'A' && s.charAt(0) <= 'Z') && edge.getAttributes().getValue(i) != null) {
        printTag(attributeModel.getEdgeTable().getColumn(i).getTitle() + "String_Node_Str" + (String)edge.getAttributes().getValue(i)+ "String_Node_Str");
      }
    }
  }
  printClose();
  progressTicket.progress();
}