[
https://issues.apache.org/jira/browse/JENA-505?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Andy Seaborne closed JENA-505.
------------------------------
> NPE in the OWL class
> --------------------
>
> Key: JENA-505
> URL: https://issues.apache.org/jira/browse/JENA-505
> Project: Apache Jena
> Issue Type: Bug
> Components: Jena
> Affects Versions: Jena 2.10.1
> Reporter: Piotr Hołubowicz
> Assignee: Andy Seaborne
> Attachments: jena-505.zip
>
>
> The error happens when you try to load a file using the file manager in Jena
> 2.10.1, for example
> {code}
> model =
> FileManager.get().loadModel("http://example.org","http://example.org","RDF/XML");
> {code}
> The reason is incorrect initialization of variables in the OWL class. In the
> following code:
> {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" );
> ...
> {code}
> 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.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira