[ https://issues.apache.org/jira/browse/JENA-468?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13681516#comment-13681516 ]
Andy Seaborne commented on JENA-468: ------------------------------------ I have protected the i.close call but I still think this can only happen when an unrelated exception occurs in listRDFTypes. At least now the exception will not be lost to the NPE. > NullPointerException when calling getRDFType() > ---------------------------------------------- > > Key: JENA-468 > URL: https://issues.apache.org/jira/browse/JENA-468 > Project: Apache Jena > Issue Type: Bug > Components: Onotology API > Affects Versions: Jena 2.10.1 > Reporter: Sriram Gopalan > Attachments: data.ttl > > > When I run the following code snippet after having loaded the attached ttl > file, I get a NullPointerException @ > com.hp.hpl.jena.ontology.impl.OntResourceImpl#getRDFType(boolean direct) - > Line 833 > {noformat} > Resource bob = model.getResource("http://example.org/bob"); > OntResource ontBob = bob.as(OntResource.class); > ontBob.getRDFType() > {noformat} > Upon inspection, it appears as though the code is not checking to see if the > iterator is null, before calling the close() method -- 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