Program: 109407
Project: 109407
Buggy source:
@Override public void perform(GraphRewrite event,EvaluationContext context,XmlFileModel sourceFile){
  boolean validationFailed=false;
  try {
    if (StringUtils.isNotBlank(sourceFile.getParseError()))     return;
    SAXParserFactory factory=SAXParserFactory.newInstance();
    factory.setNamespaceAware(true);
    factory.setValidating(true);
    factory.setXIncludeAware(false);
    final SAXParser parser=factory.newSAXParser();
    parser.setProperty(JAXP_SCHEMA_LANGUAGE,XMLConstants.W3C_XML_SCHEMA_NS_URI);
    final List<String> xsdURLs=new ArrayList<>();
    final List<SAXParseException> parseExceptions=new ArrayList<>();
    DefaultHandler2 handler=new DefaultHandler2(){
      private final EnhancedEntityResolver2 entityResolver=new EnhancedEntityResolver2();
      private boolean firstElementFound=false;
      private Locator locator;
      @Override public InputSource resolveEntity(      String publicId,      String systemId) throws IOException, SAXException {
        return entityResolver.resolveEntity(publicId,systemId);
      }
      @Override public InputSource resolveEntity(      String name,      String publicId,      String baseURI,      String systemId) throws SAXException, IOException {
        return entityResolver.resolveEntity(name,publicId,baseURI,systemId);
      }
      @Override public void setDocumentLocator(      Locator locator){
        this.locator=locator;
      }
      @Override public void startElement(      String uri,      String localName,      String qName,      Attributes attributes) throws SAXException {
        if (!firstElementFound) {
          firstElementFound=true;
          try {
            xsdURLs.addAll(getXSDLocations(attributes));
            for (            String xsdUrl : xsdURLs) {
              try (InputStream is=new URL(xsdUrl).openStream()){
              }
 catch (              IOException e) {
                throw new InvalidXSDURLException(e.getMessage(),xsdUrl);
              }
            }
          }
 catch (          InvalidXSDURLException e) {
            parseExceptions.add(new SAXParseException(e.getMessage(),locator,e));
          }
        }
        super.startElement(uri,localName,qName,attributes);
      }
      @Override public void warning(      SAXParseException e) throws SAXException {
        super.warning(e);
      }
      @Override public void error(      SAXParseException e) throws SAXException {
        parseExceptions.add(e);
      }
      @Override public void fatalError(      SAXParseException e) throws SAXException {
        parseExceptions.add(e);
      }
    }
;
    parser.parse(sourceFile.asFile(),handler);
    if (!xsdURLs.isEmpty()) {
      for (      SAXParseException exception : parseExceptions) {
        validationFailed=true;
        createSAXParseHint(event,context,sourceFile,exception);
      }
    }
  }
 catch (  SAXParseException e) {
    validationFailed=true;
    createSAXParseHint(event,context,sourceFile,e);
  }
catch (  ParserConfigurationException|IOException|SAXException e) {
    validationFailed=true;
  }
 finally {
    if (validationFailed) {
      sourceFile.setGenerateSourceReport(true);
      ClassificationService classificationService=new ClassificationService(event.getGraphContext());
      ClassificationModel model=classificationService.attachClassification(context,sourceFile,XmlFileModel.NOT_VALID_XML,null);
      TagSetService tagSetService=new TagSetService(event.getGraphContext());
      model.setTagModel(tagSetService.getOrCreate(event,Collections.singleton(NOT_VALID_XML_TAG)));
    }
  }
}

Fixed version (ground truth):
@Override public void perform(GraphRewrite event,EvaluationContext context,XmlFileModel sourceFile){
  boolean validationFailed=false;
  try {
    if (StringUtils.isNotBlank(sourceFile.getParseError()))     return;
    SAXParserFactory factory=SAXParserFactory.newInstance();
    factory.setNamespaceAware(true);
    factory.setValidating(true);
    factory.setXIncludeAware(false);
    final SAXParser parser=factory.newSAXParser();
    parser.setProperty(JAXP_SCHEMA_LANGUAGE,XMLConstants.W3C_XML_SCHEMA_NS_URI);
    ValidateXmlHandler handler=new ValidateXmlHandler();
    parser.parse(sourceFile.asFile(),handler);
    if (!handler.getXsdURLs().isEmpty()) {
      for (      SAXParseException exception : handler.getParseExceptions()) {
        validationFailed=true;
        createSAXParseHint(event,context,sourceFile,exception);
      }
    }
  }
 catch (  SAXParseException e) {
    validationFailed=true;
    createSAXParseHint(event,context,sourceFile,e);
  }
catch (  ParserConfigurationException|IOException|SAXException e) {
    validationFailed=true;
  }
 finally {
    if (validationFailed) {
      sourceFile.setGenerateSourceReport(true);
      ClassificationService classificationService=new ClassificationService(event.getGraphContext());
      ClassificationModel model=classificationService.attachClassification(context,sourceFile,XmlFileModel.NOT_VALID_XML,null);
      TagSetService tagSetService=new TagSetService(event.getGraphContext());
      model.setTagModel(tagSetService.getOrCreate(event,Collections.singleton(NOT_VALID_XML_TAG)));
    }
  }
}