nus-yam/ex-repair huggingface dataset:
Program: 100645
Project: 100645
Buggy source:
private void updateReltable(final Element elem){
  final String hrefValue=elem.getAttribute(ATTRIBUTE_NAME_HREF);
  if (hrefValue.length() != 0) {
    if (changeTable.containsKey(inputFile.resolve(hrefValue).getPath())) {
      URI resulthrefValue=getRelativePath(inputFile.resolve(FILE_NAME_STUB_DITAMAP),inputFile.resolve(hrefValue));
      final String fragment=getFragment(hrefValue);
      if (fragment != null) {
        resulthrefValue=setFragment(resulthrefValue,fragment);
      }
      elem.setAttribute(ATTRIBUTE_NAME_HREF,resulthrefValue.toString());
    }
  }
  final NodeList children=elem.getChildNodes();
  for (int i=0; i < children.getLength(); i++) {
    final Node current=children.item(i);
    if (current.getNodeType() == Node.ELEMENT_NODE) {
      final Element currentElem=(Element)current;
      final String classValue=currentElem.getAttribute(ATTRIBUTE_NAME_CLASS);
      if (MAP_TOPICREF.matches(classValue)) {
      }
    }
  }
}

Fixed version (ground truth):
private void updateReltable(final Element elem){
  final String hrefValue=elem.getAttribute(ATTRIBUTE_NAME_HREF);
  if (hrefValue.length() != 0) {
    if (changeTable.containsKey(inputFile.resolve(hrefValue))) {
      URI resulthrefValue=getRelativePath(inputFile.resolve(FILE_NAME_STUB_DITAMAP),inputFile.resolve(hrefValue));
      final String fragment=getFragment(hrefValue);
      if (fragment != null) {
        resulthrefValue=setFragment(resulthrefValue,fragment);
      }
      elem.setAttribute(ATTRIBUTE_NAME_HREF,resulthrefValue.toString());
    }
  }
  final NodeList children=elem.getChildNodes();
  for (int i=0; i < children.getLength(); i++) {
    final Node current=children.item(i);
    if (current.getNodeType() == Node.ELEMENT_NODE) {
      final Element currentElem=(Element)current;
      final String classValue=currentElem.getAttribute(ATTRIBUTE_NAME_CLASS);
      if (MAP_TOPICREF.matches(classValue)) {
      }
    }
  }
}
Program: 100646
Project: 100646
Buggy source:
private void processChildTopicref(final Element node){
  final NodeList children=node.getChildNodes();
  for (int i=0; i < children.getLength(); i++) {
    final Node current=children.item(i);
    if (current.getNodeType() == Node.ELEMENT_NODE) {
      final Element currentElem=(Element)current;
      final String classValue=currentElem.getAttribute(ATTRIBUTE_NAME_CLASS);
      if (MAP_TOPICREF.matches(classValue)) {
        final String hrefValue=currentElem.getAttribute(ATTRIBUTE_NAME_HREF);
        final String xtrfValue=currentElem.getAttribute(ATTRIBUTE_NAME_XTRF);
        if (hrefValue.length() == 0) {
          processTopicref(currentElem);
        }
 else         if (!ATTR_XTRF_VALUE_GENERATED.equals(xtrfValue) && !inputFile.resolve(hrefValue).getPath().equals(changeTable.get(inputFile.resolve(hrefValue).getPath()))) {
          processTopicref(currentElem);
        }
      }
    }
  }
}

Fixed version (ground truth):
private void processChildTopicref(final Element node){
  final NodeList children=node.getChildNodes();
  for (int i=0; i < children.getLength(); i++) {
    final Node current=children.item(i);
    if (current.getNodeType() == Node.ELEMENT_NODE) {
      final Element currentElem=(Element)current;
      final String classValue=currentElem.getAttribute(ATTRIBUTE_NAME_CLASS);
      if (MAP_TOPICREF.matches(classValue)) {
        final String hrefValue=currentElem.getAttribute(ATTRIBUTE_NAME_HREF);
        final String xtrfValue=currentElem.getAttribute(ATTRIBUTE_NAME_XTRF);
        if (hrefValue.length() == 0) {
          processTopicref(currentElem);
        }
 else         if (!ATTR_XTRF_VALUE_GENERATED.equals(xtrfValue) && !inputFile.resolve(hrefValue).equals(changeTable.get(inputFile.resolve(hrefValue)))) {
          processTopicref(currentElem);
        }
      }
    }
  }
}
Program: 100650
Project: 100650
Buggy source:
/** 
 * Retrieve the element ID from the path. If there is no element ID, return topic ID.
 * @param relativePath
 * @return String
 */
private String getElementID(final String relativePath){
  String elementID=null;
  String topicWithelement=null;
  final String fragment=getFragment(relativePath);
  if (fragment != null) {
    topicWithelement=getFragment(relativePath);
    if (topicWithelement.lastIndexOf(SLASH) != -1) {
      elementID=topicWithelement.substring(topicWithelement.lastIndexOf(SLASH) + 1);
    }
 else {
      elementID=topicWithelement;
    }
  }
  return elementID;
}

Fixed version (ground truth):
/** 
 * Retrieve the element ID from the path. If there is no element ID, return topic ID.
 * @param relativePath
 * @return String
 */
private String getElementID(final String relativePath){
  final String fragment=getFragment(relativePath);
  if (fragment != null) {
    if (fragment.lastIndexOf(SLASH) != -1) {
      return fragment.substring(fragment.lastIndexOf(SLASH) + 1);
    }
 else {
      return fragment;
    }
  }
  return null;
}
Program: 100651
Project: 100651
Buggy source:
/** 
 * Update href attributes in ditamap and topic files.
 */
private void updateRefOfDita(final Map<URI,URI> changeTable,final Map<URI,URI> conflictTable){
  final TopicRefWriter topicRefWriter=new TopicRefWriter();
  topicRefWriter.setLogger(logger);
  topicRefWriter.setJob(job);
  topicRefWriter.setChangeTable(changeTable);
  topicRefWriter.setup(conflictTable);
  try {
    for (    final FileInfo f : job.getFileInfo()) {
      if (ATTR_FORMAT_VALUE_DITA.equals(f.format) || ATTR_FORMAT_VALUE_DITAMAP.equals(f.format)) {
        topicRefWriter.setFixpath(relativePath2fix.get(f.file.toString()));
        topicRefWriter.write(new File(job.tempDir.getAbsoluteFile(),f.file.getPath()).getAbsoluteFile());
      }
    }
  }
 catch (  final RuntimeException e) {
    throw e;
  }
catch (  final DITAOTException ex) {
    logger.error(ex.getMessage(),ex);
  }
}

Fixed version (ground truth):
/** 
 * Update href attributes in ditamap and topic files.
 */
