owlcs / jfact

JFact repository
13 stars 8 forks source link

.dispose throws NPE #11

Open phillord opened 8 years ago

phillord commented 8 years ago

I'm getting a NPE from dispose().

Root cause of the problem appears to be that the ConcurrentOWLOntologyImpl can return null with getOWLOntologyManager -- in this case, because I have already removed the OWLOntology from the OWLOntologyManager myself.

Not sure whose fault this is really. I can dispose the reasoner before I detact the ontology from the manager. But if this is required, I guess, the OWL API doc needs updating to state that this is necessary.

ignazio1977 commented 8 years ago

It's a bug introduced by a feature I added :-) even after removing an ontology from a manager, it was not possible to remove the manager from the ontology, so getOWLOntologyManager() never returned null. However, when I added the ability to move an ontology from one manager to another, this required making the manager settable - introducing the ability to remove it from the ontology.

dispose() needs to be updated to do a null check. In the meantime, the workaround is to call dispose() before removing the ontology from the manager.

phillord commented 8 years ago

Yeah, I guessed it was your fault:-)

If you fix it, though, is the reasoner going to stop listening to the ontology (although the error occurs when I am trying to ditch the ontology, so it's probably not that important).

ignazio1977 commented 8 years ago

Yes it's intended to stop listening to updates.