EmmanuelOga / hypergraphdb

Automatically exported from code.google.com/p/hypergraphdb
1 stars 0 forks source link

AtomPartCondition does not properly handle null projection/comparison values #58

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1a. Define a AtomPartCondition that tests for null, f.e. hg.eq("myProp", null)
1b. Define a AtomPartCondition that tests for null, f.e. hg.eq("myProp", null) 
and store a node that has a null projection value
2. Execute query using one of these conditions

What is the expected output? What do you see instead?
The nodes that have a null projection value. An exception is thrown instead.

What version of the product are you using? On what operating system?
Version 1.1

Please provide any additional information below.
java.lang.NullPointerException
 at org.hypergraphdb.query.SimpleValueCondition.compareToValue(SimpleValueCondition.java:45)
 at org.hypergraphdb.query.AtomPartCondition.satisfies(AtomPartCondition.java:66)
 at org.hypergraphdb.query.impl.PredicateBasedFilter.execute(PredicateBasedFilter.java:54)
 at org.hypergraphdb.query.impl.UnionQuery.execute(UnionQuery.java:42)
 at org.hypergraphdb.query.cond2qry.ExpressionBasedQuery.execute(ExpressionBasedQuery.java:612)
 at org.hypergraphdb.HyperGraph.find(HyperGraph.java:1467)
 at org.hypergraphdb.HGQuery$hg$7.call(HGQuery.java:937)
 at org.hypergraphdb.transaction.HGTransactionManager.transact(HGTransactionManager.java:397)
 at org.hypergraphdb.transaction.HGTransactionManager.ensureTransaction(HGTransactionManager.java:323)
 at org.hypergraphdb.transaction.HGTransactionManager.ensureTransaction(HGTransactionManager.java:294)
 at org.hypergraphdb.HGQuery$hg.findOne(HGQuery.java:931)

For ComparisonOperator.EQ the problem can be fixed by replacing line 45 with: 
"return HGUtils.eq(value, x)". However, the other operators also need to 
properly handle null projection/comparison values.

Original issue reported on code.google.com by cgbeek...@gmail.com on 11 Jun 2011 at 3:14

GoogleCodeExporter commented 9 years ago

Original comment by borislav...@gmail.com on 11 Jun 2011 at 9:02