private void updateRefOfDita(final Map<URI,URI> changeTable,final Map<URI,URI> conflictTable){
  final TopicRefWriter topicRefWriter=new TopicRefWriter();
  topicRefWriter.setLogger(logger);
  topicRefWriter.setJob(job);
  topicRefWriter.setChangeTable(changeTable);
  topicRefWriter.setup(conflictTable);
  try {
    for (    final FileInfo f : job.getFileInfo()) {
      if (ATTR_FORMAT_VALUE_DITA.equals(f.format) || ATTR_FORMAT_VALUE_DITAMAP.equals(f.format)) {
        topicRefWriter.setFixpath(relativePath2fix.get(f.uri));
        topicRefWriter.write(new File(job.tempDir.getAbsoluteFile(),f.file.getPath()).getAbsoluteFile());
      }
    }
  }
 catch (  final RuntimeException e) {
    throw e;
  }
catch (  final DITAOTException ex) {
    logger.error(ex.getMessage(),ex);
  }
}
Program: 100652
Project: 100652
Buggy source:
/** 
 * Entry point of chunk module.
 * @param input Input parameters and resources.
 * @return null
 * @throws DITAOTException exception
 */
@Override public AbstractPipelineOutput execute(final AbstractPipelineInput input) throws DITAOTException {
  final String transtype=input.getAttribute(ANT_INVOKER_EXT_PARAM_TRANSTYPE);
  final ChunkMapReader mapReader=new ChunkMapReader();
  mapReader.setLogger(logger);
  mapReader.setJob(job);
  mapReader.supportToNavigation(INDEX_TYPE_ECLIPSEHELP.equals(transtype));
  if (input.getAttribute(ROOT_CHUNK_OVERRIDE) != null) {
    mapReader.setRootChunkOverride(input.getAttribute(ROOT_CHUNK_OVERRIDE));
  }
  try {
    final File mapFile=new File(job.tempDir.toURI().resolve(job.getInputMap()));
    if (transtype.equals(INDEX_TYPE_ECLIPSEHELP) && isEclipseMap(mapFile.toURI())) {
      for (      final FileInfo f : job.getFileInfo()) {
        if (ATTR_FORMAT_VALUE_DITAMAP.equals(f.format)) {
          mapReader.read(new File(job.tempDir,f.file.getPath()).getAbsoluteFile());
        }
      }
    }
 else {
      mapReader.read(mapFile);
    }
  }
 catch (  final RuntimeException e) {
    throw e;
  }
catch (  final Exception e) {
    logger.error(e.getMessage(),e);
  }
  final Map<URI,URI> changeTable=mapReader.getChangeTable();
  if (hasChanges(changeTable)) {
    final Map<URI,URI> conflicTable=mapReader.getConflicTable();
    updateList(changeTable,conflicTable);
    updateRefOfDita(changeTable,conflicTable);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Entry point of chunk module.
 * @param input Input parameters and resources.
 * @return null
 * @throws DITAOTException exception
 */
@Override public AbstractPipelineOutput execute(final AbstractPipelineInput input) throws DITAOTException {
  final String transtype=input.getAttribute(ANT_INVOKER_EXT_PARAM_TRANSTYPE);
  final ChunkMapReader mapReader=new ChunkMapReader();
  mapReader.setLogger(logger);
  mapReader.setJob(job);
  mapReader.supportToNavigation(INDEX_TYPE_ECLIPSEHELP.equals(transtype));
  if (input.getAttribute(ROOT_CHUNK_OVERRIDE) != null) {
    mapReader.setRootChunkOverride(input.getAttribute(ROOT_CHUNK_OVERRIDE));
  }
  try {
    final File mapFile=new File(job.tempDir.toURI().resolve(job.getInputMap()));
    if (transtype.equals(INDEX_TYPE_ECLIPSEHELP) && isEclipseMap(mapFile.toURI())) {
      for (      final FileInfo f : job.getFileInfo()) {
        if (ATTR_FORMAT_VALUE_DITAMAP.equals(f.format)) {
          mapReader.read(new File(job.tempDir,f.file.getPath()).getAbsoluteFile());
        }
      }
    }
 else {
      mapReader.read(mapFile);
    }
  }
 catch (  final RuntimeException e) {
    throw e;
  }
catch (  final Exception e) {
    logger.error(e.getMessage(),e);
  }
  final Map<URI,URI> changeTable=mapReader.getChangeTable();
  if (hasChanges(changeTable)) {
    final Map<URI,URI> conflicTable=mapReader.getConflicTable();
    updateList(changeTable,Collections.unmodifiableMap(conflicTable));
    updateRefOfDita(changeTable,Collections.unmodifiableMap(conflicTable));
  }
  return null;
}
Program: 100654
Project: 100654
Buggy source:
/** 
 * Create the new topic stump.
 */
private void createTopicStump(final URI newFile){
  OutputStream newFileWriter=null;
  try {
    newFileWriter=new FileOutputStream(new File(newFile));
    final XMLStreamWriter o=XMLOutputFactory.newInstance().createXMLStreamWriter(newFileWriter,UTF8);
    o.writeStartDocument();
    o.writeProcessingInstruction(PI_WORKDIR_TARGET,UNIX_SEPARATOR + new File(newFile.resolve("String_Node_Str")).getAbsolutePath());
    o.writeProcessingInstruction(PI_WORKDIR_TARGET_URI,newFile.resolve("String_Node_Str").toString());
    o.writeStartElement(ELEMENT_NAME_DITA);
    o.writeEndElement();
    o.writeEndDocument();
    o.close();
    newFileWriter.flush();
  }
 catch (  final RuntimeException e) {
    throw e;
  }
catch (  final Exception e) {
    logger.error(e.getMessage(),e);
  }
 finally {
    try {
      if (newFileWriter != null) {
        newFileWriter.close();
      }
    }
 catch (    final IOException e) {
      logger.error(e.getMessage(),e);
    }
  }
}

Fixed version (ground truth):
/** 
 * Create the new topic stump.
 */
private void createTopicStump(final URI newFile){
  try (final OutputStream newFileWriter=new FileOutputStream(new File(newFile))){
    final XMLStreamWriter o=XMLOutputFactory.newInstance().createXMLStreamWriter(newFileWriter,UTF8);
    o.writeStartDocument();
    o.writeProcessingInstruction(PI_WORKDIR_TARGET,UNIX_SEPARATOR + new File(newFile.resolve("String_Node_Str")).getAbsolutePath());
    o.writeProcessingInstruction(PI_WORKDIR_TARGET_URI,newFile.resolve("String_Node_Str").toString());
    o.writeStartElement(ELEMENT_NAME_DITA);
    o.writeEndElement();
    o.writeEndDocument();
    o.close();
    newFileWriter.flush();
  }
 catch (  final RuntimeException e) {
    throw e;
  }
catch (  final Exception e) {
    logger.error(e.getMessage(),e);
  }
}
Program: 100655
Project: 100655
Buggy source:
/** 
 * Process map when "to-content" is specified on map element. TODO: Instead of reclassing map element to be a topicref, add a topicref into the map root and move all map content into that topicref.
 */
private void chunkMap(final Element root){
  String newFilename=replaceExtension(new File(inputFile).getName(),FILE_EXTENSION_DITA);
  URI newFile=inputFile.resolve(newFilename);
  if (new File(newFile).exists()) {
    newFilename=chunkFilenameGenerator.generateFilename("String_Node_Str",FILE_EXTENSION_DITA);
    newFile=inputFile.resolve(newFilename);
    conflictTable.put(newFile,newFile.normalize());
  }
  changeTable.put(newFile,newFile);
  final String originClassValue=root.getAttribute(ATTRIBUTE_NAME_CLASS);
  root.setAttribute(ATTRIBUTE_NAME_CLASS,originClassValue + MAP_TOPICREF.matcher);
  root.setAttribute(ATTRIBUTE_NAME_HREF,toURI(newFilename).toString());
  createTopicStump(newFile);
  processTopicref(root);
  if (originClassValue != null) {
    root.setAttribute(ATTRIBUTE_NAME_CLASS,originClassValue);
  }
  root.removeAttribute(ATTRIBUTE_NAME_HREF);
}

Fixed version (ground truth):
/** 
 * Process map when "to-content" is specified on map element. TODO: Instead of reclassing map element to be a topicref, add a topicref into the map root and move all map content into that topicref.
 */
private void chunkMap(final Element root){
  String newFilename=replaceExtension(new File(inputFile).getName(),FILE_EXTENSION_DITA);
  URI newFile=inputFile.resolve(newFilename);
  if (new File(newFile).exists()) {
    final URI oldFile=newFile;
    newFilename=chunkFilenameGenerator.generateFilename("String_Node_Str",FILE_EXTENSION_DITA);
    newFile=inputFile.resolve(newFilename);
    conflictTable.put(newFile,oldFile.normalize());
  }
  changeTable.put(newFile,newFile);
  final String originClassValue=root.getAttribute(ATTRIBUTE_NAME_CLASS);
  root.setAttribute(ATTRIBUTE_NAME_CLASS,originClassValue + MAP_TOPICREF.matcher);
  root.setAttribute(ATTRIBUTE_NAME_HREF,toURI(newFilename).toString());
  createTopicStump(newFile);
  processTopicref(root);
  if (originClassValue != null) {
    root.setAttribute(ATTRIBUTE_NAME_CLASS,originClassValue);
  }
  root.removeAttribute(ATTRIBUTE_NAME_HREF);
}
Program: 100656
Project: 100656
Buggy source:
public static Collection<String> split(final String value){
  if (value == null) {
    return Collections.EMPTY_LIST;
  }
  final String[] tokens=value.trim().split("String_Node_Str");
  return asList(tokens);
}

Fixed version (ground truth):
public static Collection<String> split(final String value){
  if (value == null) {
    return Collections.emptyList();
  }
  final String[] tokens=value.trim().split("String_Node_Str");
  return asList(tokens);
}
Program: 100662
Project: 100662
Buggy source:
/** 
 * Execute copy-to task, generate copy-to targets base on sources
 */
private void performCopytoTask(){
  final Map<File,File> copytoMap=new HashMap<File,File>();
  for (  final Map.Entry<URI,URI> e : job.getCopytoMap().entrySet()) {
    copytoMap.put(toFile(e.getKey()),toFile(e.getValue()));
  }
  if (forceUniqueFilter != null) {
    copytoMap.putAll(forceUniqueFilter.copyToMap);
  }
  for (  final Map.Entry<File,File> entry : copytoMap.entrySet()) {
    final File copytoTarget=entry.getKey();
    final File copytoSource=entry.getValue();
    final File srcFile=new File(job.tempDir,copytoSource.getPath());
    final File targetFile=new File(job.tempDir,copytoTarget.getPath());
    if (targetFile.exists()) {
      logger.warn(MessageUtils.getInstance().getMessage("String_Node_Str",copytoTarget.getPath()).toString());
    }
 else {
      final File inputMapInTemp=new File(job.tempDir,job.getInputMap().getPath()).getAbsoluteFile();
      copyFileWithPIReplaced(srcFile,targetFile,copytoTarget,inputMapInTemp);
      final FileInfo src=job.getFileInfo(toURI(copytoSource));
      final FileInfo.Builder b=src != null ? new FileInfo.Builder(src) : new FileInfo.Builder();
      final FileInfo dst=b.uri(toURI(copytoTarget)).isCopyToSource(false).build();
      job.add(dst);
    }
  }
}

Fixed version (ground truth):
/** 
 * Execute copy-to task, generate copy-to targets base on sources
 */
private void performCopytoTask(){
  final Map<File,File> copytoMap=new HashMap<File,File>();
  for (  final Map.Entry<URI,URI> e : job.getCopytoMap().entrySet()) {
    copytoMap.put(toFile(e.getKey()),toFile(e.getValue()));
  }
  if (forceUniqueFilter != null) {
    for (    final Map.Entry<URI,URI> e : forceUniqueFilter.copyToMap.entrySet()) {
      copytoMap.put(toFile(e.getKey()),toFile(e.getValue()));
    }
  }
  for (  final Map.Entry<File,File> entry : copytoMap.entrySet()) {
    final File copytoTarget=entry.getKey();
    final File copytoSource=entry.getValue();
    final File srcFile=new File(job.tempDir,copytoSource.getPath());
    final File targetFile=new File(job.tempDir,copytoTarget.getPath());
    if (targetFile.exists()) {
      logger.warn(MessageUtils.getInstance().getMessage("String_Node_Str",copytoTarget.getPath()).toString());
    }
 else {
      final File inputMapInTemp=new File(job.tempDir,job.getInputMap().getPath()).getAbsoluteFile();
      copyFileWithPIReplaced(srcFile,targetFile,copytoTarget,inputMapInTemp);
      final FileInfo src=job.getFileInfo(toURI(copytoSource));
      final FileInfo.Builder b=src != null ? new FileInfo.Builder(src) : new FileInfo.Builder();
      final FileInfo dst=b.uri(toURI(copytoTarget)).isCopyToSource(false).build();
      job.add(dst);
    }
  }
}
Program: 100663
Project: 100663
Buggy source:
/** 
 * Relativize absolute references if possible.
 * @param attName attribute name
 * @param atts attributes
 * @return attribute value, may be {@code null}
 */
private URI replaceHREF(final String attName,final Attributes atts){
  URI attValue=toURI(atts.getValue(attName));
  if (attValue != null) {
    final String fragment=attValue.getFragment();
    if (fragment != null) {
      attValue=stripFragment(attValue);
    }
    if (attValue.toString().length() != 0) {
      final URI current=currentFile.toURI().resolve(attValue);
      final FileInfo f=fileInfoMap.get(current);
      if (f != null) {
        final FileInfo cfi=fileInfoMap.get(currentFile.toURI());
        final URI currrentFileTemp=job.tempDir.toURI().resolve(cfi.uri);
        final URI targetTemp=job.tempDir.toURI().resolve(f.uri);
        attValue=getRelativePath(currrentFileTemp,targetTemp);
      }
 else {
        attValue=getRelativePath(currentFile.toURI(),current);
      }
    }
    if (fragment != null) {
      attValue=setFragment(attValue,fragment);
    }
  }
 else {
    return null;
  }
  return attValue;
}

Fixed version (ground truth):
/** 
 * Relativize absolute references if possible.
 * @param attName attribute name
 * @param atts attributes
 * @return attribute value, may be {@code null}
 */
private URI replaceHREF(final String attName,final Attributes atts){
  URI attValue=toURI(atts.getValue(attName));
  if (attValue != null) {
    final String fragment=attValue.getFragment();
    if (fragment != null) {
      attValue=stripFragment(attValue);
    }
    if (attValue.toString().length() != 0) {
      final URI current=currentFile.resolve(attValue);
      final FileInfo f=fileInfoMap.get(current);
      if (f != null) {
        final FileInfo cfi=fileInfoMap.get(currentFile);
        final URI currrentFileTemp=job.tempDir.toURI().resolve(cfi.uri);
        final URI targetTemp=job.tempDir.toURI().resolve(f.uri);
        attValue=getRelativePath(currrentFileTemp,targetTemp);
      }
 else {
        attValue=getRelativePath(currentFile,current);
      }
    }
    if (fragment != null) {
      attValue=setFragment(attValue,fragment);
    }
  }
 else {
    return null;
  }
  return attValue;
}
Program: 100664
Project: 100664
Buggy source:
public void setCurrentFile(final File currentFile){
  this.currentFile=currentFile;
}

Fixed version (ground truth):
public void setCurrentFile(final URI currentFile){
  this.currentFile=currentFile;
}
Program: 100665
Project: 100665
Buggy source:
@Override public void startDocument() throws SAXException {
  final File path2Project=DebugAndFilterModule.getPathtoProject(getRelativePath(new File(job.getInputDir(),"String_Node_Str"),currentFile),currentFile,job.getInputFile(),job);
  getContentHandler().startDocument();
  if (!OS_NAME.toLowerCase().contains(OS_NAME_WINDOWS)) {
    getContentHandler().processingInstruction(PI_WORKDIR_TARGET,outputFile.getParentFile().getAbsolutePath());
  }
 else {
    getContentHandler().processingInstruction(PI_WORKDIR_TARGET,UNIX_SEPARATOR + outputFile.getParentFile().getAbsolutePath());
  }
  getContentHandler().ignorableWhitespace(new char[]{'\n'},0,1);
  getContentHandler().processingInstruction(PI_WORKDIR_TARGET_URI,outputFile.getParentFile().toURI().toASCIIString());
  getContentHandler().ignorableWhitespace(new char[]{'\n'},0,1);
  if (path2Project != null) {
    getContentHandler().processingInstruction(PI_PATH2PROJ_TARGET,path2Project.getPath() + File.separator);
    getContentHandler().processingInstruction(PI_PATH2PROJ_TARGET_URI,toURI(path2Project).toString() + URI_SEPARATOR);
  }
 else {
    getContentHandler().processingInstruction(PI_PATH2PROJ_TARGET,"String_Node_Str");
    getContentHandler().processingInstruction(PI_PATH2PROJ_TARGET_URI,"String_Node_Str" + URI_SEPARATOR);
  }
  getContentHandler().ignorableWhitespace(new char[]{'\n'},0,1);
}

Fixed version (ground truth):
@Override public void startDocument() throws SAXException {
  final File path2Project=DebugAndFilterModule.getPathtoProject(getRelativePath(new File(job.getInputDir(),"String_Node_Str"),toFile(currentFile)),toFile(currentFile),job.getInputFile(),job);
  getContentHandler().startDocument();
  if (!OS_NAME.toLowerCase().contains(OS_NAME_WINDOWS)) {
    getContentHandler().processingInstruction(PI_WORKDIR_TARGET,outputFile.getParentFile().getAbsolutePath());
  }
 else {
    getContentHandler().processingInstruction(PI_WORKDIR_TARGET,UNIX_SEPARATOR + outputFile.getParentFile().getAbsolutePath());
  }
  getContentHandler().ignorableWhitespace(new char[]{'\n'},0,1);
  getContentHandler().processingInstruction(PI_WORKDIR_TARGET_URI,outputFile.getParentFile().toURI().toASCIIString());
  getContentHandler().ignorableWhitespace(new char[]{'\n'},0,1);
  if (path2Project != null) {
    getContentHandler().processingInstruction(PI_PATH2PROJ_TARGET,path2Project.getPath() + File.separator);
    getContentHandler().processingInstruction(PI_PATH2PROJ_TARGET_URI,toURI(path2Project).toString() + URI_SEPARATOR);
  }
 else {
    getContentHandler().processingInstruction(PI_PATH2PROJ_TARGET,"String_Node_Str");
    getContentHandler().processingInstruction(PI_PATH2PROJ_TARGET_URI,"String_Node_Str" + URI_SEPARATOR);
  }
  getContentHandler().ignorableWhitespace(new char[]{'\n'},0,1);
}
Program: 100667
Project: 100667
Buggy source:
public void setCurrentFile(final File currentFile){
  this.currentFile=currentFile;
}

Fixed version (ground truth):
public void setCurrentFile(final URI currentFile){
  this.currentFile=currentFile;
}
Program: 100668
Project: 100668
Buggy source:
private URI generateCopyToTarget(final URI src,final int count){
  final URI path=stripFragment(src);
  final String fragment=src.getFragment();
  for (int i=0; ; i++) {
    final StringBuilder ext=new StringBuilder();
    ext.append('_');
    ext.append(Integer.toString(count));
    if (i > 0) {
      ext.append('_');
      ext.append(Integer.toString(i));
    }
    ext.append('.');
    ext.append(getExtension(path.toString()));
    final URI dst=toURI(replaceExtension(path.toString(),ext.toString()));
    final URI target=URLUtils.getRelativePath(new File(job.getInputDir(),"String_Node_Str").toURI(),currentFile.toURI().resolve(dst));
    if (job.getFileInfo(target) == null) {
      return setFragment(dst,fragment);
    }
  }
}

Fixed version (ground truth):
private URI generateCopyToTarget(final URI src,final int count){
  final URI path=stripFragment(src);
  final String fragment=src.getFragment();
  for (int i=0; ; i++) {
    final StringBuilder ext=new StringBuilder();
    ext.append('_');
    ext.append(Integer.toString(count));
    if (i > 0) {
      ext.append('_');
      ext.append(Integer.toString(i));
    }
    ext.append('.');
    ext.append(getExtension(path.toString()));
    final URI dst=toURI(replaceExtension(path.toString(),ext.toString()));
    final URI target=URLUtils.getRelativePath(new File(job.getInputDir(),"String_Node_Str").toURI(),currentFile.resolve(dst));
    if (job.getFileInfo(target) == null) {
      return setFragment(dst,fragment);
    }
  }
}
Program: 100669
Project: 100669
Buggy source:
public void startElement(final String uri,final String localName,final String qName,final Attributes atts) throws SAXException {
  final String xtrf=atts.getValue("String_Node_Str");
  assertNotNull(xtrf);
  assertEquals(source.getAbsolutePath(),xtrf);
  final String xtrc=atts.getValue("String_Node_Str");
  assertNotNull(xtrc);
  Integer c=counter.get(localName);
  c=c == null ? 1 : c + 1;
  counter.put(localName,c);
  assertTrue(xtrc.startsWith(localName + "String_Node_Str" + c+ "String_Node_Str"));
}

Fixed version (ground truth):
public void startElement(final String uri,final String localName,final String qName,final Attributes atts) throws SAXException {
  final String xtrf=atts.getValue("String_Node_Str");
  assertNotNull(xtrf);
  assertEquals(source.getAbsoluteFile().toURI().toString(),xtrf);
  final String xtrc=atts.getValue("String_Node_Str");
  assertNotNull(xtrc);
  Integer c=counter.get(localName);
  c=c == null ? 1 : c + 1;
  counter.put(localName,c);
  assertTrue(xtrc.startsWith(localName + "String_Node_Str" + c+ "String_Node_Str"));
}
Program: 100670
Project: 100670
Buggy source:
/** 
 * Validate table   {@code cols} attribute.
 * @param atts attributes
 */
private void validateCols(final Attributes atts) throws SAXException {
  if (TOPIC_TGROUP.matches(atts)) {
    colsLocator=new LocatorImpl(locator);
    final String c=atts.getValue(ATTRIBUTE_NAME_COLS);
    try {
      cols=Integer.parseInt(c.trim());
    }
 catch (    final NumberFormatException e) {
      if (processingMode == Mode.STRICT) {
        throw new SAXException(messageUtils.getMessage("String_Node_Str",ATTRIBUTE_NAME_COLS,c).setLocation(locator).toString());
      }
 else {
        logger.error(messageUtils.getMessage("String_Node_Str",ATTRIBUTE_NAME_COLS,c).setLocation(locator).toString());
      }
      cols=-1;
    }
  }
 else   if (TOPIC_COLSPEC.matches(atts)) {
    columnNumber++;
  }
 else   if (TOPIC_THEAD.matches(atts) || TOPIC_TBODY.matches(atts)) {
    if (cols != -1 && columnNumber > cols) {
      if (processingMode == Mode.STRICT) {
        throw new SAXException(messageUtils.getMessage("String_Node_Str",Integer.toString(cols),Integer.toString(columnNumber)).setLocation(colsLocator).toString());
      }
 else {
        logger.error(messageUtils.getMessage("String_Node_Str",Integer.toString(cols),Integer.toString(columnNumber)).setLocation(colsLocator).toString());
      }
    }
    columnNumber=0;
  }
}

Fixed version (ground truth):
/** 
 * Validate table   {@code cols} attribute.
 * @param atts attributes
 */
private void validateCols(final Attributes atts) throws SAXException {
  if (TOPIC_TGROUP.matches(atts)) {
    colsLocator=locator != null ? new LocatorImpl(locator) : null;
    final String c=atts.getValue(ATTRIBUTE_NAME_COLS);
    try {
      cols=Integer.parseInt(c.trim());
    }
 catch (    final NumberFormatException e) {
      if (processingMode == Mode.STRICT) {
        throw new SAXException(messageUtils.getMessage("String_Node_Str",ATTRIBUTE_NAME_COLS,c).setLocation(locator).toString());
      }
 else {
        logger.error(messageUtils.getMessage("String_Node_Str",ATTRIBUTE_NAME_COLS,c).setLocation(locator).toString());
      }
      cols=-1;
    }
  }
 else   if (TOPIC_COLSPEC.matches(atts)) {
    columnNumber++;
  }
 else   if (TOPIC_THEAD.matches(atts) || TOPIC_TBODY.matches(atts)) {
    if (cols != -1 && columnNumber > cols) {
      if (processingMode == Mode.STRICT) {
        throw new SAXException(messageUtils.getMessage("String_Node_Str",Integer.toString(cols),Integer.toString(columnNumber)).setLocation(colsLocator).toString());
      }
 else {
        logger.error(messageUtils.getMessage("String_Node_Str",Integer.toString(cols),Integer.toString(columnNumber)).setLocation(colsLocator).toString());
      }
    }
    columnNumber=0;
  }
}
Program: 100671
Project: 100671
Buggy source:
/** 
 * Just for the overflowing files.
 * @param overflowingFile overflowingFile
 * @return relative path to out
 */
public static String getRelativePathFromOut(final File overflowingFile,final Job job){
  final File relativePath=getRelativePath(job.getInputFile(),overflowingFile);
  final File outputDir=job.getOutputDir().getAbsoluteFile();
  final File outputPathName=new File(outputDir,"String_Node_Str");
  final File finalOutFilePathName=resolve(outputDir,relativePath.getPath());
  final File finalRelativePathName=getRelativePath(finalOutFilePathName,outputPathName);
  File parentDir=finalRelativePathName.getParentFile();
  if (parentDir == null || parentDir.getPath().isEmpty()) {
    parentDir=new File("String_Node_Str");
  }
  return parentDir.getPath() + File.separator;
}

Fixed version (ground truth):
/** 
 * Just for the overflowing files.
 * @param overflowingFile overflowingFile
 * @return relative system path to out which ends in {@link java.io.File#separator File.separator}
 */
public static String getRelativePathFromOut(final File overflowingFile,final Job job){
  final File relativePath=getRelativePath(job.getInputFile(),overflowingFile);
  final File outputDir=job.getOutputDir().getAbsoluteFile();
  final File outputPathName=new File(outputDir,"String_Node_Str");
  final File finalOutFilePathName=resolve(outputDir,relativePath.getPath());
  final File finalRelativePathName=getRelativePath(finalOutFilePathName,outputPathName);
  File parentDir=finalRelativePathName.getParentFile();
  if (parentDir == null || parentDir.getPath().isEmpty()) {
    parentDir=new File("String_Node_Str");
  }
  return parentDir.getPath() + File.separator;
}
Program: 100672
Project: 100672
Buggy source:
/** 
 * Get map of valid attribute values based on subject scheme. The contents of the map is in pseudo-code  {@code Map<AttName, Map<ElemName, <Set<Value>>>}. For default element mapping, the value is   {@code *}.
 * @return valid attribute values
 */
public Map<String,Map<String,Set<String>>> getValidValuesMap(){
  return validValuesMap;
}

Fixed version (ground truth):
/** 
 * Get map of valid attribute values based on subject scheme. The contents of the map is in pseudo-code  {@code Map<AttName, Map<ElemName, <Set<Value>>>}. For default element mapping, the value is   {@code *}.
 * @return valid attribute values or empty map
 */
public Map<String,Map<String,Set<String>>> getValidValuesMap(){
  return validValuesMap;
}
Program: 100673
Project: 100673
Buggy source:
/** 
 * Get map of default values based on subject scheme. The contents of the map is in pseudo-code  {@code Map<AttName, Map<ElemName, Default>>}. For default element mapping, the value is   {@code *}.
 * @return default values
 */
public Map<String,Map<String,String>> getDefaultValueMap(){
  return defaultValueMap;
}

Fixed version (ground truth):
/** 
 * Get map of default values based on subject scheme. The contents of the map is in pseudo-code  {@code Map<AttName, Map<ElemName, Default>>}. For default element mapping, the value is   {@code *}.
 * @return default values or empty map
 */
public Map<String,Map<String,String>> getDefaultValueMap(){
  return defaultValueMap;
}
Program: 100674
Project: 100674
Buggy source:
/** 
 * Populate valid values map
 * @param subtree subject scheme definition element
 * @param elementName element name
 * @param attName attribute name
 */
private void putValuePairsIntoMap(final Element subtree,final String elementName,final String attName){
  if (subtree == null || attName == null) {
    return;
  }
  Map<String,Set<String>> valueMap=validValuesMap.get(attName);
  if (valueMap == null) {
    valueMap=new HashMap<String,Set<String>>();
  }
  Set<String> valueSet=valueMap.get(elementName);
  if (valueSet == null) {
    valueSet=new HashSet<String>();
  }
  final LinkedList<Element> queue=new LinkedList<Element>();
  queue.offer(subtree);
  while (!queue.isEmpty()) {
    final Element node=queue.poll();
    final NodeList children=node.getChildNodes();
    for (int i=0; i < children.getLength(); i++) {
      if (children.item(i).getNodeType() == Node.ELEMENT_NODE) {
        queue.offer((Element)children.item(i));
      }
    }
    if (SUBJECTSCHEME_SUBJECTDEF.matches(node)) {
      final String key=node.getAttribute(ATTRIBUTE_NAME_KEYS);
      if (!StringUtils.isEmptyString(key)) {
        valueSet.add(key);
      }
    }
  }
  valueMap.put(elementName,valueSet);
  validValuesMap.put(attName,valueMap);
}

Fixed version (ground truth):
/** 
 * Populate valid values map
 * @param subtree subject scheme definition element
 * @param elementName element name
 * @param attName attribute name
 * @param category enumeration category name
 */
private void putValuePairsIntoMap(final Element subtree,final String elementName,final String attName,final String category){
  if (subtree == null || attName == null) {
    return;
  }
  Map<String,Set<String>> valueMap=validValuesMap.get(attName);
  if (valueMap == null) {
    valueMap=new HashMap<String,Set<String>>();
  }
  Set<String> valueSet=valueMap.get(elementName);
  if (valueSet == null) {
    valueSet=new HashSet<String>();
  }
  final LinkedList<Element> queue=new LinkedList<Element>();
  queue.offer(subtree);
  while (!queue.isEmpty()) {
    final Element node=queue.poll();
    final NodeList children=node.getChildNodes();
    for (int i=0; i < children.getLength(); i++) {
      if (children.item(i).getNodeType() == Node.ELEMENT_NODE) {
        queue.offer((Element)children.item(i));
      }
    }
    if (SUBJECTSCHEME_SUBJECTDEF.matches(node)) {
      final String key=node.getAttribute(ATTRIBUTE_NAME_KEYS);
      if (!(key == null || key.trim().isEmpty() || key.equals(category))) {
        valueSet.add(key);
      }
    }
  }
  valueMap.put(elementName,valueSet);
  validValuesMap.put(attName,valueMap);
}
Program: 100675
Project: 100675
Buggy source:
/** 
 * Construct filter utility.
 * @param isPrintType transformation output is print-oriented
 */
public FilterUtils(final boolean isPrintType,final Map<FilterKey,Action> filterMap){
  final Map<FilterKey,Action> dfm=new HashMap<FilterKey,Action>();
  dfm.put(new FilterKey(ATTRIBUTE_NAME_PRINT,ATTR_PRINT_VALUE_YES),Action.INCLUDE);
  if (isPrintType) {
    dfm.put(new FilterKey(ATTRIBUTE_NAME_PRINT,ATTR_PRINT_VALUE_PRINT_ONLY),Action.INCLUDE);
    dfm.put(new FilterKey(ATTRIBUTE_NAME_PRINT,ATTR_PRINT_VALUE_NO),Action.EXCLUDE);
  }
 else {
    dfm.put(new FilterKey(ATTRIBUTE_NAME_PRINT,ATTR_PRINT_VALUE_PRINT_ONLY),Action.EXCLUDE);
    dfm.put(new FilterKey(ATTRIBUTE_NAME_PRINT,ATTR_PRINT_VALUE_NO),Action.INCLUDE);
  }
  dfm.put(new FilterKey(ATTRIBUTE_NAME_PRINT,null),Action.INCLUDE);
  dfm.putAll(filterMap);
  this.filterMap=dfm;
}

Fixed version (ground truth):
/** 
 * Construct filter utility.
 * @param isPrintType transformation output is print-oriented
 */
public FilterUtils(final boolean isPrintType,final Map<FilterKey,Action> filterMap){
  final Map<FilterKey,Action> dfm=new HashMap<FilterKey,Action>();
  dfm.put(new FilterKey(ATTRIBUTE_NAME_PRINT,ATTR_PRINT_VALUE_YES),Action.INCLUDE);
  if (isPrintType) {
    dfm.put(new FilterKey(ATTRIBUTE_NAME_PRINT,ATTR_PRINT_VALUE_PRINT_ONLY),Action.INCLUDE);
    dfm.put(new FilterKey(ATTRIBUTE_NAME_PRINT,ATTR_PRINT_VALUE_NO),Action.EXCLUDE);
  }
 else {
    dfm.put(new FilterKey(ATTRIBUTE_NAME_PRINT,ATTR_PRINT_VALUE_PRINT_ONLY),Action.EXCLUDE);
    dfm.put(new FilterKey(ATTRIBUTE_NAME_PRINT,ATTR_PRINT_VALUE_NO),Action.INCLUDE);
  }
  dfm.put(new FilterKey(ATTRIBUTE_NAME_PRINT,null),Action.INCLUDE);
  dfm.putAll(filterMap);
  this.logMissingAction=!filterMap.isEmpty();
  this.filterMap=dfm;
}
Program: 100676
Project: 100676
Buggy source:
/** 
 * Refine filter with subject scheme.
 * @param bindingMap subject scheme bindings
 * @return new filter with subject scheme information
 */
public FilterUtils refine(final Map<String,Map<String,Set<Element>>> bindingMap){
  if (bindingMap != null && !bindingMap.isEmpty()) {
    final Map<FilterKey,Action> buf=new HashMap<FilterKey,Action>(filterMap);
    for (    final Map.Entry<FilterKey,Action> e : filterMap.entrySet()) {
      refineAction(e.getValue(),e.getKey(),bindingMap,buf);
    }
    final FilterUtils filterUtils=new FilterUtils(buf);
    filterUtils.setLogger(logger);
    return filterUtils;
  }
 else {
    return this;
  }
}

Fixed version (ground truth):
/** 
 * Refine filter with subject scheme.
 * @param bindingMap subject scheme bindings
 * @return new filter with subject scheme information
 */
public FilterUtils refine(final Map<String,Map<String,Set<Element>>> bindingMap){
  if (bindingMap != null && !bindingMap.isEmpty()) {
    final Map<FilterKey,Action> buf=new HashMap<FilterKey,Action>(filterMap);
    for (    final Map.Entry<FilterKey,Action> e : filterMap.entrySet()) {
      refineAction(e.getValue(),e.getKey(),bindingMap,buf);
    }
    final FilterUtils filterUtils=new FilterUtils(buf);
    filterUtils.setLogger(logger);
    filterUtils.logMissingAction=logMissingAction;
    return filterUtils;
  }
 else {
    return this;
  }
}
Program: 100677
Project: 100677
Buggy source:
/** 
 * Check if attribute value has mapping in filter configuration and throw messages.
 * @param attName attribute name
 * @param attValue attribute value
 */
private void checkRuleMapping(final String attName,final List<String> attValue){
  if (attValue == null || attValue.isEmpty()) {
    return;
  }
  for (  final String attSubValue : attValue) {
    final FilterKey filterKey=new FilterKey(attName,attSubValue);
    final Action filterAction=filterMap.get(filterKey);
    if (filterAction == null) {
      if (!alreadyShowed(filterKey)) {
        logger.info(MessageUtils.getInstance().getMessage("String_Node_Str",filterKey.toString()).toString());
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Check if attribute value has mapping in filter configuration and throw messages.
 * @param attName attribute name
 * @param attValue attribute value
 */
private void checkRuleMapping(final String attName,final List<String> attValue){
  if (attValue == null || attValue.isEmpty()) {
    return;
  }
  for (  final String attSubValue : attValue) {
    final FilterKey filterKey=new FilterKey(attName,attSubValue);
    final Action filterAction=filterMap.get(filterKey);
    if (filterAction == null && logMissingAction) {
      if (!alreadyShowed(filterKey)) {
        logger.info(MessageUtils.getInstance().getMessage("String_Node_Str",filterKey.toString()).toString());
      }
    }
  }
}
Program: 100678
Project: 100678
Buggy source:
/** 
 * Get attribute value or default if attribute is not defined
 * @param elemQName element QName
 * @param attQName attribute QName
 * @param value attribute value
 * @return attribute value or default
 */
private String getAttributeValue(final String elemQName,final String attQName,final String value){
  if (StringUtils.isEmptyString(value) && defaultValueMap != null && !defaultValueMap.isEmpty()) {
    final Map<String,String> defaultMap=defaultValueMap.get(attQName);
    if (defaultMap != null) {
      final String defaultValue=defaultMap.get(elemQName);
      if (defaultValue != null) {
        return defaultValue;
      }
    }
  }
  return value;
}

Fixed version (ground truth):
/** 
 * Get attribute value or default if attribute is not defined
 * @param elemQName element QName
 * @param attQName attribute QName
 * @param value attribute value
 * @return attribute value or default
 */
private String getAttributeValue(final String elemQName,final String attQName,final String value){
  if (StringUtils.isEmptyString(value) && !defaultValueMap.isEmpty()) {
    final Map<String,String> defaultMap=defaultValueMap.get(attQName);
    if (defaultMap != null) {
      final String defaultValue=defaultMap.get(elemQName);
      if (defaultValue != null) {
        return defaultValue;
      }
    }
  }
  return value;
}
Program: 100679
Project: 100679
Buggy source:
/** 
 * Set default value map.
 * @param defaultMap default value map, may be {@code null}
 */
public void setDefaultValueMap(final Map<String,Map<String,String>> defaultMap){
  defaultValueMap=defaultMap;
}

Fixed version (ground truth):
/** 
 * Set default value map.
 * @param defaultMap default value map
 */
public void setDefaultValueMap(final Map<String,Map<String,String>> defaultMap){
  defaultValueMap=defaultMap;
}
Program: 100680
Project: 100680
Buggy source:
/** 
 * Validate attribute values
 * @param qName element name
 * @param atts attributes
 */
private void validateAttributeValues(final String qName,final Attributes atts){
  if (validateMap == null || validateMap.isEmpty()) {
    return;
  }
  for (int i=0; i < atts.getLength(); i++) {
    final String attrName=atts.getQName(i);
    final Map<String,Set<String>> valueMap=validateMap.get(attrName);
    if (valueMap != null) {
      Set<String> valueSet=valueMap.get(qName);
      if (valueSet == null) {
        valueSet=valueMap.get("String_Node_Str");
      }
      if (valueSet != null) {
        final String attrValue=atts.getValue(i);
        final String[] keylist=attrValue.trim().split("String_Node_Str");
        for (        final String s : keylist) {
          if (!StringUtils.isEmptyString(s) && !valueSet.contains(s)) {
            logger.warn(messageUtils.getMessage("String_Node_Str",attrName,qName,attrValue,StringUtils.join(valueSet,COMMA)).toString());
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Validate attribute values
 * @param qName element name
 * @param atts attributes
 */
private void validateAttributeValues(final String qName,final Attributes atts){
  if (validateMap.isEmpty()) {
    return;
  }
  for (int i=0; i < atts.getLength(); i++) {
    final String attrName=atts.getQName(i);
    final Map<String,Set<String>> valueMap=validateMap.get(attrName);
    if (valueMap != null) {
      Set<String> valueSet=valueMap.get(qName);
      if (valueSet == null) {
        valueSet=valueMap.get("String_Node_Str");
      }
      if (valueSet != null) {
        final String attrValue=atts.getValue(i);
        final String[] keylist=attrValue.trim().split("String_Node_Str");
        for (        final String s : keylist) {
          if (!StringUtils.isEmptyString(s) && !valueSet.contains(s)) {
            logger.warn(messageUtils.getMessage("String_Node_Str",attrName,qName,attrValue,StringUtils.join(valueSet,COMMA)).toString());
          }
        }
      }
    }
  }
}
Program: 100681
Project: 100681
Buggy source:
@Test public void testNeedExcludeGroup(){
  final Map<FilterKey,Action> fm=new HashMap<FilterKey,Action>();
  fm.put(new FilterKey("String_Node_Str","String_Node_Str"),Action.INCLUDE);
  fm.put(new FilterKey("String_Node_Str",null),Action.EXCLUDE);
  fm.put(new FilterKey("String_Node_Str",null),Action.EXCLUDE);
  final FilterUtils f=new FilterUtils(fm);
  f.setLogger(new TestUtils.TestLogger());
  assertFalse(f.needExclude(attr("String_Node_Str","String_Node_Str"),new String[0][0]));
  assertFalse(f.needExclude(attr("String_Node_Str","String_Node_Str"),new String[0][0]));
  assertTrue(f.needExclude(attr("String_Node_Str","String_Node_Str"),new String[0][0]));
  assertTrue(f.needExclude(attr("String_Node_Str","String_Node_Str"),new String[0][0]));
  assertTrue(f.needExclude(attr("String_Node_Str","String_Node_Str"),new String[0][0]));
}

Fixed version (ground truth):
@Test public void testNeedExcludeGroup(){
  final Map<FilterKey,Action> fm=new HashMap<FilterKey,Action>();
  fm.put(new FilterKey("String_Node_Str","String_Node_Str"),Action.INCLUDE);
  fm.put(new FilterKey("String_Node_Str",null),Action.EXCLUDE);
  fm.put(new FilterKey("String_Node_Str",null),Action.EXCLUDE);
  final FilterUtils f=new FilterUtils(false,fm);
  f.setLogger(new TestUtils.TestLogger());
  assertFalse(f.needExclude(attr("String_Node_Str","String_Node_Str"),new String[0][0]));
  assertFalse(f.needExclude(attr("String_Node_Str","String_Node_Str"),new String[0][0]));
  assertTrue(f.needExclude(attr("String_Node_Str","String_Node_Str"),new String[0][0]));
  assertTrue(f.needExclude(attr("String_Node_Str","String_Node_Str"),new String[0][0]));
  assertTrue(f.needExclude(attr("String_Node_Str","String_Node_Str"),new String[0][0]));
}
Program: 100682
Project: 100682
Buggy source:
@Test public void testNeedExcludeLabel(){
  final Map<FilterKey,Action> fm=new HashMap<FilterKey,Action>();
  fm.put(new FilterKey("String_Node_Str","String_Node_Str"),Action.INCLUDE);
  fm.put(new FilterKey("String_Node_Str",null),Action.EXCLUDE);
  final FilterUtils f=new FilterUtils(fm);
  f.setLogger(new TestUtils.TestLogger());
  assertFalse(f.needExclude(attr("String_Node_Str","String_Node_Str"),new String[][]{{"String_Node_Str","String_Node_Str"}}));
  assertFalse(f.needExclude(attr("String_Node_Str","String_Node_Str"),new String[][]{{"String_Node_Str","String_Node_Str","String_Node_Str"}}));
  assertFalse(f.needExclude(attr("String_Node_Str","String_Node_Str"),new String[][]{{"String_Node_Str","String_Node_Str","String_Node_Str"}}));
  assertTrue(f.needExclude(attr("String_Node_Str","String_Node_Str"),new String[][]{{"String_Node_Str","String_Node_Str"}}));
  assertTrue(f.needExclude(attr("String_Node_Str","String_Node_Str"),new String[][]{{"String_Node_Str","String_Node_Str"}}));
}

Fixed version (ground truth):
@Test public void testNeedExcludeLabel(){
  final Map<FilterKey,Action> fm=new HashMap<FilterKey,Action>();
  fm.put(new FilterKey("String_Node_Str","String_Node_Str"),Action.INCLUDE);
  fm.put(new FilterKey("String_Node_Str",null),Action.EXCLUDE);
  final FilterUtils f=new FilterUtils(false,fm);
  f.setLogger(new TestUtils.TestLogger());
  assertFalse(f.needExclude(attr("String_Node_Str","String_Node_Str"),new String[][]{{"String_Node_Str","String_Node_Str"}}));
  assertFalse(f.needExclude(attr("String_Node_Str","String_Node_Str"),new String[][]{{"String_Node_Str","String_Node_Str","String_Node_Str"}}));
  assertFalse(f.needExclude(attr("String_Node_Str","String_Node_Str"),new String[][]{{"String_Node_Str","String_Node_Str","String_Node_Str"}}));
  assertTrue(f.needExclude(attr("String_Node_Str","String_Node_Str"),new String[][]{{"String_Node_Str","String_Node_Str"}}));
  assertTrue(f.needExclude(attr("String_Node_Str","String_Node_Str"),new String[][]{{"String_Node_Str","String_Node_Str"}}));
}
Program: 100683
Project: 100683
Buggy source:
@Test public void testNeedExcludeDefaultExclude(){
  final Map<FilterKey,Action> fm=new HashMap<FilterKey,Action>(filterMap);
  fm.put(new FilterKey("String_Node_Str",null),Action.EXCLUDE);
  final FilterUtils f=new FilterUtils(fm);
  f.setLogger(new TestUtils.TestLogger());
  assertFalse(f.needExclude(new AttributesImpl(),new String[0][0]));
  assertFalse(f.needExclude(attr("String_Node_Str","String_Node_Str"),new String[0][0]));
  assertTrue(f.needExclude(attr("String_Node_Str","String_Node_Str"),new String[0][0]));
  assertTrue(f.needExclude(attr("String_Node_Str","String_Node_Str"),new String[0][0]));
}

Fixed version (ground truth):
@Test public void testNeedExcludeDefaultExclude(){
  final Map<FilterKey,Action> fm=new HashMap<FilterKey,Action>(filterMap);
  fm.put(new FilterKey("String_Node_Str",null),Action.EXCLUDE);
  final FilterUtils f=new FilterUtils(false,fm);
  f.setLogger(new TestUtils.TestLogger());
  assertFalse(f.needExclude(new AttributesImpl(),new String[0][0]));
  assertFalse(f.needExclude(attr("String_Node_Str","String_Node_Str"),new String[0][0]));
  assertTrue(f.needExclude(attr("String_Node_Str","String_Node_Str"),new String[0][0]));
  assertTrue(f.needExclude(attr("String_Node_Str","String_Node_Str"),new String[0][0]));
}
Program: 100684
Project: 100684
Buggy source:
@Test public void testNeedExcludeNoAttribute(){
  final FilterUtils f=new FilterUtils(filterMap);
  assertFalse(f.needExclude(new AttributesImpl(),new String[0][0]));
}

Fixed version (ground truth):
@Test public void testNeedExcludeNoAttribute(){
  final FilterUtils f=new FilterUtils(false,filterMap);
  assertFalse(f.needExclude(new AttributesImpl(),new String[0][0]));
}