Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Done
-
Jena 2.10.1
-
None
Description
The error happens when you try to load a file using the file manager in Jena 2.10.1, for example
model = FileManager.get().loadModel("http://example.org","http://example.org","RDF/XML");
The reason is incorrect initialization of variables in the OWL class. In the following code:
public class OWL { private static Model m_model = ModelFactory.createDefaultModel(); public static final String NS = "http://www.w3.org/2002/07/owl#"; public static String getURI() {return NS;} ... public static final Property sameAs = m_model.createProperty( "http://www.w3.org/2002/07/owl#sameAs" ); ...
a call to OWL.sameAs will result in a NPE because m_model is null. I guess that if you start with OWL.getURI(), then m_model will be evaluated first and there will be no error, which is why this never occurred before.
I think that a solution would be to make m_model final as well.