nus-yam/ex-repair huggingface dataset:
Program: 98747
Project: 98747
Buggy source:
private PRQAComplianceStatus performUpload(AbstractBuild<?,?> build,PRQAApplicationSettings appSettings,PRQARemoteToolCheck remoteToolCheck,QAFrameworkRemoteReportUpload remoteReportUpload) throws PrqaException {
  boolean success=true;
  PRQAComplianceStatus currentBuild=null;
  try {
    QaFrameworkVersion qaFrameworkVersion=new QaFrameworkVersion(build.getWorkspace().act(remoteToolCheck));
    success=isQafVersionSupported(qaFrameworkVersion);
    if (!success) {
      build.setResult(Result.FAILURE);
      throw new PrqaException("String_Node_Str");
    }
    remoteReportUpload.setQaFrameworkVersion(qaFrameworkVersion);
    build.getWorkspace().act(remoteReportUpload);
  }
 catch (  IOException ex) {
    success=false;
    outStream.println(ex.getMessage());
    build.setResult(Result.FAILURE);
    throw new PrqaException("String_Node_Str");
  }
catch (  Exception ex) {
    outStream.println(Messages.PRQANotifier_FailedGettingResults());
    outStream.println(ex.getMessage());
    log.log(Level.SEVERE,"String_Node_Str",ex);
    success=false;
    build.setResult(Result.FAILURE);
    throw new PrqaException("String_Node_Str");
  }
  return currentBuild;
}

Fixed version (ground truth):
private PRQAComplianceStatus performUpload(AbstractBuild<?,?> build,PRQAApplicationSettings appSettings,PRQARemoteToolCheck remoteToolCheck,QAFrameworkRemoteReportUpload remoteReportUpload) throws PrqaException {
  boolean success=true;
  PRQAComplianceStatus currentBuild=null;
  try {
    QaFrameworkVersion qaFrameworkVersion=new QaFrameworkVersion(build.getWorkspace().act(remoteToolCheck));
    success=isQafVersionSupported(qaFrameworkVersion);
    if (!success) {
      build.setResult(Result.FAILURE);
      throw new PrqaException("String_Node_Str");
    }
    remoteReportUpload.setQaFrameworkVersion(qaFrameworkVersion);
    currentBuild=build.getWorkspace().act(remoteReportUpload);
  }
 catch (  IOException ex) {
    success=false;
    outStream.println(ex.getMessage());
    build.setResult(Result.FAILURE);
    throw new PrqaException("String_Node_Str");
  }
catch (  Exception ex) {
    outStream.println(Messages.PRQANotifier_FailedGettingResults());
    outStream.println(ex.getMessage());
    log.log(Level.SEVERE,"String_Node_Str",ex);
    success=false;
    build.setResult(Result.FAILURE);
    throw new PrqaException("String_Node_Str");
  }
  return currentBuild;
}
Program: 98748
Project: 98748
Buggy source:
private boolean isTresholdValidForMessageGroups(PRQAComplianceStatus currentComplianceStatus,int thresholdLevel){
  boolean isValidTreshold=true;
  List<MessageGroup> messageGroups=currentComplianceStatus.getMessagesGroups();
  if (messageGroups == null || messageGroups.isEmpty()) {
    isValidTreshold=currentComplianceStatus.getMessageCount(thresholdLevel) <= value;
    if (!isValidTreshold) {
      currentComplianceStatus.addNotification(Messages.PRQANotifier_MaxMessagesRequirementNotMetExistingPrqa(currentComplianceStatus.getMessageCount(thresholdLevel),value));
    }
  }
 else {
    for (    MessageGroup messageGroup : currentComplianceStatus.getMessagesGroups()) {
      isValidTreshold=messageGroup.getMessagesWithinTreshold() <= value;
      if (!isValidTreshold) {
        currentComplianceStatus.addNotification(onUnstableMessage(messageGroup.getMessageGroupName(),messageGroup.getMessagesWithinTreshold(),value));
      }
      log.fine(String.format("String_Node_Str",messageGroup.getMessageGroupName(),messageGroup.getMessagesWithinTreshold(),value));
      log.fine(String.format("String_Node_Str",isValidTreshold));
    }
  }
  return isValidTreshold;
}

Fixed version (ground truth):
private boolean isTresholdValidForMessageGroups(PRQAComplianceStatus currentComplianceStatus,int thresholdLevel){
  boolean isValidTreshold=true;
  boolean isStableBuild=true;
  List<MessageGroup> messageGroups=currentComplianceStatus.getMessagesGroups();
  if (messageGroups == null || messageGroups.isEmpty()) {
    isValidTreshold=currentComplianceStatus.getMessageCount(thresholdLevel) <= value;
    if (!isValidTreshold) {
      currentComplianceStatus.addNotification(Messages.PRQANotifier_MaxMessagesRequirementNotMetExistingPrqa(currentComplianceStatus.getMessageCount(thresholdLevel),value));
    }
  }
 else {
    for (    MessageGroup messageGroup : currentComplianceStatus.getMessagesGroups()) {
      isValidTreshold=messageGroup.getMessagesWithinTreshold() <= value;
      if (!isValidTreshold) {
        currentComplianceStatus.addNotification(onUnstableMessage(messageGroup.getMessageGroupName(),messageGroup.getMessagesWithinTreshold(),value));
        isStableBuild=false;
      }
      log.fine(String.format("String_Node_Str",messageGroup.getMessageGroupName(),messageGroup.getMessagesWithinTreshold(),value));
      log.fine(String.format("String_Node_Str",isValidTreshold));
    }
  }
  return isStableBuild;
}
Program: 98750
Project: 98750
Buggy source:
private void copyReportsFromWorkspaceToArtefactsDir(File artefact,File workspace,long elapsedTime) throws IOException {
  if (artefact == null) {
    return;
  }
  if (!artefact.exists()) {
    artefact.mkdirs();
  }
  FileUtils.cleanDirectory(artefact);
  File[] workspaceFiles=workspace.listFiles();
  if (workspaceFiles.length < 1) {
    return;
  }
  Arrays.sort(workspaceFiles,new Comparator<File>(){
    @Override public int compare(    File o1,    File o2){
      if (o1.lastModified() > o2.lastModified()) {
        return -1;
      }
 else       if (o1.lastModified() < o2.lastModified()) {
        return +1;
      }
 else {
        return 0;
      }
    }
  }
);
  boolean hasCRReport=false;
  boolean hasSUReport=false;
  boolean hasRCReport=false;
  boolean hasMDReport=false;
  for (  File file : workspaceFiles) {
    if (file.lastModified() < elapsedTime) {
      break;
    }
    if (file.getName().contains("String_Node_Str") && !hasCRReport) {
      FileUtils.copyFileToDirectory(file,artefact);
      hasCRReport=true;
    }
    if (file.getName().contains("String_Node_Str") && !hasSUReport) {
      FileUtils.copyFileToDirectory(file,artefact);
      hasSUReport=true;
    }
    if (file.getName().contains("String_Node_Str") && !hasRCReport) {
      FileUtils.copyFileToDirectory(file,artefact);
      hasRCReport=true;
    }
    if (file.getName().contains("String_Node_Str") && !hasMDReport) {
      FileUtils.copyFileToDirectory(file,artefact);
      hasMDReport=true;
    }
  }
}

