nus-yam/ex-repair huggingface dataset:
Program: 100685
Project: 100685
Buggy source:
@Test public void testNeedExclude(){
  final FilterUtils f=new FilterUtils(filterMap);
  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]));
}

Fixed version (ground truth):
@Test public void testNeedExclude(){
  final FilterUtils f=new FilterUtils(false,filterMap);
  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]));
}
Program: 100686
Project: 100686
Buggy source:
@Test public void testNeedExcludeDefaultInclude(){
  final Map<FilterKey,Action> fm=new HashMap<FilterKey,Action>(filterMap);
  fm.put(new FilterKey("String_Node_Str",null),Action.INCLUDE);
  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]));
}

Fixed version (ground truth):
@Test public void testNeedExcludeDefaultInclude(){
  final Map<FilterKey,Action> fm=new HashMap<FilterKey,Action>(filterMap);
  fm.put(new FilterKey("String_Node_Str",null),Action.INCLUDE);
  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]));
}
Program: 100687
Project: 100687
Buggy source:
@Test public void testNeedExcludeMultipleAttributes(){
  final FilterUtils f=new FilterUtils(filterMap);
  f.setLogger(new TestUtils.TestLogger());
  final AttributesImpl amigaUnix=new AttributesImpl();
  XMLUtils.addOrSetAttribute(amigaUnix,"String_Node_Str","String_Node_Str");
  XMLUtils.addOrSetAttribute(amigaUnix,"String_Node_Str","String_Node_Str");
  assertFalse(f.needExclude(amigaUnix,new String[0][0]));
  final AttributesImpl amiga=new AttributesImpl();
  XMLUtils.addOrSetAttribute(amiga,"String_Node_Str","String_Node_Str");
  XMLUtils.addOrSetAttribute(amiga,"String_Node_Str","String_Node_Str");
  assertFalse(f.needExclude(amiga,new String[0][0]));
  final AttributesImpl windows=new AttributesImpl();
  XMLUtils.addOrSetAttribute(windows,"String_Node_Str","String_Node_Str");
  XMLUtils.addOrSetAttribute(windows,"String_Node_Str","String_Node_Str");
  assertTrue(f.needExclude(windows,new String[0][0]));
}

Fixed version (ground truth):
@Test public void testNeedExcludeMultipleAttributes(){
  final FilterUtils f=new FilterUtils(false,filterMap);
  f.setLogger(new TestUtils.TestLogger());
  final AttributesImpl amigaUnix=new AttributesImpl();
  XMLUtils.addOrSetAttribute(amigaUnix,"String_Node_Str","String_Node_Str");
  XMLUtils.addOrSetAttribute(amigaUnix,"String_Node_Str","String_Node_Str");
  assertFalse(f.needExclude(amigaUnix,new String[0][0]));
  final AttributesImpl amiga=new AttributesImpl();
  XMLUtils.addOrSetAttribute(amiga,"String_Node_Str","String_Node_Str");
  XMLUtils.addOrSetAttribute(amiga,"String_Node_Str","String_Node_Str");
  assertFalse(f.needExclude(amiga,new String[0][0]));
  final AttributesImpl windows=new AttributesImpl();
  XMLUtils.addOrSetAttribute(windows,"String_Node_Str","String_Node_Str");
  XMLUtils.addOrSetAttribute(windows,"String_Node_Str","String_Node_Str");
  assertTrue(f.needExclude(windows,new String[0][0]));
}
Program: 100688
Project: 100688
Buggy source:
@Test public void testNeedExcludeDomainAttribute(){
  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"}}));
  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"}}));
}

Fixed version (ground truth):
@Test public void testNeedExcludeDomainAttribute(){
  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"}}));
  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"}}));
}
Program: 100689
Project: 100689
Buggy source:
@Test public void testNeedExcludeGroupMultiple(){
  final Map<FilterKey,Action> fm=new HashMap<FilterKey,Action>();
  fm.put(new FilterKey("String_Node_Str","String_Node_Str"),Action.EXCLUDE);
  fm.put(new FilterKey("String_Node_Str","String_Node_Str"),Action.EXCLUDE);
  fm.put(new FilterKey("String_Node_Str",null),Action.INCLUDE);
  fm.put(new FilterKey("String_Node_Str",null),Action.INCLUDE);
  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]));
  assertTrue(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]));
}

Fixed version (ground truth):
@Test public void testNeedExcludeGroupMultiple(){
  final Map<FilterKey,Action> fm=new HashMap<FilterKey,Action>();
  fm.put(new FilterKey("String_Node_Str","String_Node_Str"),Action.EXCLUDE);
  fm.put(new FilterKey("String_Node_Str","String_Node_Str"),Action.EXCLUDE);
  fm.put(new FilterKey("String_Node_Str",null),Action.INCLUDE);
  fm.put(new FilterKey("String_Node_Str",null),Action.INCLUDE);
  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]));
  assertTrue(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]));
}
Program: 100690
Project: 100690
Buggy source:
@Test public void testNeedExcludeMixedGroups(){
  final Map<FilterKey,Action> fm=new HashMap<FilterKey,Action>();
  fm.put(new FilterKey("String_Node_Str","String_Node_Str"),Action.EXCLUDE);
  fm.put(new FilterKey("String_Node_Str","String_Node_Str"),Action.EXCLUDE);
  fm.put(new FilterKey("String_Node_Str",null),Action.INCLUDE);
  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]));
  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 testNeedExcludeMixedGroups(){
  final Map<FilterKey,Action> fm=new HashMap<FilterKey,Action>();
  fm.put(new FilterKey("String_Node_Str","String_Node_Str"),Action.EXCLUDE);
  fm.put(new FilterKey("String_Node_Str","String_Node_Str"),Action.EXCLUDE);
  fm.put(new FilterKey("String_Node_Str",null),Action.INCLUDE);
  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]));
  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: 100692
