Program: 9885
Project: 9885
Buggy source:
public void loadOntologies(){
  Comparator<OWLNamedObject> namedObjectComparator=new Comparator<OWLNamedObject>(){
    public int compare(    OWLNamedObject o1,    OWLNamedObject o2){
      return o1.getURI().compareTo(o2.getURI());
    }
  }
;
  Set<OWLClass> classes=new TreeSet<OWLClass>(namedObjectComparator);
  Set<OWLObjectProperty> owlObjectProperties=new TreeSet<OWLObjectProperty>(namedObjectComparator);
  Set<OWLDataProperty> owlDatatypeProperties=new TreeSet<OWLDataProperty>(namedObjectComparator);
  Set<OWLIndividual> owlIndividuals=new TreeSet<OWLIndividual>(namedObjectComparator);
  Set<OWLOntology> allImports=new HashSet<OWLOntology>();
  prefixes=new TreeMap<String,String>();
  for (  KnowledgeSource source : sources) {
    if (source instanceof OWLFile || source instanceof SparqlKnowledgeSource || source instanceof OWLAPIOntology) {
      URL url=null;
      if (source instanceof OWLFile) {
        url=((OWLFile)source).getURL();
      }
      try {
        if (source instanceof OWLAPIOntology) {
          ontology=((OWLAPIOntology)source).getOWLOntolgy();
        }
 else         if (source instanceof SparqlKnowledgeSource) {
          ontology=((SparqlKnowledgeSource)source).getOWLAPIOntology();
        }
 else {
          ontology=manager.loadOntologyFromPhysicalURI(url.toURI());
        }
        owlAPIOntologies.add(ontology);
        Set<OWLOntology> imports=manager.getImportsClosure(ontology);
        allImports.addAll(imports);
        for (        OWLOntology ont : imports) {
          classes.addAll(ont.getReferencedClasses());
          owlObjectProperties.addAll(ont.getReferencedObjectProperties());
          owlDatatypeProperties.addAll(ont.getReferencedDataProperties());
          owlIndividuals.addAll(ont.getReferencedIndividuals());
        }
        OWLOntologyFormat format=manager.getOntologyFormat(ontology);
        if (format instanceof NamespaceOWLOntologyFormat) {
          prefixes.putAll(((NamespaceOWLOntologyFormat)format).getNamespacesByPrefixMap());
          baseURI=prefixes.get("String_Node_Str");
          prefixes.remove("String_Node_Str");
        }
        for (        OWLClass owlClass : classes)         atomicConcepts.add(new NamedClass(owlClass.getURI().toString()));
        for (        OWLObjectProperty owlProperty : owlObjectProperties)         atomicRoles.add(new ObjectProperty(owlProperty.getURI().toString()));
        for (        OWLDataProperty owlProperty : owlDatatypeProperties) {
          DatatypeProperty dtp=new DatatypeProperty(owlProperty.getURI().toString());
          Set<OWLDataRange> ranges=owlProperty.getRanges(allImports);
          Iterator<OWLDataRange> it=ranges.iterator();
          if (it.hasNext()) {
            OWLDataRange range=it.next();
            if (range.isDataType()) {
              URI uri=((OWLDataType)range).getURI();
              if (uri.equals(Datatype.BOOLEAN.getURI()))               booleanDatatypeProperties.add(dtp);
 else               if (uri.equals(Datatype.DOUBLE.getURI()))               doubleDatatypeProperties.add(dtp);
 else               if (uri.equals(Datatype.INT.getURI()))               intDatatypeProperties.add(dtp);
            }
          }
          datatypeProperties.add(dtp);
        }
        for (        OWLIndividual owlIndividual : owlIndividuals) {
          individuals.add(new Individual(owlIndividual.getURI().toString()));
        }
      }
 catch (      OWLOntologyCreationException e) {
        e.printStackTrace();
      }
catch (      URISyntaxException e) {
        e.printStackTrace();
      }
    }
 else {
      KB kb=source.toKB();
      URI ontologyURI=URI.create("String_Node_Str");
      ontology=null;
      try {
        ontology=manager.createOntology(ontologyURI);
      }
 catch (      OWLOntologyCreationException e) {
        e.printStackTrace();
      }
      OWLAPIAxiomConvertVisitor.fillOWLOntology(manager,ontology,kb);
      owlAPIOntologies.add(ontology);
      allImports.add(ontology);
      atomicConcepts.addAll(kb.findAllAtomicConcepts());
      atomicRoles.addAll(kb.findAllAtomicRoles());
      individuals.addAll(kb.findAllIndividuals());
    }
  }
  try {
    classifier.loadOntologies(allImports);
  }
 catch (  OWLReasonerException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void loadOntologies() throws URISyntaxException, OWLOntologyCreationException {
  Comparator<OWLNamedObject> namedObjectComparator=new Comparator<OWLNamedObject>(){
    public int compare(    OWLNamedObject o1,    OWLNamedObject o2){
      return o1.getURI().compareTo(o2.getURI());
    }
  }
;
  Set<OWLClass> classes=new TreeSet<OWLClass>(namedObjectComparator);
  Set<OWLObjectProperty> owlObjectProperties=new TreeSet<OWLObjectProperty>(namedObjectComparator);
  Set<OWLDataProperty> owlDatatypeProperties=new TreeSet<OWLDataProperty>(namedObjectComparator);
  Set<OWLIndividual> owlIndividuals=new TreeSet<OWLIndividual>(namedObjectComparator);
  Set<OWLOntology> allImports=new HashSet<OWLOntology>();
  prefixes=new TreeMap<String,String>();
  for (  KnowledgeSource source : sources) {
    if (source instanceof OWLFile || source instanceof SparqlKnowledgeSource || source instanceof OWLAPIOntology) {
      URL url=null;
      if (source instanceof OWLFile) {
        url=((OWLFile)source).getURL();
      }
      if (source instanceof OWLAPIOntology) {
        ontology=((OWLAPIOntology)source).getOWLOntolgy();
      }
 else       if (source instanceof SparqlKnowledgeSource) {
        ontology=((SparqlKnowledgeSource)source).getOWLAPIOntology();
      }
 else {
        ontology=manager.loadOntologyFromPhysicalURI(url.toURI());
      }
      owlAPIOntologies.add(ontology);
      Set<OWLOntology> imports=manager.getImportsClosure(ontology);
      allImports.addAll(imports);
      for (      OWLOntology ont : imports) {
        classes.addAll(ont.getReferencedClasses());
        owlObjectProperties.addAll(ont.getReferencedObjectProperties());
        owlDatatypeProperties.addAll(ont.getReferencedDataProperties());
        owlIndividuals.addAll(ont.getReferencedIndividuals());
      }
      OWLOntologyFormat format=manager.getOntologyFormat(ontology);
      if (format instanceof NamespaceOWLOntologyFormat) {
        prefixes.putAll(((NamespaceOWLOntologyFormat)format).getNamespacesByPrefixMap());
        baseURI=prefixes.get("String_Node_Str");
        prefixes.remove("String_Node_Str");
      }
      for (      OWLClass owlClass : classes)       atomicConcepts.add(new NamedClass(owlClass.getURI().toString()));
      for (      OWLObjectProperty owlProperty : owlObjectProperties)       atomicRoles.add(new ObjectProperty(owlProperty.getURI().toString()));
      for (      OWLDataProperty owlProperty : owlDatatypeProperties) {
        DatatypeProperty dtp=new DatatypeProperty(owlProperty.getURI().toString());
        Set<OWLDataRange> ranges=owlProperty.getRanges(allImports);
        Iterator<OWLDataRange> it=ranges.iterator();
        if (it.hasNext()) {
          OWLDataRange range=it.next();
          if (range.isDataType()) {
            URI uri=((OWLDataType)range).getURI();
            if (uri.equals(Datatype.BOOLEAN.getURI()))             booleanDatatypeProperties.add(dtp);
 else             if (uri.equals(Datatype.DOUBLE.getURI()))             doubleDatatypeProperties.add(dtp);
 else             if (uri.equals(Datatype.INT.getURI()))             intDatatypeProperties.add(dtp);
          }
        }
        datatypeProperties.add(dtp);
      }
      for (      OWLIndividual owlIndividual : owlIndividuals) {
        individuals.add(new Individual(owlIndividual.getURI().toString()));
      }
    }
 else {
      KB kb=source.toKB();
      URI ontologyURI=URI.create("String_Node_Str");
      ontology=null;
      try {
        ontology=manager.createOntology(ontologyURI);
      }
 catch (      OWLOntologyCreationException e) {
        e.printStackTrace();
      }
      OWLAPIAxiomConvertVisitor.fillOWLOntology(manager,ontology,kb);
      owlAPIOntologies.add(ontology);
      allImports.add(ontology);
      atomicConcepts.addAll(kb.findAllAtomicConcepts());
      atomicRoles.addAll(kb.findAllAtomicRoles());
      individuals.addAll(kb.findAllIndividuals());
    }
  }
  try {
    classifier.loadOntologies(allImports);
  }
 catch (  OWLReasonerException e) {
    e.printStackTrace();
  }
}