Fixed version (ground truth):
private void copyReportsFromWorkspaceToArtefactsDir(File artefact,File workspace,long elapsedTime) throws IOException {
  if (artefact == null) {
    return;
  }
  if (!artefact.exists()) {
    artefact.mkdirs();
  }
  FileUtils.cleanDirectory(artefact);
  File[] workspaceFiles=workspace.listFiles();
  if (workspaceFiles.length < 1) {
    return;
  }
  Arrays.sort(workspaceFiles,new Comparator<File>(){
    @Override public int compare(    File o1,    File o2){
      if (o1.lastModified() > o2.lastModified()) {
        return -1;
      }
 else       if (o1.lastModified() < o2.lastModified()) {
        return +1;
      }
 else {
        return 0;
      }
    }
  }
);
  for (  File file : workspaceFiles) {
    if (file.lastModified() < elapsedTime) {
      break;
    }
    if (file.getName().contains("String_Node_Str")) {
      FileUtils.copyFileToDirectory(file,artefact);
    }
    if (file.getName().contains("String_Node_Str")) {
      FileUtils.copyFileToDirectory(file,artefact);
    }
    if (file.getName().contains("String_Node_Str")) {
      FileUtils.copyFileToDirectory(file,artefact);
    }
    if (file.getName().contains("String_Node_Str")) {
      FileUtils.copyFileToDirectory(file,artefact);
    }
  }
}
Program: 98751
Project: 98751
Buggy source:
public void setUploadSourceCode(String uploadSourceCode){
  uploadSourceCode=uploadSourceCode;
}

Fixed version (ground truth):
public void setUploadSourceCode(String uploadSource){
  uploadSourceCode=uploadSource;
}
Program: 98752
Project: 98752
Buggy source:
public FormValidation doCheckCMAProjectName(@QueryParameter String CMAProjectName){
  if (StringUtils.isBlank(CMAProjectName)) {
    return FormValidation.errorWithMarkup("String_Node_Str");
  }
  if (CMAProjectName.startsWith("String_Node_Str")) {
    return FormValidation.errorWithMarkup("String_Node_Str");
  }
  return FormValidation.ok();
}

Fixed version (ground truth):
public FormValidation doCheckCMAProjectName(@QueryParameter String CMAProjectName){
  if (StringUtils.isBlank(CMAProjectName)) {
    return FormValidation.errorWithMarkup("String_Node_Str");
  }
  if (CMAProjectName.startsWith("String_Node_Str")) {
    return FormValidation.errorWithMarkup("String_Node_Str");
  }
  if (!CMAProjectName.matches("String_Node_Str")) {
    return FormValidation.errorWithMarkup("String_Node_Str");
  }
  return FormValidation.ok();
}
Program: 98753
Project: 98753
Buggy source:
private void _checkBinaryMatch(HashMap<String,String> env,Product product) throws PrqaSetupException {
  String pathSep=System.getProperty("String_Node_Str");
  if (isUnix) {
    if (product instanceof QAC) {
      File f=new File(env.get("String_Node_Str") + pathSep + "String_Node_Str");
      String path=f.getPath();
      if (!f.exists()) {
        throw new PrqaSetupException(String.format("String_Node_Str",path));
      }
    }
 else {
      File f=new File(env.get("String_Node_Str") + pathSep + "String_Node_Str");
      String path=f.getPath();
      if (!f.exists()) {
        throw new PrqaSetupException(String.format("String_Node_Str",path));
      }
    }
  }
 else {
    if (product instanceof QAC) {
      File f=new File(env.get("String_Node_Str") + pathSep + "String_Node_Str");
      String path=f.getPath();
      if (!f.exists()) {
        throw new PrqaSetupException(String.format("String_Node_Str",path));
      }
    }
 else {
      File f=new File(env.get("String_Node_Str") + pathSep + "String_Node_Str");
      String path=f.getPath();
      if (!f.exists()) {
        throw new PrqaSetupException(String.format("String_Node_Str",path));
      }
    }
  }
}

Fixed version (ground truth):
private void _checkBinaryMatch(HashMap<String,String> env,Product product) throws PrqaSetupException {
  String pathSep=System.getProperty("String_Node_Str");
  if (env != null) {
    if (isUnix) {
      if (product instanceof QAC) {
        File f=new File(env.get("String_Node_Str") + pathSep + "String_Node_Str");
        String path=f.getPath();
        if (!f.exists()) {
          throw new PrqaSetupException(String.format("String_Node_Str",path));
        }
      }
 else {
        File f=new File(env.get("String_Node_Str") + pathSep + "String_Node_Str");
        String path=f.getPath();
        if (!f.exists()) {
          throw new PrqaSetupException(String.format("String_Node_Str",path));
        }
      }
    }
 else {
      if (product instanceof QAC) {
        File f=new File(env.get("String_Node_Str") + pathSep + "String_Node_Str");
        String path=f.getPath();
        if (!f.exists()) {
          throw new PrqaSetupException(String.format("String_Node_Str",path));
        }
      }
 else {
        File f=new File(env.get("String_Node_Str") + pathSep + "String_Node_Str");
        String path=f.getPath();
        if (!f.exists()) {
          throw new PrqaSetupException(String.format("String_Node_Str",path));
        }
      }
    }
  }
}
Program: 98755
Project: 98755
Buggy source:
public abstract String onUnstableMessage(PRQAComplianceStatus lastStableValue,PRQAComplianceStatus currentValue);

