[
https://issues.apache.org/jira/browse/JENA-792?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14154627#comment-14154627
]
ASF subversion and git services commented on JENA-792:
------------------------------------------------------
Commit 82bc9cca941cb45399eb06e87d04bc3e7d6b89f9 in jena's branch
refs/heads/master from [~andy.seaborne]
[ https://git-wip-us.apache.org/repos/asf?p=jena.git;h=82bc9cc ]
JENA-792 : Fix contains test for non-existent graph.
> 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
> Labels: easyfix
>
> 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)