Project: 100692
Buggy source:
@Test public void testNeedExcludeOtherpropsLabel(){
  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[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]));
}

Fixed version (ground truth):
@Test public void testNeedExcludeOtherpropsLabel(){
  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[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]));
}
Program: 100693
Project: 100693
Buggy source:
@Test public void testNoFilter() throws Exception {
  test(new FilterUtils(Collections.EMPTY_MAP),"String_Node_Str","String_Node_Str");
  final DitaValReader filterReader=new DitaValReader();
  filterReader.read(new File(getClass().getClassLoader().getResource("String_Node_Str").toURI()).getAbsoluteFile());
  final FilterUtils filterUtils=new FilterUtils(filterReader.getFilterMap());
  filterUtils.setLogger(new TestUtils.TestLogger());
  test(filterUtils,"String_Node_Str","String_Node_Str");
  test(new FilterUtils(false,Collections.EMPTY_MAP),"String_Node_Str","String_Node_Str");
  test(new FilterUtils(true,Collections.EMPTY_MAP),"String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
@Test public void testNoFilter() throws Exception {
  test(new FilterUtils(false,Collections.EMPTY_MAP),"String_Node_Str","String_Node_Str");
  final DitaValReader filterReader=new DitaValReader();
  filterReader.read(new File(getClass().getClassLoader().getResource("String_Node_Str").toURI()).getAbsoluteFile());
  final FilterUtils filterUtils=new FilterUtils(false,filterReader.getFilterMap());
  filterUtils.setLogger(new TestUtils.TestLogger());
  test(filterUtils,"String_Node_Str","String_Node_Str");
  test(new FilterUtils(false,Collections.EMPTY_MAP),"String_Node_Str","String_Node_Str");
  test(new FilterUtils(true,Collections.EMPTY_MAP),"String_Node_Str","String_Node_Str");
}
Program: 100694
Project: 100694
Buggy source:
@Test public void testKeyscope() throws SAXException, URISyntaxException {
  final ValidationFilter f=new ValidationFilter();
  f.setContentHandler(new DefaultHandler());
  final TestUtils.CachingLogger l=new TestUtils.CachingLogger();
  f.setLogger(l);
  f.startElement(NULL_NS_URI,TOPIC_P.localName,TOPIC_P.localName,new AttributesBuilder().add(ATTRIBUTE_NAME_KEYSCOPE,"String_Node_Str").build());
  f.startElement(NULL_NS_URI,TOPIC_P.localName,TOPIC_P.localName,new AttributesBuilder().add(ATTRIBUTE_NAME_KEYSCOPE,"String_Node_Str").build());
  f.startElement(NULL_NS_URI,TOPIC_P.localName,TOPIC_P.localName,new AttributesBuilder().add(ATTRIBUTE_NAME_KEYSCOPE,"String_Node_Str").build());
  assertEquals(0,l.getMessages().size());
  f.startElement(NULL_NS_URI,TOPIC_P.localName,TOPIC_P.localName,new AttributesBuilder().add(ATTRIBUTE_NAME_KEYSCOPE,"String_Node_Str").build());
  f.startElement(NULL_NS_URI,TOPIC_P.localName,TOPIC_P.localName,new AttributesBuilder().add(ATTRIBUTE_NAME_KEYSCOPE,"String_Node_Str").build());
  assertEquals(2,l.getMessages().size());
  for (  final Message m : l.getMessages()) {
    assertEquals(TestUtils.CachingLogger.Message.Level.ERROR,m.level);
  }
}

Fixed version (ground truth):
@Test public void testKeyscope() throws SAXException, URISyntaxException {
  final ValidationFilter f=new ValidationFilter();
  f.setValidateMap(Collections.EMPTY_MAP);
  f.setContentHandler(new DefaultHandler());
  final TestUtils.CachingLogger l=new TestUtils.CachingLogger();
  f.setLogger(l);
  f.startElement(NULL_NS_URI,TOPIC_P.localName,TOPIC_P.localName,new AttributesBuilder().add(ATTRIBUTE_NAME_KEYSCOPE,"String_Node_Str").build());
  f.startElement(NULL_NS_URI,TOPIC_P.localName,TOPIC_P.localName,new AttributesBuilder().add(ATTRIBUTE_NAME_KEYSCOPE,"String_Node_Str").build());
  f.startElement(NULL_NS_URI,TOPIC_P.localName,TOPIC_P.localName,new AttributesBuilder().add(ATTRIBUTE_NAME_KEYSCOPE,"String_Node_Str").build());
  assertEquals(0,l.getMessages().size());
  f.startElement(NULL_NS_URI,TOPIC_P.localName,TOPIC_P.localName,new AttributesBuilder().add(ATTRIBUTE_NAME_KEYSCOPE,"String_Node_Str").build());
  f.startElement(NULL_NS_URI,TOPIC_P.localName,TOPIC_P.localName,new AttributesBuilder().add(ATTRIBUTE_NAME_KEYSCOPE,"String_Node_Str").build());
  assertEquals(2,l.getMessages().size());
  for (  final Message m : l.getMessages()) {
    assertEquals(TestUtils.CachingLogger.Message.Level.ERROR,m.level);
  }
}
Program: 100695
Project: 100695
Buggy source:
@Test public void testKeys() throws SAXException, URISyntaxException {
  final ValidationFilter f=new ValidationFilter();
  f.setContentHandler(new DefaultHandler());
  final TestUtils.CachingLogger l=new TestUtils.CachingLogger();
  f.setLogger(l);
  f.startElement(NULL_NS_URI,TOPIC_P.localName,TOPIC_P.localName,new AttributesBuilder().add(ATTRIBUTE_NAME_KEYS,"String_Node_Str").build());
  f.startElement(NULL_NS_URI,TOPIC_P.localName,TOPIC_P.localName,new AttributesBuilder().add(ATTRIBUTE_NAME_KEYS,"String_Node_Str").build());
  f.startElement(NULL_NS_URI,TOPIC_P.localName,TOPIC_P.localName,new AttributesBuilder().add(ATTRIBUTE_NAME_KEYS,"String_Node_Str").build());
  assertEquals(0,l.getMessages().size());
  f.startElement(NULL_NS_URI,TOPIC_P.localName,TOPIC_P.localName,new AttributesBuilder().add(ATTRIBUTE_NAME_KEYS,"String_Node_Str").build());
  f.startElement(NULL_NS_URI,TOPIC_P.localName,TOPIC_P.localName,new AttributesBuilder().add(ATTRIBUTE_NAME_KEYS,"String_Node_Str").build());
  assertEquals(2,l.getMessages().size());
  for (  final Message m : l.getMessages()) {
    assertEquals(TestUtils.CachingLogger.Message.Level.ERROR,m.level);
  }
}

Fixed version (ground truth):
@Test public void testKeys() throws SAXException, URISyntaxException {
  final ValidationFilter f=new ValidationFilter();
  f.setValidateMap(Collections.EMPTY_MAP);
  f.setContentHandler(new DefaultHandler());
  final TestUtils.CachingLogger l=new TestUtils.CachingLogger();
  f.setLogger(l);
  f.startElement(NULL_NS_URI,TOPIC_P.localName,TOPIC_P.localName,new AttributesBuilder().add(ATTRIBUTE_NAME_KEYS,"String_Node_Str").build());
  f.startElement(NULL_NS_URI,TOPIC_P.localName,TOPIC_P.localName,new AttributesBuilder().add(ATTRIBUTE_NAME_KEYS,"String_Node_Str").build());
  f.startElement(NULL_NS_URI,TOPIC_P.localName,TOPIC_P.localName,new AttributesBuilder().add(ATTRIBUTE_NAME_KEYS,"String_Node_Str").build());
  assertEquals(0,l.getMessages().size());
  f.startElement(NULL_NS_URI,TOPIC_P.localName,TOPIC_P.localName,new AttributesBuilder().add(ATTRIBUTE_NAME_KEYS,"String_Node_Str").build());
  f.startElement(NULL_NS_URI,TOPIC_P.localName,TOPIC_P.localName,new AttributesBuilder().add(ATTRIBUTE_NAME_KEYS,"String_Node_Str").build());
  assertEquals(2,l.getMessages().size());
  for (  final Message m : l.getMessages()) {
    assertEquals(TestUtils.CachingLogger.Message.Level.ERROR,m.level);
  }
}
Program: 100697
Project: 100697
Buggy source:
@Test public void testHref() throws SAXException, URISyntaxException {
  final List<String> res=new ArrayList<String>();
  final ValidationFilter f=new ValidationFilter();
  f.setProcessingMode(Configuration.Mode.LAX);
  f.setContentHandler(new DefaultHandler(){
    @Override public void startElement(    final String uri,    final String localName,    final String qName,    final Attributes atts) throws SAXException {
      res.add(atts.getValue(ATTRIBUTE_NAME_HREF));
    }
  }
);
  final TestUtils.CachingLogger l=new TestUtils.CachingLogger();
  f.setLogger(l);
  f.startElement(NULL_NS_URI,TOPIC_XREF.localName,TOPIC_XREF.localName,new AttributesBuilder().add(ATTRIBUTE_NAME_HREF,"String_Node_Str").build());
  f.startElement(NULL_NS_URI,TOPIC_XREF.localName,TOPIC_XREF.localName,new AttributesBuilder().add(ATTRIBUTE_NAME_HREF,"String_Node_Str").build());
  assertEquals(1,l.getMessages().size());
  assertEquals(TestUtils.CachingLogger.Message.Level.ERROR,l.getMessages().get(0).level);
  assertEquals("String_Node_Str",res.get(0));
  assertEquals("String_Node_Str",res.get(1));
}

Fixed version (ground truth):
@Test public void testHref() throws SAXException, URISyntaxException {
  final List<String> res=new ArrayList<String>();
  final ValidationFilter f=new ValidationFilter();
  f.setValidateMap(Collections.EMPTY_MAP);
  f.setProcessingMode(Configuration.Mode.LAX);
  f.setContentHandler(new DefaultHandler(){
    @Override public void startElement(    final String uri,    final String localName,    final String qName,    final Attributes atts) throws SAXException {
      res.add(atts.getValue(ATTRIBUTE_NAME_HREF));
    }
  }
);
  final TestUtils.CachingLogger l=new TestUtils.CachingLogger();
  f.setLogger(l);
  f.startElement(NULL_NS_URI,TOPIC_XREF.localName,TOPIC_XREF.localName,new AttributesBuilder().add(ATTRIBUTE_NAME_HREF,"String_Node_Str").build());
  f.startElement(NULL_NS_URI,TOPIC_XREF.localName,TOPIC_XREF.localName,new AttributesBuilder().add(ATTRIBUTE_NAME_HREF,"String_Node_Str").build());
  assertEquals(1,l.getMessages().size());
  assertEquals(TestUtils.CachingLogger.Message.Level.ERROR,l.getMessages().get(0).level);
  assertEquals("String_Node_Str",res.get(0));
  assertEquals("String_Node_Str",res.get(1));
}
Program: 100698
Project: 100698
Buggy source:
@Test public void testXMLLang() throws SAXException {
  final List<String> res=new ArrayList<String>();
  final ValidationFilter f=new ValidationFilter();
  f.setProcessingMode(Configuration.Mode.LAX);
  f.setContentHandler(new DefaultHandler(){
    @Override public void startElement(    final String uri,    final String localName,    final String qName,    final Attributes atts) throws SAXException {
      res.add(atts.getValue(XML_NS_URI,"String_Node_Str"));
    }
  }
);
  final TestUtils.CachingLogger l=new TestUtils.CachingLogger();
  f.setLogger(l);
  f.startElement(NULL_NS_URI,"String_Node_Str","String_Node_Str",new AttributesBuilder().add(XML_NS_URI,"String_Node_Str","String_Node_Str").build());
  f.startElement(NULL_NS_URI,"String_Node_Str","String_Node_Str",new AttributesBuilder().add(XML_NS_URI,"String_Node_Str","String_Node_Str").build());
  assertEquals(1,l.getMessages().size());
  assertEquals(TestUtils.CachingLogger.Message.Level.ERROR,l.getMessages().get(0).level);
  assertEquals("String_Node_Str",res.get(0));
  assertEquals("String_Node_Str",res.get(1));
}

Fixed version (ground truth):
@Test public void testXMLLang() throws SAXException {
  final List<String> res=new ArrayList<String>();
  final ValidationFilter f=new ValidationFilter();
  f.setValidateMap(Collections.EMPTY_MAP);
  f.setProcessingMode(Configuration.Mode.LAX);
  f.setContentHandler(new DefaultHandler(){
    @Override public void startElement(    final String uri,    final String localName,    final String qName,    final Attributes atts) throws SAXException {
      res.add(atts.getValue(XML_NS_URI,"String_Node_Str"));
    }
  }
);
  final TestUtils.CachingLogger l=new TestUtils.CachingLogger();
  f.setLogger(l);
  f.startElement(NULL_NS_URI,"String_Node_Str","String_Node_Str",new AttributesBuilder().add(XML_NS_URI,"String_Node_Str","String_Node_Str").build());
  f.startElement(NULL_NS_URI,"String_Node_Str","String_Node_Str",new AttributesBuilder().add(XML_NS_URI,"String_Node_Str","String_Node_Str").build());
  assertEquals(1,l.getMessages().size());
  assertEquals(TestUtils.CachingLogger.Message.Level.ERROR,l.getMessages().get(0).level);
  assertEquals("String_Node_Str",res.get(0));
  assertEquals("String_Node_Str",res.get(1));
}
Program: 100699
Project: 100699
Buggy source:
@Test public void testAttributeGeneralization() throws SAXException {
  final ValidationFilter f=new ValidationFilter();
  f.setContentHandler(new DefaultHandler());
  final TestUtils.CachingLogger l=new TestUtils.CachingLogger();
  f.setLogger(l);
  f.startElement(NULL_NS_URI,"String_Node_Str","String_Node_Str",new AttributesBuilder().add(XML_NS_URI,ATTRIBUTE_NAME_DOMAINS,"String_Node_Str").build());
  f.startElement(NULL_NS_URI,"String_Node_Str","String_Node_Str",new AttributesBuilder().add(XML_NS_URI,"String_Node_Str","String_Node_Str").add(XML_NS_URI,"String_Node_Str","String_Node_Str").build());
  f.startElement(NULL_NS_URI,"String_Node_Str","String_Node_Str",new AttributesBuilder().add(XML_NS_URI,"String_Node_Str","String_Node_Str").build());
  f.startElement(NULL_NS_URI,"String_Node_Str","String_Node_Str",new AttributesBuilder().add(XML_NS_URI,"String_Node_Str","String_Node_Str").build());
  assertEquals(1,l.getMessages().size());
  assertEquals(TestUtils.CachingLogger.Message.Level.ERROR,l.getMessages().get(0).level);
}

Fixed version (ground truth):
@Test public void testAttributeGeneralization() throws SAXException {
  final ValidationFilter f=new ValidationFilter();
  f.setValidateMap(Collections.EMPTY_MAP);
  f.setContentHandler(new DefaultHandler());
  final TestUtils.CachingLogger l=new TestUtils.CachingLogger();
  f.setLogger(l);
  f.startElement(NULL_NS_URI,"String_Node_Str","String_Node_Str",new AttributesBuilder().add(XML_NS_URI,ATTRIBUTE_NAME_DOMAINS,"String_Node_Str").build());
  f.startElement(NULL_NS_URI,"String_Node_Str","String_Node_Str",new AttributesBuilder().add(XML_NS_URI,"String_Node_Str","String_Node_Str").add(XML_NS_URI,"String_Node_Str","String_Node_Str").build());
  f.startElement(NULL_NS_URI,"String_Node_Str","String_Node_Str",new AttributesBuilder().add(XML_NS_URI,"String_Node_Str","String_Node_Str").build());
  f.startElement(NULL_NS_URI,"String_Node_Str","String_Node_Str",new AttributesBuilder().add(XML_NS_URI,"String_Node_Str","String_Node_Str").build());
  assertEquals(1,l.getMessages().size());
  assertEquals(TestUtils.CachingLogger.Message.Level.ERROR,l.getMessages().get(0).level);
}
Program: 100700
Project: 100700
Buggy source:
/** 
 * Check if path falls outside start document directory
 * @param filePathName absolute path to test
 * @param inputMap absolute input map path
 * @return {@code true} if outside start directory, otherwise {@code false}
 */
private static boolean isOutFile(final File filePathName,final File inputMap){
  final File relativePath=getRelativePath(inputMap.getAbsoluteFile(),filePathName.getAbsoluteFile());
  return !(relativePath == null || relativePath.getPath().length() == 0 || !relativePath.getPath().startsWith("String_Node_Str"));
}

Fixed version (ground truth):
/** 
 * Check if path falls outside start document directory
 * @param filePathName absolute path to test
 * @param inputMap absolute input map path
 * @return {@code true} if outside start directory, otherwise {@code false}
 */
private static boolean isOutFile(final File filePathName,final File inputMap){
  final File relativePath=getRelativePath(inputMap.getAbsoluteFile(),filePathName.getAbsoluteFile());
  return !(relativePath.getPath().length() == 0 || !relativePath.getPath().startsWith("String_Node_Str"));
}
Program: 100702
Project: 100702
Buggy source:
@Override public AbstractPipelineOutput execute(final AbstractPipelineInput input) throws DITAOTException {
  if (logger == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  try {
    parseInputParameters(input);
    initFilters();
    initXMLReader(ditaDir,xmlValidate);
    addToWaitList(rootFile.toURI());
    processWaitList();
    updateBaseDirectory();
    refactoringResult();
    outputResult();
  }
 catch (  final DITAOTException e) {
    throw e;
  }
catch (  final SAXException e) {
    throw new DITAOTException(e.getMessage(),e);
  }
catch (  final Exception e) {
    throw new DITAOTException(e.getMessage(),e);
  }
  return null;
}

Fixed version (ground truth):
@Override public AbstractPipelineOutput execute(final AbstractPipelineInput input) throws DITAOTException {
  if (logger == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  try {
    parseInputParameters(input);
    initFilters();
    initXMLReader(ditaDir,xmlValidate);
    addToWaitList(rootFile);
    processWaitList();
    updateBaseDirectory();
    refactoringResult();
    outputResult();
  }
 catch (  final DITAOTException e) {
    throw e;
  }
catch (  final SAXException e) {
    throw new DITAOTException(e.getMessage(),e);
  }
catch (  final Exception e) {
    throw new DITAOTException(e.getMessage(),e);
  }
  return null;
}
Program: 100703
Project: 100703
Buggy source:
/** 
 * Initialize reusable filters.
 */
private void initFilters(){
  listFilter=new GenListModuleReader();
  listFilter.setLogger(logger);
  listFilter.setInputFile(rootFile.toURI());
  listFilter.setInputDir(rootFile.getParentFile().toURI());
  listFilter.setPrimaryDitamap(rootFile.getPath());
  listFilter.setJob(job);
  if (profilingEnabled) {
    filterUtils=parseFilterFile();
  }
  exportAnchorsFilter=new ExportAnchorsFilter();
  exportAnchorsFilter.setInputFile(rootFile.toURI());
  keydefFilter=new KeydefFilter();
  keydefFilter.setLogger(logger);
  keydefFilter.setInputFile(rootFile.toURI());
  keydefFilter.setJob(job);
  nullHandler=new DefaultHandler();
}

Fixed version (ground truth):
/** 
 * Initialize reusable filters.
 */
private void initFilters(){
  listFilter=new GenListModuleReader();
  listFilter.setLogger(logger);
  listFilter.setInputFile(rootFile);
  listFilter.setInputDir(rootFile.resolve("String_Node_Str"));
  listFilter.setPrimaryDitamap(rootFile);
  listFilter.setJob(job);
  if (profilingEnabled) {
    filterUtils=parseFilterFile();
  }
  exportAnchorsFilter=new ExportAnchorsFilter();
  exportAnchorsFilter.setInputFile(rootFile);
  keydefFilter=new KeydefFilter();
  keydefFilter.setLogger(logger);
  keydefFilter.setInputFile(rootFile);
  keydefFilter.setJob(job);
  nullHandler=new DefaultHandler();
}
Program: 100704
Project: 100704
Buggy source:
/** 
 * Add key definition to job configuration
 * @param prop job configuration
 * @param keydefs key defintions to add
 */
private void addKeyDefSetToProperties(final Job prop,final Map<String,KeyDef> keydefs){
  final URI b=baseInputDir.toURI();
  final Collection<KeyDef> updated=new ArrayList<KeyDef>(keydefs.size());
  for (  final KeyDef file : keydefs.values()) {
    final String keys=file.keys;
    if (file.href != null && ATTR_SCOPE_VALUE_LOCAL.equals(file.scope)) {
      assert(file.href == null || file.href.isAbsolute() || toFile(file.href).isAbsolute());
    }
    final URI href=(file.href != null && ATTR_SCOPE_VALUE_LOCAL.equals(file.scope)) ? b.relativize(file.href) : file.href;
    final URI source=b.relativize(file.source);
    final KeyDef keyDef=new KeyDef(keys,href,file.scope,source);
    updated.add(keyDef);
  }
  try {
    KeyDef.writeKeydef(new File(job.tempDir,KEYDEF_LIST_FILE),updated);
  }
 catch (  final DITAOTException e) {
    logger.error("String_Node_Str" + e.getMessage(),e);
  }
}

Fixed version (ground truth):
/** 
 * Add key definition to job configuration
 * @param prop job configuration
 * @param keydefs key defintions to add
 */
private void addKeyDefSetToProperties(final Job prop,final Map<String,KeyDef> keydefs){
  final URI b=baseInputDir.toURI();
  final Collection<KeyDef> updated=new ArrayList<KeyDef>(keydefs.size());
  for (  final KeyDef file : keydefs.values()) {
    final String keys=file.keys;
    final URI href=(file.href != null && ATTR_SCOPE_VALUE_LOCAL.equals(file.scope)) ? b.relativize(file.href) : file.href;
    final URI source=b.relativize(file.source);
    final KeyDef keyDef=new KeyDef(keys,href,file.scope,source);
    updated.add(keyDef);
  }
  try {
    KeyDef.writeKeydef(new File(job.tempDir,KEYDEF_LIST_FILE),updated);
  }
 catch (  final DITAOTException e) {
    logger.error("String_Node_Str" + e.getMessage(),e);
  }
}
Program: 100706
Project: 100706
Buggy source:
/** 
 * Refine action key with information from subject schemes.
 */
private void refineAction(final Action action,final FilterKey key){
  if (key.attribute != null && key.value != null && bindingMap != null && !bindingMap.isEmpty()) {
    final Map<String,Set<Element>> schemeMap=bindingMap.get(key.attribute);
    if (schemeMap != null && !schemeMap.isEmpty()) {
      for (      final Set<Element> submap : schemeMap.values()) {
        for (        final Element e : submap) {
          final Element subRoot=searchForKey(e,key.value);
          if (subRoot != null) {
            insertAction(subRoot,key.attribute,action);
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Refine action key with information from subject schemes.
 */
private void refineAction(final Action action,final FilterKey key){
  if (key.value != null && bindingMap != null && !bindingMap.isEmpty()) {
    final Map<String,Set<Element>> schemeMap=bindingMap.get(key.attribute);
    if (schemeMap != null && !schemeMap.isEmpty()) {
      for (      final Set<Element> submap : schemeMap.values()) {
        for (        final Element e : submap) {
          final Element subRoot=searchForKey(e,key.value);
          if (subRoot != null) {
            insertAction(subRoot,key.attribute,action);
          }
        }
      }
    }
  }
}
Program: 100707
Project: 100707
Buggy source:
public void setPrimaryDitamap(final String primaryDitamap){
  this.primaryDitamap=primaryDitamap;
}

Fixed version (ground truth):
public void setPrimaryDitamap(final URI primaryDitamap){
}
Program: 100708
Project: 100708
Buggy source:
/** 
 * Set current file absolute path
 * @param currentFile absolute path to current file
 */
public void setCurrentFile(final URI currentFile){
  this.currentFile=currentFile;
}

Fixed version (ground truth):
/** 
 * Set current file absolute path
 * @param currentFile absolute path to current file
 */
public void setCurrentFile(final URI currentFile){
}
Program: 100709
Project: 100709
Buggy source:
@Override public int hashCode(){
  final int prime=31;
  int result=1;
  result=prime * result + ((stringValue == null) ? 0 : stringValue.hashCode());
  return result;
}

Fixed version (ground truth):
@Override public int hashCode(){
  final int prime=31;
  int result=1;
  result=prime * result + (stringValue.hashCode());
  return result;
}
Program: 100710
Project: 100710
Buggy source:
@Override public boolean equals(final Object obj){
  if (this == obj) {
    return true;
  }
  if (obj == null) {
    return false;
  }
  if (getClass() != obj.getClass()) {
    return false;
  }
  final DitaClass other=(DitaClass)obj;
  if (stringValue == null) {
    if (other.stringValue != null) {
      return false;
    }
  }
 else   if (!stringValue.equals(other.stringValue)) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean equals(final Object obj){
  if (this == obj) {
    return true;
  }
  if (obj == null) {
    return false;
  }
  if (getClass() != obj.getClass()) {
    return false;
  }
  final DitaClass other=(DitaClass)obj;
  if (!stringValue.equals(other.stringValue)) {
    return false;
  }
  return true;
}
Program: 100712
Project: 100712
Buggy source:
@Override public int hashCode(){
  final int prime=31;
  int result=1;
  result=prime * result + ((attribute == null) ? 0 : attribute.hashCode());
  result=prime * result + ((value == null) ? 0 : value.hashCode());
  return result;
}

Fixed version (ground truth):
@Override public int hashCode(){
  final int prime=31;
  int result=1;
  result=prime * result + (attribute.hashCode());
  result=prime * result + ((value == null) ? 0 : value.hashCode());
  return result;
}
Program: 100713
Project: 100713
Buggy source:
/** 
 * Refine action key with information from subject schemes.
 */
private void refineAction(final Action action,final FilterKey key,final Map<String,Map<String,Set<Element>>> bindingMap,final Map<FilterKey,Action> destFilterMap){
  if (key.attribute != null && key.value != null) {
    final Map<String,Set<Element>> schemeMap=bindingMap.get(key.attribute);
    if (schemeMap != null && !schemeMap.isEmpty()) {
      for (      final Set<Element> submap : schemeMap.values()) {
        for (        final Element e : submap) {
          final Element subRoot=searchForKey(e,key.value);
          if (subRoot != null) {
            insertAction(subRoot,key.attribute,action,destFilterMap);
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Refine action key with information from subject schemes.
 */
private void refineAction(final Action action,final FilterKey key,final Map<String,Map<String,Set<Element>>> bindingMap,final Map<FilterKey,Action> destFilterMap){
  if (key.value != null) {
    final Map<String,Set<Element>> schemeMap=bindingMap.get(key.attribute);
    if (schemeMap != null && !schemeMap.isEmpty()) {
      for (      final Set<Element> submap : schemeMap.values()) {
        for (        final Element e : submap) {
          final Element subRoot=searchForKey(e,key.value);
          if (subRoot != null) {
            insertAction(subRoot,key.attribute,action,destFilterMap);
          }
        }
      }
    }
  }
}
Program: 100714
Project: 100714
Buggy source:
@Override public boolean equals(final Object obj){
  if (this == obj) {
    return true;
  }
  if (obj == null) {
    return false;
  }
  if (!(obj instanceof FilterKey)) {
    final Throwable t=new RuntimeException("String_Node_Str");
    t.printStackTrace();
    return false;
  }
  final FilterKey other=(FilterKey)obj;
  if (attribute == null) {
    if (other.attribute != null) {
      return false;
    }
  }
 else   if (!attribute.equals(other.attribute)) {
    return false;
  }
  if (value == null) {
    if (other.value != null) {
      return false;
    }
  }
 else   if (!value.equals(other.value)) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean equals(final Object obj){
  if (this == obj) {
    return true;
  }
  if (obj == null) {
    return false;
  }
  if (!(obj instanceof FilterKey)) {
    final Throwable t=new RuntimeException("String_Node_Str");
    t.printStackTrace();
    return false;
  }
  final FilterKey other=(FilterKey)obj;
  if (!attribute.equals(other.attribute)) {
    return false;
  }
  if (value == null) {
    if (other.value != null) {
      return false;
    }
  }
 else   if (!value.equals(other.value)) {
    return false;
  }
  return true;
}
Program: 100715
Project: 100715
Buggy source:
public Map<String,List<String>> getGroups(final String value){
  final Map<String,List<String>> res=new HashMap<String,List<String>>();
  final StringBuilder buf=new StringBuilder();
  int previousEnd=0;
  final Matcher m=groupPattern.matcher(value);
  if (m != null) {
    while (m.find()) {
      buf.append(value.subSequence(previousEnd,m.start()));
      final String v=m.group(2);
      if (!v.trim().isEmpty()) {
        final String k=m.group(1);
        if (res.containsKey(k)) {
          final List<String> l=new ArrayList<String>(res.get(k));
          l.addAll(Arrays.asList(v.trim().split("String_Node_Str")));
          res.put(k,l);
        }
 else {
          res.put(k,Arrays.asList(v.trim().split("String_Node_Str")));
        }
      }
      previousEnd=m.end();
    }
    buf.append(value.substring(previousEnd));
    if (!buf.toString().trim().isEmpty()) {
      res.put(null,Arrays.asList(buf.toString().trim().split("String_Node_Str")));
    }
  }
 else {
    res.put(null,Arrays.asList(value.trim().split("String_Node_Str")));
  }
  return res;
}

Fixed version (ground truth):
public Map<String,List<String>> getGroups(final String value){
  final Map<String,List<String>> res=new HashMap<String,List<String>>();
  final StringBuilder buf=new StringBuilder();
  int previousEnd=0;
  final Matcher m=groupPattern.matcher(value);
  while (m.find()) {
    buf.append(value.subSequence(previousEnd,m.start()));
    final String v=m.group(2);
    if (!v.trim().isEmpty()) {
      final String k=m.group(1);
      if (res.containsKey(k)) {
        final List<String> l=new ArrayList<String>(res.get(k));
        l.addAll(Arrays.asList(v.trim().split("String_Node_Str")));
        res.put(k,l);
      }
 else {
        res.put(k,Arrays.asList(v.trim().split("String_Node_Str")));
      }
    }
    previousEnd=m.end();
  }
  buf.append(value.substring(previousEnd));
  if (!buf.toString().trim().isEmpty()) {
    res.put(null,Arrays.asList(buf.toString().trim().split("String_Node_Str")));
  }
  return res;
}
Program: 100716
Project: 100716
Buggy source:
/** 
 * Normalize and validate href attribute.
 * @param attName attribute name
 * @param atts attributes
 * @return attribute value
 */
private URI replaceHREF(final String attName,final Attributes atts){
  if (attName == null) {
    return null;
  }
  URI attValue=toURI(atts.getValue(attName));
  if (attValue != null) {
    final String fragment=attValue.getFragment();
    if (fragment != null) {
      URI path=stripFragment(attValue);
      if (path.toString().length() != 0) {
        final File target=toFile(path);
        if (target.isAbsolute()) {
          final URI relativePath=getRelativePath(job.getInputFile().toURI(),path);
          attValue=setFragment(relativePath,fragment);
        }
      }
    }
 else {
      final File target=toFile(attValue);
      if (target.isAbsolute()) {
        attValue=getRelativePath(job.getInputFile().toURI(),attValue);
      }
    }
  }
 else {
    return null;
  }
  return attValue;
}

Fixed version (ground truth):
/** 
 * Normalize and validate href attribute.
 * @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) {
      URI path=stripFragment(attValue);
      if (path.toString().length() != 0) {
        final File target=toFile(path);
        if (target.isAbsolute()) {
          final URI relativePath=getRelativePath(job.getInputFile().toURI(),path);
          attValue=setFragment(relativePath,fragment);
        }
      }
    }
 else {
      final File target=toFile(attValue);
      if (target.isAbsolute()) {
        attValue=getRelativePath(job.getInputFile().toURI(),attValue);
      }
    }
  }
 else {
    return null;
  }
  return attValue;
}
Program: 100717
Project: 100717
Buggy source:
/** 
 * Write output
 * @param baseDir absolute base directory path
 * @param inFile relative file path
 */
public void write(final File baseDir,final File inFile){
  inputFile=inFile;
  OutputStream out=null;
  try {
    currentFile=new File(baseDir,inputFile.getPath());
    outputFile=new File(tempDir,inputFile.getPath());
    final File outputDir=outputFile.getParentFile();
    if (!outputDir.exists()) {
      outputDir.mkdirs();
    }
    out=new FileOutputStream(outputFile);
    reader.setErrorHandler(new DITAOTXMLErrorHandler(currentFile.getAbsolutePath(),logger));
    final InputSource is=new InputSource(currentFile.toURI().toString());
    if (setSystemid) {
      is.setSystemId(currentFile.toURI().toString());
    }
    final TransformerFactory tf=TransformerFactory.newInstance();
    final Transformer serializer=tf.newTransformer();
    XMLReader xmlSource=reader;
    for (    final XMLFilter f : getProcessingPipe(currentFile,inFile)) {
      f.setParent(xmlSource);
      xmlSource=f;
    }
    xmlSource.setContentHandler(null);
    final Source source=new SAXSource(xmlSource,is);
    final Result result=new StreamResult(out);
    serializer.transform(source,result);
  }
 catch (  final RuntimeException e) {
    throw e;
  }
catch (  final Exception e) {
    e.printStackTrace();
    logger.error(e.getMessage(),e);
  }
 finally {
    if (out != null) {
      try {
        out.close();
      }
 catch (      final Exception e) {
        logger.error(e.getMessage(),e);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Write output
 * @param baseDir absolute base directory path
 * @param inFile relative file path
 */
public void write(final File baseDir,final File inFile){
  inputFile=inFile;
  OutputStream out=null;
  try {
    currentFile=new File(baseDir,inFile.getPath());
    outputFile=new File(tempDir,inFile.getPath());
    final File outputDir=outputFile.getParentFile();
    if (!outputDir.exists()) {
      outputDir.mkdirs();
    }
    out=new FileOutputStream(outputFile);
    reader.setErrorHandler(new DITAOTXMLErrorHandler(currentFile.getAbsolutePath(),logger));
    final InputSource is=new InputSource(currentFile.toURI().toString());
    if (setSystemid) {
      is.setSystemId(currentFile.toURI().toString());
    }
    final TransformerFactory tf=TransformerFactory.newInstance();
    final Transformer serializer=tf.newTransformer();
    XMLReader xmlSource=reader;
    for (    final XMLFilter f : getProcessingPipe(currentFile,inFile)) {
      f.setParent(xmlSource);
      xmlSource=f;
    }
    xmlSource.setContentHandler(null);
    final Source source=new SAXSource(xmlSource,is);
    final Result result=new StreamResult(out);
    serializer.transform(source,result);
  }
 catch (  final RuntimeException e) {
    throw e;
  }
catch (  final Exception e) {
    e.printStackTrace();
    logger.error(e.getMessage(),e);
  }
 finally {
    if (out != null) {
      try {
        out.close();
      }
 catch (      final Exception e) {
        logger.error(e.getMessage(),e);
      }
    }
  }
}
Program: 100718
Project: 100718
Buggy source:
@Test public void testReplaceConref() throws Exception {
  final Invoker w=new Invoker("String_Node_Str",ATTRIBUTE_NAME_CONREF,Attributes.class){
    @Override public String invoke(    final String value) throws Exception {
      final AttributesImpl atts=new AttributesImpl();
      XMLUtils.addOrSetAttribute(atts,attrName,value);
      return ((URI)method.invoke(writer,atts)).toString();
    }
  }
;
  assertEquals("String_Node_Str",w.invoke("String_Node_Str"));
  assertEquals("String_Node_Str",w.invoke("String_Node_Str"));
  assertEquals("String_Node_Str",w.invoke(new File(srcDir,"String_Node_Str").getAbsoluteFile().toURI().toString()));
  assertEquals("String_Node_Str",w.invoke(new File(srcDir,"String_Node_Str").getAbsoluteFile().toURI().toString() + "String_Node_Str"));
  final File sub=new File(srcDir,"String_Node_Str" + File.separator + "String_Node_Str").getAbsoluteFile();
  assertEquals("String_Node_Str",w.invoke(sub.toURI().toString()));
  assertEquals("String_Node_Str",w.invoke(sub.toURI().toString() + "String_Node_Str"));
  assertEquals("String_Node_Str",w.invoke(sub.getAbsoluteFile().toURI().toString()));
  assertEquals("String_Node_Str",w.invoke(sub.getAbsoluteFile().toURI().toString() + "String_Node_Str"));
  assertEquals("String_Node_Str",w.invoke("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void testReplaceConref() throws Exception {
  final Invoker w=new Invoker("String_Node_Str",ATTRIBUTE_NAME_CONREF,String.class,Attributes.class){
    @Override public String invoke(    final String value) throws Exception {
      final AttributesImpl atts=new AttributesImpl();
      XMLUtils.addOrSetAttribute(atts,attrName,value);
      return ((URI)method.invoke(writer,ATTRIBUTE_NAME_CONREF,atts)).toString();
    }
  }
;
  assertEquals("String_Node_Str",w.invoke("String_Node_Str"));
  assertEquals("String_Node_Str",w.invoke("String_Node_Str"));
  assertEquals("String_Node_Str",w.invoke(new File(srcDir,"String_Node_Str").getAbsoluteFile().toURI().toString()));
  assertEquals("String_Node_Str",w.invoke(new File(srcDir,"String_Node_Str").getAbsoluteFile().toURI().toString() + "String_Node_Str"));
  final File sub=new File(srcDir,"String_Node_Str" + File.separator + "String_Node_Str").getAbsoluteFile();
  assertEquals("String_Node_Str",w.invoke(sub.toURI().toString()));
  assertEquals("String_Node_Str",w.invoke(sub.toURI().toString() + "String_Node_Str"));
  assertEquals("String_Node_Str",w.invoke(sub.getAbsoluteFile().toURI().toString()));
  assertEquals("String_Node_Str",w.invoke(sub.getAbsoluteFile().toURI().toString() + "String_Node_Str"));
  assertEquals("String_Node_Str",w.invoke("String_Node_Str"));
}
Program: 100720
Project: 100720
Buggy source:
/** 
 * Normalize and validate href attribute.
 * @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) {
      final URI path=stripFragment(attValue);
      if (path.toString().length() != 0) {
        final File target=toFile(path);
        if (target.isAbsolute()) {
          final URI relativePath=getRelativePath(job.getInputFile().toURI(),path);
          attValue=setFragment(relativePath,fragment);
        }
      }
    }
 else {
      final File target=toFile(attValue);
      if (target.isAbsolute()) {
        attValue=getRelativePath(job.getInputFile().toURI(),attValue);
      }
    }
  }
 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.toURI().resolve(attValue);
      attValue=getRelativePath(currentFile.toURI(),current);
    }
    if (fragment != null) {
      attValue=setFragment(attValue,fragment);
    }
  }
 else {
    return null;
  }
  return attValue;
}