Fixed version (ground truth):
public abstract String onUnstableMessage(PRQAComplianceStatus lastStableValue,PRQAComplianceStatus currentValue,int thresholdLevel);
Program: 98756
Project: 98756
Buggy source:
public abstract Boolean validateThreshold(PRQAComplianceStatus currentValue);

Fixed version (ground truth):
public abstract Boolean validateThreshold(PRQAComplianceStatus currentValue,int thresholdLevel);
Program: 98757
Project: 98757
Buggy source:
public abstract Boolean validateImprovement(PRQAComplianceStatus lastStableValue,PRQAComplianceStatus currentValue);

Fixed version (ground truth):
public abstract Boolean validateImprovement(PRQAComplianceStatus lastStableValue,PRQAComplianceStatus currentValue,int thresholdLevel);
Program: 98758
Project: 98758
Buggy source:
public Boolean validate(PRQAComplianceStatus lastStableValue,PRQAComplianceStatus currentValue){
  if (improvement) {
    return validateImprovement(lastStableValue,currentValue);
  }
 else {
    return validateThreshold(currentValue);
  }
}

Fixed version (ground truth):
public Boolean validate(PRQAComplianceStatus lastStableValue,PRQAComplianceStatus currentValue,int thresholdLevel){
  if (improvement) {
    return validateImprovement(lastStableValue,currentValue,thresholdLevel);
  }
 else {
    return validateThreshold(currentValue,thresholdLevel);
  }
}
Program: 98759
Project: 98759
Buggy source:
@Override public String onUnstableMessage(PRQAComplianceStatus lastStableValue,PRQAComplianceStatus currentValue){
  if (!improvement) {
    return Messages.PRQANotifier_FileComplianceRequirementNotMet(currentValue.getFileCompliance(),lastStableValue.getFileCompliance());
  }
 else {
    return Messages.PRQANotifier_FileComplianceRequirementNotMet(currentValue.getFileCompliance(),value);
  }
}

Fixed version (ground truth):
@Override public String onUnstableMessage(PRQAComplianceStatus lastStableValue,PRQAComplianceStatus currentValue,int thresholdLevel){
  if (!improvement) {
    return Messages.PRQANotifier_FileComplianceRequirementNotMet(currentValue.getFileCompliance(),lastStableValue.getFileCompliance());
  }
 else {
    return Messages.PRQANotifier_FileComplianceRequirementNotMet(currentValue.getFileCompliance(),value);
  }
}
Program: 98760
Project: 98760
Buggy source:
@Override public Boolean validateThreshold(PRQAComplianceStatus currentValue){
  return currentValue.getFileCompliance() >= value;
}

Fixed version (ground truth):
@Override public Boolean validateThreshold(PRQAComplianceStatus currentValue,int thresholdLevel){
  return currentValue.getFileCompliance() >= value;
}
Program: 98761
Project: 98761
Buggy source:
@Override public Boolean validateImprovement(PRQAComplianceStatus lastStableValue,PRQAComplianceStatus currentValue){
  if (lastStableValue == null)   return Boolean.TRUE;
  return currentValue.getFileCompliance() >= lastStableValue.getFileCompliance();
}

Fixed version (ground truth):
@Override public Boolean validateImprovement(PRQAComplianceStatus lastStableValue,PRQAComplianceStatus currentValue,int thresholdLevel){
  if (lastStableValue == null)   return Boolean.TRUE;
  return currentValue.getFileCompliance() >= lastStableValue.getFileCompliance();
}
Program: 98762
Project: 98762
Buggy source:
@Override public String onUnstableMessage(PRQAComplianceStatus lastStableValue,PRQAComplianceStatus currentValue){
  if (improvement) {
    return Messages.PRQANotifier_MaxMessagesRequirementNotMet(currentValue.getMessageCount(thresholdLevel),lastStableValue.getMessageCount(thresholdLevel));
  }
 else {
    return Messages.PRQANotifier_MaxMessagesRequirementNotMet(currentValue.getMessageCount(thresholdLevel),value);
  }
}

Fixed version (ground truth):
@Override public String onUnstableMessage(PRQAComplianceStatus lastStableValue,PRQAComplianceStatus currentValue,int thresholdLevel){
  if (improvement) {
    return Messages.PRQANotifier_MaxMessagesRequirementNotMet(currentValue.getMessageCount(thresholdLevel),lastStableValue.getMessageCount(thresholdLevel));
  }
 else {
    return Messages.PRQANotifier_MaxMessagesRequirementNotMet(currentValue.getMessageCount(thresholdLevel),value);
  }
}
Program: 98763
Project: 98763
Buggy source:
@Override public Boolean validateThreshold(PRQAComplianceStatus currentValue){
  Boolean res=currentValue.getMessageCount(thresholdLevel) <= value;
  log.fine(String.format("String_Node_Str",currentValue.getMessageCount(thresholdLevel),value));
  log.fine(String.format("String_Node_Str",res));
  return res;
}

Fixed version (ground truth):
@Override public Boolean validateThreshold(PRQAComplianceStatus currentValue,int thresholdLevel){
  Boolean res=currentValue.getMessageCount(thresholdLevel) <= value;
  log.fine(String.format("String_Node_Str",currentValue.getMessageCount(thresholdLevel),value));
  log.fine(String.format("String_Node_Str",res));
  return res;
}
Program: 98764
Project: 98764
Buggy source:
@Override public Boolean validateImprovement(PRQAComplianceStatus lastStableValue,PRQAComplianceStatus currentValue){
  if (lastStableValue == null) {
    return Boolean.TRUE;
  }
 else {
    return currentValue.getMessageCount(thresholdLevel) <= lastStableValue.getMessageCount(thresholdLevel);
  }
}

Fixed version (ground truth):
@Override public Boolean validateImprovement(PRQAComplianceStatus lastStableValue,PRQAComplianceStatus currentValue,int thresholdLevel){
  if (lastStableValue == null) {
    return Boolean.TRUE;
  }
 else {
    return currentValue.getMessageCount(thresholdLevel) <= lastStableValue.getMessageCount(thresholdLevel);
  }
}
Program: 98765
Project: 98765
Buggy source:
@DataBoundConstructor public MessageComplianceThreshold(final Integer value,final int thresholdLevel,final Boolean improvement){
  super(improvement);
  this.value=value;
  this.thresholdLevel=thresholdLevel;
}

