You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by "Andy Seaborne (JIRA)" <ji...@apache.org> on 2014/10/01 12:16:34 UTC
[jira] [Closed] (JENA-792) DatasetGraphCollection throws
NullPointerException when calling contains() with non-existing graph
[ https://issues.apache.org/jira/browse/JENA-792?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andy Seaborne closed JENA-792.
------------------------------
Resolution: Fixed
Fix Version/s: Jena 2.12.2
Assignee: Andy Seaborne
Fixed as you describe. Thank you.
> DatasetGraphCollection throws NullPointerException when calling contains() with non-existing graph
> --------------------------------------------------------------------------------------------------
>
> Key: JENA-792
> URL: https://issues.apache.org/jira/browse/JENA-792
> Project: Apache Jena
> Issue Type: Bug
> Components: Jena
> Affects Versions: Jena 2.12.0
> Environment: Ubuntu 14.04 and Eclipse Luna. Jena, Fuseki, and JUnit on the classpath.
> Reporter: Gert van Valkenhoef
> Assignee: Andy Seaborne
> Labels: easyfix
> Fix For: Jena 2.12.2
>
>
> While unit testing an implementation of the DatasetGraph interface I ran in to this bug in DatasetGraphCollection:
> {code}
> @Test public void test() {
> DatasetGraph mem = DatasetGraphFactory.createMem();
> DatasetGraph ds = DatasetGraphFactory.create(mem);
> ds.contains(NodeFactory.createURI("http://example.com/DoesNotExist"),
> NodeFactory.createURI("http://example.com/subject"),
> NodeFactory.createURI("http://example.com/predicate"),
> NodeFactory.createURI("http://example.com/object"));
> }
> {code}
> This throws:
> {code}
> java.lang.NullPointerException
> at com.hp.hpl.jena.sparql.core.DatasetGraphCollection.findInSpecificNamedGraph(DatasetGraphCollection.java:66)
> at com.hp.hpl.jena.sparql.core.DatasetGraphCollection.findInSpecificNamedGraph(DatasetGraphCollection.java:34)
> at com.hp.hpl.jena.sparql.core.DatasetGraphBaseFind.findNG(DatasetGraphBaseFind.java:59)
> at com.hp.hpl.jena.sparql.core.DatasetGraphBaseFind.find(DatasetGraphBaseFind.java:48)
> at com.hp.hpl.jena.sparql.core.DatasetGraphBase.contains(DatasetGraphBase.java:131)
> at
> .....
> {code}
> It seems that the null check in findInSpecificNamedGraph is checking the wrong variable (it checks g == null but shoud check graph == null).
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)