Fixed version (ground truth):
@DataBoundConstructor public MessageComplianceThreshold(final Integer value,final int thresholdLevel,final Boolean improvement){
  super(improvement);
  this.value=value;
}
Program: 98766
Project: 98766
Buggy source:
@Override public Boolean validate(PRQAComplianceStatus lastStableValue,PRQAComplianceStatus currentValue){
  int msgWithin=currentValue.getMessageCount(thresholdLevel);
  currentValue.setMessagesWithinThreshold(msgWithin);
  if (improvement) {
    return validateImprovement(lastStableValue,currentValue);
  }
 else {
    return validateThreshold(currentValue);
  }
}

Fixed version (ground truth):
@Override public Boolean validate(PRQAComplianceStatus lastStableValue,PRQAComplianceStatus currentValue,int thresholdLevel){
  int msgWithin=currentValue.getMessageCount(thresholdLevel);
  currentValue.setMessagesWithinThreshold(msgWithin);
  if (improvement) {
    return validateImprovement(lastStableValue,currentValue,thresholdLevel);
  }
 else {
    return validateThreshold(currentValue,thresholdLevel);
  }
}
Program: 98767
Project: 98767
Buggy source:
/** 
 * Process the results
 */
private boolean evaluate(PRQAReading previousResult,List<? extends AbstractThreshold> thresholds,PRQAComplianceStatus status){
  PRQAComplianceStatus previousComplianceStatus=(PRQAComplianceStatus)previousResult;
  HashMap<StatusCategory,Number> tholds=new HashMap<StatusCategory,Number>();
  boolean isStable=true;
  for (  AbstractThreshold threshold : thresholds) {
    addThreshold(threshold,tholds);
    if (!threshold.validate(previousComplianceStatus,status)) {
      status.addNotification(threshold.onUnstableMessage(previousComplianceStatus,status));
      isStable=false;
    }
  }
  status.setThresholds(tholds);
  return isStable;
}

Fixed version (ground truth):
/** 
 * Process the results
 */
private boolean evaluate(PRQAReading previousResult,List<? extends AbstractThreshold> thresholds,PRQAComplianceStatus status){
  PRQAComplianceStatus previousComplianceStatus=(PRQAComplianceStatus)previousResult;
  HashMap<StatusCategory,Number> tholds=new HashMap<StatusCategory,Number>();
  boolean isStable=true;
  for (  AbstractThreshold threshold : thresholds) {
    addThreshold(threshold,tholds);
    if (!threshold.validate(previousComplianceStatus,status,threshholdlevel)) {
      status.addNotification(threshold.onUnstableMessage(previousComplianceStatus,status,threshholdlevel));
      isStable=false;
    }
  }
  status.setThresholds(tholds);
  return isStable;
}
Program: 98768
Project: 98768
Buggy source:
@Override public String onUnstableMessage(PRQAComplianceStatus lastStableValue,PRQAComplianceStatus currentValue){
  if (improvement) {
    return Messages.PRQANotifier_ProjectComplianceIndexRequirementNotMet(currentValue.getProjectCompliance(),lastStableValue.getProjectCompliance());
  }
 else {
    return Messages.PRQANotifier_ProjectComplianceIndexRequirementNotMet(currentValue.getProjectCompliance(),value);
  }
}

Fixed version (ground truth):
@Override public String onUnstableMessage(PRQAComplianceStatus lastStableValue,PRQAComplianceStatus currentValue,int thresholdLevel){
  if (improvement) {
    return Messages.PRQANotifier_ProjectComplianceIndexRequirementNotMet(currentValue.getProjectCompliance(),lastStableValue.getProjectCompliance());
  }
 else {
    return Messages.PRQANotifier_ProjectComplianceIndexRequirementNotMet(currentValue.getProjectCompliance(),value);
  }
}
Program: 98769
Project: 98769
Buggy source:
@Override public Boolean validateThreshold(PRQAComplianceStatus currentValue){
  return currentValue.getProjectCompliance() >= value;
}

Fixed version (ground truth):
@Override public Boolean validateThreshold(PRQAComplianceStatus currentValue,int thresholdLevel){
  return currentValue.getProjectCompliance() >= value;
}
Program: 98770
Project: 98770
Buggy source:
@Override public Boolean validateImprovement(PRQAComplianceStatus lastStableValue,PRQAComplianceStatus currentValue){
  if (lastStableValue == null)   return Boolean.TRUE;
  return currentValue.getProjectCompliance() >= lastStableValue.getProjectCompliance();
}

Fixed version (ground truth):
@Override public Boolean validateImprovement(PRQAComplianceStatus lastStableValue,PRQAComplianceStatus currentValue,int thresholdLevel){
  if (lastStableValue == null)   return Boolean.TRUE;
  return currentValue.getProjectCompliance() >= lastStableValue.getProjectCompliance();
}
Program: 98774
Project: 98774
Buggy source:
@Override public PRQASuppressionStatus invoke(File file,VirtualChannel vc) throws IOException, InterruptedException {
  try {
    listener.getLogger().println(String.format("String_Node_Str",report.getQar().getCommand()));
    setup(file.getPath(),PRQAReport.XHTML);
    return report.completeTask();
  }
 catch (  PrqaException ex) {
    listener.getLogger().println("String_Node_Str" + report.getQar().getBuilder().getCommand());
    throw new IOException(ex);
  }
}

Fixed version (ground truth):
@Override public PRQASuppressionStatus invoke(File file,VirtualChannel vc) throws IOException, InterruptedException {
  try {
    setup(file.getPath(),PRQAReport.XHTML);
    listener.getLogger().println(String.format("String_Node_Str",report.getQar().getCommand()));
    return report.completeTask();
  }
 catch (  PrqaException ex) {
    listener.getLogger().println("String_Node_Str" + report.getQar().getBuilder().getCommand());
    throw new IOException(ex);
  }
}
Program: 98775
Project: 98775
Buggy source:
public void fillModel(Map<String,Object> model,HttpServletRequest request){
  model.put("String_Node_Str",request.getContextPath() + Piazza.PATH + "String_Node_Str"+ queryParameter(model,request));
}

Fixed version (ground truth):
public void fillModel(Map<String,Object> model,HttpServletRequest request){
  String queryParameter=queryParameter(request);
  model.put("String_Node_Str",request.getContextPath() + Piazza.PATH + "String_Node_Str"+ queryParameter+ "String_Node_Str"+ request.getParameter(queryParameter));
}
Program: 98776
Project: 98776
Buggy source:
private String queryParameter(Map<String,Object> model,HttpServletRequest request){
  if (isBuildTypeView(request)) {
    return buildTypeQuery(model);
  }
 else   if (isProjectView(request)) {
    return projectQuery(model);
  }
 else {
    throw new IllegalStateException("String_Node_Str" + request.getRequestURI());
  }
}

Fixed version (ground truth):
private String queryParameter(HttpServletRequest request){
  if (isBuildTypeView(request)) {
    return BUILD_TYPE_ID;
  }
 else   if (isProjectView(request)) {
    return PROJECT_ID;
  }
 else {
    throw new IllegalStateException("String_Node_Str" + request.getRequestURI());
  }
}
Program: 98777
Project: 98777
Buggy source:
private boolean exceptionExists(Word nextBestWord){
  for (Iterator<Word> iterator=exceptions.iterator(); iterator.hasNext(); ) {
    Word next=iterator.next();
    if (nextBestWord == next) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean exceptionExists(Word nextBestWord){
  for (  Word next : exceptions) {
    if (nextBestWord == next) {
      return true;
    }
  }
  return false;
}
Program: 98778
Project: 98778
Buggy source:
private void iterateAndSelectWords(int counter,StringBuilder sb,Word next){
  for (int i=0; i < counter; i++) {
    if (i == counter - 1) {
      sb.append(getEOSWord(next));
      break;
    }
 else {
      Word bestLink=next.getBestLink();
      if (bestLink != null) {
        Word nextBestWord=bestLink;
        if (!exceptionExists(nextBestWord)) {
          exceptions.add(nextBestWord);
          sb.append(nextBestWord.toString());
          sb.append("String_Node_Str");
          next=repository.getByName(bestLink.toString());
        }
 else {
          if (exceptionsForAllLinks(nextBestWord)) {
            System.out.println("String_Node_Str");
            exceptions.clear();
          }
 else {
            System.out.println("String_Node_Str");
          }
          i--;
        }
      }
 else {
        sb.append("String_Node_Str");
        break;
      }
    }
  }
}

Fixed version (ground truth):
private void iterateAndSelectWords(int counter,StringBuilder sb,Word next){
  for (int i=0; i < counter; i++) {
    if (i == counter - 1) {
      sb.append(getEOSWord(next));
      break;
    }
 else {
      Word bestLink=next.getBestLink();
      if (bestLink != null) {
        if (!exceptionExists(bestLink)) {
          exceptions.add(bestLink);
          sb.append(bestLink.toString());
          sb.append("String_Node_Str");
          next=repository.getByName(bestLink.toString());
        }
 else {
          if (exceptionsForAllLinks(bestLink)) {
            System.out.println("String_Node_Str");
            exceptions.clear();
          }
 else {
            System.out.println("String_Node_Str");
          }
          i--;
        }
      }
 else {
        sb.append("String_Node_Str");
        break;
      }
    }
  }
}
Program: 98779
Project: 98779
Buggy source:
private String getPartialSentence(Integer userSelection,String[] sentenceArray){
  StringBuilder lastSentenceTemp=new StringBuilder();
  for (int i=0; i < userSelection; i++) {
    String s=sentenceArray[i];
    lastSentenceTemp.append(s + "String_Node_Str");
  }
  return lastSentenceTemp.toString();
}

Fixed version (ground truth):
private String getPartialSentence(Integer userSelection,String[] sentenceArray){
  StringBuilder lastSentenceTemp=new StringBuilder();
  for (int i=0; i < userSelection; i++) {
    String s=sentenceArray[i];
    lastSentenceTemp.append(s).append("String_Node_Str");
  }
  return lastSentenceTemp.toString();
}
Program: 98780
Project: 98780
Buggy source:
public boolean exceptionsForAllLinks(Word word){
  ArrayList<Link> links=word.links;
  boolean allExceptions=true;
  for (Iterator<Link> iterator=links.iterator(); iterator.hasNext(); ) {
    Link next=iterator.next();
    if (!exceptionExists(next.otherWord))     allExceptions=false;
  }
  return allExceptions;
}

Fixed version (ground truth):
public boolean exceptionsForAllLinks(Word word){
  ArrayList<Link> links=word.links;
  boolean allExceptions=true;
  for (  Link next : links) {
    if (!exceptionExists(next.otherWord))     allExceptions=false;
  }
  return allExceptions;
}
Program: 98781
Project: 98781
Buggy source:
public int calcRandomIndex(){
  int index=0;
  int size=this.links.size();
  int priorityCounter;
  do {
    priorityCounter=priorityCounterGenerate();
switch (priorityCounter) {
case 0:
      index=(int)((Math.random() * size) / 5.0);
    break;
case 1:
  index=(int)Math.round((Math.random() * size / 5.0) + (size / 5.0));
break;
case 2:
index=(int)Math.round((Math.random() * size / 5.0) + ((size / 5.0) * 2.0));
break;
case 3:
index=(int)Math.round((Math.random() * size / 5.0) + ((size / 5.0) * 3.0));
break;
case 4:
index=(int)Math.round((Math.random() * size / 5.0) + ((size / 5.0) * 4.0));
break;
}
}
 while (index >= size);
return index;
}

Fixed version (ground truth):
public int calcRandomIndex(){
  int index=0;
  int size=this.links.size();
  int priorityCounter;
  do {
    if (links.size() < 10) {
      return (int)(Math.random() * links.size());
    }
    priorityCounter=priorityCounterGenerate();
switch (priorityCounter) {
case 0:
      index=(int)((Math.random() * size) / 5.0);
    break;
case 1:
  index=(int)(((Math.random() * size) / 5.0) + (size / 5.0));
break;
case 2:
index=(int)(((Math.random() * size) / 5.0) + ((size / 5.0) * 2.0));
break;
case 3:
index=(int)(((Math.random() * size) / 5.0) + ((size / 5.0) * 3.0));
break;
case 4:
index=(int)(((Math.random() * size) / 5.0) + ((size / 5.0) * 4.0));
break;
}
}
 while (index >= size);
return index;
}
Program: 98782
Project: 98782
Buggy source:
public Word getBestLink(){
  Word returnWord=null;
  int index;
  boolean good=false;
  while (good == false) {
    index=calcRandomIndex();
    if (links.isEmpty()) {
      return null;
    }
 else     if (getSingleLink(index).isEOS() && links.size() == 1) {
      return null;
    }
 else     if (!getSingleLink(index).isEOS()) {
      good=true;
      returnWord=getSingleLink(index);
      links.get(index).downRate();
      Collections.sort(this.links,new LinkComparator());
    }
  }
  return returnWord;
}

Fixed version (ground truth):
public Word getBestLink(){
  Word returnWord=null;
  int index;
  boolean good=false;
  while (!good) {
    index=calcRandomIndex();
    if (links.isEmpty()) {
      return null;
    }
 else     if (getSingleLink(index).isEOS() && links.size() == 1) {
      return null;
    }
 else     if (!getSingleLink(index).isEOS()) {
      good=true;
      returnWord=getSingleLink(index);
      links.get(index).downRate();
      Collections.sort(this.links,new LinkComparator());
    }
  }
  return returnWord;
}
Program: 98783
Project: 98783
Buggy source:
@Ignore @Test public void returnsEOSIfNextWordIsNull(){
  assertEquals(null,generator.getNextLink(java));
}

Fixed version (ground truth):
@Test public void returnsEOSIfNextWordIsNull(){
  assertEquals(null,generator.getNextLink(java));
}
Program: 98784
Project: 98784
Buggy source:
public boolean process(EntryStruct struct) throws IOException {
  String name=struct.name;
  boolean result=chain.process(struct);
  if (verbose) {
    if (result) {
      if (name.equals(struct.name)) {
        System.err.println("String_Node_Str" + name + "String_Node_Str"+ struct.name);
      }
    }
 else {
      System.err.println("String_Node_Str" + name);
    }
  }
  return result;
}

Fixed version (ground truth):
public boolean process(EntryStruct struct) throws IOException {
  String name=struct.name;
  boolean result=chain.process(struct);
  if (verbose) {
    if (result) {
      if (!name.equals(struct.name))       System.err.println("String_Node_Str" + name + "String_Node_Str"+ struct.name);
    }
 else {
      System.err.println("String_Node_Str" + name);
    }
  }
  return result;
}
Program: 98785
Project: 98785
Buggy source:
public FieldVisitor visitField(int access,String name,String desc,String signature,Object value){
  FieldVisitor fv=new FieldFixer(cv.visitField(access,name,rules.fixDesc(desc),fixSignature(signature,true),fixValue(value)));
  return (fv != null) ? new FieldFixer(fv) : null;
}

Fixed version (ground truth):
public FieldVisitor visitField(int access,String name,String desc,String signature,Object value){
  FieldVisitor fv=cv.visitField(access,name,rules.fixDesc(desc),fixSignature(signature,true),fixValue(value));
  return (fv != null) ? new FieldFixer(fv) : null;
}
Program: 98786
Project: 98786
Buggy source:
public void run(String classPath,final PrintWriter pw) throws IOException {
  try {
    StringVisitor sv=new StringVisitor(){
      private String className;
      private boolean needName;
      public void visitStart(      String className){
        this.className=className;
        needName=true;
      }
      public void visitString(      String value,      int line){
        if (value.length() > 0) {
          if (needName) {
            pw.println(className.replace('/','.'));
            needName=false;
          }
          pw.print("String_Node_Str");
          if (line >= 0)           pw.print(line + "String_Node_Str");
          pw.print(IoUtils.escapeStringLiteral(value));
          pw.println();
        }
      }
      public void visitEnd(){
        pw.flush();
      }
    }
;
    StringReader stringReader=new StringReader(sv);
    ClassPathIterator cp=new ClassPathIterator(classPath);
    while (cp.hasNext()) {
      new ClassReader(cp.getInputStream(cp.next())).accept(stringReader,false);
    }
  }
 catch (  RuntimeIOException e) {
    throw (IOException)e.getCause();
  }
}

Fixed version (ground truth):
public void run(String classPath,PrintWriter pw) throws IOException {
  try {
    StringReader stringReader=new StringReader(new DumpStringVisitor(pw));
    ClassPathIterator cp=new ClassPathIterator(classPath);
    while (cp.hasNext()) {
      new ClassReader(cp.getInputStream(cp.next())).accept(stringReader,false);
    }
  }
 catch (  RuntimeIOException e) {
    throw (IOException)e.getCause();
  }
}
Program: 98787
Project: 98787
Buggy source:
public Pattern compile(String pattern){
  try {
    final RE re=new RE(pattern);
    return new Pattern(){
      public String replaceAll(      String value,      String replace){
        return re.substituteAll(value,replace,0,RE.REG_NO_INTERPOLATE);
      }
      public boolean matches(      String value){
        return re.isMatch(value);
      }
      public int groupCount(){
        return re.getNumSubs();
      }
      public Matcher getMatcher(      final String value){
        final REMatch match=re.getMatch(value,0);
        return new Matcher(){
          public boolean matches(){
            return re.isMatch(value);
          }
          public int start(){
            return match.getStartIndex();
          }
          public int end(){
            return match.getEndIndex();
          }
          public String group(          int index){
            return match.toString(index);
          }
        }
;
      }
      public String toString(){
        return re.toString();
      }
    }
;
  }
 catch (  final REException e) {
    throw new IllegalArgumentException(e.getMessage()){
      public Throwable getCause(){
        return e;
      }
    }
;
  }
}

Fixed version (ground truth):
public Pattern compile(String pattern){
  try {
    return new GnuPattern(new RE(pattern));
  }
 catch (  final REException e) {
    throw new IllegalArgumentException(e.getMessage()){
      public Throwable getCause(){
        return e;
      }
    }
;
  }
}
Program: 98788
Project: 98788
Buggy source:
private static boolean hasExtension(String name,String ext){
  int len=name.length();
  if (name.length() < ext.length())   return false;
  String actual=name.substring(name.length() - ext.length());
  return actual.equals(ext) || actual.equals(ext.toUpperCase());
}

Fixed version (ground truth):
private static boolean hasExtension(String name,String ext){
  if (name.length() < ext.length())   return false;
  String actual=name.substring(name.length() - ext.length());
  return actual.equals(ext) || actual.equals(ext.toUpperCase());
}
Program: 98789
Project: 98789
Buggy source:
public void visitLocalVariable(String name,String desc,String signature,Label start,Label end,int index){
  checkDesc(desc);
}

Fixed version (ground truth):
public void visitLocalVariable(String name,String desc,String signature,Label start,Label end,int index){
  checkDesc(desc);
  checkSignature(signature);
}
Program: 98790
Project: 98790
Buggy source:
public MethodVisitor visitMethod(int access,String name,String desc,String signature,String[] exceptions){
  checkMethodDesc(desc);
  if (exceptions != null) {
    for (int i=0; i < exceptions.length; i++)     checkName(exceptions[i]);
  }
  return code;
}

Fixed version (ground truth):
public MethodVisitor visitMethod(int access,String name,String desc,String signature,String[] exceptions){
  checkMethodDesc(desc);
  checkSignature(signature);
  if (exceptions != null) {
    for (int i=0; i < exceptions.length; i++)     checkName(exceptions[i]);
  }
  return code;
}
Program: 98791
Project: 98791
Buggy source:
public FieldVisitor visitField(int access,String name,String desc,String signature,Object value){
  checkDesc(desc);
  return null;
}

Fixed version (ground truth):
public FieldVisitor visitField(int access,String name,String desc,String signature,Object value){
  checkDesc(desc);
  checkSignature(signature);
  return null;
}
Program: 98792
Project: 98792
Buggy source:
private void checkMethodDesc(String methodDesc){
  Type[] args=Type.getArgumentTypes(methodDesc);
  for (int i=0; i < args.length; i++)   checkDesc(args[i].getDescriptor());
}

Fixed version (ground truth):
private void checkMethodDesc(String methodDesc){
  checkDesc(Type.getReturnType(methodDesc).getDescriptor());
  Type[] args=Type.getArgumentTypes(methodDesc);
  for (int i=0; i < args.length; i++)   checkDesc(args[i].getDescriptor());
}
Program: 98793
Project: 98793
Buggy source:
public void visit(int version,int access,String name,String superName,String[] interfaces,String sourceFile){
  curName=name;
  curPathClass=new PathClass(source,curName);
}

Fixed version (ground truth):
public void visit(int version,int access,String name,String signature,String superName,String[] interfaces){
  curName=name;
  curPathClass=new PathClass(source,curName);
  checkSignature(signature);
  checkName(superName);
  if (interfaces != null) {
    for (int i=0; i < interfaces.length; i++)     checkName(interfaces[i]);
  }
}
Program: 98794
Project: 98794
Buggy source:
public String fixSignature(String signature){
  return (signature != null) ? fixMethodDesc(signature,true) : signature;
}

Fixed version (ground truth):
public String fixSignature(String signature){
  if (signature == null)   return null;
  if (signature.charAt(0) == '(')   return fixMethodDesc(signature,true);
  return fixDesc(signature,true);
}
Program: 98795
Project: 98795
Buggy source:
public ClassHeaderReader(InputStream in) throws IOException {
  try {
    DataInputStream data=new DataInputStream(in);
    int magic=data.readInt();
    int minorVersion=data.readUnsignedShort();
    int majorVersion=data.readUnsignedShort();
    if (magic != 0xCAFEBABE)     throw new IOException("String_Node_Str");
    int constant_pool_count=data.readUnsignedShort();
    Map items=new TreeMap();
    for (int i=1; i < constant_pool_count; i++) {
      int tag=data.readUnsignedByte();
switch (tag) {
case 9:
case 10:
case 11:
case 3:
case 4:
case 12:
        skipFully(data,4);
      break;
case 5:
case 6:
    skipFully(data,8);
  i++;
break;
case 1:
items.put(new Integer(i),data.readUTF());
break;
case 7:
items.put(new Integer(i),new Integer(data.readUnsignedShort()));
break;
case 8:
skipFully(data,2);
break;
default :
throw new IllegalStateException("String_Node_Str" + tag);
}
}
access=data.readUnsignedShort();
thisClass=readClass(data.readUnsignedShort(),items);
superClass=readClass(data.readUnsignedShort(),items);
int interfaces_count=data.readUnsignedShort();
interfaces=new String[interfaces_count];
for (int i=0; i < interfaces_count; i++) {
interfaces[i]=readClass(data.readUnsignedShort(),items);
}
}
  finally {
in.close();
}
}

Fixed version (ground truth):
public ClassHeaderReader(InputStream in) throws IOException {
  try {
    DataInputStream data=new DataInputStream(in);
    int magic=data.readInt();
    int minorVersion=data.readUnsignedShort();
    int majorVersion=data.readUnsignedShort();
    if (magic != 0xCAFEBABE)     throw new IOException("String_Node_Str");
    int constant_pool_count=data.readUnsignedShort();
    Map items=new TreeMap();
    for (int i=1; i < constant_pool_count; i++) {
      int tag=data.readUnsignedByte();
switch (tag) {
case 9:
case 10:
case 11:
case 3:
case 4:
case 12:
        skipFully(data,4);
      break;
case 5:
case 6:
    skipFully(data,8);
  i++;
break;
case 1:
items.put(new Integer(i),data.readUTF());
break;
case 7:
items.put(new Integer(i),new Integer(data.readUnsignedShort()));
break;
case 8:
skipFully(data,2);
break;
default :
throw new IllegalStateException("String_Node_Str" + tag);
}
}
access=data.readUnsignedShort();
thisClass=readClass(data.readUnsignedShort(),items);
int superclassIndex=data.readUnsignedShort();
superClass=(superclassIndex == 0) ? null : readClass(superclassIndex,items);
int interfaces_count=data.readUnsignedShort();
interfaces=new String[interfaces_count];
for (int i=0; i < interfaces_count; i++) {
interfaces[i]=readClass(data.readUnsignedShort(),items);
}
}
  finally {
in.close();
}
}
Program: 98796
Project: 98796
Buggy source:
public InputStream getInputStream(Object obj) throws IOException {
  if (obj instanceof ZipEntry) {
    return zip.getInputStream((ZipEntry)obj);
  }
 else {
    return new BufferedInputStream(new FileInputStream((File)obj));
  }
}

Fixed version (ground truth):
public InputStream getInputStream(Object obj) throws IOException {
  if (obj instanceof ZipEntry) {
    return ((ZipFile)zipFiles.get(obj)).getInputStream((ZipEntry)obj);
  }
 else {
    return new BufferedInputStream(new FileInputStream((File)obj));
  }
}
Program: 98797
Project: 98797
Buggy source:
private void advance(){
  try {
    close();
    if (entries == null) {
      prevZip=zip;
      if (parts.size() == 0) {
        next=null;
        return;
      }
      String part=(String)parts.removeFirst();
      File file=new File(part);
      if (!file.isAbsolute())       file=new File(parent,part);
      int len=part.length();
      if (len >= 4) {
        String ext=part.substring(len - 4,len);
        if (ext.equalsIgnoreCase("String_Node_Str")) {
          zip=new JarFile(file);
        }
 else         if (ext.equalsIgnoreCase("String_Node_Str")) {
          zip=new ZipFile(file);
        }
 else {
          zip=null;
        }
        if (zip != null)         entries=zip.entries();
      }
      if (entries == null) {
        if (file.isDirectory()) {
          entries=findClasses(file);
        }
 else {
          throw new IllegalArgumentException("String_Node_Str" + part);
        }
      }
    }
    boolean foundClass=false;
    while (entries.hasMoreElements()) {
      next=entries.nextElement();
      if (foundClass=isClassFile(getName(next)))       break;
    }
    if (!foundClass)     next=null;
    if (!entries.hasMoreElements())     entries=null;
  }
 catch (  IOException e) {
    throw new WrappedIOException(e);
  }
}

Fixed version (ground truth):
private void advance(){
  try {
    if (entries == null) {
      if (parts.size() == 0) {
        next=null;
        return;
      }
      zip=null;
      String part=(String)parts.removeFirst();
      File file=new File(part);
      if (!file.isAbsolute())       file=new File(parent,part);
      int len=part.length();
      if (len >= 4) {
        String ext=part.substring(len - 4,len);
        if (ext.equalsIgnoreCase("String_Node_Str")) {
          zip=new JarFile(file);
        }
 else         if (ext.equalsIgnoreCase("String_Node_Str")) {
          zip=new ZipFile(file);
        }
        if (zip != null)         entries=zip.entries();
      }
      if (entries == null) {
        if (file.isDirectory()) {
          entries=findClasses(file);
        }
 else {
          throw new IllegalArgumentException("String_Node_Str" + part);
        }
      }
    }
    boolean foundClass=false;
    while (entries.hasMoreElements()) {
      next=entries.nextElement();
      if (foundClass=isClassFile(getName(next))) {
        if (zip != null)         zipFiles.put(next,zip);
        break;
      }
    }
    if (!foundClass) {
      entries=null;
      advance();
    }
  }
 catch (  IOException e) {
    throw new WrappedIOException(e);
  }
}
Program: 98798
Project: 98798
Buggy source:
public void close() throws IOException {
  if (prevZip != null) {
    prevZip.close();
    prevZip=null;
  }
}

Fixed version (ground truth):
public void close() throws IOException {
  if (zipFiles != null) {
    for (Iterator it=zipFiles.values().iterator(); it.hasNext(); ) {
      ((ZipFile)it.next()).close();
    }
  }
}
Program: 98799
Project: 98799
Buggy source:
public ClassPathIterator(File parent,String classPath){
  this.parent=parent;
  StringTokenizer st=new StringTokenizer(classPath,"String_Node_Str");
  while (st.hasMoreTokens())   parts.add(st.nextElement());
  advance();
}

Fixed version (ground truth):
public ClassPathIterator(File parent,String classPath){
  this.parent=parent;
  StringTokenizer st=new StringTokenizer(classPath,"String_Node_Str");
  while (st.hasMoreTokens()) {
    parts.add(st.nextElement());
  }
  advance();
}
Program: 98800
Project: 98800
Buggy source:
private DepFind(String[] args) throws Exception {
  if (args.length != 2) {
    System.err.println("String_Node_Str");
    System.exit(1);
  }
  final Set names=new HashSet();
  ClassVisitor gatherNamesVisitor=new NullClassVisitor(){
    public void visit(    int access,    String name,    String superName,    String[] interfaces,    String sourceFile){
      names.add(name);
    }
  }
;
  File curDir=new File(System.getProperty("String_Node_Str"));
  ClassPathIterator cp=new ClassPathIterator(curDir,args[0]);
  while (cp.hasNext()) {
    Object cls=cp.next();
    new ClassReader(cp.getInputStream(cls)).accept(gatherNamesVisitor,true);
  }
  DepFindVisitor depFind=new DepFindVisitor(names);
  cp=new ClassPathIterator(curDir,args[1]);
  while (cp.hasNext()) {
    try {
      Object cls=cp.next();
      new ClassReader(cp.getInputStream(cls)).accept(depFind,true);
    }
 catch (    DepFindException e) {
      System.out.println(e.getClassName() + "String_Node_Str" + e.getDependency());
    }
  }
}

Fixed version (ground truth):
private DepFind(String[] args) throws Exception {
  if (args.length != 2) {
    System.err.println("String_Node_Str");
    System.exit(1);
  }
  final Set names=new HashSet();
  ClassVisitor gatherNamesVisitor=new NullClassVisitor(){
    public void visit(    int access,    String name,    String superName,    String[] interfaces,    String sourceFile){
      names.add(name);
    }
  }
;
  File curDir=new File(System.getProperty("String_Node_Str"));
  ClassPathIterator cp=new ClassPathIterator(curDir,args[0]);
  while (cp.hasNext()) {
    Object cls=cp.next();
    new ClassReader(cp.getInputStream(cls)).accept(gatherNamesVisitor,true);
  }
  cp.close();
  DepFindVisitor depFind=new DepFindVisitor(names);
  cp=new ClassPathIterator(curDir,args[1]);
  while (cp.hasNext()) {
    try {
      Object cls=cp.next();
      new ClassReader(cp.getInputStream(cls)).accept(depFind,true);
    }
 catch (    DepFindException e) {
      System.out.println(e.getClassName() + "String_Node_Str" + e.getDependency()+ "String_Node_Str");
    }
  }
  cp.close();
}